summaryrefslogtreecommitdiff
path: root/extensions/source/scanner/sanedlg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/scanner/sanedlg.cxx')
-rw-r--r--extensions/source/scanner/sanedlg.cxx162
1 files changed, 81 insertions, 81 deletions
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 7b4b258ea43f..fc8119c07b4c 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -50,8 +50,8 @@ ResId SaneResId( sal_uInt32 nID )
SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) :
ModalDialog( pParent, SaneResId( RID_SANE_DIALOG ) ),
mrSane( rSane ),
- mbIsDragging( FALSE ),
- mbDragDrawn( FALSE ),
+ mbIsDragging( sal_False ),
+ mbDragDrawn( sal_False ),
maMapMode( MAP_APPFONT ),
maOKButton( this, SaneResId( RID_SCAN_OK ) ),
maCancelButton( this, SaneResId( RID_SCAN_CANCEL ) ),
@@ -141,7 +141,7 @@ short SaneDlg::Execute()
ErrorBox aErrorBox( NULL, WB_OK | WB_DEF_OK,
String( SaneResId( RID_SANE_NOSANELIB_TXT ) ) );
aErrorBox.Execute();
- return FALSE;
+ return sal_False;
}
LoadState();
return ModalDialog::Execute();
@@ -173,7 +173,7 @@ void SaneDlg::InitFields()
int nOption, i, nValue;
double fValue;
- BOOL bSuccess = FALSE;
+ sal_Bool bSuccess = sal_False;
const char *ppSpecialOptions[] = {
"resolution",
"tl-x",
@@ -183,7 +183,7 @@ void SaneDlg::InitFields()
"preview"
};
- mbDragEnable = TRUE;
+ mbDragEnable = sal_True;
maReslBox.Clear();
maMinTopLeft = Point( 0, 0 );
maMaxBottomRight = Point( PREVIEW_WIDTH, PREVIEW_HEIGHT );
@@ -200,7 +200,7 @@ void SaneDlg::InitFields()
bSuccess = mrSane.GetOptionValue( nOption, fRes );
if( bSuccess )
{
- maReslBox.Enable( TRUE );
+ maReslBox.Enable( sal_True );
maReslBox.SetValue( (long)fRes );
double *pDouble = NULL;
@@ -241,11 +241,11 @@ void SaneDlg::InitFields()
delete [] pDouble;
}
else
- maReslBox.Enable( FALSE );
+ maReslBox.Enable( sal_False );
}
}
else
- maReslBox.Enable( FALSE );
+ maReslBox.Enable( sal_False );
// set scan area
for( i = 0; i < 4; i++ )
@@ -271,7 +271,7 @@ void SaneDlg::InitFields()
pField = &maBottomField;
}
nOption = pOptionName ? mrSane.GetOptionByName( pOptionName ) : -1;
- bSuccess = FALSE;
+ bSuccess = sal_False;
if( nOption != -1 )
{
bSuccess = mrSane.GetOptionValue( nOption, fValue, 0 );
@@ -323,11 +323,11 @@ void SaneDlg::InitFields()
case 3: maMaxBottomRight.Y() = (int)fValue;break;
}
}
- pField->Enable( TRUE );
+ pField->Enable( sal_True );
}
else
{
- mbDragEnable = FALSE;
+ mbDragEnable = sal_False;
pField->SetMin( 0 );
switch( i ) {
case 0:
@@ -355,7 +355,7 @@ void SaneDlg::InitFields()
pField->SetValue( PREVIEW_HEIGHT );
break;
}
- pField->Enable( FALSE );
+ pField->Enable( sal_False );
}
}
maTopLeft = GetPixelPos( maTopLeft );
@@ -367,23 +367,23 @@ void SaneDlg::InitFields()
// fill OptionBox
maOptionBox.Clear();
SvLBoxEntry* pParentEntry = 0;
- BOOL bGroupRejected = FALSE;
+ sal_Bool bGroupRejected = sal_False;
for( i = 1; i < mrSane.CountOptions(); i++ )
{
String aOption=mrSane.GetOptionName( i );
- BOOL bInsertAdvanced =
+ sal_Bool bInsertAdvanced =
mrSane.GetOptionCap( i ) & SANE_CAP_ADVANCED &&
- ! maAdvancedBox.IsChecked() ? FALSE : TRUE;
+ ! maAdvancedBox.IsChecked() ? sal_False : sal_True;
if( mrSane.GetOptionType( i ) == SANE_TYPE_GROUP )
{
if( bInsertAdvanced )
{
aOption = mrSane.GetOptionTitle( i );
pParentEntry = maOptionBox.InsertEntry( aOption );
- bGroupRejected = FALSE;
+ bGroupRejected = sal_False;
}
else
- bGroupRejected = TRUE;
+ bGroupRejected = sal_True;
}
else if( aOption.Len() &&
! ( mrSane.GetOptionCap( i ) &
@@ -393,12 +393,12 @@ void SaneDlg::InitFields()
) ) &&
bInsertAdvanced && ! bGroupRejected )
{
- BOOL bIsSpecial = FALSE;
+ sal_Bool bIsSpecial = sal_False;
for( size_t n = 0; !bIsSpecial &&
n < sizeof(ppSpecialOptions)/sizeof(ppSpecialOptions[0]); n++ )
{
if( aOption.EqualsAscii( ppSpecialOptions[n] ) )
- bIsSpecial=TRUE;
+ bIsSpecial=sal_True;
}
if( ! bIsSpecial )
{
@@ -432,7 +432,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
{
mrSane.SetOptionValue( mnCurrentOption,
maBoolCheckBox.IsChecked() ?
- (BOOL)TRUE : (BOOL)FALSE );
+ (sal_Bool)sal_True : (sal_Bool)sal_False );
}
else if( pButton == &maButtonOption )
{
@@ -479,7 +479,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
double fRes = (double)maReslBox.GetValue();
SetAdjustedNumericalValue( "resolution", fRes );
mrSane.SetReloadOptionsHdl( maOldLink );
- UpdateScanArea( TRUE );
+ UpdateScanArea( sal_True );
SaveState();
EndDialog( mrSane.IsOpen() ? 1 : 0 );
}
@@ -567,8 +567,8 @@ IMPL_LINK( SaneDlg, OptionsBoxSelectHdl, SvTreeListBox*, pBox )
maVectorBox.SetMin( 1 );
maVectorBox.SetMax(
mrSane.GetOptionElements( mnCurrentOption ) );
- maVectorBox.Show( TRUE );
- maVectorTxt.Show( TRUE );
+ maVectorBox.Show( sal_True );
+ maVectorTxt.Show( sal_True );
}
else
{
@@ -623,7 +623,7 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit )
if( fRes > pDouble[ 1 ] )
fRes = pDouble[ 1 ];
}
- maReslBox.SetValue( (ULONG)fRes );
+ maReslBox.SetValue( (sal_uLong)fRes );
}
}
else if( pEdit == &maNumericEdit )
@@ -706,7 +706,7 @@ void SaneDlg::AcquirePreview()
if( ! mrSane.IsOpen() )
return;
- UpdateScanArea( TRUE );
+ UpdateScanArea( sal_True );
// set small resolution for preview
double fResl = (double)maReslBox.GetValue();
SetAdjustedNumericalValue( "resolution", 30.0 );
@@ -720,7 +720,7 @@ void SaneDlg::AcquirePreview()
return;
}
else
- mrSane.SetOptionValue( nOption, (BOOL)TRUE );
+ mrSane.SetOptionValue( nOption, (sal_Bool)sal_True );
BitmapTransporter aTransporter;
if( ! mrSane.Start( aTransporter ) )
@@ -736,11 +736,11 @@ void SaneDlg::AcquirePreview()
fprintf( stderr, "Previewbitmapstream contains %d bytes\n", (int)aTransporter.getStream().Tell() );
#endif
aTransporter.getStream().Seek( STREAM_SEEK_TO_BEGIN );
- maPreviewBitmap.Read( aTransporter.getStream(), TRUE );
+ maPreviewBitmap.Read( aTransporter.getStream(), sal_True );
}
SetAdjustedNumericalValue( "resolution", fResl );
- maReslBox.SetValue( (ULONG)fResl );
+ maReslBox.SetValue( (sal_uLong)fResl );
if( mbDragEnable )
maPreviewRect = Rectangle( maTopLeft,
@@ -781,7 +781,7 @@ void SaneDlg::Paint( const Rectangle& rRect )
DrawBitmap( maPreviewRect.TopLeft(), maPreviewRect.GetSize(),
maPreviewBitmap );
- mbDragDrawn = FALSE;
+ mbDragDrawn = sal_False;
DrawDrag();
ModalDialog::Paint( rRect );
@@ -789,43 +789,43 @@ void SaneDlg::Paint( const Rectangle& rRect )
void SaneDlg::DisableOption()
{
- maBoolCheckBox.Show( FALSE );
- maStringEdit.Show( FALSE );
- maNumericEdit.Show( FALSE );
- maQuantumRangeBox.Show( FALSE );
- maStringRangeBox.Show( FALSE );
- maButtonOption.Show( FALSE );
- maVectorBox.Show( FALSE );
- maVectorTxt.Show( FALSE );
- maOptionDescTxt.Show( FALSE );
+ maBoolCheckBox.Show( sal_False );
+ maStringEdit.Show( sal_False );
+ maNumericEdit.Show( sal_False );
+ maQuantumRangeBox.Show( sal_False );
+ maStringRangeBox.Show( sal_False );
+ maButtonOption.Show( sal_False );
+ maVectorBox.Show( sal_False );
+ maVectorTxt.Show( sal_False );
+ maOptionDescTxt.Show( sal_False );
}
void SaneDlg::EstablishBoolOption()
{
- BOOL bSuccess, bValue;
+ sal_Bool bSuccess, bValue;
bSuccess = mrSane.GetOptionValue( mnCurrentOption, bValue );
if( bSuccess )
{
maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
- maOptionDescTxt.Show( TRUE );
+ maOptionDescTxt.Show( sal_True );
maBoolCheckBox.Check( bValue );
- maBoolCheckBox.Show( TRUE );
+ maBoolCheckBox.Show( sal_True );
}
}
void SaneDlg::EstablishStringOption()
{
- BOOL bSuccess;
+ sal_Bool bSuccess;
ByteString aValue;
bSuccess = mrSane.GetOptionValue( mnCurrentOption, aValue );
if( bSuccess )
{
maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
- maOptionDescTxt.Show( TRUE );
+ maOptionDescTxt.Show( sal_True );
maStringEdit.SetText( String( aValue, osl_getThreadTextEncoding() ) );
- maStringEdit.Show( TRUE );
+ maStringEdit.Show( sal_True );
}
}
@@ -838,9 +838,9 @@ void SaneDlg::EstablishStringRange()
ByteString aValue;
mrSane.GetOptionValue( mnCurrentOption, aValue );
maStringRangeBox.SelectEntry( String( aValue, osl_getThreadTextEncoding() ) );
- maStringRangeBox.Show( TRUE );
+ maStringRangeBox.Show( sal_True );
maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
- maOptionDescTxt.Show( TRUE );
+ maOptionDescTxt.Show( sal_True );
}
void SaneDlg::EstablishQuantumRange()
@@ -876,18 +876,18 @@ void SaneDlg::EstablishQuantumRange()
sprintf( pBuf, "%g", fValue );
maQuantumRangeBox.SelectEntry( String( pBuf, osl_getThreadTextEncoding() ) );
}
- maQuantumRangeBox.Show( TRUE );
+ maQuantumRangeBox.Show( sal_True );
String aText( mrSane.GetOptionName( mnCurrentOption ) );
aText += ' ';
aText += mrSane.GetOptionUnitName( mnCurrentOption );
maOptionDescTxt.SetText( aText );
- maOptionDescTxt.Show( TRUE );
+ maOptionDescTxt.Show( sal_True );
}
}
void SaneDlg::EstablishNumericOption()
{
- BOOL bSuccess;
+ sal_Bool bSuccess;
double fValue;
bSuccess = mrSane.GetOptionValue( mnCurrentOption, fValue );
@@ -904,17 +904,17 @@ void SaneDlg::EstablishNumericOption()
aText += String( pBuf, osl_getThreadTextEncoding() );
}
maOptionDescTxt.SetText( aText );
- maOptionDescTxt.Show( TRUE );
+ maOptionDescTxt.Show( sal_True );
sprintf( pBuf, "%g", fValue );
maNumericEdit.SetText( String( pBuf, osl_getThreadTextEncoding() ) );
- maNumericEdit.Show( TRUE );
+ maNumericEdit.Show( sal_True );
}
void SaneDlg::EstablishButtonOption()
{
maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
- maOptionDescTxt.Show( TRUE );
- maButtonOption.Show( TRUE );
+ maOptionDescTxt.Show( sal_True );
+ maButtonOption.Show( sal_True );
}
#define RECT_SIZE_PIX 7
@@ -959,7 +959,7 @@ void SaneDlg::MouseMove( const MouseEvent& rMEvt )
maBottomRight.Y() = nSwap;
}
DrawDrag();
- UpdateScanArea( FALSE );
+ UpdateScanArea( sal_False );
}
ModalDialog::MouseMove( rMEvt );
}
@@ -980,21 +980,21 @@ void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt )
{
meDragDirection = TopLeft;
aMousePixel = maTopLeft;
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
else if( aMousePixel.X() >= nMiddleX &&
aMousePixel.X() < nMiddleX + RECT_SIZE_PIX )
{
meDragDirection = Top;
aMousePixel.Y() = maTopLeft.Y();
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX &&
aMousePixel.X() <= maBottomRight.X() )
{
meDragDirection = TopRight;
aMousePixel = Point( maBottomRight.X(), maTopLeft.Y() );
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
}
else if( aMousePixel.Y() >= nMiddleY &&
@@ -1005,14 +1005,14 @@ void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt )
{
meDragDirection = Left;
aMousePixel.X() = maTopLeft.X();
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX &&
aMousePixel.X() <= maBottomRight.X() )
{
meDragDirection = Right;
aMousePixel.X() = maBottomRight.X();
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
}
else if( aMousePixel.Y() <= maBottomRight.Y() &&
@@ -1023,21 +1023,21 @@ void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt )
{
meDragDirection = BottomLeft;
aMousePixel = Point( maTopLeft.X(), maBottomRight.Y() );
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
else if( aMousePixel.X() >= nMiddleX &&
aMousePixel.X() < nMiddleX + RECT_SIZE_PIX )
{
meDragDirection = Bottom;
aMousePixel.Y() = maBottomRight.Y();
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX &&
aMousePixel.X() <= maBottomRight.X() )
{
meDragDirection = BottomRight;
aMousePixel = maBottomRight;
- mbIsDragging = TRUE;
+ mbIsDragging = sal_True;
}
}
}
@@ -1053,9 +1053,9 @@ void SaneDlg::MouseButtonUp( const MouseEvent& rMEvt )
{
if( mbIsDragging )
{
- UpdateScanArea( TRUE );
+ UpdateScanArea( sal_True );
}
- mbIsDragging = FALSE;
+ mbIsDragging = sal_False;
ModalDialog::MouseButtonUp( rMEvt );
}
@@ -1102,7 +1102,7 @@ void SaneDlg::DrawDrag()
aLastBR = maBottomRight;
DrawRectangles( maTopLeft, maBottomRight );
- mbDragDrawn = TRUE;
+ mbDragDrawn = sal_True;
SetRasterOp( eROP );
SetMapMode( maMapMode );
}
@@ -1141,7 +1141,7 @@ Point SaneDlg::GetLogicPos( const Point& rIn )
return aConvert;
}
-void SaneDlg::UpdateScanArea( BOOL bSend )
+void SaneDlg::UpdateScanArea( sal_Bool bSend )
{
if( ! mbDragEnable )
return;
@@ -1166,26 +1166,26 @@ void SaneDlg::UpdateScanArea( BOOL bSend )
}
}
-BOOL SaneDlg::LoadState()
+sal_Bool SaneDlg::LoadState()
{
#ifdef USE_SAVE_STATE
int i;
if( ! Sane::IsSane() )
- return FALSE;
+ return sal_False;
const char* pEnv = getenv("HOME");
String aFileName( pEnv ? pEnv : "", osl_getThreadTextEncoding() );
aFileName += String( RTL_CONSTASCII_USTRINGPARAM( "/.so_sane_state" ) );
Config aConfig( aFileName );
if( ! aConfig.HasGroup( "SANE" ) )
- return FALSE;
+ return sal_False;
aConfig.SetGroup( "SANE" );
ByteString aString = aConfig.ReadKey( "SO_LastSaneDevice" );
for( i = 0; i < Sane::CountDevices() && ! aString.Equals( ByteString( Sane::GetName( i ), osl_getThreadTextEncoding() ) ); i++ ) ;
if( i == Sane::CountDevices() )
- return FALSE;
+ return sal_False;
mrSane.Close();
mrSane.Open( aString.GetBuffer() );
@@ -1206,7 +1206,7 @@ BOOL SaneDlg::LoadState()
if( aValue.CompareTo( "BOOL=", 5 ) == COMPARE_EQUAL )
{
aValue.Erase( 0, 5 );
- BOOL aBOOL = (BOOL)aValue.ToInt32();
+ sal_Bool aBOOL = (sal_Bool)aValue.ToInt32();
mrSane.SetOptionValue( nOption, aBOOL );
}
else if( aValue.CompareTo( "STRING=", 7 ) == COMPARE_EQUAL )
@@ -1233,9 +1233,9 @@ BOOL SaneDlg::LoadState()
DisableOption();
InitFields();
- return TRUE;
+ return sal_True;
#else
- return FALSE;
+ return sal_False;
#endif
}
@@ -1263,11 +1263,11 @@ void SaneDlg::SaveState()
{
case SANE_TYPE_BOOL:
{
- BOOL bValue;
+ sal_Bool bValue;
if( mrSane.GetOptionValue( i, bValue ) )
{
ByteString aString( "BOOL=" );
- aString += (ULONG)bValue;
+ aString += (sal_uLong)bValue;
aConfig.WriteKey( aOption, aString );
}
}
@@ -1327,7 +1327,7 @@ void SaneDlg::SaveState()
{
case SANE_TYPE_BOOL:
{
- BOOL bValue;
+ sal_Bool bValue;
if( mrSane.GetOptionValue( nOption, bValue ) )
{
ByteString aString( "BOOL=" );
@@ -1377,22 +1377,22 @@ void SaneDlg::SaveState()
#endif
}
-BOOL SaneDlg::SetAdjustedNumericalValue(
+sal_Bool SaneDlg::SetAdjustedNumericalValue(
const char* pOption,
double fValue,
int nElement )
{
int nOption;
if( ! Sane::IsSane() || ! mrSane.IsOpen() || ( nOption = mrSane.GetOptionByName( pOption ) ) == -1 )
- return FALSE;
+ return sal_False;
if( nElement < 0 || nElement >= mrSane.GetOptionElements( nOption ) )
- return FALSE;
+ return sal_False;
double* pValues = NULL;
int nValues;
if( ( nValues = mrSane.GetRange( nOption, pValues ) ) < 0 )
- return FALSE;
+ return sal_False;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "SaneDlg::SetAdjustedNumericalValue( \"%s\", %lg ) ",
@@ -1427,5 +1427,5 @@ BOOL SaneDlg::SetAdjustedNumericalValue(
#endif
- return TRUE;
+ return sal_True;
}