diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-06 07:44:11 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-06 07:45:25 +0200 |
commit | 794f09f195a449e387ebfbd53eb1b693803c95e7 (patch) | |
tree | 4c82e01015ccac094261060021b49757dab12f19 | |
parent | 3f569908ac72c20826a45ebed59af9b1e5449207 (diff) |
simplify ternary conditions "xxx ? true : yyy"
Look for code like:
xxx ? true : yyy;
Which can be simplified to:
xxx || yyy
Change-Id: Ib7ca86580bfd0cf04674328a3c0cf3747de4758d
24 files changed, 34 insertions, 34 deletions
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 6533752fa38b..a331e0ed6431 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -133,8 +133,8 @@ namespace basegfx if(!bBaseEqualZero) { - const bool bLeftParallel(bLeftEqualZero ? true : areParallel(aLeft, aBase)); - const bool bRightParallel(bRightEqualZero ? true : areParallel(aRight, aBase)); + const bool bLeftParallel(bLeftEqualZero || areParallel(aLeft, aBase)); + const bool bRightParallel(bRightEqualZero || areParallel(aRight, aBase)); if(bLeftParallel && bRightParallel) { diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 97342aecb7e6..3ce8bf22ab1b 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -800,8 +800,8 @@ namespace break; } return NameComponentSupport( - bIgnoreMetaData ? true : (_rxMetaData.get()->*pCatalogCall)(), - bIgnoreMetaData ? true : (_rxMetaData.get()->*pSchemaCall)() + bIgnoreMetaData || (_rxMetaData.get()->*pCatalogCall)(), + bIgnoreMetaData || (_rxMetaData.get()->*pSchemaCall)() ); } } diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 59a97552a25f..d32b973e3150 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -146,7 +146,7 @@ OKeySet::~OKeySet() void OKeySet::initColumns() { Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - bool bCase = (xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()) ? true : false; + bool bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(); m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) ); m_pColumnNames.reset( new SelectColumnsMetaData(bCase) ); m_pParameterNames.reset( new SelectColumnsMetaData(bCase) ); diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 2a60e228e6fc..84cbc7a0fad3 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -111,7 +111,7 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const OU m_sRowSetFilter = i_sRowSetFilter; Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - bool bCase = (xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()) ? true : false; + bool bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(); Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY); const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns(); const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY); diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 6897395f7b2e..8abdbe524b14 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -218,7 +218,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, { Reference<XNameAccess> xSelColumns = xColSup->getColumns(); Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData(); - SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false); + SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()); ::dbaccess::getColumnPositions(xSelColumns,xPrimaryKeyColumns->getElementNames(),aUpdateTableName,aColumnNames); bAllKeysFound = !aColumnNames.empty() && sal_Int32(aColumnNames.size()) == xPrimaryKeyColumns->getElementNames().getLength(); } @@ -285,7 +285,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, else { Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData(); - SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false); + SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()); Reference<XColumnsSupplier> xColSup(_xAnalyzer,UNO_QUERY); Reference<XNameAccess> xSelColumns = xColSup->getColumns(); Reference<XNameAccess> xColumns = m_aUpdateTable->getColumns(); diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index a19fcf465776..e27c91aa36d4 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -1009,7 +1009,7 @@ void OTableController::alterColumns() // contains all columns names which are already handled those which are not in the list will be deleted Reference< XDatabaseMetaData> xMetaData = getMetaData( ); - ::std::map< OUString,sal_Bool,::comphelper::UStringMixLess> aColumns(xMetaData.is() ? (xMetaData->supportsMixedCaseQuotedIdentifiers() ? true : false): sal_True); + ::std::map< OUString,sal_Bool,::comphelper::UStringMixLess> aColumns(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True); ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vRowList.begin(); ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_vRowList.end(); // first look for columns where something other than the name changed diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 18c11b4a56ca..8684ea68724f 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -239,7 +239,7 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) } } - return bKeyProcessed ? true : pEditView->PostKeyEvent( rKEvt, pFrameWin ); + return bKeyProcessed || pEditView->PostKeyEvent( rKEvt, pFrameWin ); } sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget) diff --git a/fpicker/source/aqua/FilterHelper.mm b/fpicker/source/aqua/FilterHelper.mm index ef048f28fe47..99c1e93cf584 100644 --- a/fpicker/source/aqua/FilterHelper.mm +++ b/fpicker/source/aqua/FilterHelper.mm @@ -135,16 +135,16 @@ public: bool operator () ( const FilterEntry& _rEntry ) { - sal_Bool bMatch; + bool bMatch; if( !_rEntry.hasSubFilters() ) { //first try the complete filter name rtl::OUString title = _rEntry.getTitle(); - bMatch = ( title.equals(rTitle) ); + bMatch = title.equals(rTitle); if (!bMatch) { //we didn't find a match using the full name, let's give it another //try using the shrunk version rtl::OUString aShrunkName = shrinkFilterName( _rEntry.getTitle() ).trim(); - bMatch = ( aShrunkName.equals(rTitle) ); + bMatch = aShrunkName.equals(rTitle); } } else @@ -156,7 +156,7 @@ public: *this ); - return bMatch ? true : false; + return bMatch; } bool operator () ( const UnoFilterEntry& _rEntry ) diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx index 7420e9f5d75f..65bfd2e88de5 100644 --- a/mysqlc/source/mysqlc_connection.cxx +++ b/mysqlc/source/mysqlc_connection.cxx @@ -329,7 +329,7 @@ void SAL_CALL OConnection::setAutoCommit(sal_Bool autoCommit) MutexGuard aGuard(m_aMutex); checkDisposed(OConnection_BASE::rBHelper.bDisposed); try { - m_settings.cppConnection->setAutoCommit(autoCommit == sal_True? true:false); + m_settings.cppConnection->setAutoCommit(autoCommit == sal_True); } catch (const sql::SQLException & e) { mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding()); } diff --git a/qadevOOo/testdocs/qadevlibs/source/com/sun/star/cmp/MyPersistObject.java b/qadevOOo/testdocs/qadevlibs/source/com/sun/star/cmp/MyPersistObject.java index 999479aa35f7..a3fdd14658d2 100644 --- a/qadevOOo/testdocs/qadevlibs/source/com/sun/star/cmp/MyPersistObject.java +++ b/qadevOOo/testdocs/qadevlibs/source/com/sun/star/cmp/MyPersistObject.java @@ -68,7 +68,7 @@ public class MyPersistObject implements XPersistObject, XTypeProvider, } public boolean hasPropertyByName(String name) { int i = getPropertyIndexByName(name); - return i>0?true:false; + return i>0; } } diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index e0eb23e3061a..a8011c99c3d2 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -2228,7 +2228,7 @@ void ScAttrArray::MoveTo(SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray SCROW nStart = nStartRow; for (SCSIZE i = 0; i < nCount; i++) { - if ((pData[i].nRow >= nStartRow) && ((i==0) ? true : pData[i-1].nRow < nEndRow)) + if ((pData[i].nRow >= nStartRow) && (i == 0 || pData[i-1].nRow < nEndRow)) { // copy (bPutToPool=TRUE) rAttrArray.SetPatternArea( nStart, std::min( (SCROW)pData[i].nRow, (SCROW)nEndRow ), diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 3b5a0b42532f..fe280e31177a 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -251,7 +251,7 @@ bool ScChangeAction::IsDialogParent() const return pPrevContent && pPrevContent->IsVirgin(); } if ( HasDependent() ) - return IsDeleteType() ? true : !IsDeletedIn(); + return IsDeleteType() || !IsDeletedIn(); if ( HasDeleted() ) { if ( IsDeleteType() ) diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 10ed6364db6e..cc45d02fc406 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1228,7 +1228,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos, SfxItemSet aItemSet = pCaption->GetMergedItemSet(); meTVA = pCaption->GetTextVerticalAdjust(); meTHA = pCaption->GetTextHorizontalAdjust(); - mbAutoScale = pCaption->GetFitToSize()?true:false; + mbAutoScale = pCaption->GetFitToSize() ? true : false; mbLocked = pCaption->IsMoveProtect() || pCaption->IsResizeProtect(); // AutoFill style would change if Postit.cxx object creation values are changed diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 7d8f4454bc33..c21ea7d9ee8d 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -4477,7 +4477,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const ScDocument* pDoc = pShell ? pShell->GetDocument() : NULL; if (pDoc) { - bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( autoFiltAddress.StartColumn ), static_cast< SCROW >( autoFiltAddress.StartRow ), static_cast< SCCOL >( autoFiltAddress.EndColumn ), static_cast< SCROW >( autoFiltAddress.EndRow ), static_cast< SCTAB >( autoFiltAddress.Sheet ) ) ? true : false; + bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( autoFiltAddress.StartColumn ), static_cast< SCROW >( autoFiltAddress.StartRow ), static_cast< SCCOL >( autoFiltAddress.EndColumn ), static_cast< SCROW >( autoFiltAddress.EndRow ), static_cast< SCTAB >( autoFiltAddress.Sheet ) ); } xFiltProps->setPropertyValue( "ContainsHeader", uno::Any( bHasColHeader ) ); } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 63824ad265b4..be3b53225c92 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -526,7 +526,7 @@ bool SdrGrafObj::IsEPS() const bool SdrGrafObj::IsSwappedOut() const { - return mbIsPreview ? true : pGraphic->IsSwappedOut(); + return mbIsPreview || pGraphic->IsSwappedOut(); } const MapMode& SdrGrafObj::GetGrafPrefMapMode() const diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d7e75c449dc3..1c419fe49d8f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -870,8 +870,8 @@ void SwDoc::CalculatePagesForPrinting( // properties to take into account when calculating the set of pages // (PDF export UI does not allow for selecting left or right pages only) - bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages(); - bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages(); + bool bPrintLeftPages = bIsPDFExport || rOptions.IsPrintLeftPages(); + bool bPrintRightPages = bIsPDFExport || rOptions.IsPrintRightPages(); // #i103700# printing selections should not allow for automatic inserting empty pages bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport ); diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 1a21aecb4a00..8da3bb1402c8 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1249,7 +1249,7 @@ namespace bool bChkSelDirection ) { // Respect direction of selection - bool bBound1IsStart = !bChkSelDirection ? true : + bool bBound1IsStart = !bChkSelDirection || ( *rPam.GetPoint() < *rPam.GetMark() ? rPam.GetPoint() == &rPam.GetBound() : rPam.GetMark() == &rPam.GetBound()); diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 99874d791625..5c946a715b3e 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -225,7 +225,7 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) rSI.GetDefaultDir() : rSI.DirType( IsFollow() ? rInf.GetIdx() - 1 : rInf.GetIdx() ); - bool bPerformUBA = UBIDI_LTR != nFldDir ? true : i18n::ScriptType::COMPLEX == nScript; + bool bPerformUBA = UBIDI_LTR != nFldDir || i18n::ScriptType::COMPLEX == nScript; if (bPerformUBA) { UErrorCode nError = U_ZERO_ERROR; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 03dff3824e65..7e60a8fe51c8 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -6172,7 +6172,7 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const if (!pThis->OpenMainStream(refStrm, nOldBuffSize)) { WW8Glossary aGloss( refStrm, 8, pStg ); - bRet = aGloss.Load( rBlocks, bSaveRelFiles ? true : false); + bRet = aGloss.Load( rBlocks, bSaveRelFiles ); } return bRet; } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 52dd5890d67d..2769e905423b 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -1059,7 +1059,7 @@ bool ImplListBoxWindow::SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bo // Space for selection change if( !bShift && ( ( eLET == LET_KEYSPACE ) || ( eLET == LET_MBDOWN ) ) ) { - bool bSelect = ( mbStackMode && IsMouseMoveSelect() ) ? true : !mpEntryList->IsEntryPosSelected( nSelect ); + bool bSelect = ( mbStackMode && IsMouseMoveSelect() ) || !mpEntryList->IsEntryPosSelected( nSelect ); if ( mbStackMode ) { sal_Int32 n; diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 32d977702fde..dc7213001e28 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -486,7 +486,7 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags ) if( !bNativeOK ) return false; - bool bHorz = (GetStyle() & WB_HORZ ? true : false); + bool bHorz = (GetStyle() & WB_HORZ) ? true : false; // Draw the entire background if the control supports it if( IsNativeControlSupported(CTRL_SCROLLBAR, bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT) ) @@ -802,7 +802,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) { sal_uInt16 nOldStateFlags = mnStateFlags; bool bAction = false; - bool bHorizontal = ( GetStyle() & WB_HORZ )? true: false; + bool bHorizontal = ( GetStyle() & WB_HORZ ) ? true: false; bool bIsInside = false; Point aPoint( 0, 0 ); @@ -912,7 +912,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) { const Point& rMousePos = rMEvt.GetPosPixel(); sal_uInt16 nTrackFlags = 0; - bool bHorizontal = ( GetStyle() & WB_HORZ )? true: false; + bool bHorizontal = ( GetStyle() & WB_HORZ ) ? true: false; bool bIsInside = false; bool bDragToMouse = false; @@ -1247,7 +1247,7 @@ void ScrollBar::DataChanged( const DataChangedEvent& rDCEvt ) Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) { - bool bHorizontal = ( GetStyle() & WB_HORZ )? true: false; + bool bHorizontal = ( GetStyle() & WB_HORZ ) ? true: false; bool bIsInside = false; Point aPoint( 0, 0 ); diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx index add2b60384b8..9749cfc74e4e 100644 --- a/vcl/unx/x11/x11sys.cxx +++ b/vcl/unx/x11/x11sys.cxx @@ -52,7 +52,7 @@ bool X11SalSystem::IsUnifiedDisplay() { SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay(); unsigned int nScreenCount = pSalDisp->GetXScreenCount(); - return pSalDisp->IsXinerama() ? true : (nScreenCount == 1); + return pSalDisp->IsXinerama() || (nScreenCount == 1); } unsigned int X11SalSystem::GetDisplayBuiltInScreen() diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 43b382d962fc..e50ccf435c37 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1580,7 +1580,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) { OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); if(pSectionContext) - pSectionContext->SetTitlePage( nIntValue > 0 ? true : false );//section has title page + pSectionContext->SetTitlePage( nIntValue > 0 );//section has title page } break; case 165: diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index a423b675df5d..9c44fd2858b1 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -216,7 +216,7 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) m_pImpl->m_sCharacterSpacing = sStringValue; // doNotCompress, compressPunctuation, compressPunctuationAndJapaneseKana break; case NS_ooxml::LN_CT_Settings_doNotIncludeSubdocsInStats: // 92554; // Do Not Include Content in Text Boxes, Footnotes, and Endnotes in Document Statistics) - m_pImpl->m_doNotIncludeSubdocsInStats = nIntValue? true : false; + m_pImpl->m_doNotIncludeSubdocsInStats = nIntValue ? true : false; break; case NS_ooxml::LN_CT_Settings_decimalSymbol: // 92562; m_pImpl->m_sDecimalSymbol = sStringValue; |