summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-04-24 12:34:53 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-04-24 12:36:31 +0200
commita9a4d46ce74fc3c4ff1b7399ea6be6ffeeeb8863 (patch)
treef44261f69c3c6c5cb13095d092ea538a8d47a5e0 /vcl
parent9796e52ab3bbf64fa751c71e695c64d6215e1df6 (diff)
loplugin:simplifybool
Change-Id: I8276e8b356ff26241613de64bcd90b5dbcd92f29
Diffstat (limited to 'vcl')
-rw-r--r--vcl/generic/fontmanager/fontmanager.cxx4
-rw-r--r--vcl/generic/print/common_gfx.cxx2
-rw-r--r--vcl/generic/print/genprnpsp.cxx8
-rw-r--r--vcl/generic/print/printerjob.cxx9
-rw-r--r--vcl/inc/ilstbox.hxx2
-rw-r--r--vcl/inc/openglgdiimpl.hxx2
-rw-r--r--vcl/osx/salframeview.mm2
-rw-r--r--vcl/osx/salnativewidgets.cxx6
-rw-r--r--vcl/source/app/svapp.cxx2
-rw-r--r--vcl/source/control/button.cxx7
-rw-r--r--vcl/source/control/combobox.cxx4
-rw-r--r--vcl/source/control/ilstbox.cxx4
-rw-r--r--vcl/source/control/lstbox.cxx6
-rw-r--r--vcl/source/control/scrbar.cxx14
-rw-r--r--vcl/source/control/spinfld.cxx2
-rw-r--r--vcl/source/edit/textdat2.hxx2
-rw-r--r--vcl/source/edit/texteng.cxx4
-rw-r--r--vcl/source/edit/textview.cxx2
-rw-r--r--vcl/source/filter/ixpm/xpmread.cxx2
-rw-r--r--vcl/source/gdi/bitmap4.cxx2
-rw-r--r--vcl/source/gdi/bitmapex.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx4
-rw-r--r--vcl/source/gdi/print.cxx2
-rw-r--r--vcl/source/gdi/print2.cxx4
-rw-r--r--vcl/source/gdi/virdev.cxx2
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx2
-rw-r--r--vcl/source/outdev/bitmap.cxx2
-rw-r--r--vcl/source/window/brdwin.cxx4
-rw-r--r--vcl/source/window/menu.cxx6
-rw-r--r--vcl/source/window/menufloatingwindow.cxx2
-rw-r--r--vcl/source/window/splitwin.cxx4
-rw-r--r--vcl/source/window/stacking.cxx2
-rw-r--r--vcl/source/window/toolbox.cxx6
-rw-r--r--vcl/source/window/toolbox2.cxx2
-rw-r--r--vcl/source/window/window.cxx10
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx2
-rw-r--r--vcl/unx/generic/window/salframe.cxx4
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx2
39 files changed, 75 insertions, 77 deletions
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index a357c7896f7c..87027d41e8cb 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1571,7 +1571,7 @@ bool PrintFontManager::getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const
rInfo.m_nID = nFontID;
fillPrintFontInfo( pFont, rInfo );
}
- return pFont ? true : false;
+ return pFont != nullptr;
}
bool PrintFontManager::getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo ) const
@@ -1582,7 +1582,7 @@ bool PrintFontManager::getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo
rInfo.m_nID = nFontID;
fillPrintFontInfo( pFont, rInfo );
}
- return pFont ? true : false;
+ return pFont != nullptr;
}
bool PrintFontManager::getFontBoundingBox( fontID nFontID, int& xMin, int& yMin, int& xMax, int& yMax )
diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx
index 769bb9893507..ffe1e25ae705 100644
--- a/vcl/generic/print/common_gfx.cxx
+++ b/vcl/generic/print/common_gfx.cxx
@@ -76,7 +76,7 @@ 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 ) : ( rData.m_pParser ? rData.m_pParser->isColorDevice() : true );
+ mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice != -1 ) : ( rData.m_pParser == nullptr || rData.m_pParser->isColorDevice() );
int nRes = rData.m_aContext.getRenderResolution();
mnDpi = nRes;
mfScaleX = (double)72.0 / (double)mnDpi;
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 7a0ab922eca8..71f35eb2d3e0 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -251,7 +251,7 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC
OString aCmdLine(OUStringToOString(rCommandLine, aEncoding));
OString aFilename(OUStringToOString(rFilename, aEncoding));
- bool bPipe = aCmdLine.indexOf( "(TMP)" ) != -1 ? false : true;
+ bool bPipe = aCmdLine.indexOf( "(TMP)" ) == -1;
// setup command line for exec
if( ! bPipe )
@@ -277,7 +277,7 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC
int pid, fd[2];
if( bPipe )
- bHavePipes = pipe( fd ) ? false : true;
+ bHavePipes = pipe( fd ) == 0;
if( ( pid = fork() ) > 0 )
{
if( bPipe && bHavePipes )
@@ -919,7 +919,7 @@ bool PspSalPrinter::StartJob(
#endif
m_aPrinterGfx.Init( m_aJobData );
- return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? true : false;
+ return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect );
}
bool PspSalPrinter::EndJob()
@@ -944,7 +944,7 @@ bool PspSalPrinter::EndJob()
bool PspSalPrinter::AbortJob()
{
- bool bAbort = m_aPrintJob.AbortJob() ? true : false;
+ bool bAbort = m_aPrintJob.AbortJob();
GetSalData()->m_pInstance->jobEndedPrinterUpdate();
return bAbort;
}
diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx
index f3aa39df8125..ba0da718eec6 100644
--- a/vcl/generic/print/printerjob.cxx
+++ b/vcl/generic/print/printerjob.cxx
@@ -720,8 +720,8 @@ static bool writeFeature( osl::File* pFile, const PPDKey* pKey, const PPDValue*
}
aFeature.append( "\n} stopped cleartomark\n" );
sal_uInt64 nWritten = 0;
- return pFile->write( aFeature.getStr(), aFeature.getLength(), nWritten )
- || nWritten != (sal_uInt64)aFeature.getLength() ? false : true;
+ return !(pFile->write( aFeature.getStr(), aFeature.getLength(), nWritten )
+ || nWritten != (sal_uInt64)aFeature.getLength());
}
bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool bDocumentSetup )
@@ -1014,9 +1014,8 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob )
aLine.append(static_cast<sal_Int32>(rJob.m_nCopies));
aLine.append(" def\n");
sal_uInt64 nWritten = 0;
- bSuccess = pFile->write(aLine.getStr(), aLine.getLength(), nWritten)
- || nWritten != static_cast<sal_uInt64>(aLine.getLength()) ?
- false : true;
+ bSuccess = !(pFile->write(aLine.getStr(), aLine.getLength(), nWritten)
+ || nWritten != static_cast<sal_uInt64>(aLine.getLength()));
if( bSuccess && GetPostscriptLevel( &rJob ) >= 2 )
WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" );
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 2fec0559096c..0efc7e12988b 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -128,7 +128,7 @@ public:
long GetEntryHeight( sal_Int32 nPos ) const;
sal_Int32 GetEntryCount() const { return (sal_Int32 )maEntries.size(); }
- bool HasImages() const { return mnImages ? true : false; }
+ bool HasImages() const { return mnImages != 0; }
OUString GetEntryText( sal_Int32 nPos ) const;
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index c5a7abcfdb2c..9abc4f975941 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -115,7 +115,7 @@ public:
GLfloat GetHeight() const { return mpProvider ? mpProvider->GetHeight() : 1; }
// check whether this instance is used for offscreen rendering
- bool IsOffscreen() const { return mpProvider ? mpProvider->IsOffScreen() : true; }
+ bool IsOffscreen() const { return mpProvider == nullptr || mpProvider->IsOffScreen(); }
// operations to do before painting
void PreDraw();
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 37b4602c4f9d..4a5166333e67 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -1497,7 +1497,7 @@ private:
nRet = mpFrame->CallCallback( SALEVENT_KEYINPUT, &aEvent );
std::map< NSEvent*, bool >::iterator it = GetSalData()->maKeyEventAnswer.find( mpLastEvent );
if( it != GetSalData()->maKeyEventAnswer.end() )
- it->second = nRet ? true : false;
+ it->second = nRet != 0;
if( AquaSalFrame::isAlive( mpFrame ) )
mpFrame->CallCallback( SALEVENT_KEYUP, &aEvent );
}
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index 041df334a051..72e035f5a7f4 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -333,7 +333,7 @@ bool AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart
*/
UInt32 AquaSalGraphics::getState( ControlState nState )
{
- const bool bDrawActive = mpFrame ? ([mpFrame->getNSWindow() isKeyWindow] ? true : false) : true;
+ const bool bDrawActive = mpFrame == nullptr || [mpFrame->getNSWindow() isKeyWindow];
if( !(nState & ControlState::ENABLED) || ! bDrawActive )
{
if( ! (nState & ControlState::HIDDEN) )
@@ -353,7 +353,7 @@ UInt32 AquaSalGraphics::getState( ControlState nState )
UInt32 AquaSalGraphics::getTrackState( ControlState nState )
{
- const bool bDrawActive = mpFrame ? ([mpFrame->getNSWindow() isKeyWindow] ? true : false) : true;
+ const bool bDrawActive = mpFrame == nullptr || [mpFrame->getNSWindow() isKeyWindow];
if( ! (nState & ControlState::ENABLED) || ! bDrawActive )
return kThemeTrackInactive;
@@ -419,7 +419,7 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType,
#else
if (rControlRegion.Top() == 0 && nPart == PART_DRAW_BACKGROUND_HORZ)
{
- const bool bDrawActive = mpFrame ? ([mpFrame->getNSWindow() isKeyWindow] ? true : false) : true;
+ const bool bDrawActive = mpFrame == nullptr || [mpFrame->getNSWindow() isKeyWindow];
CGFloat unifiedHeight = rControlRegion.GetHeight();
CGRect drawRect = CGRectMake(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
CUIDraw([NSWindow coreUIRenderer], drawRect, mrContext,
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 64b0336ddb87..3d22d7cf5621 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1102,7 +1102,7 @@ unsigned int Application::GetScreenCount()
bool Application::IsUnifiedDisplay()
{
SalSystem* pSys = ImplGetSalSystem();
- return pSys ? pSys->IsUnifiedDisplay() : true;
+ return pSys == nullptr || pSys->IsUnifiedDisplay();
}
unsigned int Application::GetDisplayBuiltInScreen()
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 30e111a674d1..09abe44f5f80 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -239,7 +239,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
OUString aText( GetText() );
bool bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE );
bool bDrawText = !aText.isEmpty() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOTEXT );
- bool bHasSymbol = pSymbolRect ? true : false;
+ bool bHasSymbol = pSymbolRect != nullptr;
// No text and no image => nothing to do => return
if ( !bDrawImage && !bDrawText && !bHasSymbol )
@@ -684,9 +684,8 @@ void PushButton::ImplInitSettings( bool bFont,
EnableChildTransparentMode( true );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
SetPaintTransparent( true );
- mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON)
- ? false
- : ImplGetSVData()->maNWFData.mbNoFocusRects;
+ mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON) == 0
+ && ImplGetSVData()->maNWFData.mbNoFocusRects;
}
else
{
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 16d1cccb7f5e..3d5a41f6809f 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -122,7 +122,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
ImplInitStyle( nStyle );
- bool bNoBorder = ( nStyle & WB_NOBORDER ) ? true : false;
+ bool bNoBorder = ( nStyle & WB_NOBORDER ) != 0;
if ( !(nStyle & WB_DROPDOWN) )
{
nStyle &= ~WB_BORDER;
@@ -647,7 +647,7 @@ void ComboBox::StateChanged( StateChangedType nType )
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
+ mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) != 0 );
}
else if( nType == StateChangedType::MIRRORING )
{
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e5d29ea4a98e..0500a46dc8ba 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -459,7 +459,7 @@ bool ImplEntryList::IsEntryPosSelected( sal_Int32 nIndex ) const
bool ImplEntryList::IsEntrySelectable( sal_Int32 nPos ) const
{
ImplEntryType* pImplEntry = GetEntry( nPos );
- return pImplEntry ? ((pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0) : true;
+ return pImplEntry == nullptr || ((pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0);
}
sal_Int32 ImplEntryList::FindFirstSelectable( sal_Int32 nPos, bool bForward /* = true */ )
@@ -2538,7 +2538,7 @@ bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
{
- bool bChanges = GetEntryList()->GetMRUCount() ? true : false;
+ bool bChanges = GetEntryList()->GetMRUCount() != 0;
// Remove old MRU entries
for ( sal_Int32 n = GetEntryList()->GetMRUCount();n; )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 3669e1813f5f..131d0fe8b31e 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -853,8 +853,8 @@ void ListBox::StateChanged( StateChangedType nType )
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
- bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? true : false;
+ mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) != 0 );
+ bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
}
else if( nType == StateChangedType::MIRRORING )
@@ -1175,7 +1175,7 @@ void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
// WB_SIMPLEMODE:
// The MultiListBox behaves just like a normal ListBox
// MultiSelection is possible via corresponding additional keys
- bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? true : false;
+ bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
// In a MultiSelection, we can't see us travelling without focus
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 98d753363f18..e31391d27ab3 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -456,7 +456,7 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags )
if( !bNativeOK )
return false;
- bool bHorz = (GetStyle() & WB_HORZ) ? true : false;
+ bool bHorz = (GetStyle() & WB_HORZ) != 0;
// Draw the entire background if the control supports it
if( IsNativeControlSupported(CTRL_SCROLLBAR, bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT) )
@@ -786,7 +786,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 ) != 0;
bool bIsInside = false;
Point aPoint( 0, 0 );
@@ -896,7 +896,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 ) != 0;
bool bIsInside = false;
bool bDragToMouse = false;
@@ -972,9 +972,9 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
ImplDraw( mnDragDraw, this );
}
}
- else if(bPage && (HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA,
- aControlRegion, rMousePos, bIsInside ) ?
- bIsInside : true) )
+ else if(bPage && (!HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA,
+ aControlRegion, rMousePos, bIsInside ) ||
+ bIsInside) )
{
nTrackFlags = STARTTRACK_BUTTONREPEAT;
@@ -1231,7 +1231,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 ) != 0;
bool bIsInside = false;
Point aPoint( 0, 0 );
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 85aa37b07769..15ae57f4042a 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -407,7 +407,7 @@ void SpinField::MouseButtonDown( const MouseEvent& rMEvt )
else if ( maDropDownRect.IsInside( rMEvt.GetPosPixel() ) )
{
// put DropDownButton to the right
- mbInDropDown = ShowDropDown( mbInDropDown ? false : true );
+ mbInDropDown = ShowDropDown( !mbInDropDown );
Paint( Rectangle( Point(), GetOutputSizePixel() ) );
}
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx
index 81785cf35fce..c1cdded84148 100644
--- a/vcl/source/edit/textdat2.hxx
+++ b/vcl/source/edit/textdat2.hxx
@@ -154,7 +154,7 @@ public:
void SetInvalid() { mbInvalid = true; }
void SetValid() { mbInvalid = false; }
- bool IsEmpty() const { return (mnEnd > mnStart) ? false : true; }
+ bool IsEmpty() const { return mnEnd <= mnStart; }
short GetStartX() const { return mnStartX; }
void SetStartX( short n ) { mnStartX = n; }
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index bac8fdbd48d0..f4a11a2d0ec3 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2520,7 +2520,7 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
SetUpdateMode( bUpdate );
FormatAndUpdate( GetActiveView() );
- return rInput.GetError() ? false : true;
+ return rInput.GetError() == 0;
}
bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML )
@@ -2608,7 +2608,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
rOutput.WriteLine( "</HTML>" );
}
- return rOutput.GetError() ? false : true;
+ return rOutput.GetError() == 0;
}
void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index cafbbf52f9c4..768125bf2a35 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1841,7 +1841,7 @@ bool TextView::SetCursorAtPoint( const Point& rPosPixel )
ShowSelection( aTmpNewSel );
}
- bool bForceCursor = mpImpl->mpDDInfo ? false : true; // && !mbInSelection
+ bool bForceCursor = mpImpl->mpDDInfo == nullptr; // && !mbInSelection
ImpShowCursor( mpImpl->mbAutoScroll, bForceCursor, false );
return true;
}
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 338069b0b2b1..6d7646c827f3 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -398,7 +398,7 @@ bool XPMReader::ImplGetColKey( sal_uInt8 nKey )
}
}
}
- return ( mnParaSize ) ? true : false;
+ return mnParaSize != 0;
}
// ImplGetRGBHex translates the ASCII-Hexadecimalvalue belonging to mpPara
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index d5dc4705111a..8790b2baf58b 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -943,7 +943,7 @@ extern "C" int SAL_CALL ImplPopArtCmpFnc( const void* p1, const void* p2 )
bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ )
{
- bool bRet = ( GetBitCount() > 8 ) ? Convert( BMP_CONVERSION_8BIT_COLORS ) : true;
+ bool bRet = ( GetBitCount() <= 8 ) || Convert( BMP_CONVERSION_8BIT_COLORS );
if( bRet )
{
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index d75d6749143e..79ae295b3f74 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -157,7 +157,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ) :
aMask ( rAlphaMask.ImplGetBitmap() ),
aBitmapSize ( aBitmap.GetSizePixel() ),
eTransparent ( !rAlphaMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ),
- bAlpha ( !rAlphaMask ? false : true )
+ bAlpha ( !rAlphaMask.IsEmpty() )
{
if(!!aBitmap && !!aMask && aBitmap.GetSizePixel() != aMask.GetSizePixel())
{
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 1bcd5cf5fe8c..0c6714e9ffba 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -1968,8 +1968,8 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap )
{
const Scanline pCurLine = i_pBitmap->GetScanline( nY );
long nLineIndex = 0;
- bool bRunSet = (*pCurLine & 0x80) ? true : false;
- bool bRefSet = (*pRefLine & 0x80) ? true : false;
+ bool bRunSet = (*pCurLine & 0x80) != 0;
+ bool bRefSet = (*pRefLine & 0x80) != 0;
long nRunIndex1 = bRunSet ? 0 : findBitRun( pCurLine, 0, nW, bRunSet );
long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet );
for( ; nLineIndex < nW; )
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 658363dff292..e96e14bc9c68 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -643,7 +643,7 @@ bool Printer::AcquireGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics ? true : false;
+ return mpGraphics != nullptr;
}
void Printer::ImplReleaseFonts()
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 76a471b45d99..4b5a2f1505b9 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -282,8 +282,8 @@ void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
// Returns true, if given action creates visible (i.e. non-transparent) output
bool ImplIsNotTransparent( const MetaAction& rAct, const OutputDevice& rOut )
{
- const bool bLineTransparency( rOut.IsLineColor() ? rOut.GetLineColor().GetTransparency() == 255 : true );
- const bool bFillTransparency( rOut.IsFillColor() ? rOut.GetFillColor().GetTransparency() == 255 : true );
+ const bool bLineTransparency( !rOut.IsLineColor() || rOut.GetLineColor().GetTransparency() == 255 );
+ const bool bFillTransparency( !rOut.IsFillColor() || rOut.GetFillColor().GetTransparency() == 255 );
bool bRet( false );
switch( rAct.GetType() )
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index eec2fa98768b..b94b6c20e1d6 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -89,7 +89,7 @@ bool VirtualDevice::AcquireGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics ? true : false;
+ return mpGraphics != nullptr;
}
void VirtualDevice::ReleaseGraphics( bool bRelease )
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index e692584c3768..3acb0c667a94 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -539,7 +539,7 @@ GLXFBConfig OpenGLHelper::GetPixmapFBConfig( Display* pDisplay, bool& bInverted
}
glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_Y_INVERTED_EXT, &nValue );
- bInverted = (nValue == True) ? true : false;
+ bInverted = nValue == True;
break;
}
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 35ef02d1498a..9f13a24f1442 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1263,7 +1263,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, sal_uInt16
void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
const Image& rImage, sal_uInt16 nStyle )
{
- bool bIsSizeValid = (rSize.getWidth() == 0 || rSize.getHeight() == 0) ? false : true;
+ bool bIsSizeValid = rSize.getWidth() != 0 && rSize.getHeight() != 0;
if( rImage.mpImplData && !ImplIsRecordLayout() )
{
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 882818fc0297..5818d11b57ae 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -127,7 +127,7 @@ static void ImplDrawBrdWinSymbolButton( OutputDevice* pDev,
pWin->SetFillColor( pDev->GetSettings().GetStyleSettings().GetWindowColor() );
pWin->SetLineColor();
pWin->DrawRect( rRect );
- pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) ? true : false,
+ pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) != 0,
true, false );
}
aTempRect = rRect;
@@ -1777,7 +1777,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent,
{
mpWindowImpl->mbOverlapWin = true;
mpWindowImpl->mbFrame = true;
- mbFrameBorder = (nOrgStyle & WB_NOBORDER) ? false : true;
+ mbFrameBorder = (nOrgStyle & WB_NOBORDER) == 0;
}
else
{
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index d32c86f3f07c..597e6627d1fb 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2551,7 +2551,7 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode())
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
- bDone = pMenuWin ? pMenuWin->HandleKeyEvent(rKEvent, bFromMenu) : false;
+ bDone = pMenuWin && pMenuWin->HandleKeyEvent(rKEvent, bFromMenu);
}
return bDone;
}
@@ -2682,7 +2682,7 @@ void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
- return pMenuWin ? pMenuWin->HandleMenuButtonEvent(i_nButtonId) : false;
+ return pMenuWin && pMenuWin->HandleMenuButtonEvent(i_nButtonId);
}
// bool PopupMenu::bAnyPopupInExecute = false;
@@ -2754,7 +2754,7 @@ void PopupMenu::ClosePopup(Menu* pMenu)
bool PopupMenu::IsInExecute()
{
- return GetActivePopupMenu() ? true : false;
+ return GetActivePopupMenu() != nullptr;
}
PopupMenu* PopupMenu::GetActivePopupMenu()
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index e4b1124af4da..19e709d43423 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -317,7 +317,7 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
Menu* pTest = pActivePopup;
sal_uLong nOldFlags = GetPopupModeFlags();
SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
- sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer ? false : true );
+ sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer == nullptr );
SetPopupModeFlags( nOldFlags );
// nRet != 0, wenn es waerend Activate() abgeschossen wurde...
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 86db81283a4f..c18e1d06adca 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -2433,8 +2433,8 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
if ( bSplit )
{
- bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? true : false;
- bool bPropGreater = (mnMouseModifier & KEY_MOD1) ? true : false;
+ bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) != 0;
+ bool bPropGreater = (mnMouseModifier & KEY_MOD1) != 0;
long nDelta = mnMSplitPos-mnMStartPos;
if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index ee29a8deabda..f20c0ece86dd 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -647,7 +647,7 @@ bool Window::IsTopWindow() const
uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0;
}
- return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? true : false;
+ return mpWindowImpl->mpWinData->mnIsTopWindow == 1;
}
vcl::Window* Window::FindWindow( const Point& rPos ) const
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 7cf7a23b0c76..34ad659b9ece 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -894,7 +894,7 @@ void ToolBox::ImplSetMinMaxFloatSize( ToolBox *pThis )
{
pWrapper->SetMinOutputSizePixel( aMinSize );
pWrapper->SetMaxOutputSizePixel( aMaxSize );
- pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) ? true : false );
+ pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) != 0 );
}
else
{
@@ -4476,7 +4476,7 @@ void ToolBox::SetStyle(WinBits nNewStyle)
if (!ImplIsFloatingMode())
{
bool bOldScroll = mbScroll;
- mbScroll = (mnWinStyle & WB_SCROLL) ? true : false;
+ mbScroll = (mnWinStyle & WB_SCROLL) != 0;
if (mbScroll != bOldScroll)
{
mbFormat = true;
@@ -4505,7 +4505,7 @@ void ToolBox::ToggleFloatingMode()
}
else
{
- mbScroll = (mnWinStyle & WB_SCROLL) ? true : false;
+ mbScroll = (mnWinStyle & WB_SCROLL) != 0;
if ( (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM) )
mbHorz = true;
else
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 2c9a9d0eda9e..80b2bf920075 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1731,7 +1731,7 @@ void ToolBox::SetMenuType( sal_uInt16 aType )
// the menu button may have to be moved into the decoration which changes the layout
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
if( pWrapper )
- pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) ? true : false );
+ pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) != 0 );
mbFormat = true;
ImplFormat();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6fdb764bf2b5..4a898eeac6b9 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -796,7 +796,7 @@ bool Window::AcquireGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics ? true : false;
+ return mpGraphics != nullptr;
}
void Window::ReleaseGraphics( bool bRelease )
@@ -1259,7 +1259,7 @@ ImplWinData* Window::ImplGetWinData() const
mpWindowImpl->mpWinData->mnTrackFlags = 0;
mpWindowImpl->mpWinData->mnIsTopWindow = (sal_uInt16) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
mpWindowImpl->mpWinData->mbMouseOver = false;
- mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? false : true; // true: try to draw this control with native theme API
+ mpWindowImpl->mpWinData->mbEnableNativeWidget = !(pNoNWF && *pNoNWF); // true: try to draw this control with native theme API
}
return mpWindowImpl->mpWinData;
@@ -2423,7 +2423,7 @@ void Window::Show( bool bVisible, sal_uInt16 nFlags )
mpWindowImpl->mbPaintFrame = true;
if (!Application::GetSettings().GetMiscSettings().GetPseudoHeadless())
{
- bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) ? true : false;
+ bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) != 0;
mpWindowImpl->mpFrame->Show( true, bNoActivate );
}
if( aDogTag.IsDead() )
@@ -2564,7 +2564,7 @@ void Window::Enable( bool bEnable, bool bChild )
void Window::SetCallHandlersOnInputDisabled( bool bCall )
{
- mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall ? true : false;
+ mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall;
vcl::Window* pChild = mpWindowImpl->mpFirstChild;
while ( pChild )
@@ -3752,7 +3752,7 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr
else
aArg[ 2 ] = makeAny( css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
- aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? true : false );
+ aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop );
aArg[ 4 ] = makeAny( Reference< css::awt::XWindow >(
const_cast<vcl::Window*>(this)->GetComponentInterface(),
UNO_QUERY ));
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index 1dfac0972c6d..427bd54cc049 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1347,7 +1347,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
}
if( (pFlavors - rTypes.getArray()) < rTypes.getLength() )
rTypes.realloc(pFlavors - rTypes.getArray());
- bSuccess = rTypes.getLength() ? true : false;
+ bSuccess = rTypes.hasElements();
if( bHaveText && ! bHaveUTF16 )
{
int i = 0;
@@ -2562,7 +2562,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
dsde.DragSource = static_cast< XDragSource* >( this );
dsde.UserAction = getUserDragAction();
dsde.DropAction = DNDConstants::ACTION_NONE;
- m_bDropSuccess = rMessage.xclient.data.l[1] & 1 ? true : false;
+ m_bDropSuccess = (rMessage.xclient.data.l[1] & 1) != 0;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "status drop action: accept = %s, %s\n",
m_bDropSuccess ? "true" : "false",
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 3c573ae00b43..c1de3696f5c4 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -356,7 +356,7 @@ bool PPDDecompressStream::IsOpen() const
bool PPDDecompressStream::IsEof() const
{
- return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream ? mpFileStream->IsEof() : true ) );
+ return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream == nullptr || mpFileStream->IsEof() ) );
}
OString PPDDecompressStream::ReadLine()
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index b39dd8e1d7b3..f93883a82b51 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1752,8 +1752,8 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
Maximize();
else
{
- bool bHorz = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_HORZ) ? true : false;
- bool bVert = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_VERT) ? true : false;
+ bool bHorz = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_HORZ) != 0;
+ bool bVert = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_VERT) != 0;
GetDisplay()->getWMAdaptor()->maximizeFrame( this, bHorz, bVert );
}
maRestorePosSize.Left() = pState->mnX;
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index f2ea9f2d9d06..97727a727d54 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -792,7 +792,7 @@ void GtkSalMenu::Display( bool bVisible )
bMenuVisibility = bVisible;
- bool bVCLMenuVisible = ( bVisible ) ? false : true;
+ bool bVCLMenuVisible = !bVisible;
MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
pMenuBar->SetDisplayable( bVCLMenuVisible );