diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-02 15:42:25 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-05 12:47:48 +0200 |
commit | 4f9b21248ffdf55cef9f3f9d1da76778ee000775 (patch) | |
tree | b059d288339a68aa4c3901f1100e99b04d05a23d /vcl | |
parent | b4107411900f5bb4c215e2d9db09fc2b2b82939b (diff) |
simplify ternary conditions "xxx ? yyy : false"
Look for code like:
xxx ? yyy : false;
Which can be simplified to:
xxx && yyy
Change-Id: Ia33c0e452aa28af3f0658a5382895aaad0246b4d
Diffstat (limited to 'vcl')
35 files changed, 57 insertions, 60 deletions
diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx index 71708590597b..1463492d8ac8 100644 --- a/vcl/generic/print/common_gfx.cxx +++ b/vcl/generic/print/common_gfx.cxx @@ -64,7 +64,7 @@ PrinterGfx::Init (PrinterJob &rPrinterJob) mnDpi = rPrinterJob.GetResolution(); rPrinterJob.GetScale (mfScaleX, mfScaleY); const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rPrinterJob.GetPrinterName() ) ); - mbUploadPS42Fonts = rInfo.m_pParser ? ( rInfo.m_pParser->isType42Capable() ? true : false ) : false; + mbUploadPS42Fonts = rInfo.m_pParser && rInfo.m_pParser->isType42Capable(); return true; } @@ -76,13 +76,13 @@ PrinterGfx::Init (const JobData& rData) mpPageBody = NULL; mnDepth = rData.m_nColorDepth; mnPSLevel = rData.m_nPSLevel ? rData.m_nPSLevel : (rData.m_pParser ? rData.m_pParser->getLanguageLevel() : 2 ); - mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice == -1 ? false : true ) : (( rData.m_pParser ? (rData.m_pParser->isColorDevice() ? true : false ) : true ) ); + mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice != -1 ) : ( rData.m_pParser ? rData.m_pParser->isColorDevice() : true ); int nRes = rData.m_aContext.getRenderResolution(); mnDpi = nRes; mfScaleX = (double)72.0 / (double)mnDpi; mfScaleY = (double)72.0 / (double)mnDpi; const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rData.m_aPrinterName ) ); - mbUploadPS42Fonts = rInfo.m_pParser ? ( rInfo.m_pParser->isType42Capable() ? true : false ) : false; + mbUploadPS42Fonts = rInfo.m_pParser && rInfo.m_pParser->isType42Capable(); return true; } diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index fc85e21e1afc..e80ec57b6b6c 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -970,7 +970,7 @@ bool PspSalPrinter::EndPage() bool bResult = m_aPrintJob.EndPage(); m_aPrinterGfx.Clear(); OSL_TRACE("PspSalPrinter::EndPage"); - return bResult ? true : false; + return bResult; } sal_uLong PspSalPrinter::GetErrorCode() diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx index dc3b84675665..19b19e86ab93 100644 --- a/vcl/generic/print/printerjob.cxx +++ b/vcl/generic/print/printerjob.cxx @@ -155,9 +155,9 @@ PrinterJob::IsColorPrinter () const bool bColor = false; if( m_aLastJobData.m_nColorDevice ) - bColor = m_aLastJobData.m_nColorDevice == -1 ? false : true; + bColor = m_aLastJobData.m_nColorDevice != -1; else if( m_aLastJobData.m_pParser ) - bColor = m_aLastJobData.m_pParser->isColorDevice() ? true : false; + bColor = m_aLastJobData.m_pParser->isColorDevice(); return bColor; } diff --git a/vcl/generic/print/text_gfx.cxx b/vcl/generic/print/text_gfx.cxx index 40a7dad60558..2513843d49e4 100644 --- a/vcl/generic/print/text_gfx.cxx +++ b/vcl/generic/print/text_gfx.cxx @@ -66,8 +66,8 @@ Font2::Font2(const PrinterGfx &rGfx) mpFont[1] = rGfx.getFallbackID(); PrintFontManager &rMgr = PrintFontManager::get(); - mbSymbol = mpFont[0] != -1 ? - rMgr.getFontEncoding(mpFont[0]) == RTL_TEXTENCODING_SYMBOL : false; + mbSymbol = mpFont[0] != -1 && + rMgr.getFontEncoding(mpFont[0]) == RTL_TEXTENCODING_SYMBOL; } } // namespace psp @@ -714,7 +714,7 @@ PrinterGfx::writeResources( osl::File* pFile, std::list< OString >& rSuppliedFon { if (aIter->GetFontType() == fonttype::TrueType) { - aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts ? true : false, rSuppliedFonts ); + aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts, rSuppliedFonts ); } else { diff --git a/vcl/inc/fontmanager.hxx b/vcl/inc/fontmanager.hxx index acac65cf524d..e1203bd83a90 100644 --- a/vcl/inc/fontmanager.hxx +++ b/vcl/inc/fontmanager.hxx @@ -399,7 +399,7 @@ public: bool getUseOnlyFontEncoding( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_bFontEncodingOnly : false; + return pFont && pFont->m_bFontEncodingOnly; } // get a specific fonts system dependent filename diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index dda41306a60f..da756f00fb6c 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -409,7 +409,7 @@ bool AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart { Rectangle aRect; bool bValid = AquaGetScrollRect( /* TODO: m_nScreen */ nPart, rControlRegion, aRect ); - rIsInside = bValid ? aRect.IsInside( rPos ) : false; + rIsInside = bValid && aRect.IsInside( rPos ); if( NSAppKitVersionNumber < NSAppKitVersionNumber10_7 && GetSalData()->mbIsScrollbarDoubleMax ) { diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 2c46385d19cc..4174d5af59ae 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2340,7 +2340,7 @@ ImplMiscData::ImplMiscData() mnEnableATT = TRISTATE_INDET; mnDisablePrinting = TRISTATE_INDET; static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI - mbEnableLocalizedDecimalSep = (pEnv != NULL) ? true : false; + mbEnableLocalizedDecimalSep = (pEnv != NULL); } ImplMiscData::ImplMiscData( const ImplMiscData& rData ) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 66082155c108..f117e3f73d9d 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -513,7 +513,7 @@ void Edit::ImplRepaint(bool bLayout) } Cursor* pCursor = GetCursor(); - bool bVisCursor = pCursor ? pCursor->IsVisible() : false; + bool bVisCursor = pCursor && pCursor->IsVisible(); if ( pCursor ) pCursor->Hide(); diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index ea56541a1b24..52dd5890d67d 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -453,7 +453,7 @@ sal_Int32 ImplEntryList::GetSelectEntryPos( sal_Int32 nIndex ) const bool ImplEntryList::IsEntryPosSelected( sal_Int32 nIndex ) const { ImplEntryType* pImplEntry = GetEntry( nIndex ); - return pImplEntry ? pImplEntry->mbIsSelected : false; + return pImplEntry && pImplEntry->mbIsSelected; } bool ImplEntryList::IsEntrySelectable( sal_Int32 nPos ) const diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index c19f5df28648..2223ff092e18 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -750,7 +750,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, if ( IsUndoEnabled() && !IsInUndo() ) { TextUndoInsertChars* pNewUndo = new TextUndoInsertChars( this, aPaM, OUString(c) ); - bool bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? true : false; + bool bTryMerge = !bDoOverwrite && ( c != ' ' ); InsertUndo( pNewUndo, bTryMerge ); } diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index c3593f8e8d9e..2be376153832 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -2049,7 +2049,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv bool bStarterOfDD = false; for ( sal_uInt16 nView = mpImpl->mpTextEngine->GetViewCount(); nView && !bStarterOfDD; ) - bStarterOfDD = mpImpl->mpTextEngine->GetView( --nView )->mpImpl->mpDDInfo ? mpImpl->mpTextEngine->GetView( nView )->mpImpl->mpDDInfo->mbStarterOfDD : false; + bStarterOfDD = mpImpl->mpTextEngine->GetView( --nView )->mpImpl->mpDDInfo && mpImpl->mpTextEngine->GetView( nView )->mpImpl->mpDDInfo->mbStarterOfDD; HideSelection(); ImpSetSelection( mpImpl->mpDDInfo->maDropPos ); diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx index 6f63ccecb9a0..6eff3dd2f22d 100644 --- a/vcl/source/edit/xtextedt.cxx +++ b/vcl/source/edit/xtextedt.cxx @@ -245,7 +245,7 @@ bool ExtTextView::MatchGroup() if ( aMatchSel.HasRange() ) SetSelection( aMatchSel ); - return aMatchSel.HasRange() ? true : false; + return aMatchSel.HasRange(); } bool ExtTextView::Search( const util::SearchOptions& rSearchOptions, bool bForward ) diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index 7be3492ccfb7..7aa84e22833c 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -860,7 +860,7 @@ bool EnhWMFReader::ReadEnhWMF() if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 ) { pWMF->ReadUInt32( nStyle ); - pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? true : false ) ); + pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ) ); } } break; diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index 22940dd3ed57..8b1936b0e8c7 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -815,7 +815,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) { sal_uInt16 nStyle = 0; pWMF->ReadUInt16( nStyle ); - pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? true : false ) ); + pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ) ); } break; diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index dee0722356ba..dbdc6d2e400a 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -271,7 +271,7 @@ sal_uInt16 Bitmap::GetBitCount() const bool Bitmap::HasGreyPalette() const { const sal_uInt16 nBitCount = GetBitCount(); - bool bRet = nBitCount == 1 ? true : false; + bool bRet = nBitCount == 1; BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index da9d07f66295..bc25f0490dba 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -467,12 +467,12 @@ bool BitmapEx::Crop( const Rectangle& rRectPixel ) bool BitmapEx::Convert( BmpConversion eConversion ) { - return( !!aBitmap ? aBitmap.Convert( eConversion ) : false ); + return !!aBitmap && aBitmap.Convert( eConversion ); } bool BitmapEx::ReduceColors( sal_uInt16 nNewColorCount, BmpReduce eReduce ) { - return( !!aBitmap ? aBitmap.ReduceColors( nNewColorCount, eReduce ) : false ); + return !!aBitmap && aBitmap.ReduceColors( nNewColorCount, eReduce ); } bool BitmapEx::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor, bool bExpandTransparent ) @@ -614,31 +614,31 @@ bool BitmapEx::Erase( const Color& rFillColor ) bool BitmapEx::Dither( sal_uLong nDitherFlags ) { - return( !!aBitmap ? aBitmap.Dither( nDitherFlags ) : false ); + return !!aBitmap && aBitmap.Dither( nDitherFlags ); } bool BitmapEx::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) { - return( !!aBitmap ? aBitmap.Replace( rSearchColor, rReplaceColor, nTol ) : false ); + return !!aBitmap && aBitmap.Replace( rSearchColor, rReplaceColor, nTol ); } bool BitmapEx::Replace( const Color* pSearchColors, const Color* pReplaceColors, sal_uLong nColorCount, const sal_uLong* pTols ) { - return( !!aBitmap ? aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, (sal_uLong*) pTols ) : false ); + return !!aBitmap && aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, (sal_uLong*) pTols ); } bool BitmapEx::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma, bool bInvert, bool msoBrightness ) { - return( !!aBitmap ? aBitmap.Adjust( nLuminancePercent, nContrastPercent, + return !!aBitmap && aBitmap.Adjust( nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent, nChannelBPercent, - fGamma, bInvert, msoBrightness ) : false ); + fGamma, bInvert, msoBrightness ); } bool BitmapEx::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress ) { - return( !!aBitmap ? aBitmap.Filter( eFilter, pFilterParam, pProgress ) : false ); + return !!aBitmap && aBitmap.Filter( eFilter, pFilterParam, pProgress ); } void BitmapEx::Draw( OutputDevice* pOutDev, const Point& rDestPt ) const diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index a055283a54f5..ff8c044c9650 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1514,7 +1514,7 @@ GfxLink ImpGraphic::ImplGetLink() bool ImpGraphic::ImplIsLink() const { - return ( mpGfxLink != NULL ) ? true : false; + return ( mpGfxLink != NULL ); } sal_uLong ImpGraphic::ImplGetChecksum() const diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 26189b83651c..2766ef23a787 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1152,7 +1152,7 @@ public: void setTextFillColor( const Color& rColor ) { m_aGraphicsStack.front().m_aFont.SetFillColor( rColor ); - m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ? true : false ); + m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ); m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont; } void setTextFillColor() diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index 996463b84eb7..abf06ff0d4a9 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -57,7 +57,7 @@ void LazyDelete::flush() // specialized is_less function for Window template<> bool LazyDeletor<Window>::is_less( Window* left, Window* right ) { - return (left != right && right->IsChild( left, true )) ? true : false; + return left != right && right->IsChild( left, true ); } #ifndef LINUX diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index af9eb1b0e0e6..c5030ad66200 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -746,7 +746,7 @@ void OutputDevice::SetTextFillColor( const Color& rColor ) { Color aColor( rColor ); - bool bTransFill = ImplIsColorTransparent( aColor ) ? true : false; + bool bTransFill = ImplIsColorTransparent( aColor ); if ( !bTransFill ) { @@ -1334,7 +1334,7 @@ bool OutputDevice::GetTextIsRTL( const OUString& rString, sal_Int32 nIndex, sal_ bool bRTL = false; int nCharPos = -1; aArgs.GetNextPos( &nCharPos, &bRTL ); - return (nCharPos != nIndex) ? true : false; + return (nCharPos != nIndex); } sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 91a2b9769186..dfeff7320a73 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -176,7 +176,7 @@ VclBuilder::VclBuilder(Window *pParent, const OUString& sUIDir, const OUString& , m_pParserState(new ParserState) , m_xFrame(rFrame) { - m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false; + m_bToplevelHasDeferredInit = pParent && pParent->IsDialog() && ((Dialog*)pParent)->isDeferredInit(); m_bToplevelHasDeferredProperties = m_bToplevelHasDeferredInit; sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.'); @@ -1820,9 +1820,9 @@ bool VclBuilder::sortIntoBestTabTraversalOrder::operator()(const Window *pA, con sal_Int32 nPackA = m_pBuilder->get_window_packing_data(pA).m_nPosition; sal_Int32 nPackB = m_pBuilder->get_window_packing_data(pB).m_nPosition; if (nPackA < nPackB) - return ePackA == VCL_PACK_START ? true : false; + return ePackA == VCL_PACK_START; if (nPackA > nPackB) - return ePackA == VCL_PACK_START ? false : true; + return ePackA != VCL_PACK_START; //sort labels of Frames before body if (pA->GetParent() == pB->GetParent()) { diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 9a33284c5245..756a09b7343c 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1189,7 +1189,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal bool Dialog::isLayoutEnabled() const { //pre dtor called, and single child is a container => we're layout enabled - return mpDialogImpl ? ::isLayoutEnabled(this) : false; + return mpDialogImpl && ::isLayoutEnabled(this); } Size Dialog::GetOptimalSize() const diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 9ed5681a4b70..b06a9a5493d6 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1958,7 +1958,7 @@ void Menu::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ) ( ! pData->bMirrorMode && bMirror ) ) { - pData->bMirrorMode = bMirror ? true : false; + pData->bMirrorMode = bMirror; if( !!pData->aImage ) pData->aImage = ImplMirrorImage( pData->aImage ); } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 00e9e5f277c7..cf9642e4d21a 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -787,7 +787,7 @@ bool PrintDialog::isPrintToFile() bool PrintDialog::isCollate() { - return maJobPage.mpCopyCountField->GetValue() > 1 ? maJobPage.mpCollateBox->IsChecked() : false; + return maJobPage.mpCopyCountField->GetValue() > 1 && maJobPage.mpCollateBox->IsChecked(); } bool PrintDialog::isSingleJobs() diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index d24f76bbdfbb..508b582d075d 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -897,7 +897,7 @@ void SystemWindow::SetMenuBar( MenuBar* pMenuBar ) ImplToBottomChild(); if ( pOldMenuBar ) { - bool bDelete = (pMenuBar == 0) ? true : false; + bool bDelete = (pMenuBar == 0); if( bDelete && pOldWindow ) { if( mpImplData->mpTaskPaneList ) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 965a0871e220..6ca7338e7553 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3141,7 +3141,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aButtonRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? true : false ); + ImplDrawButton( this, aButtonRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ); if( nHighlight != 0 ) { @@ -3195,7 +3195,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, pItem->maRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? true : false ); + ImplDrawButton( this, pItem->maRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ); } sal_uInt16 nTextStyle = 0; @@ -4283,7 +4283,7 @@ bool ToolBox::Notify( NotifyEvent& rNEvt ) if( bNoTabCycling && ! (GetStyle() & WB_FORCETABCYCLE) ) return DockingWindow::Notify( rNEvt ); - else if( ImplChangeHighlightUpDn( aKeyCode.IsShift() ? true : false , bNoTabCycling ) ) + else if( ImplChangeHighlightUpDn( aKeyCode.IsShift() , bNoTabCycling ) ) return false; else return DockingWindow::Notify( rNEvt ); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 5619b4cbba81..ea9a1fa14988 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1338,7 +1338,7 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ) ( ! pItem->mbMirrorMode && bMirror ) ) { - pItem->mbMirrorMode = bMirror ? true : false; + pItem->mbMirrorMode = bMirror; if( !!pItem->maImage ) { pItem->maImage = ImplMirrorImage( pItem->maImage ); @@ -2134,7 +2134,7 @@ bool ToolBox::AlwaysLocked() } } - return nAlwaysLocked == 1 ? true : false; + return nAlwaysLocked == 1; } bool ToolBox::WillUsePopupMode() const diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 2747c4547de1..3d05688e8abc 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -6503,7 +6503,7 @@ void Window::SetCallHandlersOnInputDisabled( bool bCall ) bool Window::IsCallHandlersOnInputDisabled() const { - return mpWindowImpl->mbCallHandlersDuringInputDisabled ? true : false; + return mpWindowImpl->mbCallHandlersDuringInputDisabled; } void Window::EnableInput( bool bEnable, bool bChild ) diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index a476957b45ef..0d7889b51bb4 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -4023,7 +4023,7 @@ void SelectionManagerHolder::initialize( const Sequence< Any >& arguments ) thro sal_Bool SelectionManagerHolder::isDragImageSupported() throw(std::exception) { - return m_xRealDragSource.is() ? m_xRealDragSource->isDragImageSupported() : false; + return m_xRealDragSource.is() && m_xRealDragSource->isDragImageSupported(); } sal_Int32 SelectionManagerHolder::getDefaultCursor( sal_Int8 dragAction ) throw(std::exception) diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index bbc2b369fcbe..d99c406df8a8 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -113,7 +113,7 @@ X11SalGraphics::X11SalGraphics() #if ENABLE_GRAPHITE // check if graphite fonts have been disabled static const char* pDisableGraphiteStr = getenv( "SAL_DISABLE_GRAPHITE" ); - bDisableGraphite_ = pDisableGraphiteStr ? (pDisableGraphiteStr[0]!='0') : false; + bDisableGraphite_ = pDisableGraphiteStr && (pDisableGraphiteStr[0]!='0'); #endif pBrushGC_ = NULL; diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 56aa036c8266..cd0d0b5c0aeb 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -156,7 +156,7 @@ bool X11SalVirtualDevice::Init( SalDisplay *pDisplay, pGraphics_->Init( this, pColormap, bDeleteColormap ); - return hDrawable_ != None ? true : false; + return hDrawable_ != None; } X11SalVirtualDevice::X11SalVirtualDevice() : diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index d51577dd029a..3a818d242a50 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -821,10 +821,7 @@ const PPDKey* PPDParser::getKey( const OUString& rKey ) const bool PPDParser::hasKey( const PPDKey* pKey ) const { - return - pKey ? - ( m_aKeys.find( pKey->getKey() ) != m_aKeys.end() ? true : false ) : - false; + return pKey && ( m_aKeys.find( pKey->getKey() ) != m_aKeys.end() ); } static sal_uInt8 getNibble( sal_Char cChar ) @@ -1676,7 +1673,7 @@ bool PPDContext::resetValue( const PPDKey* pKey, bool bDefaultable ) if( ! pResetValue && bDefaultable ) pResetValue = pKey->getDefaultValue(); - bool bRet = pResetValue ? ( setValue( pKey, pResetValue ) == pResetValue ? true : false ) : false; + bool bRet = pResetValue && ( setValue( pKey, pResetValue ) == pResetValue ); return bRet; } diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index 558eba0b63e6..30dd88c7569c 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -507,12 +507,12 @@ namespace { *this ); - return bMatch ? true : false; + return bMatch; } bool operator () ( const UnoFilterEntry& _rEntry ) { OUString aShrunkName = shrinkFilterName( _rEntry.First ); - return aShrunkName == rTitle ? true : false; + return aShrunkName == rTitle; } }; } @@ -1217,7 +1217,7 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr //actually select something from the list. gint nItems = gtk_tree_model_iter_n_children( gtk_combo_box_get_model(pWidget), NULL); - gtk_widget_set_sensitive(GTK_WIDGET(pWidget), nItems > 1 ? true : false); + gtk_widget_set_sensitive(GTK_WIDGET(pWidget), nItems > 1); } uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction) const diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index b5967e0c31dc..5f4fa94131fd 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -2932,7 +2932,7 @@ void GtkSalFrame::SetParent( SalFrame* pNewParent ) void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, SalX11Screen nXScreen ) { - bool bWasVisible = m_pWindow ? IS_WIDGET_MAPPED(m_pWindow) : false; + bool bWasVisible = m_pWindow && IS_WIDGET_MAPPED(m_pWindow); if( bWasVisible ) Show( false ); @@ -3035,7 +3035,7 @@ bool GtkSalFrame::SetPluginParent( SystemParentData* pSysParent ) { #if !GTK_CHECK_VERSION(3,0,0) GetGenericData()->ErrorTrapPush(); // permanantly ignore unruly children's errors - createNewWindow( pSysParent->aWindow, (pSysParent->nSize > sizeof(long)) ? pSysParent->bXEmbedSupport : false, m_nXScreen ); + createNewWindow( pSysParent->aWindow, (pSysParent->nSize > sizeof(long)) && pSysParent->bXEmbedSupport, m_nXScreen ); return true; #else (void)pSysParent; diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 2f00cfbbf52d..01d480668f04 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -3813,7 +3813,7 @@ static bool ImplHandlePaintMsg( HWND hWnd ) if ( bMutex ) ImplSalYieldMutexRelease(); - return bMutex ? true : false; + return bMutex; } static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect ) |