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/source | |
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/source')
-rw-r--r-- | vcl/source/app/settings.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/xtextedt.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/wmf/enhwmf.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winwmf.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 16 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 2 | ||||
-rw-r--r-- | vcl/source/helper/lazydelete.cxx | 2 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/syswin.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 2 |
22 files changed, 35 insertions, 35 deletions
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 ) |