diff options
author | Noel Grandin <noel@peralex.com> | 2014-04-30 11:46:15 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-02 08:49:22 +0200 |
commit | 7ae4102f171c5f0d452fa78c5c17722bc9649fc5 (patch) | |
tree | 40ff03aeaabe4adfdd90bdb82cb6ef6b80381795 /extensions/source/scanner | |
parent | 7d2cf383667106efe3e2ea6099fe52206b685c5d (diff) |
extensions: sal_Bool->bool
Change-Id: I1730f99c08690138e9aa7aba54304fd7bc51491d
Diffstat (limited to 'extensions/source/scanner')
-rw-r--r-- | extensions/source/scanner/grid.cxx | 2 | ||||
-rw-r--r-- | extensions/source/scanner/grid.hxx | 4 | ||||
-rw-r--r-- | extensions/source/scanner/sane.cxx | 124 | ||||
-rw-r--r-- | extensions/source/scanner/sane.hxx | 30 | ||||
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 91 | ||||
-rw-r--r-- | extensions/source/scanner/sanedlg.hxx | 12 | ||||
-rw-r--r-- | extensions/source/scanner/scanunx.cxx | 2 |
7 files changed, 132 insertions, 133 deletions
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 34e1f5e360c1..20ec7947b600 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -40,7 +40,7 @@ ResId SaneResId( sal_uInt32 ); -GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* pParent, sal_Bool bCutValues ) +GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* pParent, bool bCutValues ) : ModalDialog( pParent, SaneResId( GRID_DIALOG ) ), m_aGridArea( 50, 15, 100, 100 ), m_pXValues( pXValues ), diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx index 888ca3b3b99a..5f738f0f5298 100644 --- a/extensions/source/scanner/grid.hxx +++ b/extensions/source/scanner/grid.hxx @@ -77,7 +77,7 @@ class GridWindow : public ModalDialog sal_uInt16 m_BmOffX; sal_uInt16 m_BmOffY; - sal_Bool m_bCutValues; + bool m_bCutValues; // stuff for handles std::vector< impHandle > m_aHandles; @@ -117,7 +117,7 @@ class GridWindow : public ModalDialog virtual void MouseButtonUp( const MouseEvent& ) SAL_OVERRIDE; public: GridWindow( double* pXValues, double* pYValues, int nValues, - Window* pParent, sal_Bool bCutValues = sal_True ); + Window* pParent, bool bCutValues = true ); virtual ~GridWindow(); void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY ); diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index f89895c93d7d..9762d838492b 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -101,7 +101,7 @@ SANE_Status (*Sane::p_set_io_mode)( SANE_Handle, SANE_Bool ) = 0; SANE_Status (*Sane::p_get_select_fd)( SANE_Handle, SANE_Int* ) = 0; SANE_String_Const (*Sane::p_strstatus)( SANE_Status ) = 0; -static sal_Bool bSaneSymbolLoadFailed = sal_False; +static bool bSaneSymbolLoadFailed = false; inline oslGenericFunction Sane::LoadSymbol( const char* pSymbolname ) { @@ -110,7 +110,7 @@ inline oslGenericFunction Sane::LoadSymbol( const char* pSymbolname ) { fprintf( stderr, "Could not load symbol %s\n", pSymbolname ); - bSaneSymbolLoadFailed = sal_True; + bSaneSymbolLoadFailed = true; } return pFunction; } @@ -185,7 +185,7 @@ void Sane::Init() if( pSaneLib ) { - bSaneSymbolLoadFailed = sal_False; + bSaneSymbolLoadFailed = false; p_init = (SANE_Status(*)(SANE_Int*, SANE_Auth_Callback )) LoadSymbol( "sane_init" ); p_exit = (void(*)()) @@ -278,15 +278,15 @@ void Sane::ReloadOptions() mppOptions[ i ] = (SANE_Option_Descriptor*) p_get_option_descriptor( maHandle, i ); - CheckConsistency( NULL, sal_True ); + CheckConsistency( NULL, true ); maReloadOptionsLink.Call( this ); } -sal_Bool Sane::Open( const char* name ) +bool Sane::Open( const char* name ) { SANE_Status nStatus = p_open( (SANE_String_Const)name, &maHandle ); - FAIL_STATE( nStatus, "sane_open", sal_False ); + FAIL_STATE( nStatus, "sane_open", false ); ReloadOptions(); @@ -303,17 +303,17 @@ sal_Bool Sane::Open( const char* name ) } } - return sal_True; + return true; } -sal_Bool Sane::Open( int n ) +bool Sane::Open( int n ) { if( n >= 0 && n < nDevices ) { mnDevice = n; return Open( (char*)ppDevices[n]->name ); } - return sal_False; + return false; } void Sane::Close() @@ -340,47 +340,47 @@ int Sane::GetOptionByName( const char* rName ) return -1; } -sal_Bool Sane::GetOptionValue( int n, sal_Bool& rRet ) +bool Sane::GetOptionValue( int n, bool& rRet ) { if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL ) - return sal_False; + return false; SANE_Word nRet; SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, &nRet ); if( nStatus != SANE_STATUS_GOOD ) - return sal_False; + return false; rRet = nRet; - return sal_True; + return true; } -sal_Bool Sane::GetOptionValue( int n, OString& rRet ) +bool Sane::GetOptionValue( int n, OString& rRet ) { - sal_Bool bSuccess = sal_False; + bool bSuccess = false; if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) - return sal_False; + return false; boost::scoped_array<char> pRet(new char[mppOptions[n]->size+1]); SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet.get() ); if( nStatus == SANE_STATUS_GOOD ) { - bSuccess = sal_True; + bSuccess = true; rRet = pRet.get(); } return bSuccess; } -sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement ) +bool Sane::GetOptionValue( int n, double& rRet, int nElement ) { - sal_Bool bSuccess = sal_False; + bool bSuccess = false; if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return sal_False; + return false; boost::scoped_array<SANE_Word> pRet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet.get() ); if( nStatus == SANE_STATUS_GOOD ) { - bSuccess = sal_True; + bSuccess = true; if( mppOptions[n]->type == SANE_TYPE_INT ) rRet = (double)pRet[ nElement ]; else @@ -389,16 +389,16 @@ sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement ) return bSuccess; } -sal_Bool Sane::GetOptionValue( int n, double* pSet ) +bool Sane::GetOptionValue( int n, double* pSet ) { if( ! maHandle || ! ( mppOptions[n]->type == SANE_TYPE_FIXED || mppOptions[n]->type == SANE_TYPE_INT ) ) - return sal_False; + return false; boost::scoped_array<SANE_Word> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pFixedSet.get() ); if( nStatus != SANE_STATUS_GOOD ) - return sal_False; + return false; for( size_t i = 0; i <mppOptions[n]->size/sizeof(SANE_Word); i++ ) { if( mppOptions[n]->type == SANE_TYPE_FIXED ) @@ -406,38 +406,38 @@ sal_Bool Sane::GetOptionValue( int n, double* pSet ) else pSet[i] = (double) pFixedSet[i]; } - return sal_True; + return true; } -sal_Bool Sane::SetOptionValue( int n, sal_Bool bSet ) +bool Sane::SetOptionValue( int n, bool bSet ) { if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL ) - return sal_False; + return false; SANE_Word nRet = bSet ? SANE_TRUE : SANE_FALSE; SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nRet ); if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; + return false; + return true; } -sal_Bool Sane::SetOptionValue( int n, const OUString& rSet ) +bool Sane::SetOptionValue( int n, const OUString& rSet ) { if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) - return sal_False; + return false; OString aSet(OUStringToOString(rSet, osl_getThreadTextEncoding())); SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, (void*)aSet.getStr() ); if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; + return false; + return true; } -sal_Bool Sane::SetOptionValue( int n, double fSet, int nElement ) +bool Sane::SetOptionValue( int n, double fSet, int nElement ) { - sal_Bool bSuccess = sal_False; + bool bSuccess = false; if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return sal_False; + return false; SANE_Status nStatus; if( mppOptions[n]->size/sizeof(SANE_Word) > 1 ) @@ -459,16 +459,16 @@ sal_Bool Sane::SetOptionValue( int n, double fSet, int nElement ) nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo ); if( nStatus == SANE_STATUS_GOOD ) - bSuccess = sal_True; + bSuccess = true; } return bSuccess; } -sal_Bool Sane::SetOptionValue( int n, double* pSet ) +bool Sane::SetOptionValue( int n, double* pSet ) { if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return sal_False; + return false; boost::scoped_array<SANE_Word> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); for( size_t i = 0; i < mppOptions[n]->size/sizeof(SANE_Word); i++ ) { @@ -479,8 +479,8 @@ sal_Bool Sane::SetOptionValue( int n, double* pSet ) } SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet.get() ); if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; + return false; + return true; } enum FrameStyleType { @@ -519,7 +519,7 @@ static inline sal_uInt8 _ReadValue( FILE* fp, int depth ) return nByte; } -sal_Bool Sane::CheckConsistency( const char* pMes, sal_Bool bInit ) +bool Sane::CheckConsistency( const char* pMes, bool bInit ) { static const SANE_Option_Descriptor** pDescArray = NULL; static const SANE_Option_Descriptor* pZero = NULL; @@ -529,15 +529,15 @@ sal_Bool Sane::CheckConsistency( const char* pMes, sal_Bool bInit ) pDescArray = mppOptions; if( mppOptions ) pZero = mppOptions[0]; - return sal_True; + return true; } - sal_Bool bConsistent = sal_True; + bool bConsistent = true; if( pDescArray != mppOptions ) - bConsistent = sal_False; + bConsistent = false; if( pZero != mppOptions[0] ) - bConsistent = sal_False; + bConsistent = false; if( ! bConsistent ) dbg_msg( "Sane is not consistent. (%s)\n", pMes ); @@ -545,16 +545,16 @@ sal_Bool Sane::CheckConsistency( const char* pMes, sal_Bool bInit ) return bConsistent; } -sal_Bool Sane::Start( BitmapTransporter& rBitmap ) +bool Sane::Start( BitmapTransporter& rBitmap ) { int nStream = 0, nLine = 0, i = 0; SANE_Parameters aParams; FrameStyleType eType = FrameStyle_Gray; - sal_Bool bSuccess = sal_True; - sal_Bool bWidthSet = sal_False; + bool bSuccess = true; + bool bWidthSet = false; if( ! maHandle ) - return sal_False; + return false; int nWidthMM = 0; int nHeightMM = 0; @@ -627,7 +627,7 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap ) CheckConsistency( "sane_get_parameters" ); if (nStatus != SANE_STATUS_GOOD || aParams.bytes_per_line == 0) { - bSuccess = sal_False; + bSuccess = false; break; } #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL @@ -670,14 +670,14 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap ) fprintf( stderr, "Warning: unknown frame style !!!\n" ); } - sal_Bool bSynchronousRead = sal_True; + bool bSynchronousRead = true; // should be fail safe, but ... ?? nStatus = p_set_io_mode( maHandle, SANE_FALSE ); CheckConsistency( "sane_set_io_mode" ); if( nStatus != SANE_STATUS_GOOD ) { - bSynchronousRead = sal_False; + bSynchronousRead = false; nStatus = p_set_io_mode( maHandle, SANE_TRUE ); CheckConsistency( "sane_set_io_mode" ); #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL @@ -696,12 +696,12 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap ) DUMP_STATE( nStatus, "sane_get_select_fd" ); CheckConsistency( "sane_get_select_fd" ); if( nStatus != SANE_STATUS_GOOD ) - bSynchronousRead = sal_True; + bSynchronousRead = true; } FILE* pFrame = tmpfile(); if( ! pFrame ) { - bSuccess = sal_False; + bSuccess = false; break; } do { @@ -733,7 +733,7 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap ) if (nStatus != SANE_STATUS_EOF || !bSuccess) { fclose( pFrame ); - bSuccess = sal_False; + bSuccess = false; break; } @@ -759,7 +759,7 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap ) aConverter.Seek( 38 ); aConverter.WriteUInt32( (sal_uInt32)(1000*nWidth/nWidthMM) ); aConverter.WriteUInt32( (sal_uInt32)(1000*nHeight/nHeightMM) ); - bWidthSet = sal_True; + bWidthSet = true; } aConverter.Seek(60); @@ -866,7 +866,7 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap ) break; } else - bSuccess = sal_False; + bSuccess = false; } // get stream length aConverter.Seek( STREAM_SEEK_TO_END ); @@ -906,7 +906,7 @@ int Sane::GetRange( int n, double*& rpDouble ) rpDouble = 0; int nItems, i; - sal_Bool bIsFixed = mppOptions[n]->type == SANE_TYPE_FIXED ? sal_True : sal_False; + bool bIsFixed = mppOptions[n]->type == SANE_TYPE_FIXED ? sal_True : sal_False; dbg_msg( "Sane::GetRange of option %s ", mppOptions[n]->name ); if(mppOptions[n]->constraint_type == SANE_CONSTRAINT_RANGE ) @@ -984,12 +984,12 @@ OUString Sane::GetOptionUnitName( int n ) return aText; } -sal_Bool Sane::ActivateButtonOption( int n ) +bool Sane::ActivateButtonOption( int n ) { SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, NULL ); if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; + return false; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx index 475bceefcf1f..ba7cf2c47bef 100644 --- a/extensions/source/scanner/sane.hxx +++ b/extensions/source/scanner/sane.hxx @@ -105,15 +105,15 @@ private: SANE_Status ControlOption( int, SANE_Action, void* ); - sal_Bool CheckConsistency( const char*, sal_Bool bInit = sal_False ); + bool CheckConsistency( const char*, bool bInit = false ); public: Sane(); ~Sane(); - static sal_Bool IsSane() + static bool IsSane() { return pSaneLib ? sal_True : sal_False; } - sal_Bool IsOpen() + bool IsOpen() { return maHandle ? sal_True : sal_False; } static int CountDevices() { return nDevices; } @@ -145,28 +145,28 @@ public: inline int GetOptionElements( int n ); int GetOptionByName( const char* ); - sal_Bool GetOptionValue( int, sal_Bool& ); - sal_Bool GetOptionValue( int, OString& ); - sal_Bool GetOptionValue( int, double&, int nElement = 0 ); - sal_Bool GetOptionValue( int, double* ); + bool GetOptionValue( int, bool& ); + bool GetOptionValue( int, OString& ); + bool GetOptionValue( int, double&, int nElement = 0 ); + bool GetOptionValue( int, double* ); - sal_Bool SetOptionValue( int, sal_Bool ); - sal_Bool SetOptionValue( int, const OUString& ); - sal_Bool SetOptionValue( int, double, int nElement = 0 ); - sal_Bool SetOptionValue( int, double* ); + bool SetOptionValue( int, bool ); + bool SetOptionValue( int, const OUString& ); + bool SetOptionValue( int, double, int nElement = 0 ); + bool SetOptionValue( int, double* ); - sal_Bool ActivateButtonOption( int ); + bool ActivateButtonOption( int ); int CountOptions() { return mnOptions; } int GetDeviceNumber() { return mnDevice; } - sal_Bool Open( const char* ); - sal_Bool Open( int ); + bool Open( const char* ); + bool Open( int ); void Close(); void ReloadDevices(); void ReloadOptions(); - sal_Bool Start( BitmapTransporter& ); + bool Start( BitmapTransporter& ); inline Link SetReloadOptionsHdl( const Link& rLink ); }; diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 49608c43af8a..84e085685dbb 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -39,9 +39,9 @@ ResId SaneResId( sal_uInt32 nID ) SaneDlg::SaneDlg( Window* pParent, Sane& rSane, bool bScanEnabled ) : ModalDialog( pParent, SaneResId( RID_SANE_DIALOG ) ), mrSane( rSane ), - mbIsDragging( sal_False ), + mbIsDragging( false ), mbScanEnabled( bScanEnabled ), - mbDragDrawn( sal_False ), + mbDragDrawn( false ), meDragDirection( TopLeft ), maMapMode( MAP_APPFONT ), maOKButton( this, SaneResId( RID_SCAN_OK ) ), @@ -172,7 +172,7 @@ void SaneDlg::InitFields() int nOption, i, nValue; double fValue; - sal_Bool bSuccess = sal_False; + bool bSuccess = false; const char *ppSpecialOptions[] = { "resolution", "tl-x", @@ -182,7 +182,7 @@ void SaneDlg::InitFields() "preview" }; - mbDragEnable = sal_True; + mbDragEnable = true; maReslBox.Clear(); maMinTopLeft = Point( 0, 0 ); maMaxBottomRight = Point( PREVIEW_WIDTH, PREVIEW_HEIGHT ); @@ -270,7 +270,7 @@ void SaneDlg::InitFields() pField = &maBottomField; } nOption = pOptionName ? mrSane.GetOptionByName( pOptionName ) : -1; - bSuccess = sal_False; + bSuccess = false; if( nOption != -1 ) { bSuccess = mrSane.GetOptionValue( nOption, fValue, 0 ); @@ -326,7 +326,7 @@ void SaneDlg::InitFields() } else { - mbDragEnable = sal_False; + mbDragEnable = false; pField->SetMin( 0 ); switch( i ) { case 0: @@ -366,11 +366,11 @@ void SaneDlg::InitFields() // fill OptionBox maOptionBox.Clear(); SvTreeListEntry* pParentEntry = 0; - sal_Bool bGroupRejected = sal_False; + bool bGroupRejected = false; for( i = 1; i < mrSane.CountOptions(); i++ ) { OUString aOption=mrSane.GetOptionName( i ); - sal_Bool bInsertAdvanced = + bool bInsertAdvanced = mrSane.GetOptionCap( i ) & SANE_CAP_ADVANCED && ! maAdvancedBox.IsChecked() ? sal_False : sal_True; if( mrSane.GetOptionType( i ) == SANE_TYPE_GROUP ) @@ -379,10 +379,10 @@ void SaneDlg::InitFields() { aOption = mrSane.GetOptionTitle( i ); pParentEntry = maOptionBox.InsertEntry( aOption ); - bGroupRejected = sal_False; + bGroupRejected = false; } else - bGroupRejected = sal_True; + bGroupRejected = true; } else if( !aOption.isEmpty() && ! ( mrSane.GetOptionCap( i ) & @@ -392,12 +392,12 @@ void SaneDlg::InitFields() ) ) && bInsertAdvanced && ! bGroupRejected ) { - sal_Bool bIsSpecial = sal_False; + bool bIsSpecial = false; for( size_t n = 0; !bIsSpecial && n < SAL_N_ELEMENTS(ppSpecialOptions); n++ ) { if( aOption == OUString::createFromAscii(ppSpecialOptions[n]) ) - bIsSpecial=sal_True; + bIsSpecial=true; } if( ! bIsSpecial ) { @@ -429,8 +429,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton ) else if( pButton == &maBoolCheckBox ) { mrSane.SetOptionValue( mnCurrentOption, - maBoolCheckBox.IsChecked() ? - (sal_Bool)sal_True : (sal_Bool)sal_False ); + maBoolCheckBox.IsChecked() ); } else if( pButton == &maButtonOption ) { @@ -473,7 +472,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton ) { double fRes = (double)maReslBox.GetValue(); SetAdjustedNumericalValue( "resolution", fRes ); - UpdateScanArea( sal_True ); + UpdateScanArea( true ); SaveState(); EndDialog( mrSane.IsOpen() ? 1 : 0 ); doScan = (pButton == &maScanButton); @@ -704,7 +703,7 @@ void SaneDlg::AcquirePreview() if( ! mrSane.IsOpen() ) return; - UpdateScanArea( sal_True ); + UpdateScanArea( true ); // set small resolution for preview double fResl = (double)maReslBox.GetValue(); SetAdjustedNumericalValue( "resolution", 30.0 ); @@ -718,7 +717,7 @@ void SaneDlg::AcquirePreview() return; } else - mrSane.SetOptionValue( nOption, (sal_Bool)sal_True ); + mrSane.SetOptionValue( nOption, true ); BitmapTransporter aTransporter; if( ! mrSane.Start( aTransporter ) ) @@ -781,7 +780,7 @@ void SaneDlg::Paint( const Rectangle& rRect ) DrawBitmap( maPreviewRect.TopLeft(), maPreviewRect.GetSize(), maPreviewBitmap ); - mbDragDrawn = sal_False; + mbDragDrawn = false; DrawDrag(); ModalDialog::Paint( rRect ); @@ -802,7 +801,7 @@ void SaneDlg::DisableOption() void SaneDlg::EstablishBoolOption() { - sal_Bool bSuccess, bValue; + bool bSuccess, bValue; bSuccess = mrSane.GetOptionValue( mnCurrentOption, bValue ); if( bSuccess ) @@ -816,7 +815,7 @@ void SaneDlg::EstablishBoolOption() void SaneDlg::EstablishStringOption() { - sal_Bool bSuccess; + bool bSuccess; OString aValue; bSuccess = mrSane.GetOptionValue( mnCurrentOption, aValue ); @@ -887,7 +886,7 @@ void SaneDlg::EstablishQuantumRange() void SaneDlg::EstablishNumericOption() { - sal_Bool bSuccess; + bool bSuccess; double fValue; bSuccess = mrSane.GetOptionValue( mnCurrentOption, fValue ); @@ -959,7 +958,7 @@ void SaneDlg::MouseMove( const MouseEvent& rMEvt ) maBottomRight.Y() = nSwap; } DrawDrag(); - UpdateScanArea( sal_False ); + UpdateScanArea( false ); } ModalDialog::MouseMove( rMEvt ); } @@ -980,21 +979,21 @@ void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt ) { meDragDirection = TopLeft; aMousePixel = maTopLeft; - mbIsDragging = sal_True; + mbIsDragging = true; } else if( aMousePixel.X() >= nMiddleX && aMousePixel.X() < nMiddleX + RECT_SIZE_PIX ) { meDragDirection = Top; aMousePixel.Y() = maTopLeft.Y(); - mbIsDragging = sal_True; + mbIsDragging = true; } else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX && aMousePixel.X() <= maBottomRight.X() ) { meDragDirection = TopRight; aMousePixel = Point( maBottomRight.X(), maTopLeft.Y() ); - mbIsDragging = sal_True; + mbIsDragging = true; } } else if( aMousePixel.Y() >= nMiddleY && @@ -1005,14 +1004,14 @@ void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt ) { meDragDirection = Left; aMousePixel.X() = maTopLeft.X(); - mbIsDragging = sal_True; + mbIsDragging = true; } else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX && aMousePixel.X() <= maBottomRight.X() ) { meDragDirection = Right; aMousePixel.X() = maBottomRight.X(); - mbIsDragging = sal_True; + mbIsDragging = true; } } else if( aMousePixel.Y() <= maBottomRight.Y() && @@ -1023,21 +1022,21 @@ void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt ) { meDragDirection = BottomLeft; aMousePixel = Point( maTopLeft.X(), maBottomRight.Y() ); - mbIsDragging = sal_True; + mbIsDragging = true; } else if( aMousePixel.X() >= nMiddleX && aMousePixel.X() < nMiddleX + RECT_SIZE_PIX ) { meDragDirection = Bottom; aMousePixel.Y() = maBottomRight.Y(); - mbIsDragging = sal_True; + mbIsDragging = true; } else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX && aMousePixel.X() <= maBottomRight.X() ) { meDragDirection = BottomRight; aMousePixel = maBottomRight; - mbIsDragging = sal_True; + mbIsDragging = true; } } } @@ -1053,9 +1052,9 @@ void SaneDlg::MouseButtonUp( const MouseEvent& rMEvt ) { if( mbIsDragging ) { - UpdateScanArea( sal_True ); + UpdateScanArea( true ); } - mbIsDragging = sal_False; + mbIsDragging = false; ModalDialog::MouseButtonUp( rMEvt ); } @@ -1102,7 +1101,7 @@ void SaneDlg::DrawDrag() aLastBR = maBottomRight; DrawRectangles( maTopLeft, maBottomRight ); - mbDragDrawn = sal_True; + mbDragDrawn = true; SetRasterOp( eROP ); SetMapMode( maMapMode ); } @@ -1141,7 +1140,7 @@ Point SaneDlg::GetLogicPos( const Point& rIn ) return aConvert; } -void SaneDlg::UpdateScanArea( sal_Bool bSend ) +void SaneDlg::UpdateScanArea( bool bSend ) { if( ! mbDragEnable ) return; @@ -1166,25 +1165,25 @@ void SaneDlg::UpdateScanArea( sal_Bool bSend ) } } -sal_Bool SaneDlg::LoadState() +bool SaneDlg::LoadState() { int i; if( ! Sane::IsSane() ) - return sal_False; + return false; const char* pEnv = getenv("HOME"); OUString aFileName = pEnv ? OUString(pEnv, strlen(pEnv), osl_getThreadTextEncoding() ) : OUString(); aFileName += "/.so_sane_state"; Config aConfig( aFileName ); if( ! aConfig.HasGroup( "SANE" ) ) - return sal_False; + return false; aConfig.SetGroup( "SANE" ); OString aString = aConfig.ReadKey( "SO_LastSaneDevice" ); for( i = 0; i < Sane::CountDevices() && !aString.equals(OUStringToOString(Sane::GetName(i), osl_getThreadTextEncoding())); i++ ) ; if( i == Sane::CountDevices() ) - return sal_False; + return false; mrSane.Close(); mrSane.Open( aString.getStr() ); @@ -1206,7 +1205,7 @@ sal_Bool SaneDlg::LoadState() if (aValue.startsWith("BOOL=")) { aValue = aValue.copy(RTL_CONSTASCII_LENGTH("BOOL=")); - sal_Bool aBOOL = (sal_Bool)aValue.toInt32(); + bool aBOOL = aValue.toInt32() != 0; mrSane.SetOptionValue( nOption, aBOOL ); } else if (aValue.startsWith("STRING=")) @@ -1235,7 +1234,7 @@ sal_Bool SaneDlg::LoadState() DisableOption(); InitFields(); - return sal_True; + return true; } void SaneDlg::SaveState() @@ -1275,7 +1274,7 @@ void SaneDlg::SaveState() { case SANE_TYPE_BOOL: { - sal_Bool bValue; + bool bValue; if( mrSane.GetOptionValue( nOption, bValue ) ) { OStringBuffer aString("BOOL="); @@ -1323,24 +1322,24 @@ void SaneDlg::SaveState() } } -sal_Bool SaneDlg::SetAdjustedNumericalValue( +bool SaneDlg::SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement ) { int nOption; if( ! Sane::IsSane() || ! mrSane.IsOpen() || ( nOption = mrSane.GetOptionByName( pOption ) ) == -1 ) - return sal_False; + return false; if( nElement < 0 || nElement >= mrSane.GetOptionElements( nOption ) ) - return sal_False; + return false; double* pValues = NULL; int nValues; if( ( nValues = mrSane.GetRange( nOption, pValues ) ) < 0 ) { delete [] pValues; - return sal_False; + return false; } #if OSL_DEBUG_LEVEL > 1 @@ -1376,7 +1375,7 @@ sal_Bool SaneDlg::SetAdjustedNumericalValue( #endif - return sal_True; + return true; } bool SaneDlg::getDoScan() diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx index 4f2715364028..f91a260f1273 100644 --- a/extensions/source/scanner/sanedlg.hxx +++ b/extensions/source/scanner/sanedlg.hxx @@ -41,10 +41,10 @@ private: Rectangle maPreviewRect; Point maTopLeft, maBottomRight; Point maMinTopLeft, maMaxBottomRight; - sal_Bool mbDragEnable; - sal_Bool mbIsDragging; + bool mbDragEnable; + bool mbIsDragging; bool mbScanEnabled; - sal_Bool mbDragDrawn; + bool mbDragDrawn; DragDirection meDragDirection; MapMode maMapMode; @@ -107,7 +107,7 @@ private: DECL_LINK( OptionsBoxSelectHdl, SvTreeListBox* ); void SaveState(); - sal_Bool LoadState(); + bool LoadState(); void InitDevices(); void InitFields(); @@ -124,10 +124,10 @@ private: void DrawDrag(); Point GetPixelPos( const Point& ); Point GetLogicPos( const Point& ); - void UpdateScanArea( sal_Bool ); + void UpdateScanArea( bool ); // helper - sal_Bool SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement = 0 ); + bool SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement = 0 ); virtual void Paint( const Rectangle& ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index d8d421411bc0..d7b0d6ad138e 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -192,7 +192,7 @@ void ScannerThread::run() { int nOption = m_pHolder->m_aSane.GetOptionByName( "preview" ); if( nOption != -1 ) - m_pHolder->m_aSane.SetOptionValue( nOption, (sal_Bool)sal_False ); + m_pHolder->m_aSane.SetOptionValue( nOption, false ); m_pHolder->m_nError = m_pHolder->m_aSane.Start( *pTransporter ) ? |