diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-25 10:33:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-25 12:15:17 +0200 |
commit | a334e85a2f0885b0d931fe80c50c4b3d07af7dd5 (patch) | |
tree | b4e2e73f094bf5a00c930af201822f75ffd9a8ec | |
parent | tdf#106035 update the contextual groupedbar full layout update (diff) | |
download | core-a334e85a2f0885b0d931fe80c50c4b3d07af7dd5.tar.gz core-a334e85a2f0885b0d931fe80c50c4b3d07af7dd5.zip |
clang-tidy readability-simplify-boolean-expr in vcl
Change-Id: I10ad38bcb5b05a754de9a396f4aaa79d97458d6f
Reviewed-on: https://gerrit.libreoffice.org/36930
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
37 files changed, 88 insertions, 235 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 9e1bc471d13f..5b92cb08c64b 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -631,9 +631,7 @@ bool OpenGLSalGraphicsImpl::UseSolid() bool OpenGLSalGraphicsImpl::UseInvert50() { - if( !UseProgram( "dumbVertexShader", "invert50FragmentShader" ) ) - return false; - return true; + return UseProgram( "dumbVertexShader", "invert50FragmentShader" ); } bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor ) diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx index 590fec1d8329..a4bf268739fe 100644 --- a/vcl/source/app/brand.cxx +++ b/vcl/source/app/brand.cxx @@ -67,10 +67,7 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap) return true; } - if (tryLoadPng( aBaseDir, aBaseName + aPng, rBitmap)) - return true; - - return false; + return tryLoadPng( aBaseDir, aBaseName + aPng, rBitmap); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index db8acb198729..005746d89764 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -500,7 +500,8 @@ bool MouseSettings::operator ==( const MouseSettings& rSet ) const if ( mxData == rSet.mxData ) return true; - if ( (mxData->mnOptions == rSet.mxData->mnOptions) && + return + (mxData->mnOptions == rSet.mxData->mnOptions) && (mxData->mnDoubleClkTime == rSet.mxData->mnDoubleClkTime) && (mxData->mnDoubleClkWidth == rSet.mxData->mnDoubleClkWidth) && (mxData->mnDoubleClkHeight == rSet.mxData->mnDoubleClkHeight) && @@ -516,10 +517,7 @@ bool MouseSettings::operator ==( const MouseSettings& rSet ) const (mxData->mnActionDelay == rSet.mxData->mnActionDelay) && (mxData->mnMenuDelay == rSet.mxData->mnMenuDelay) && (mxData->mnFollow == rSet.mxData->mnFollow) && - (mxData->mnWheelBehavior == rSet.mxData->mnWheelBehavior ) ) - return true; - else - return false; + (mxData->mnWheelBehavior == rSet.mxData->mnWheelBehavior ); } ImplStyleData::ImplStyleData() : @@ -2279,7 +2277,7 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const return false; } - if ( (mxData->mnOptions == rSet.mxData->mnOptions) && + return (mxData->mnOptions == rSet.mxData->mnOptions) && (mxData->mbAutoMnemonic == rSet.mxData->mbAutoMnemonic) && (mxData->mnDragFullOptions == rSet.mxData->mnDragFullOptions) && (mxData->mnSelectionOptions == rSet.mxData->mnSelectionOptions) && @@ -2376,10 +2374,7 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mxData->maListBoxPreviewDefaultLogicSize == rSet.mxData->maListBoxPreviewDefaultLogicSize) && (mxData->maListBoxPreviewDefaultPixelSize == rSet.mxData->maListBoxPreviewDefaultPixelSize) && (mxData->mnListBoxPreviewDefaultLineWidth == rSet.mxData->mnListBoxPreviewDefaultLineWidth) && - (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground)) - return true; - else - return false; + (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground); } ImplMiscData::ImplMiscData() @@ -2416,12 +2411,9 @@ bool MiscSettings::operator ==( const MiscSettings& rSet ) const if ( mxData == rSet.mxData ) return true; - if ( (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) && + return (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) && (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) && - (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep ) ) - return true; - else - return false; + (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep ); } bool @@ -2615,12 +2607,9 @@ bool HelpSettings::operator ==( const HelpSettings& rSet ) const if ( mxData == rSet.mxData ) return true; - if ( (mxData->mnTipDelay == rSet.mxData->mnTipDelay ) && + return (mxData->mnTipDelay == rSet.mxData->mnTipDelay ) && (mxData->mnTipTimeout == rSet.mxData->mnTipTimeout ) && - (mxData->mnBalloonDelay == rSet.mxData->mnBalloonDelay ) ) - return true; - else - return false; + (mxData->mnBalloonDelay == rSet.mxData->mnBalloonDelay ); } sal_uLong diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index eeeb25e0a283..90cb5d10a7ed 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -649,11 +649,8 @@ bool Application::IsUICaptured() // If mouse was captured, or if in tracking- or in select-mode of a floatingwindow (e.g. menus // or pulldown toolboxes) another window should be created // D&D active !!! - if ( pSVData->maWinData.mpCaptureWin || pSVData->maWinData.mpTrackWin || - pSVData->maWinData.mpFirstFloat || nImplSysDialog ) - return true; - else - return false; + return pSVData->maWinData.mpCaptureWin || pSVData->maWinData.mpTrackWin || + pSVData->maWinData.mpFirstFloat || nImplSysDialog; } void Application::OverrideSystemSettings( AllSettings& /*rSettings*/ ) diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index aa616ef50805..b1543c557615 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -71,15 +71,13 @@ bool ImplNumericProcessKeyInput( const KeyEvent& rKEvt, sal_Unicode cChar = rKEvt.GetCharCode(); sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); - if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || - (nGroup == KEYGROUP_MISC) || - ((cChar >= '0') && (cChar <= '9')) || - string::equals(rLocaleDataWrappper.getNumDecimalSep(), cChar) || - (bThousandSep && string::equals(rLocaleDataWrappper.getNumThousandSep(), cChar)) || - (cChar == '-') ) - return false; - else - return true; + return !((nGroup == KEYGROUP_FKEYS) || + (nGroup == KEYGROUP_CURSOR) || + (nGroup == KEYGROUP_MISC) || + ((cChar >= '0') && (cChar <= '9')) || + string::equals(rLocaleDataWrappper.getNumDecimalSep(), cChar) || + (bThousandSep && string::equals(rLocaleDataWrappper.getNumThousandSep(), cChar)) || + (cChar == '-')); } } diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 97afce44d12e..8f1f8157a856 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1002,13 +1002,11 @@ static bool ImplDateProcessKeyInput( const KeyEvent& rKEvt, ExtDateFieldFormat e { sal_Unicode cChar = rKEvt.GetCharCode(); sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); - if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || - (nGroup == KEYGROUP_MISC)|| - ((cChar >= '0') && (cChar <= '9')) || - (cChar == ImplGetDateSep( rLocaleDataWrapper, eFormat )[0]) ) - return false; - else - return true; + return !((nGroup == KEYGROUP_FKEYS) || + (nGroup == KEYGROUP_CURSOR) || + (nGroup == KEYGROUP_MISC)|| + ((cChar >= '0') && (cChar <= '9')) || + (cChar == ImplGetDateSep( rLocaleDataWrapper, eFormat )[0])); } static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFormat eDateOrder, diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index 04de31562e3d..6f3b8305da88 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -104,15 +104,13 @@ bool ImplNumericProcessKeyInput( const KeyEvent& rKEvt, sal_Unicode cChar = rKEvt.GetCharCode(); sal_uInt16 nGroup = rKEvt.GetKeyCode().GetGroup(); - if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) || - (nGroup == KEYGROUP_MISC) || - ((cChar >= '0') && (cChar <= '9')) || - (bThousandSep && string::equals(rLocaleDataWrapper.getNumThousandSep(), cChar)) || - (string::equals(rLocaleDataWrapper.getNumDecimalSep(), cChar) ) || - (cChar == '-') ) - return false; - else - return true; + return !((nGroup == KEYGROUP_FKEYS) || + (nGroup == KEYGROUP_CURSOR) || + (nGroup == KEYGROUP_MISC) || + ((cChar >= '0') && (cChar <= '9')) || + (bThousandSep && string::equals(rLocaleDataWrapper.getNumThousandSep(), cChar)) || + (string::equals(rLocaleDataWrapper.getNumDecimalSep(), cChar) ) || + (cChar == '-')); } } diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index fc6143296072..187d3d089a61 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -44,15 +44,10 @@ bool GraphicNativeTransform::canBeRotated() return false; } - if ( aLink.GetType() == GfxLinkType::NativeJpg + return aLink.GetType() == GfxLinkType::NativeJpg || aLink.GetType() == GfxLinkType::NativePng || aLink.GetType() == GfxLinkType::NativeGif - || aLink.GetType() == GfxLinkType::NONE) - { - return true; - } - - return false; + || aLink.GetType() == GfxLinkType::NONE; } bool GraphicNativeTransform::rotate(sal_uInt16 aInputRotation) diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 0bce1b8046c4..1a67243d38e0 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -436,10 +436,7 @@ bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSe } } - if (hb_set_has(mpVertGlyphs, nGlyphIndex)) - return true; - - return false; + return hb_set_has(mpVertGlyphs, nGlyphIndex) != 0; } bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index 7de77e20dc7f..db6e7d7bf89a 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -53,7 +53,7 @@ Impl_Gradient::Impl_Gradient( const Impl_Gradient& rImplGradient ) : bool Impl_Gradient::operator==( const Impl_Gradient& rImpl_Gradient ) const { - if ( (meStyle == rImpl_Gradient.meStyle) && + return (meStyle == rImpl_Gradient.meStyle) && (mnAngle == rImpl_Gradient.mnAngle) && (mnBorder == rImpl_Gradient.mnBorder) && (mnOfsX == rImpl_Gradient.mnOfsX) && @@ -62,9 +62,7 @@ bool Impl_Gradient::operator==( const Impl_Gradient& rImpl_Gradient ) const (mnIntensityStart == rImpl_Gradient.mnIntensityStart) && (mnIntensityEnd == rImpl_Gradient.mnIntensityEnd) && (maStartColor == rImpl_Gradient.maStartColor) && - (maEndColor == rImpl_Gradient.maEndColor) ) - return true; - return false; + (maEndColor == rImpl_Gradient.maEndColor); } Gradient::Gradient() : diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx index 3e7975c82b7c..89e8347bc7a0 100644 --- a/vcl/source/gdi/hatch.cxx +++ b/vcl/source/gdi/hatch.cxx @@ -40,12 +40,10 @@ ImplHatch::ImplHatch( const ImplHatch& rImplHatch ) : bool ImplHatch::operator==( const ImplHatch& rImplHatch ) const { - if( maColor == rImplHatch.maColor && + return maColor == rImplHatch.maColor && meStyle == rImplHatch.meStyle && mnDistance == rImplHatch.mnDistance && - mnAngle == rImplHatch.mnAngle) - return true; - return false; + mnAngle == rImplHatch.mnAngle; } Hatch::Hatch() : mpImplHatch() diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index f80e246a5c68..290de283caa5 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -170,7 +170,7 @@ JobSetup& JobSetup::operator=( JobSetup&& rJobSetup ) bool ImplJobSetup::operator==( const ImplJobSetup& rImplJobSetup ) const { - if ( mnSystem == rImplJobSetup.mnSystem && + return mnSystem == rImplJobSetup.mnSystem && maPrinterName == rImplJobSetup.maPrinterName && maDriver == rImplJobSetup.maDriver && meOrientation == rImplJobSetup.meOrientation && @@ -181,9 +181,7 @@ bool ImplJobSetup::operator==( const ImplJobSetup& rImplJobSetup ) const mnPaperHeight == rImplJobSetup.mnPaperHeight && mnDriverDataLen == rImplJobSetup.mnDriverDataLen && maValueMap == rImplJobSetup.maValueMap && - memcmp( mpDriverData, rImplJobSetup.mpDriverData, mnDriverDataLen ) == 0) - return true; - return false; + memcmp( mpDriverData, rImplJobSetup.mpDriverData, mnDriverDataLen ) == 0; } namespace diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index d4aa04415443..c4d0cf9f555f 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -63,12 +63,10 @@ MapMode::ImplMapMode::ImplMapMode( const ImplMapMode& rImplMapMode ) : bool MapMode::ImplMapMode::operator==( const ImplMapMode& rImpMapMode ) const { - if (meUnit == rImpMapMode.meUnit + return meUnit == rImpMapMode.meUnit && maOrigin == rImpMapMode.maOrigin && maScaleX == rImpMapMode.maScaleX - && maScaleY == rImpMapMode.maScaleY) - return true; - return false; + && maScaleY == rImpMapMode.maScaleY; } namespace diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 828ae3e2f66a..bf039f142d58 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -2051,10 +2051,7 @@ static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) { } // TODO: handle step count - if (rGradient.GetSteps() > 0) - return false; - - return true; + return rGradient.GetSteps() <= 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 12087c8b8f32..40d4085f56ff 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -315,9 +315,7 @@ bool PNGReaderImpl::ReadNextChunk() } ++maChunkIter; - if( mnChunkType == PNGCHUNK_IEND ) - return false; - return true; + return mnChunkType != PNGCHUNK_IEND; } // read the remaining chunks from mrPNGStream diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 21e3f9e4dba6..08341d6202dc 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -858,10 +858,7 @@ bool ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const } // different number of separations? - if ( pOwnRectBandSep || pSecondRectBandSep ) - return false; - - return true; + return !(pOwnRectBandSep || pSecondRectBandSep); } ImplRegionBand* ImplRegionBand::SplitBand (const sal_Int32 nY) diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx index e7d1163bdb26..2e54cd89194e 100644 --- a/vcl/source/gdi/regionband.cxx +++ b/vcl/source/gdi/regionband.cxx @@ -1213,14 +1213,7 @@ bool RegionBand::IsInside(const Point& rPoint) const if((pBand->mnYTop <= rPoint.Y()) && (pBand->mnYBottom >= rPoint.Y())) { // is point within separation of the band? - if(pBand->IsInside(rPoint.X())) - { - return true; - } - else - { - return false; - } + return pBand->IsInside(rPoint.X()); } pBand = pBand->mpNextBand; diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index a8127a85a0a8..b13fa620b528 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -120,9 +120,7 @@ bool urlExists(OUString const & sUrl) { osl::File aFile(sUrl); osl::FileBase::RC eRC = aFile.open(osl_File_OpenFlag_Read); - if (osl::FileBase::E_None == eRC) - return true; - return false; + return osl::FileBase::E_None == eRC; } OUString getNameNoExtension(OUString const & sName) @@ -436,10 +434,7 @@ bool ImplImageTree::iconCacheLookup(ImageRequestParameters& rParameters) } OUString aVariant = createVariant(rParameters); - if (!aVariant.isEmpty() && loadDiskCachedVersion(aVariant, rParameters)) - return true; - - return false; + return !aVariant.isEmpty() && loadDiskCachedVersion(aVariant, rParameters); } bool ImplImageTree::findImage(std::vector<OUString> const & paths, ImageRequestParameters& rParameters) diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index d0bce2e7d240..b7d1a93b861b 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -801,10 +801,7 @@ bool OpenGLHelper::supportsVCLOpenGL() static bool bDisableGL = !!getenv("SAL_DISABLEGL"); bool bBlacklisted = isDeviceBlacklisted(); - if (bDisableGL || bBlacklisted) - return false; - else - return true; + return !bDisableGL && !bBlacklisted; } void OpenGLZone::enter() { gnEnterCount++; } diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 93e80855901c..ec2a0e3b1ee7 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -247,9 +247,7 @@ bool OutputDevice::GetFontCharMap( FontCharMapRef& rxFontCharMap ) const else rxFontCharMap = xFontCharMap; - if( rxFontCharMap->IsDefaultMap() ) - return false; - return true; + return !rxFontCharMap->IsDefaultMap(); } bool OutputDevice::GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx index 5dc1fd8c417d..e946d7f9f457 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -53,9 +53,7 @@ static bool EnableNativeWidget( const OutputDevice& i_rDevice ) { const vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() ); const vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const vcl::PDFExtOutDevData* >( pOutDevData ) ); - if ( pPDFData != nullptr ) - return false; - return true; + return pPDFData == nullptr; } default: diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 5f2767aafba5..6f0ff412e98e 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -97,10 +97,7 @@ bool isDialogWindow(vcl::Window* pWindow) bool isTopWindow(vcl::Window* pWindow) { WindowType eType = pWindow->GetType(); - if (eType == WindowType::FLOATINGWINDOW) - return true; - - return false; + return eType == WindowType::FLOATINGWINDOW; } vcl::Window* get_top_parent(vcl::Window* pWindow) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index a9bf23ff1dd6..da4524ff183e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -103,16 +103,13 @@ static bool ImplIsMnemonicCtrl( vcl::Window* pWindow ) if ( !pNextWindow ) return false; pNextWindow = pNextWindow->GetWindow( GetWindowType::Client ); - if ( !(pNextWindow->GetStyle() & WB_TABSTOP) || - (pNextWindow->GetType() == WindowType::FIXEDTEXT) || - (pNextWindow->GetType() == WindowType::GROUPBOX) || - (pNextWindow->GetType() == WindowType::RADIOBUTTON) || - (pNextWindow->GetType() == WindowType::CHECKBOX) || - (pNextWindow->GetType() == WindowType::TRISTATEBOX) || - (pNextWindow->GetType() == WindowType::PUSHBUTTON) ) - return false; - - return true; + return !(!(pNextWindow->GetStyle() & WB_TABSTOP) || + (pNextWindow->GetType() == WindowType::FIXEDTEXT) || + (pNextWindow->GetType() == WindowType::GROUPBOX) || + (pNextWindow->GetType() == WindowType::RADIOBUTTON) || + (pNextWindow->GetType() == WindowType::CHECKBOX) || + (pNextWindow->GetType() == WindowType::TRISTATEBOX) || + (pNextWindow->GetType() == WindowType::PUSHBUTTON)); } return false; diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index b4a2edffec60..531bd0dd72e9 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -959,10 +959,7 @@ bool Window::ImplHasDlgCtrl() ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) ) pDlgCtrlParent = pDlgCtrlParent->ImplGetParent(); - if ( !pDlgCtrlParent || ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) ) - return false; - else - return true; + return pDlgCtrlParent && ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL); } void Window::ImplDlgCtrlNextWindow() diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 70f45b59a434..0df373e02a10 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -177,10 +177,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, DockingHdl, void*, void) aBorderRect.Right() -= nRight; PointerState aBorderState = pBorder->GetPointerState(); - if( aBorderRect.IsInside( aBorderState.maPos ) ) - bRealMove = true; - else - bRealMove = false; + bRealMove = aBorderRect.IsInside( aBorderState.maPos ); } } @@ -322,10 +319,7 @@ bool DockingManager::IsFloating( const vcl::Window *pWindow ) bool DockingManager::IsLocked( const vcl::Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); - if( pWrapper && pWrapper->IsLocked() ) - return true; - else - return false; + return pWrapper && pWrapper->IsLocked(); } void DockingManager::Lock( const vcl::Window *pWindow ) @@ -366,10 +360,7 @@ void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window bool DockingManager::IsInPopupMode( const vcl::Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); - if( pWrapper && pWrapper->IsInPopupMode() ) - return true; - else - return false; + return pWrapper && pWrapper->IsInPopupMode(); } void DockingManager::EndPopupMode( const vcl::Window *pWin ) diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 66c00f288f67..8b98c39b41c5 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1112,9 +1112,7 @@ static bool isNullGrid(const array_type &A) sal_Int32 nMaxX = A.shape()[0]; sal_Int32 nMaxY = A.shape()[1]; - if (!nMaxX || !nMaxY) - return true; - return false; + return !nMaxX || !nMaxY; } static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights) diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 814560113470..6dd9460b8d78 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -85,10 +85,7 @@ bool Window::ImplTestMousePointerSet() // if the mouse is over the window, switch it tools::Rectangle aClientRect( Point( 0, 0 ), GetOutputSizePixel() ); - if ( aClientRect.IsInside( GetPointerPosPixel() ) ) - return true; - - return false; + return aClientRect.IsInside( GetPointerPosPixel() ); } PointerStyle Window::ImplGetMousePointer() const @@ -144,13 +141,10 @@ void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged ) MouseEventModifiers nMode = mpWindowImpl->mpFrameData->mnMouseMode; bool bLeave; // check for MouseLeave - if ( ((nX < 0) || (nY < 0) || - (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) || - (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) && - !ImplGetSVData()->maWinData.mpCaptureWin ) - bLeave = true; - else - bLeave = false; + bLeave = ((nX < 0) || (nY < 0) || + (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) || + (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) && + !ImplGetSVData()->maWinData.mpCaptureWin; nMode |= MouseEventModifiers::SYNTHETIC; if ( bModChanged ) nMode |= MouseEventModifiers::MODIFIERCHANGED; diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 9d1c1a7af795..a5b71d093363 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -1839,10 +1839,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) bool bPropSmaller; mnMouseModifier = rMEvt.GetModifier(); - if ( !(mnMouseModifier & KEY_SHIFT) || (static_cast<sal_uInt16>(mnSplitPos+1) >= mpSplitSet->mpItems.size()) ) - bPropSmaller = false; - else - bPropSmaller = true; + bPropSmaller = (mnMouseModifier & KEY_SHIFT) && (static_cast<sal_uInt16>(mnSplitPos+1) < mpSplitSet->mpItems.size()); // here we can set the maximum size StartSplit(); @@ -2865,10 +2862,7 @@ bool SplitWindow::IsItemValid( sal_uInt16 nId ) const sal_uInt16 nPos; ImplSplitSet* pSet = mpBaseSet ? ImplFindItem(mpBaseSet, nId, nPos) : nullptr; - if ( pSet ) - return true; - else - return false; + return pSet != nullptr; } sal_uInt16 SplitWindow::GetItemId( vcl::Window* pWindow ) const diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index e32c4df8b81f..01f5b4a8b2f3 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -102,10 +102,7 @@ static Point ImplGetItemTextPos( const Size& rRectSize, const Size& rTextSize, bool StatusBar::ImplIsItemUpdate() { - if ( !mbProgressMode && mbVisibleItems && IsReallyVisible() && IsUpdateMode() ) - return true; - else - return false; + return !mbProgressMode && mbVisibleItems && IsReallyVisible() && IsUpdateMode(); } void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 7b6f67a41f17..bc1fcb3d906d 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -143,10 +143,7 @@ void TaskPaneList::RemoveWindow( vcl::Window *pWindow ) bool TaskPaneList::IsInList( vcl::Window *pWindow ) { auto p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), VclPtr<vcl::Window>(pWindow) ); - if( p != mTaskPanes.end() ) - return true; - else - return false; + return p != mTaskPanes.end(); } bool TaskPaneList::IsCycleKey(const vcl::KeyCode& rKeyCode) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index e6374e65f93b..e85da5b1f17a 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1516,14 +1516,8 @@ bool ToolBox::ImplCalcItem() bool bText; // check if image and/or text exists - if ( !(it->maImage) ) - bImage = false; - else - bImage = true; - if ( it->maText.isEmpty() ) - bText = false; - else - bText = true; + bImage = !!it->maImage; + bText = !it->maText.isEmpty(); ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting if ( bImage || bText ) { @@ -1997,10 +1991,7 @@ void ToolBox::ImplFormat( bool bResize ) aOldDragRect = pWrapper->GetDragArea(); ImplUpdateDragArea(); - if ( ImplCalcItem() ) - bMustFullPaint = true; - else - bMustFullPaint = false; + bMustFullPaint = ImplCalcItem(); // calculate new size during interactive resize or // set computed size when formatting only @@ -2625,15 +2616,9 @@ void ToolBox::ImplDrawSpin(vcl::RenderContext& rRenderContext) if ( maUpperRect.IsEmpty() || maLowerRect.IsEmpty() ) return; - if ( mnCurLine > 1 ) - bTmpUpper = true; - else - bTmpUpper = false; + bTmpUpper = mnCurLine > 1; - if ( mnCurLine+mnVisLines-1 < mnCurLines ) - bTmpLower = true; - else - bTmpLower = false; + bTmpLower = mnCurLine+mnVisLines-1 < mnCurLines; if ( !IsEnabled() ) { diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 4c74017a81f0..171635342747 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -195,14 +195,8 @@ void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbIma bool bHasText; // check for image and/or text - if ( !(maImage) ) - bHasImage = false; - else - bHasImage = true; - if ( maText.isEmpty() ) - bHasText = false; - else - bHasText = true; + bHasImage = !!maImage; + bHasText = !maText.isEmpty(); // prefer images if symbolonly buttons are drawn // prefer texts if textonly buttons are drawn @@ -529,10 +523,7 @@ void ToolBox::RemoveItem( ImplToolItems::size_type nPos ) if( nPos < mpData->m_aItems.size() ) { bool bMustCalc; - if ( mpData->m_aItems[nPos].meType == ToolBoxItemType::BUTTON ) - bMustCalc = true; - else - bMustCalc = false; + bMustCalc = mpData->m_aItems[nPos].meType == ToolBoxItemType::BUTTON; if ( mpData->m_aItems[nPos].mpWindow ) mpData->m_aItems[nPos].mpWindow->Hide(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index a867ab5a6453..579fdb9ca92f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3655,10 +3655,7 @@ Selection Window::GetSurroundingTextSelection() const bool Window::UsePolyPolygonForComplexGradient() { - if ( meRasterOp != RasterOp::OverPaint ) - return true; - - return false; + return meRasterOp != RasterOp::OverPaint; } void Window::ApplySettings(vcl::RenderContext& /*rRenderContext*/) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 2b7f3be487f6..a984f1c277ac 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1069,10 +1069,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, } else { - if ( ImplCallHotKey( aKeyCode ) ) - bRet = true; - else - bRet = false; + bRet = ImplCallHotKey( aKeyCode ); } } } @@ -1357,9 +1354,7 @@ bool HandleGestureEventBase::Setup() m_pSVData->maWinData.mpAutoScrollWin->EndAutoScroll(); if (m_pSVData->maHelpData.mpHelpWin) ImplDestroyHelpWindow( true ); - if (m_pWindow->IsDisposed()) - return false; - return true; + return !m_pWindow->IsDisposed(); } vcl::Window* HandleGestureEventBase::FindTarget() diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx index 609f3cb349a9..1518567412f7 100644 --- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx @@ -248,10 +248,7 @@ static bool is_kde3_desktop( Display* pDisplay ) } } - if ( KDEVersion( pDisplay ) == 3 ) - return true; - - return false; + return KDEVersion( pDisplay ) == 3; } static bool is_kde4_desktop( Display* pDisplay ) diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 6321f64e1c64..c1b4ff193679 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -464,10 +464,7 @@ bool CairoTextRender::GetGlyphOutline(const GlyphItem& rGlyph, if( !pSF ) return false; - if( pSF->GetGlyphOutline(rGlyph, rPolyPoly)) - return true; - - return false; + return pSF->GetGlyphOutline(rGlyph, rPolyPoly); } SalLayout* CairoTextRender::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index be31508dc179..f844fc8789f6 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -781,10 +781,7 @@ bool GenPspGraphics::GetGlyphOutline(const GlyphItem& rGlyph, if( !pSF ) return false; - if (pSF->GetGlyphOutline(rGlyph, rB2DPolyPoly)) - return true; - - return false; + return pSF->GetGlyphOutline(rGlyph, rB2DPolyPoly); } SalLayout* GenPspGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) |