summaryrefslogtreecommitdiff
path: root/basic/source/app/app.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/app/app.cxx')
-rw-r--r--basic/source/app/app.cxx604
1 files changed, 267 insertions, 337 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index c7a613fbb4..97106afaf8 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -58,7 +58,6 @@
#include "runtime.hxx"
#include "sbintern.hxx"
-#ifdef _USE_UNO
#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/configurationkeys.hxx>
#include <comphelper/regpathhelper.hxx>
@@ -74,65 +73,65 @@
using namespace comphelper;
using namespace cppu;
-using namespace rtl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::beans;
-#endif /* _USE_UNO */
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
IMPL_GEN_RES_STR;
#ifdef DBG_UTIL
// filter Messages generated due to missing configuration Bug:#83887#
-void TestToolDebugMessageFilter( const sal_Char *pString, BOOL bIsOsl )
+void TestToolDebugMessageFilter( const sal_Char *pString, sal_Bool bIsOsl )
{
- static BOOL static_bInsideFilter = FALSE;
+ static sal_Bool static_bInsideFilter = sal_False;
// Ignore messages during filtering to avoid endless recursions
if ( static_bInsideFilter )
return;
- static_bInsideFilter = TRUE;
+ static_bInsideFilter = sal_True;
ByteString aMessage( pString );
- BOOL bIgnore = FALSE;
+ sal_Bool bIgnore = sal_False;
if ( bIsOsl )
{
// OSL
if ( aMessage.Search( CByteString("Cannot open Configuration: Connector: unknown delegatee com.sun.star.connection.Connector.portal") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
}
else
{
// DBG
#if ! (OSL_DEBUG_LEVEL > 1)
if ( aMessage.Search( CByteString("SelectAppIconPixmap") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
#endif
if ( aMessage.Search( CByteString("PropertySetRegistry::") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
if ( aMessage.Search( CByteString("property value missing") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
if ( aMessage.Search( CByteString("getDateFormatsImpl") ) != STRING_NOTFOUND
&& aMessage.Search( CByteString("no date formats") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
if ( aMessage.Search( CByteString("ucb::configureUcb(): Bad arguments") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
if ( aMessage.Search( CByteString("CreateInstance with arguments exception") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
if ( aMessage.Search( CByteString("AcquireTree failed") ) != STRING_NOTFOUND )
- bIgnore = TRUE;
+ bIgnore = sal_True;
}
if ( bIgnore )
{
- static_bInsideFilter = FALSE;
+ static_bInsideFilter = sal_False;
return;
}
@@ -154,25 +153,25 @@ void TestToolDebugMessageFilter( const sal_Char *pString, BOOL bIsOsl )
printf("DbgPrintMsgBox failed: %s\n", pString );
}
}
-/* DBG_INSTOUTERROR( DBG_OUT_MSGBOX )
- DBG_ERROR( pString );
- DBG_INSTOUTERROR( DBG_OUT_TESTTOOL )*/
- static_bInsideFilter = FALSE;
+ static_bInsideFilter = sal_False;
}
+
void SAL_CALL DBG_TestToolDebugMessageFilter( const sal_Char *pString )
{
- TestToolDebugMessageFilter( pString, FALSE );
+ TestToolDebugMessageFilter( pString, sal_False );
}
+
extern "C" void SAL_CALL osl_TestToolDebugMessageFilter( const sal_Char *pString )
{
if ( !getenv( "DISABLE_SAL_DBGBOX" ) )
- TestToolDebugMessageFilter( pString, TRUE );
+ TestToolDebugMessageFilter( pString, sal_True );
}
+
#endif
-// #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors
+// Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors
// this routine became necessary
-BOOL IsTTSignatureForUnicodeTextfile( String aLine )
+sal_Bool IsTTSignatureForUnicodeTextfile( String aLine )
{
aLine.SearchAndReplace( '\t', ' ' );
String ThreeBlanks = CUniString(" ");
@@ -202,38 +201,18 @@ uno::Reference< XContentProviderManager > InitializeUCB( void )
}
- //////////////////////////////////////////////////////////////////////
// set global factory
setProcessServiceFactory( xSMgr );
-/* // Create simple ConfigManager
- Sequence< Any > aConfArgs(3);
- aConfArgs[0] <<= PropertyValue( OUString::createFromAscii("servertype"), 0, makeAny( OUString::createFromAscii("local") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
- aConfArgs[1] <<= PropertyValue( OUString::createFromAscii("sourcepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
- aConfArgs[2] <<= PropertyValue( OUString::createFromAscii("updatepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
-
- uno::Reference< XContentProvider > xConfProvider
- ( xSMgr->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), aConfArgs), UNO_QUERY );
-*/
-
-
// Create unconfigured Ucb:
-/* Sequence< Any > aArgs(1);
- aArgs[1] = makeAny ( xConfProvider );*/
Sequence< Any > aArgs;
::ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
uno::Reference< XContentProviderManager > xUcb =
::ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
uno::Reference< XContentProvider > xFileProvider
- ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY );
- xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True );
-
-
-/* uno::Reference< XContentProvider > xPackageProvider
- ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.PackageContentProvider" ) ), UNO_QUERY );
- xUcb->registerContentProvider( xPackageProvider, OUString::createFromAscii( "vnd.sun.star.pkg" ), sal_True );
- */
+ ( xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.FileContentProvider" )) ), UNO_QUERY );
+ xUcb->registerContentProvider( xFileProvider, OUString(RTL_CONSTASCII_USTRINGPARAM( "file" )), sal_True );
return xUcb;
}
@@ -245,17 +224,10 @@ static void ReplaceStringHookProc( UniString& rStr )
if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND )
{
rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", aTestToolName );
- /*
- rStr.SearchAndReplaceAllAscii( "%PRODUCTVERSION", rVersion );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSION", rAboutBoxVersion );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTEXTENSION", rExtension );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATNAME", rXMLFileFormatName );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATVERSION", rXMLFileFormatVersion );
- */
}
}
-void BasicApp::Main( )
+int BasicApp::Main( )
{
#ifdef DBG_UTIL
// Install filter for OSLAsserts
@@ -264,7 +236,7 @@ void BasicApp::Main( )
DBG_INSTOUTERROR( DBG_OUT_TESTTOOL );
if ( osl_setDebugMessageFunc( osl_TestToolDebugMessageFilter ) )
- DBG_ERROR("osl_setDebugMessageFunc returns non NULL pointer");
+ OSL_FAIL("osl_setDebugMessageFunc returns non NULL pointer");
#endif
ResMgr::SetReadStringHook( ReplaceStringHookProc );
@@ -282,8 +254,8 @@ void BasicApp::Main( )
DirEntry aAppFileName( GetAppFileName() );
String aAppDir ( aAppFileName.GetPath().GetFull() );
-// DirEntry aDefIniPath( Config::GetConfigName( aAppDir, CUniString("testtool") ) );
-// Do not use Config::GetConfigName here because is uses a hidden file for UNIX
+ // Do not use Config::GetConfigName here because is uses a hidden
+ // file for UNIX
DirEntry aDefIniPath( aAppDir );
ByteString aFileName;
@@ -297,7 +269,7 @@ void BasicApp::Main( )
if ( aDefIniPath.Exists() )
{
aDefIniPath.CopyTo( aIniPath, FSYS_ACTION_COPYFILE );
- FileStat::SetReadOnlyFlag( aIniPath, FALSE );
+ FileStat::SetReadOnlyFlag( aIniPath, sal_False );
}
}
}
@@ -315,31 +287,12 @@ void BasicApp::Main( )
AllSettings aSettings = GetSettings();
aSettings.SetUILanguage( aRequestedLanguage );
aSettings.SetLanguage( aRequestedLanguage );
-// International aInternational;
-// aInternational = GetSettings().GetInternational();
-// aInternational = International( aRequestedLanguage );
-// aSettings.SetInternational( aInternational );
SetSettings( aSettings );
-// aInternational = GetSettings().GetInternational();
}
-// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt ), )
-//const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio )
-
-// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt )
-// ResMgr *pRes = new ResMgr( "testtool.res" );
-// Resource::SetResManager( pRes );
-
BasicDLL aBasicDLL;
nWait = 0;
- // Hilfe:
-// pHelp = new Help;
-// SetHelp( pHelp );
-// Help::EnableContextHelp();
-// Help::EnableExtHelp();
-// DeactivateExtHelp();
-
// Acceleratoren
Accelerator aAccel( SttResId( MAIN_ACCEL ) );
InsertAccel( &aAccel );
@@ -363,7 +316,6 @@ void BasicApp::Main( )
PostUserEvent( LINK( this, BasicApp, LateInit ) );
Execute();
-// delete pHelp;
delete pFrame;
RemoveAccel( pMainAccel );
@@ -383,6 +335,7 @@ void BasicApp::Main( )
InfoBox( NULL, String::CreateFromAscii( "unknown Exception not caught" ) ).Execute();
throw;
}
+ return EXIT_SUCCESS;
}
void BasicApp::LoadIniFile()
@@ -398,8 +351,8 @@ void BasicApp::SetFocus()
IMPL_LINK( BasicApp, LateInit, void *, pDummy )
{
- (void) pDummy; /* avoid warning about unused parameter */
- USHORT i;
+ (void) pDummy; /* avoid warning about unused parameter */
+ sal_uInt16 i;
for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
{
if ( Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("-run") == COMPARE_EQUAL
@@ -407,7 +360,7 @@ IMPL_LINK( BasicApp, LateInit, void *, pDummy )
|| Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("/run") == COMPARE_EQUAL
#endif
)
- pFrame->SetAutoRun( TRUE );
+ pFrame->SetAutoRun( sal_True );
else if ( Application::GetCommandLineParam( i ).Copy(0,7).CompareIgnoreCaseToAscii("-result") == COMPARE_EQUAL
#ifndef UNX
|| Application::GetCommandLineParam( i ).Copy(0,7).CompareIgnoreCaseToAscii("/result") == COMPARE_EQUAL
@@ -418,7 +371,7 @@ IMPL_LINK( BasicApp, LateInit, void *, pDummy )
{
if ( ByteString( Application::GetCommandLineParam( i+1 ), osl_getThreadTextEncoding() ).IsNumericAscii() )
{
- MsgEdit::SetMaxLogLen( sal::static_int_cast< USHORT >( Application::GetCommandLineParam( i+1 ).ToInt32() ) );
+ MsgEdit::SetMaxLogLen( sal::static_int_cast< sal_uInt16 >( Application::GetCommandLineParam( i+1 ).ToInt32() ) );
}
i++;
}
@@ -460,7 +413,6 @@ IMPL_LINK( BasicApp, LateInit, void *, pDummy )
return 0;
}
-//////////////////////////////////////////////////////////////////////////
class FloatingExecutionStatus : public FloatingWindow
{
@@ -490,7 +442,7 @@ FloatingExecutionStatus::FloatingExecutionStatus( Window * pParent )
void FloatingExecutionStatus::SetStatus( String aW )
{
- Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
ToTop( TOTOP_NOGRABFOCUS );
aAusblend.Start();
aStatus.SetText( aW );
@@ -498,7 +450,7 @@ void FloatingExecutionStatus::SetStatus( String aW )
void FloatingExecutionStatus::SetAdditionalInfo( String aF )
{
- Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
ToTop( TOTOP_NOGRABFOCUS );
aAusblend.Start();
aAdditionalInfo.SetText( aF );
@@ -506,22 +458,21 @@ void FloatingExecutionStatus::SetAdditionalInfo( String aF )
IMPL_LINK(FloatingExecutionStatus, HideNow, FloatingExecutionStatus*, pFLC )
{
- (void) pFLC; /* avoid warning about unused parameter */
+ (void) pFLC; /* avoid warning about unused parameter */
Hide();
return 0;
}
-//////////////////////////////////////////////////////////////////////////
TYPEINIT1(TTExecutionStatusHint, SfxSimpleHint);
BasicFrame::BasicFrame() : WorkWindow( NULL,
WinBits( WB_APP | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) )
-, bIsAutoRun( FALSE )
+, bIsAutoRun( sal_False )
, pDisplayHidDlg( NULL )
, pEditVar ( 0 )
-, bAutoReload( FALSE )
-, bAutoSave( TRUE )
+, bAutoReload( sal_False )
+, bAutoSave( sal_True )
, pBasic( NULL )
, pExecutionStatus( NULL )
, pStatus( NULL )
@@ -531,21 +482,18 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
{
Application::SetDefDialogParent( this );
- AlwaysEnableInput( TRUE );
+ AlwaysEnableInput( sal_True );
pBasic = TTBasic::CreateMyBasic(); // depending on what was linked to the executable
- bInBreak = FALSE;
- bDisas = FALSE;
+ bInBreak = sal_False;
+ bDisas = sal_False;
nFlags = 0;
-// Icon aAppIcon;
if ( pBasic->pTestObject ) // Are we the testtool?
{
-// aAppIcon = Icon( ResId( RID_APPICON2 ) );
aAppName = String( SttResId( IDS_APPNAME2 ) );
}
else
{
-// aAppIcon = Icon( ResId( RID_APPICON ) );
aAppName = String( SttResId( IDS_APPNAME ) );
}
@@ -618,7 +566,6 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
LoadIniFile();
UpdateTitle();
-// SetIcon( aAppIcon );
// Size: half width, 0.75 * height - 2 * IconSize
{
@@ -627,15 +574,10 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
SetWindowState( aConf.ReadKey("WinParams", "") );
}
-// pWork = new AppEdit( this, NULL );
-// pWork->Show();
-// pWork->Close();
-
aLineNum.SetTimeoutHdl( LINK( this, BasicFrame, ShowLineNr ) );
aLineNum.SetTimeout(200);
aLineNum.Start();
-
aCheckFiles.SetTimeout( 10000 );
aCheckFiles.SetTimeoutHdl( LINK( this, BasicFrame, CheckAllFiles ) );
aCheckFiles.Start();
@@ -646,11 +588,11 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
}
const ByteString ProfilePrefix("_profile_");
-const USHORT ProfilePrefixLen = ProfilePrefix.Len();
+const sal_uInt16 ProfilePrefixLen = ProfilePrefix.Len();
void BasicFrame::LoadIniFile()
{
- USHORT i;
+ sal_uInt16 i;
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
for ( i = 0 ; i < aConf.GetGroupCount() ; i++ )
@@ -681,17 +623,15 @@ void BasicFrame::LoadIniFile()
if ( pBasic )
pBasic->LoadIniFile();
- for ( i = 0 ; i < pList->Count() ; i++ )
- pList->GetObject( i )->LoadIniFile();
+ for ( i = 0 ; i < pList->size() ; i++ )
+ pList->at( i )->LoadIniFile();
}
BasicFrame::~BasicFrame()
{
- AppWin* p = pList->First();
- DBG_ASSERT( !p, "Still open FileWindows");
- if( p )
- while( (p = pList->Remove() ) != NULL )
- delete p;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ delete pList->at( i );
+ pList->clear();
MenuBar *pBar = GetMenuBar();
SetMenuBar( NULL );
@@ -700,12 +640,10 @@ BasicFrame::~BasicFrame()
delete pStatus;
delete pPrn;
delete pList;
-// delete pExecutionStatus;
-// delete pBasic;
pBasic.Clear();
}
-void BasicFrame::Command( const CommandEvent& rCEvt )
+void BasicFrame::Command( const CommandEvent& rCEvt )
{
switch( rCEvt.GetCommand() ) {
case COMMAND_SHOWDIALOG:
@@ -755,8 +693,8 @@ IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer )
{
AppWin* pStartWin = pWork;
Window* pFocusWin = Application::GetFocusWindow();
- for ( int i = pList->Count()-1 ; i >= 0 ; i-- )
- pList->GetObject( i )->CheckReload();
+ for ( size_t i = pList->size() ; i > 0 ; )
+ pList->at( --i )->CheckReload();
if ( pWork != pStartWin )
{
@@ -770,12 +708,12 @@ IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer )
return 0;
}
-BOOL BasicFrame::IsAutoRun()
+sal_Bool BasicFrame::IsAutoRun()
{
return bIsAutoRun;
}
-void BasicFrame::SetAutoRun( BOOL bAuto )
+void BasicFrame::SetAutoRun( sal_Bool bAuto )
{
bIsAutoRun = bAuto;
}
@@ -803,19 +741,10 @@ void BasicFrame::Notify( SfxBroadcaster&, const SfxHint& rHint )
aTotalStatus.AppendAscii( " " );
aTotalStatus.Append( pStatusHint->GetAdditionalExecutionStatus() );
pStatus->Message( aTotalStatus );
-/* if ( !pExecutionStatus )
- pExecutionStatus = new FloatingExecutionStatus( this );
- pExecutionStatus->SetStatus( pStatusHint->GetExecutionStatus() );
- pExecutionStatus->SetAdditionalInfo( pStatusHint->GetAdditionalExecutionStatus() );*/
}
break;
case TT_EXECUTION_HIDE_ACTION:
{
-/* if ( pExecutionStatus )
- {
- delete pExecutionStatus;
- pExecutionStatus = NULL;
- }*/
}
break;
}
@@ -842,14 +771,22 @@ void BasicFrame::Resize()
// Resize possibly maximized window
- ULONG i;
- for( i = pList->Count(); i > 0 ; i-- )
+ for( size_t i = pList->size(); i > 0 ; i-- )
{
- if ( pList->GetObject( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
- pList->GetObject( i-1 )->Maximize();
+ if ( pList->at( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
+ pList->at( i-1 )->Maximize();
}
}
+Rectangle BasicFrame::GetInnerRect() const
+{
+ Rectangle aRect( Point(0,0), GetOutputSizePixel() );
+ aRect.Bottom() = pStatus->GetPosPixel().Y()-1;
+ if( aRect.Bottom() < 0 ) // sanity check
+ aRect.Bottom() = 0;
+ return aRect;
+}
+
void BasicFrame::Move()
{
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
@@ -866,42 +803,58 @@ void BasicFrame::GetFocus()
IMPL_LINK( BasicFrame, CloseButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->GrabFocus();
- return Command( RID_FILECLOSE, FALSE );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->GrabFocus();
+ break;
+ }
+ }
+ return Command( RID_FILECLOSE, sal_False );
}
IMPL_LINK( BasicFrame, FloatButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ break;
+ }
+ }
return 1;
}
IMPL_LINK( BasicFrame, HideButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ break;
+ }
+ }
return 1;
}
void BasicFrame::WinShow_Hide()
{
- if ( !pList->Count() )
+ if ( pList->empty() )
return;
AppWin* p;
- BOOL bWasFullscreen = FALSE;
- for ( p = pList->Last() ; p ; p = pList->Prev() )
+ sal_Bool bWasFullscreen = sal_False;
+ for ( size_t i = pList->size(); i > 0; --i )
{
+ p = pList->at( i - 1 );
if ( p->pDataEdit )
{
if ( p->GetWinState() & TT_WIN_STATE_HIDE // Hidden
@@ -909,7 +862,7 @@ void BasicFrame::WinShow_Hide()
)
p->Hide( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
else
- p->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ p->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
}
bWasFullscreen |= p->GetWinState() == TT_WIN_STATE_MAX;
}
@@ -919,18 +872,27 @@ void BasicFrame::WinMax_Restore()
{
// The application buttons
AppWin* p;
- BOOL bHasFullscreenWin = FALSE;
- for( p = pList->First(); p && !bHasFullscreenWin ; p = pList->Next() )
- bHasFullscreenWin |= ( p->GetWinState() == TT_WIN_STATE_MAX );
- GetMenuBar()->ShowButtons( bHasFullscreenWin, FALSE, FALSE );
+ sal_Bool bHasFullscreenWin = sal_False;
+ for ( size_t i = 0, n = pList->size(); i < n && !bHasFullscreenWin; ++i )
+ {
+ p = pList->at( i );
+ bHasFullscreenWin = ( p->GetWinState() == TT_WIN_STATE_MAX );
+ }
+ GetMenuBar()->ShowButtons( bHasFullscreenWin, sal_False, sal_False );
WinShow_Hide();
}
void BasicFrame::RemoveWindow( AppWin *pWin )
{
-// delete pIcon;
- pList->Remove( pWin );
- pWork = pList->Last();
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pWork = ( pList->empty() ) ? NULL : pList->back();
WinShow_Hide();
@@ -940,10 +902,11 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
WinMax_Restore();
Menu* pMenu = GetMenuBar();
- if( pList->Count() == 0 ) {
- pMenu->EnableItem( RID_APPEDIT, FALSE );
- pMenu->EnableItem( RID_APPRUN, FALSE );
- pMenu->EnableItem( RID_APPWINDOW, FALSE );
+ if( pList->empty() )
+ {
+ pMenu->EnableItem( RID_APPEDIT, sal_False );
+ pMenu->EnableItem( RID_APPRUN, sal_False );
+ pMenu->EnableItem( RID_APPWINDOW, sal_False );
}
PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW );
@@ -959,28 +922,29 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
void BasicFrame::AddWindow( AppWin *pWin )
{
- pList->Insert( pWin, LIST_APPEND );
+ pList->push_back( pWin );
pWork = pWin;
WinMax_Restore();
// Enable main menu
MenuBar* pMenu = GetMenuBar();
- if( pList->Count() > 0 ) {
- pMenu->EnableItem( RID_APPEDIT, TRUE );
- pMenu->EnableItem( RID_APPRUN, TRUE );
- pMenu->EnableItem( RID_APPWINDOW, TRUE );
+ if( !pList->empty() )
+ {
+ pMenu->EnableItem( RID_APPEDIT, sal_True );
+ pMenu->EnableItem( RID_APPRUN, sal_True );
+ pMenu->EnableItem( RID_APPWINDOW, sal_True );
}
PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW );
- USHORT nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 );
+ sal_uInt16 nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 );
// Separator necessary
if ( nLastID < RID_WIN_FILE1 && pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) != MENUITEM_SEPARATOR )
pWinMenu->InsertSeparator();
// Find free ID
- USHORT nFreeID = RID_WIN_FILE1;
+ sal_uInt16 nFreeID = RID_WIN_FILE1;
while ( pWinMenu->GetItemPos( nFreeID ) != MENU_ITEM_NOTFOUND && nFreeID < RID_WIN_FILEn )
nFreeID++;
@@ -1004,9 +968,16 @@ void BasicFrame::WindowRenamed( AppWin *pWin )
void BasicFrame::FocusWindow( AppWin *pWin )
{
pWork = pWin;
- pList->Remove( pWin );
- pList->Insert( pWin, LIST_APPEND );
- pWin->Minimize( FALSE );
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pList->push_back( pWin );
+ pWin->Minimize( sal_False );
aAppFile = pWin->GetText();
UpdateTitle();
@@ -1015,14 +986,14 @@ void BasicFrame::FocusWindow( AppWin *pWin )
pStatus->LoadTaskToolBox();
}
-BOOL BasicFrame::Close()
+sal_Bool BasicFrame::Close()
{
if( bInBreak || Basic().IsRunning() )
if( RET_NO == QueryBox( this, SttResId( IDS_RUNNING ) ).Execute() )
- return FALSE;
+ return sal_False;
StarBASIC::Stop();
- bInBreak = FALSE;
+ bInBreak = sal_False;
if( CloseAll() )
{
aLineNum.Stop();
@@ -1036,30 +1007,33 @@ BOOL BasicFrame::Close()
Application::SetDefDialogParent( NULL );
WorkWindow::Close();
- return TRUE;
- } else return FALSE;
+ return sal_True;
+ } else return sal_False;
}
-BOOL BasicFrame::CloseAll()
+sal_Bool BasicFrame::CloseAll()
{
- while ( pList->Count() )
- if ( !pList->Last()->Close() )
- return FALSE;
- return TRUE;
+ while ( !pList->empty() )
+ if ( !pList->back()->Close() )
+ return sal_False;
+ return sal_True;
}
-BOOL BasicFrame::CompileAll()
+sal_Bool BasicFrame::CompileAll()
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
- if( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE;
- return TRUE;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ {
+ p = pList->at( i );
+ if ( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return sal_False;
+ }
+ return sal_True;
}
// Setup menu
#define MENU2FILENAME( Name ) Name.Copy( Name.SearchAscii(" ") +1).EraseAllChars( '~' )
#define LRUNr( nNr ) CByteString("LRU").Append( ByteString::CreateFromInt32( nNr ) )
-String FILENAME2MENU( USHORT nNr, String aName )
+String FILENAME2MENU( sal_uInt16 nNr, String aName )
{
String aRet;
if ( nNr <= 9 )
@@ -1078,9 +1052,9 @@ void BasicFrame::AddToLRU(String const& aFile)
PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE);
aConfig.SetGroup("LRU");
- USHORT nMaxLRU = (USHORT)aConfig.ReadKey("MaxLRU","4").ToInt32();
+ sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").ToInt32();
DirEntry aFileEntry( aFile );
- USHORT i,nLastMove = nMaxLRU;
+ sal_uInt16 i,nLastMove = nMaxLRU;
for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ )
{
@@ -1112,15 +1086,15 @@ void BasicFrame::LoadLRU()
{
Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE);
- BOOL bAddSep = TRUE;
+ sal_Bool bAddSep = sal_True;
aConfig.SetGroup("LRU");
- USHORT nMaxLRU = (USHORT)aConfig.ReadKey("MaxLRU","4").ToInt32();
+ sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").ToInt32();
if ( pPopup )
bAddSep = pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND;
- USHORT i;
+ sal_uInt16 i;
for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++)
{
String aFile = UniString( aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8 );
@@ -1130,7 +1104,7 @@ void BasicFrame::LoadLRU()
if (bAddSep)
{
pPopup->InsertSeparator();
- bAddSep = FALSE;
+ bAddSep = sal_False;
}
if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND )
@@ -1149,13 +1123,11 @@ void BasicFrame::LoadLRU()
IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
{
- BOOL bNormal = BOOL( !bInBreak );
+ sal_Bool bNormal = sal_Bool( !bInBreak );
pMenu->EnableItem( RID_RUNCOMPILE, bNormal );
- BOOL bHasEdit = BOOL( /*bNormal &&*/ pWork != NULL );
+ sal_Bool bHasEdit = sal_Bool( pWork != NULL );
-// pMenu->EnableItem( RID_FILENEW, bNormal ); // always possible
-// pMenu->EnableItem( RID_FILEOPEN, bNormal );
pMenu->EnableItem( RID_FILECLOSE, bHasEdit );
pMenu->EnableItem( RID_FILESAVE, bHasEdit );
pMenu->EnableItem( RID_FILESAVEAS, bHasEdit );
@@ -1164,44 +1136,31 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
pMenu->EnableItem( RID_FILELOADLIB, bNormal );
pMenu->EnableItem( RID_FILESAVELIB, bHasEdit );
- BOOL bHasErr = BOOL( bNormal && pBasic->GetErrors() != 0 );
- BOOL bNext = bHasErr & bNormal;
- BOOL bPrev = bHasErr & bNormal;
- if( bHasErr )
+ sal_Bool bHasErr = sal_Bool( bNormal && pBasic->GetErrors() != 0 );
+ sal_Bool bNext = bHasErr & bNormal;
+ sal_Bool bPrev = bHasErr & bNormal;
+ if( bHasErr )
{
- ULONG n = pBasic->aErrors.GetCurPos();
+ size_t n = pBasic->GetCurrentError();
if( n == 0 )
- bPrev = FALSE;
- if( USHORT(n+1) == pBasic->GetErrors() )
- bNext = FALSE;
+ bPrev = sal_False;
+ if( SbError(n+1) == pBasic->GetErrors() )
+ bNext = sal_False;
}
pMenu->EnableItem( RID_RUNNEXTERR, bNext );
pMenu->EnableItem( RID_RUNPREVERR, bPrev );
pMenu->CheckItem( RID_RUNDISAS, bDisas );
- if( pWork )
+ if( pWork )
pWork->InitMenu( pMenu );
- return TRUE;
+ return sal_True;
}
IMPL_LINK_INLINE_START( BasicFrame, DeInitMenu, Menu *, pMenu )
{
- (void) pMenu; /* avoid warning about unused parameter */
-/* pMenu->EnableItem( RID_RUNCOMPILE );
-
- pMenu->EnableItem( RID_FILECLOSE );
- pMenu->EnableItem( RID_FILESAVE );
- pMenu->EnableItem( RID_FILESAVEAS );
- pMenu->EnableItem( RID_FILEPRINT );
- pMenu->EnableItem( RID_FILESETUP );
- pMenu->EnableItem( RID_FILELOADLIB );
- pMenu->EnableItem( RID_FILESAVELIB );
-
- pMenu->EnableItem( RID_RUNNEXTERR );
- pMenu->EnableItem( RID_RUNPREVERR );
- if( pWork ) pWork->DeInitMenu( pMenu );
-*/
- SetAutoRun( FALSE );
+ (void) pMenu; /* avoid warning about unused parameter */
+
+ SetAutoRun( sal_False );
String aString;
pStatus->Message( aString );
return 0L;
@@ -1218,22 +1177,22 @@ IMPL_LINK_INLINE_END( BasicFrame, HighlightMenu, Menu *, pMenu )
IMPL_LINK_INLINE_START( BasicFrame, MenuCommand, Menu *, pMenu )
{
- USHORT nId = pMenu->GetCurItemId();
- BOOL bChecked = pMenu->IsItemChecked( nId );
+ sal_uInt16 nId = pMenu->GetCurItemId();
+ sal_Bool bChecked = pMenu->IsItemChecked( nId );
return Command( nId, bChecked );
}
IMPL_LINK_INLINE_END( BasicFrame, MenuCommand, Menu *, pMenu )
IMPL_LINK_INLINE_START( BasicFrame, Accel, Accelerator*, pAcc )
{
- SetAutoRun( FALSE );
+ SetAutoRun( sal_False );
return Command( pAcc->GetCurItemId() );
}
IMPL_LINK_INLINE_END( BasicFrame, Accel, Accelerator*, pAcc )
IMPL_LINK_INLINE_START( BasicFrame, ShowLineNr, AutoTimer *, pTimer )
{
- (void) pTimer; /* avoid warning about unused parameter */
+ (void) pTimer; /* avoid warning about unused parameter */
String aPos;
if ( pWork && pWork->ISA(AppBasEd))
{
@@ -1291,14 +1250,14 @@ AppBasEd* BasicFrame::CreateModuleWin( SbModule* pMod )
return p;
}
-BOOL BasicFrame::LoadFile( String aFilename )
+sal_Bool BasicFrame::LoadFile( String aFilename )
{
- BOOL bIsResult = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("RES") == COMPARE_EQUAL;
- BOOL bIsBasic = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("BAS") == COMPARE_EQUAL;
+ sal_Bool bIsResult = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("RES") == COMPARE_EQUAL;
+ sal_Bool bIsBasic = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("BAS") == COMPARE_EQUAL;
bIsBasic |= DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("INC") == COMPARE_EQUAL;
AppWin* p;
- BOOL bSuccess = TRUE;
+ sal_Bool bSuccess = sal_True;
if ( bIsResult )
{
p = new AppError( this, aFilename );
@@ -1325,7 +1284,7 @@ BOOL BasicFrame::LoadFile( String aFilename )
}
// Execute command
-long BasicFrame::Command( short nID, BOOL bChecked )
+long BasicFrame::Command( short nID, sal_Bool bChecked )
{
BasicError* pErr;
@@ -1334,15 +1293,13 @@ long BasicFrame::Command( short nID, BOOL bChecked )
AppBasEd* p = new AppBasEd( this, NULL );
p->Show();
p->GrabFocus();
- // InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
} break;
case RID_FILEOPEN:
{
String s;
- if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, FALSE ) ) {
+ if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, sal_False ) ) {
AddToLRU( s );
LoadFile( s );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
} break;
case RID_FILELOADLIB:
@@ -1353,7 +1310,6 @@ long BasicFrame::Command( short nID, BOOL bChecked )
break;
case RID_FILECLOSE:
if( pWork && pWork->Close() ){};
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
break;
case RID_FILEPRINT:
if( pWork )
@@ -1380,7 +1336,7 @@ long BasicFrame::Command( short nID, BOOL bChecked )
{
SbModule *pModule = ((AppBasEd*)pWork)->GetModule();
#if OSL_DEBUG_LEVEL > 1
- USHORT x;
+ sal_uInt16 x;
x = pWork->GetLineNr();
x = ((AppBasEd*)pWork)->GetModule()->GetBPCount();
if ( !x )
@@ -1388,7 +1344,7 @@ long BasicFrame::Command( short nID, BOOL bChecked )
x = pModule->GetBPCount();
#endif
- for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ )
+ for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ )
{
SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod );
DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
@@ -1398,7 +1354,6 @@ long BasicFrame::Command( short nID, BOOL bChecked )
nFlags = SbDEBUG_BREAK;
goto start;
start: {
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
if ( !Basic().IsRunning() || bInBreak )
{
AppBasEd* p = NULL;
@@ -1410,7 +1365,14 @@ long BasicFrame::Command( short nID, BOOL bChecked )
else
{
AppWin *w = NULL;
- for ( w = pList->Last() ; w ? !w->ISA(AppBasEd) : FALSE ; w = pList->Prev() ) ;
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ if ( pList->at( i-1 )->ISA( AppBasEd ) )
+ {
+ w = pList->at( i-1 );
+ break;
+ }
+ }
if ( w )
{
p = ((AppBasEd*)w);
@@ -1423,7 +1385,7 @@ long BasicFrame::Command( short nID, BOOL bChecked )
if( bInBreak )
// Reset the flag
- bInBreak = FALSE;
+ bInBreak = sal_False;
else
{
if( IsAutoSave() && !SaveAll() ) break;
@@ -1432,16 +1394,14 @@ long BasicFrame::Command( short nID, BOOL bChecked )
pStatus->Message( aString );
if( p )
{
- BasicDLL::SetDebugMode( TRUE );
+ BasicDLL::SetDebugMode( sal_True );
Basic().ClearGlobalVars();
p->Run();
- BasicDLL::SetDebugMode( FALSE );
+ BasicDLL::SetDebugMode( sal_False );
// If cancelled during Interactive=FALSE
-// BasicDLL::EnableBreak( TRUE );
}
}}
}
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // after run
break;
case RID_RUNCOMPILE:
if( pWork && pWork->ISA(AppBasEd) && SaveAll() )
@@ -1452,25 +1412,24 @@ long BasicFrame::Command( short nID, BOOL bChecked )
}
break;
case RID_RUNDISAS:
- bDisas = BOOL( !bChecked );
+ bDisas = sal_Bool( !bChecked );
break;
case RID_RUNBREAK:
if ( Basic().IsRunning() && !bInBreak )
{
-// pINST->CalcBreakCallLevel(SbDEBUG_STEPINTO);
pINST->nBreakCallLvl = pINST->nCallLvl;
}
break;
case RID_RUNSTOP:
Basic().Stop();
- bInBreak = FALSE;
+ bInBreak = sal_False;
break;
case RID_RUNNEXTERR:
- pErr = pBasic->aErrors.Next();
+ pErr = pBasic->NextError();
if( pErr ) pErr->Show();
break;
case RID_RUNPREVERR:
- pErr = pBasic->aErrors.Prev();
+ pErr = pBasic->PrevError();
if( pErr ) pErr->Show();
break;
@@ -1487,13 +1446,12 @@ long BasicFrame::Command( short nID, BOOL bChecked )
case RID_WINTILE:
{
WindowArrange aArange;
- for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
-
sal_Int32 nTitleHeight;
{
sal_Int32 nDummy1, nDummy2, nDummy3;
@@ -1511,10 +1469,10 @@ long BasicFrame::Command( short nID, BOOL bChecked )
case RID_WINTILEHORZ:
{
WindowArrange aArange;
- for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
@@ -1533,16 +1491,12 @@ long BasicFrame::Command( short nID, BOOL bChecked )
}
break;
case RID_WINTILEVERT:
-//#define WINDOWARRANGE_TILE 1
-//#define WINDOWARRANGE_HORZ 2
-//#define WINDOWARRANGE_VERT 3
-//#define WINDOWARRANGE_CASCADE 4
{
WindowArrange aArange;
- for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
@@ -1562,26 +1516,14 @@ long BasicFrame::Command( short nID, BOOL bChecked )
break;
case RID_WINCASCADE:
{
- for ( USHORT i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- pList->GetObject( i )->Cascade( i );
+ pList->at( i )->Cascade( i );
}
}
break;
-/* case RID_HELPTOPIC:
- if( pWork ) pWork->Help();
- break;
- case RID_HELPKEYS:
- aBasicApp.pHelp->Start( CUniString( "Keyboard" ) );
- break;
- case RID_HELPINDEX:
- aBasicApp.pHelp->Start( OOO_HELP_INDEX );
- break;
- case RID_HELPINTRO:
- aBasicApp.pHelp->Start( OOO_HELP_HELPONHELP );
- break;
-*/ case RID_HELPABOUT:
+ case RID_HELPABOUT:
{
SttResId aResId( IDD_ABOUT_DIALOG );
if ( Basic().pTestObject ) // Are we TestTool?
@@ -1614,32 +1556,30 @@ long BasicFrame::Command( short nID, BOOL bChecked )
AddToLRU( s );
LoadFile( s );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
else
{
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
if( pWork )
pWork->Command( CommandEvent( Point(), nID ) );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
}
}
- return TRUE;
+ return sal_True;
}
-BOOL BasicFrame::SaveAll()
+sal_Bool BasicFrame::SaveAll()
{
AppWin* p, *q = pWork;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- USHORT nRes = p->QuerySave( QUERY_DISK_CHANGED );
+ p = pList->at( i );
+ sal_uInt16 nRes = p->QuerySave( QUERY_DISK_CHANGED );
if( (( nRes == SAVE_RES_ERROR ) && QueryBox(this,SttResId(IDS_ASKSAVEERROR)).Execute() == RET_NO )
|| ( nRes == SAVE_RES_CANCEL ) )
- return FALSE;
+ return sal_False;
}
if ( q )
q->ToTop();
- return TRUE;
+ return sal_True;
}
IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename )
@@ -1650,8 +1590,9 @@ IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename )
AppBasEd* BasicFrame::FindModuleWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->ISA(AppBasEd) && ((AppBasEd*)p)->GetModName() == rName )
return ((AppBasEd*)p);
}
@@ -1661,8 +1602,9 @@ AppBasEd* BasicFrame::FindModuleWin( const String& rName )
AppError* BasicFrame::FindErrorWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->ISA(AppError) && ((AppError*)p)->GetText() == rName )
return ((AppError*)p);
}
@@ -1672,19 +1614,21 @@ AppError* BasicFrame::FindErrorWin( const String& rName )
AppWin* BasicFrame::FindWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->GetText() == rName )
return p;
}
return NULL;
}
-AppWin* BasicFrame::FindWin( USHORT nWinId )
+AppWin* BasicFrame::FindWin( sal_uInt16 nWinId )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->GetWinId() == nWinId )
return p;
}
@@ -1694,8 +1638,9 @@ AppWin* BasicFrame::FindWin( USHORT nWinId )
AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p == pMaybeWin )
return p;
}
@@ -1704,13 +1649,13 @@ AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
IMPL_LINK( BasicFrame, WriteString, String*, pString )
{
- if ( pList->Last() )
+ if ( !pList->empty() )
{
- pList->Last()->pDataEdit->ReplaceSelected( *pString );
- return TRUE;
+ pList->back()->pDataEdit->ReplaceSelected( *pString );
+ return sal_True;
}
else
- return FALSE;
+ return sal_False;
}
class NewFileDialog : public FileDialog
@@ -1733,7 +1678,7 @@ void NewFileDialog::FilterSelect()
return; // User decides after he has changed the path
String aCurFilter = GetCurFilter();
- USHORT nFilterNr = 0;
+ sal_uInt16 nFilterNr = 0;
while ( nFilterNr < GetFilterCount() && aCurFilter != GetFilterName( nFilterNr ) )
{
nFilterNr++;
@@ -1746,13 +1691,11 @@ void NewFileDialog::FilterSelect()
aConf.SetGroup( aCurrentProfile );
aLastPath = UniString( aConf.ReadKey( aFilterType, aConf.ReadKey( "BaseDir" ) ), RTL_TEXTENCODING_UTF8 );
SetPath( aLastPath );
-// if ( IsInExecute() )
-// SetPath( "" );
}
short NewFileDialog::Execute()
{
- BOOL bRet = (BOOL)FileDialog::Execute();
+ sal_Bool bRet = (sal_Bool)FileDialog::Execute();
if ( bRet )
{
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
@@ -1765,8 +1708,8 @@ short NewFileDialog::Execute()
return bRet;
}
-BOOL BasicFrame::QueryFileName
- (String& rName, FileType nFileType, BOOL bSave )
+sal_Bool BasicFrame::QueryFileName
+ (String& rName, FileType nFileType, sal_Bool bSave )
{
NewFileDialog aDlg( this, bSave ? WinBits( WB_SAVEAS ) :
WinBits( WB_OPEN ) );
@@ -1806,42 +1749,34 @@ BOOL BasicFrame::QueryFileName
aDlg.SetCurFilter( String( SttResId( IDS_BASFILTER ) ) );
aDlg.FilterSelect(); // Selects the last used path
-// if ( bSave )
if ( rName.Len() > 0 )
aDlg.SetPath( rName );
if( aDlg.Execute() )
{
rName = aDlg.GetPath();
-/* rExtension = aDlg.GetCurrentFilter();
- var i:integer;
- for ( i = 0 ; i < aDlg.GetFilterCount() ; i++ )
- if ( rExtension == aDlg.GetFilterName( i ) )
- rExtension = aDlg.GetFilterType( i );
-*/
- return TRUE;
- } else return FALSE;
-}
-
-USHORT BasicFrame::BreakHandler()
-{
- bInBreak = TRUE;
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
-// MenuBar aBar( ResId( RID_APPMENUBAR ) );
-// aBar.EnableItem( RID_APPEDIT, FALSE );
+ return sal_True;
+ } else return sal_False;
+}
+
+sal_uInt16 BasicFrame::BreakHandler()
+{
+ bInBreak = sal_True;
SetAppMode( String( SttResId ( IDS_APPMODE_BREAK ) ) );
- while( bInBreak )
+
+ while( bInBreak ) {
GetpApp()->Yield();
+ }
+
SetAppMode( String( SttResId ( IDS_APPMODE_RUN ) ) );
-// aBar.EnableItem( RID_APPEDIT, TRUE );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+
return nFlags;
}
void BasicFrame::LoadLibrary()
{
String s;
- if( QueryFileName( s, FT_BASIC_LIBRARY, FALSE ) )
+ if( QueryFileName( s, FT_BASIC_LIBRARY, sal_False ) )
{
CloseAll();
SvFileStream aStrm( s, STREAM_STD_READ );
@@ -1851,7 +1786,7 @@ void BasicFrame::LoadLibrary()
pBasic = pNew;
// Show all contents if existing
SbxArray* pMods = pBasic->GetModules();
- for( USHORT i = 0; i < pMods->Count(); i++ )
+ for( sal_uInt16 i = 0; i < pMods->Count(); i++ )
{
SbModule* pMod = (SbModule*) pMods->Get( i );
AppWin* p = new AppBasEd( this, pMod );
@@ -1869,7 +1804,7 @@ void BasicFrame::LoadLibrary()
void BasicFrame::SaveLibrary()
{
String s;
- if( QueryFileName( s, FT_BASIC_LIBRARY, TRUE ) )
+ if( QueryFileName( s, FT_BASIC_LIBRARY, sal_True ) )
{
SvFileStream aStrm( s, STREAM_STD_WRITE );
if( !Basic().Store( aStrm ) )
@@ -1883,8 +1818,8 @@ String BasicFrame::GenRealString( const String &aResString )
String aType,aValue,aResult(aResString);
String aString;
xub_StrLen nInsertPos = 0;
- BOOL bFound;
- bFound = FALSE;
+ sal_Bool bFound;
+ bFound = sal_False;
while ( (nStart = aResult.Search(StartKenn,nStartPos)) != STRING_NOTFOUND &&
(nGleich = aResult.SearchAscii("=",nStart+StartKenn.Len())) != STRING_NOTFOUND &&
@@ -1903,22 +1838,17 @@ String BasicFrame::GenRealString( const String &aResString )
nEnd = nEnd + aString.Len();
aString.Erase();
}
-// if ( Resource::GetResManager()->IsAvailable( ResId( aValue ) ) )
- aString = String( SttResId( (USHORT)(aValue.ToInt32()) ) );
-// else
- {
-// DBG_ERROR( "Could not load resource!" );
-// return aResString;
- }
+
+ aString = String( SttResId( (sal_uInt16)(aValue.ToInt32()) ) );
nInsertPos = nStart;
nStartPos = nStart;
aResult.Erase( nStart, nEnd-nStart+1 );
- bFound = TRUE;
+ bFound = sal_True;
}
else if ( aType.Search(BaseArgKenn) == 0 ) // Starts with BaseArgKenn
{
// TODO: What the hell is that for??
- USHORT nArgNr = USHORT( aType.Copy( BaseArgKenn.Len() ).ToInt32() );
+ sal_uInt16 nArgNr = sal_uInt16( aType.Copy( BaseArgKenn.Len() ).ToInt32() );
DBG_ASSERT( aString.Search( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")") ) != STRING_NOTFOUND, "Extra Argument given in String");
aString.SearchAndReplace( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")"), aValue );
nStartPos = nStart;
@@ -1926,7 +1856,7 @@ String BasicFrame::GenRealString( const String &aResString )
}
else
{
- DBG_ERROR( CByteString("Unknown replacement in String: ").Append( ByteString( aResult.Copy(nStart,nEnd-nStart), RTL_TEXTENCODING_UTF8 ) ).GetBuffer() );
+ OSL_FAIL( CByteString("Unknown replacement in String: ").Append( ByteString( aResult.Copy(nStart,nEnd-nStart), RTL_TEXTENCODING_UTF8 ) ).GetBuffer() );
nStartPos = nStartPos + StartKenn.Len();
}
}