diff options
author | August Sodora <augsod@gmail.com> | 2011-12-07 00:55:10 -0500 |
---|---|---|
committer | August Sodora <augsod@gmail.com> | 2011-12-07 00:56:22 -0500 |
commit | a2eb0cf44bbd15ae24f9423d3bc6e420691c300d (patch) | |
tree | b11ce54011011e96217d9b504e81ec87aaef38a4 /basic/source/app | |
parent | e2621785569969374cc3bc39fae0341d8b848612 (diff) |
Remove testtool
Diffstat (limited to 'basic/source/app')
36 files changed, 0 insertions, 11698 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx deleted file mode 100644 index ac6d801004e9..000000000000 --- a/basic/source/app/app.cxx +++ /dev/null @@ -1,1869 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <vcl/msgbox.hxx> -#include <tools/fsys.hxx> -#include <svtools/filedlg.hxx> -#include <tools/config.hxx> - -#include <vcl/font.hxx> - -#include <basic/ttstrhlp.hxx> -#include <basic/sbx.hxx> - -#include <osl/module.h> - -#include "basic.hrc" -#include "app.hxx" -#include "status.hxx" -#include "appedit.hxx" -#include "appbased.hxx" -#include "apperror.hxx" -#include <basic/mybasic.hxx> -#include "ttbasic.hxx" -#include "dialogs.hxx" -#include <basic/basrdll.hxx> -#include "basrid.hxx" - -#include "runtime.hxx" -#include "sbintern.hxx" - -#include <ucbhelper/contentbroker.hxx> -#include <ucbhelper/configurationkeys.hxx> -#include <comphelper/regpathhelper.hxx> -#include <comphelper/processfactory.hxx> -#include <comphelper/string.hxx> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ucb/XContentProviderManager.hpp> - -#include <ucbhelper/content.hxx> -#include <unotools/syslocale.hxx> - -#include <rtl/oustringostreaminserter.hxx> -#include <rtl/strbuf.hxx> -#include <sal/log.hxx> - -using namespace comphelper; -using namespace cppu; -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; - -using ::rtl::OUString; -using ::rtl::OUStringToOString; - -SttResId::SttResId( sal_uInt32 nId ) : - ResId( nId, *((*(BasicDLL**)GetAppData(SHL_BASIC))->GetSttResMgr()) ) -{ -} - -#ifdef DBG_UTIL -// filter Messages generated due to missing configuration Bug:#83887# -void TestToolDebugMessageFilter( const sal_Char *pString, sal_Bool bIsOsl ) -{ - static sal_Bool static_bInsideFilter = sal_False; - - // Ignore messages during filtering to avoid endless recursions - if ( static_bInsideFilter ) - return; - - static_bInsideFilter = sal_True; - - ByteString aMessage( pString ); - - 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 = sal_True; - } - else - { - // DBG -#if ! (OSL_DEBUG_LEVEL > 1) - if ( aMessage.Search( CByteString("SelectAppIconPixmap") ) != STRING_NOTFOUND ) - bIgnore = sal_True; -#endif - if ( aMessage.Search( CByteString("PropertySetRegistry::") ) != STRING_NOTFOUND ) - bIgnore = sal_True; - if ( aMessage.Search( CByteString("property value missing") ) != STRING_NOTFOUND ) - bIgnore = sal_True; - if ( aMessage.Search( CByteString("getDateFormatsImpl") ) != STRING_NOTFOUND - && aMessage.Search( CByteString("no date formats") ) != STRING_NOTFOUND ) - bIgnore = sal_True; - if ( aMessage.Search( CByteString("ucb::configureUcb(): Bad arguments") ) != STRING_NOTFOUND ) - bIgnore = sal_True; - if ( aMessage.Search( CByteString("CreateInstance with arguments exception") ) != STRING_NOTFOUND ) - bIgnore = sal_True; - if ( aMessage.Search( CByteString("AcquireTree failed") ) != STRING_NOTFOUND ) - bIgnore = sal_True; - } - - - if ( bIgnore ) - { - static_bInsideFilter = sal_False; - return; - } - - if ( bIsOsl ) - { - // due to issue #i36895 only print on console - // unfortunately the osl assertions deadlock by design :-( on recursive calls of assertions - printf("%s\n", pString ); - } - else - { - try - { - aBasicApp.DbgPrintMsgBox( pString ); - } - catch ( ... ) - - { - printf("DbgPrintMsgBox failed: %s\n", pString ); - } - } - static_bInsideFilter = sal_False; -} - -void SAL_CALL DBG_TestToolDebugMessageFilter( const sal_Char *pString ) -{ - TestToolDebugMessageFilter( pString, sal_False ); -} - -extern "C" void SAL_CALL osl_TestToolDebugMessageFilter( const sal_Char *pString ) -{ - if ( !getenv( "DISABLE_SAL_DBGBOX" ) ) - TestToolDebugMessageFilter( pString, sal_True ); -} - -#endif - -// Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors -// this routine became necessary -sal_Bool IsTTSignatureForUnicodeTextfile( String aLine ) -{ - aLine.SearchAndReplace( '\t', ' ' ); - String ThreeBlanks = CUniString(" "); - String TwoBlanks = CUniString(" "); - while ( aLine.SearchAndReplace( ThreeBlanks, TwoBlanks ) != STRING_NOTFOUND ) - {} - return aLine.EqualsAscii( TT_SIGNATURE_FOR_UNICODE_TEXTFILES ); -} - -BasicApp aBasicApp; // Application instance - -uno::Reference< XContentProviderManager > InitializeUCB( void ) -{ - uno::Reference< XMultiServiceFactory > xSMgr; - try - { - xSMgr = uno::Reference< XMultiServiceFactory >( - defaultBootstrap_InitialComponentContext()->getServiceManager(), - UNO_QUERY_THROW); - } - catch( const com::sun::star::uno::Exception & exc ) - { - fprintf( stderr, "Couldn't bootstrap uno servicemanager for reason : %s\n" , - OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); - InfoBox( NULL, String( exc.Message ) ).Execute(); - throw ; - } - - - // set global factory - setProcessServiceFactory( xSMgr ); - -// Create Ucb that can handle local files: - Sequence< Any > aArgs(2); - aArgs[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); - aArgs[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); - ::ucbhelper::ContentBroker::initialize( xSMgr, aArgs ); - uno::Reference< XContentProviderManager > xUcb = - ::ucbhelper::ContentBroker::get()->getContentProviderManagerInterface(); - - uno::Reference< XContentProvider > xFileProvider - ( 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; -} - -static void ReplaceStringHookProc( UniString& rStr ) -{ - static String aTestToolName( RTL_CONSTASCII_USTRINGPARAM( "VCLTestTool" ) ); // HACK, should be read from ressources - - if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND ) - { - rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", aTestToolName ); - } -} - -int BasicApp::Main( ) -{ -#ifdef DBG_UTIL -// Install filter for OSLAsserts - DbgPrintMsgBox = DbgGetPrintMsgBox(); - DbgSetPrintTestTool( DBG_TestToolDebugMessageFilter ); - DBG_INSTOUTERROR( DBG_OUT_TESTTOOL ); - - SAL_WARN_IF( - osl_setDebugMessageFunc(osl_TestToolDebugMessageFilter), "basic", - "osl_setDebugMessageFunc returns non NULL pointer"); -#endif - - ResMgr::SetReadStringHook( ReplaceStringHookProc ); - - try - { - uno::Reference< XContentProviderManager > xUcb = InitializeUCB(); - { - DirEntry aIniPath( Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ) ); - if ( !aIniPath.Exists() ) - { // look for it besides the executable - DirEntry aAppFileName( GetAppFileName() ); - String aAppDir ( aAppFileName.GetPath().GetFull() ); - - // Do not use Config::GetConfigName here because is uses a hidden - // file for UNIX - - DirEntry aDefIniPath( aAppDir ); - ByteString aFileName; -#ifdef UNX - aFileName = "testtoolrc"; -#else - aFileName = "testtool.ini"; -#endif - aDefIniPath += DirEntry( aFileName ); - - if ( aDefIniPath.Exists() ) - { - aDefIniPath.CopyTo( aIniPath, FSYS_ACTION_COPYFILE ); - FileStat::SetReadOnlyFlag( aIniPath, sal_False ); - } - } - } - - { - LanguageType aRequestedLanguage; - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - - // 1033 = LANGUAGE_ENGLISH_US - // 1031 = LANGUAGE_GERMAN - aConf.SetGroup("Misc"); - rtl::OString aLang = aConf.ReadKey( "Language", - rtl::OString::valueOf(static_cast<sal_Int32>(LANGUAGE_SYSTEM)) ); - aRequestedLanguage = LanguageType(aLang.toInt32()); - - AllSettings aSettings = GetSettings(); - aSettings.SetUILanguage( aRequestedLanguage ); - aSettings.SetLanguage( aRequestedLanguage ); - SetSettings( aSettings ); - } - - BasicDLL aBasicDLL; - nWait = 0; - - // Acceleratoren - Accelerator aAccel( SttResId( MAIN_ACCEL ) ); - InsertAccel( &aAccel ); - pMainAccel = &aAccel; - - // Frame Window: - pFrame = new BasicFrame; - aAccel.SetSelectHdl( LINK( pFrame, BasicFrame, Accel ) ); - - pFrame->Show(); - - SetSystemWindowMode( SYSTEMWINDOW_MODE_NOAUTOMODE ); - SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG ); - - // Instantiate a SvtSysLocale to avoid permant instatiation - // and deletion of SvtSysLocale_Impl in SvtSysLocale Ctor/Dtor - // because in the testtool szenario Basic is the only instance - // instatiating SvtSysLocale (#107417). - SvtSysLocale aSysLocale; - - PostUserEvent( LINK( this, BasicApp, LateInit ) ); - Execute(); - - delete pFrame; - - RemoveAccel( pMainAccel ); - - } - catch (const class Exception & rEx) - { - printf( "Exception not caught: %s\n", rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US).getStr() ); - String aMsg( String::CreateFromAscii( "Exception not caught: " ) ); - aMsg.Append( String( rEx.Message ) ); - InfoBox( NULL, aMsg ).Execute(); - throw; - } - catch( ... ) - { - printf( "unknown Exception not caught\n" ); - InfoBox( NULL, String::CreateFromAscii( "unknown Exception not caught" ) ).Execute(); - throw; - } - return EXIT_SUCCESS; -} - -void BasicApp::LoadIniFile() -{ - pFrame->LoadIniFile(); -} - -void BasicApp::SetFocus() -{ - if( pFrame->pWork && pFrame->pWork->ISA(AppEdit) ) - ((AppEdit*)pFrame->pWork)->pDataEdit->GrabFocus(); -} - -IMPL_LINK( BasicApp, LateInit, void *, pDummy ) -{ - (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 -#ifndef UNX - || Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("/run") == COMPARE_EQUAL -#endif - ) - 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 -#endif - ) - { - if ( (i+1) < Application::GetCommandLineParamCount() ) - { - if ( comphelper::string::isdigitAsciiString(Application::GetCommandLineParam(i+1)) ) - { - MsgEdit::SetMaxLogLen( sal::static_int_cast< sal_uInt16 >( Application::GetCommandLineParam( i+1 ).ToInt32() ) ); - } - ++i; - } - } - } - - // now load the files after the switches have been set. Espechially -run is of interest sunce it changes the behavior - for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).Copy(0,1).CompareToAscii("-") != COMPARE_EQUAL -#ifndef UNX - && Application::GetCommandLineParam( i ).Copy(0,1).CompareToAscii("/") != COMPARE_EQUAL -#endif - ) - { - pFrame->LoadFile( Application::GetCommandLineParam( i ) ); - } - else if ( Application::GetCommandLineParam( i ).Copy(0,7).CompareIgnoreCaseToAscii("-result") == COMPARE_EQUAL -#ifndef UNX - || Application::GetCommandLineParam( i ).Copy(0,7).CompareIgnoreCaseToAscii("/result") == COMPARE_EQUAL -#endif - ) - { // Increment count to skip the parameter. This works even if it is not given - i++; - } - } - - pFrame->pStatus->SetStatusSize( pFrame->pStatus->GetStatusSize()+1 ); - pFrame->pStatus->SetStatusSize( pFrame->pStatus->GetStatusSize()-1 ); - - if ( pFrame->IsAutoRun() ) - { - pFrame->Command( RID_RUNSTART ); - } - - if ( pFrame->IsAutoRun() ) - pFrame->Command( RID_QUIT ); - - return 0; -} - - -class FloatingExecutionStatus : public FloatingWindow -{ -public: - FloatingExecutionStatus( Window * pParent ); - void SetStatus( String aW ); - void SetAdditionalInfo( String aF ); - -private: - Timer aAusblend; - DECL_LINK(HideNow, FloatingExecutionStatus* ); - FixedText aStatus; - FixedText aAdditionalInfo; -}; - - -FloatingExecutionStatus::FloatingExecutionStatus( Window * pParent ) - : FloatingWindow( pParent, SttResId(LOAD_CONF) ), - aStatus( this, SttResId( WORK ) ), - aAdditionalInfo( this, SttResId( FILENAME ) ) -{ - FreeResource(); - aAusblend.SetTimeoutHdl( LINK(this, FloatingExecutionStatus, HideNow ) ); - aAusblend.SetTimeout(5000); // in ms - aAusblend.Start(); -} - -void FloatingExecutionStatus::SetStatus( String aW ) -{ - Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - ToTop( TOTOP_NOGRABFOCUS ); - aAusblend.Start(); - aStatus.SetText( aW ); -} - -void FloatingExecutionStatus::SetAdditionalInfo( String aF ) -{ - Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - ToTop( TOTOP_NOGRABFOCUS ); - aAusblend.Start(); - aAdditionalInfo.SetText( aF ); -} - -IMPL_LINK(FloatingExecutionStatus, HideNow, FloatingExecutionStatus*, pFLC ) -{ - (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( sal_False ) -, pDisplayHidDlg( NULL ) -, pEditVar ( 0 ) -, bAutoReload( sal_False ) -, bAutoSave( sal_True ) -, pBasic( NULL ) -, pExecutionStatus( NULL ) -, pStatus( NULL ) -, pList( NULL ) -, pWork( NULL ) -{ - - Application::SetDefDialogParent( this ); - AlwaysEnableInput( sal_True ); - pBasic = TTBasic::CreateMyBasic(); // depending on what was linked to the executable - bInBreak = sal_False; - bDisas = sal_False; - nFlags = 0; - - if ( pBasic->pTestObject ) // Are we the testtool? - { - aAppName = String( SttResId( IDS_APPNAME2 ) ); - } - else - { - aAppName = String( SttResId( IDS_APPNAME ) ); - } - - // Menu: - MenuBar *pBar = new MenuBar( SttResId( RID_APPMENUBAR ) ); - SetMenuBar( pBar ); - - pBar->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - - - // Menu Handler: - PopupMenu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE ); - pFileMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); - pFileMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - pFileMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); - pFileMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - if (Basic().pTestObject ) // Are we TestTool? - { - pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) -1 ); // Separator before - pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) ); - pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILESAVELIB ) ); - } - - PopupMenu* pEditMenu = pBar->GetPopupMenu( RID_APPEDIT ); - pEditMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); - pEditMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - pEditMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); - pEditMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - PopupMenu* pRunMenu = pBar->GetPopupMenu( RID_APPRUN ); - pRunMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); - pRunMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - pRunMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); - pRunMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - if (Basic().pTestObject ) // Are we TestTool? - { - pRunMenu->RemoveItem( pRunMenu->GetItemPos( RID_RUNDISAS ) ); - pRunMenu->RemoveItem( pRunMenu->GetItemPos( RID_RUNCOMPILE ) ); - } - - PopupMenu *pExtras; - if (Basic().pTestObject ) // Are we TestTool? - { - pExtras = new PopupMenu( SttResId( RID_TT_EXTRAS ) ); - pBar->InsertItem( RID_TT_EXTRAS, String( SttResId( RID_TT_EXTRAS_NAME ) ), 0, pBar->GetItemPos( RID_APPWINDOW ) ); - pBar->SetPopupMenu( RID_TT_EXTRAS, pExtras ); - - pExtras->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); - pExtras->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - pExtras->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - } - - PopupMenu* pWinMenu = pBar->GetPopupMenu( RID_APPWINDOW ); - pWinMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); - pWinMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - pWinMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - PopupMenu* pHelpMenu = pBar->GetPopupMenu( RID_APPHELP ); - pHelpMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); - pHelpMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); - pHelpMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); - pHelpMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - - pList = new EditList; - pStatus = new StatusLine( this ); - - LoadIniFile(); - - UpdateTitle(); - - // Size: half width, 0.75 * height - 2 * IconSize - { - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("WinGeom"); - SetWindowState( ::rtl::OString(aConf.ReadKey("WinParams", "")) ); - } - - aLineNum.SetTimeoutHdl( LINK( this, BasicFrame, ShowLineNr ) ); - aLineNum.SetTimeout(200); - aLineNum.Start(); - - aCheckFiles.SetTimeout( 10000 ); - aCheckFiles.SetTimeoutHdl( LINK( this, BasicFrame, CheckAllFiles ) ); - aCheckFiles.Start(); - - GetMenuBar()->SetCloserHdl( LINK( this, BasicFrame, CloseButtonClick ) ); - GetMenuBar()->SetFloatButtonClickHdl( LINK( this, BasicFrame, FloatButtonClick ) ); - GetMenuBar()->SetHideButtonClickHdl( LINK( this, BasicFrame, HideButtonClick ) ); -} - -const ByteString ProfilePrefix("_profile_"); -const sal_uInt16 ProfilePrefixLen = ProfilePrefix.Len(); - -void BasicFrame::LoadIniFile() -{ - sal_uInt16 i; - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - - for ( i = 0 ; i < aConf.GetGroupCount() ; i++ ) - { - aConf.SetGroup( ByteString( aConf.GetGroupName( i ) ) ); - if ( ( aConf.ReadKey( "Aktuell" ).getLength() || aConf.ReadKey( "Alle" ).getLength() ) - &&( !aConf.ReadKey( "Current" ).getLength() && !aConf.ReadKey( "All" ).getLength() ) ) - { - aConf.WriteKey( "Current", aConf.ReadKey( "Aktuell" ) ); - aConf.WriteKey( "All", aConf.ReadKey( "Alle" ) ); - } - } - - aConf.SetGroup("Misc"); - ByteString aTemp; - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Misc" ); - - pStatus->SetProfileName( String( aCurrentProfile.Copy( ProfilePrefixLen ), RTL_TEXTENCODING_UTF8 ) ); - - aConf.SetGroup( aCurrentProfile ); - aTemp = aConf.ReadKey( "AutoReload", "0" ); - bAutoReload = ( aTemp.CompareTo("1") == COMPARE_EQUAL ); - aTemp = aConf.ReadKey( "AutoSave", "0" ); - bAutoSave = ( aTemp.CompareTo("1") == COMPARE_EQUAL ); - - LoadLRU(); - - if ( pBasic ) - pBasic->LoadIniFile(); - - for ( i = 0 ; i < pList->size() ; i++ ) - pList->at( i )->LoadIniFile(); -} - -BasicFrame::~BasicFrame() -{ - for ( size_t i = 0, n = pList->size(); i < n; ++i ) - delete pList->at( i ); - pList->clear(); - - MenuBar *pBar = GetMenuBar(); - SetMenuBar( NULL ); - delete pBar; - - delete pStatus; - delete pList; - pBasic.Clear(); -} - -void BasicFrame::Command( const CommandEvent& rCEvt ) -{ - switch( rCEvt.GetCommand() ) { - case COMMAND_SHOWDIALOG: - { - const CommandDialogData* pData = rCEvt.GetDialogData(); - if ( pData) - { - const int nCommand = pData->GetDialogId(); - - switch (nCommand) - { - case SHOWDIALOG_ID_PREFERENCES : - Command( RID_OPTIONS ); - break; - - case SHOWDIALOG_ID_ABOUT : - Command( RID_HELPABOUT ); - break; - - default : - ; - } - } - } - break; - } -} - -void BasicFrame::UpdateTitle() -{ - String aTitle; - aTitle += aAppName; - if ( aAppMode.Len() ) - { - aTitle.AppendAscii(" ["); - aTitle += aAppMode; - aTitle.AppendAscii("]"); - } - aTitle.AppendAscii(" - "); - aTitle += aAppFile; - SetText( aTitle ); -} - -IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer ) -{ - if ( pWork ) - { - AppWin* pStartWin = pWork; - Window* pFocusWin = Application::GetFocusWindow(); - for ( size_t i = pList->size() ; i > 0 ; ) - pList->at( --i )->CheckReload(); - - if ( pWork != pStartWin ) - { - pWork = pStartWin; - pWork->ToTop(); - } - if ( pFocusWin ) - pFocusWin->GrabFocus(); - } - pTimer->Start(); - return 0; -} - -sal_Bool BasicFrame::IsAutoRun() -{ - return bIsAutoRun; -} - -void BasicFrame::SetAutoRun( sal_Bool bAuto ) -{ - bIsAutoRun = bAuto; -} - -void BasicFrame::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( rHint.ISA( TTExecutionStatusHint ) ) - { - TTExecutionStatusHint *pStatusHint = ( TTExecutionStatusHint* )&rHint; - switch ( pStatusHint->GetType() ) - { - case TT_EXECUTION_ENTERWAIT: - { - EnterWait(); - } - break; - case TT_EXECUTION_LEAVEWAIT: - { - LeaveWait(); - } - break; - case TT_EXECUTION_SHOW_ACTION: - { - String aTotalStatus( pStatusHint->GetExecutionStatus() ); - aTotalStatus.AppendAscii( " " ); - aTotalStatus.Append( pStatusHint->GetAdditionalExecutionStatus() ); - pStatus->Message( aTotalStatus ); - } - break; - case TT_EXECUTION_HIDE_ACTION: - { - } - break; - } - } - - - Broadcast( rHint ); -} - -void BasicFrame::Resize() -{ - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("WinGeom"); - aConf.WriteKey("WinParams",GetWindowState()); - - // Statusbar - Size aOutSize = GetOutputSizePixel(); - Size aStatusSize = pStatus->GetSizePixel(); - Point aStatusPos( 0, aOutSize.Height() - aStatusSize.Height() ); - aStatusSize.Width() = aOutSize.Width(); - - pStatus->SetPosPixel( aStatusPos ); - pStatus->SetSizePixel( aStatusSize ); - - - // Resize possibly maximized window - for( size_t i = pList->size(); i > 0 ; i-- ) - { - 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") )); - aConf.SetGroup("WinGeom"); - aConf.WriteKey("WinParams",GetWindowState()); -} - -void BasicFrame::GetFocus() -{ - if ( pWork ) - pWork->GrabFocus(); -} - -IMPL_LINK( BasicFrame, CloseButtonClick, void*, EMPTYARG ) -{ - AppWin* p; - 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 ( 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 ( 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->empty() ) - return; - - AppWin* p; - 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 - || ( bWasFullscreen && ( !p->IsPined() || p->GetWinState() & TT_WIN_STATE_MAX )) - ) - p->Hide( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - else - p->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - } - bWasFullscreen |= p->GetWinState() == TT_WIN_STATE_MAX; - } -} - -void BasicFrame::WinMax_Restore() -{ - // The application buttons - AppWin* p; - 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 ) -{ - 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(); - - if ( pWork ) - pWork->ToTop(); - - WinMax_Restore(); - - Menu* pMenu = GetMenuBar(); - 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 ); - - pWinMenu->RemoveItem( pWinMenu->GetItemPos( pWin->GetWinId() ) ); - - // Remove separator - if ( pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) == MENUITEM_SEPARATOR ) - pWinMenu->RemoveItem( pWinMenu->GetItemCount() - 1 ); - - pStatus->LoadTaskToolBox(); -} - -void BasicFrame::AddWindow( AppWin *pWin ) -{ - pList->push_back( pWin ); - pWork = pWin; - - WinMax_Restore(); - - // Enable main menu - MenuBar* pMenu = GetMenuBar(); - 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 ); - 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 - sal_uInt16 nFreeID = RID_WIN_FILE1; - while ( pWinMenu->GetItemPos( nFreeID ) != MENU_ITEM_NOTFOUND && nFreeID < RID_WIN_FILEn ) - nFreeID++; - - pWin->SetWinId( nFreeID ); - pWinMenu->InsertItem( nFreeID, pWin->GetText() ); -} - -void BasicFrame::WindowRenamed( AppWin *pWin ) -{ - MenuBar* pMenu = GetMenuBar(); - PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - - pWinMenu->SetItemText( pWin->GetWinId(), pWin->GetText() ); - - pStatus->LoadTaskToolBox(); - - aAppFile = pWin->GetText(); - UpdateTitle(); -} - -void BasicFrame::FocusWindow( AppWin *pWin ) -{ - pWork = pWin; - 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(); - - WinShow_Hide(); - pStatus->LoadTaskToolBox(); -} - -sal_Bool BasicFrame::Close() -{ - if( bInBreak || Basic().IsRunning() ) - if( RET_NO == QueryBox( this, SttResId( IDS_RUNNING ) ).Execute() ) - return sal_False; - - StarBASIC::Stop(); - bInBreak = sal_False; - if( CloseAll() ) - { - aLineNum.Stop(); - - // Close remaining dialogs to avoid assertions - while ( GetWindow( WINDOW_OVERLAP )->GetWindow( WINDOW_FIRSTOVERLAP ) ) - { - delete GetWindow( WINDOW_OVERLAP )->GetWindow( WINDOW_FIRSTOVERLAP )->GetWindow( WINDOW_CLIENT ); - } - - Application::SetDefDialogParent( NULL ); - WorkWindow::Close(); - - return sal_True; - } else return sal_False; -} - -sal_Bool BasicFrame::CloseAll() -{ - while ( !pList->empty() ) - if ( !pList->back()->Close() ) - return sal_False; - return sal_True; -} - -sal_Bool BasicFrame::CompileAll() -{ - AppWin* p; - 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 ) comphelper::string::remove(Name.Copy(Name.SearchAscii(" ")+1), '~') - -#define LRUNr( nNr ) \ - rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("LRU")) \ - .append(static_cast<sal_Int32>(nNr)) \ - .makeStringAndClear() - -String FILENAME2MENU( sal_uInt16 nNr, String aName ) -{ - String aRet; - if ( nNr <= 9 ) - aRet = CUniString("~").Append( UniString::CreateFromInt32( nNr ) ); - else if ( nNr == 10 ) - aRet = CUniString("1~0"); - else - aRet = UniString::CreateFromInt32( nNr ); - - return aRet.AppendAscii(" ").Append( aName ); -} - -void BasicFrame::AddToLRU(String const& aFile) -{ - Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); - - aConfig.SetGroup("LRU"); - sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").toInt32(); - DirEntry aFileEntry( aFile ); - sal_uInt16 i,nLastMove = nMaxLRU; - - for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ ) - { - if ( DirEntry( rtl::OStringToOUString(aConfig.ReadKey(LRUNr(i),""), RTL_TEXTENCODING_UTF8) ) == aFileEntry ) - nLastMove = i; - } - - if ( pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND ) - pPopup->InsertSeparator(); - for ( i = nLastMove ; i>1 ; i-- ) - { - if ( aConfig.ReadKey(LRUNr(i-1),"").getLength() ) - { - aConfig.WriteKey(LRUNr(i), aConfig.ReadKey(LRUNr(i-1),"")); - if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND ) - pPopup->InsertItem(IDM_FILE_LRU1 + i-1, FILENAME2MENU( i, MENU2FILENAME( pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1) ) )); - else - pPopup->SetItemText(IDM_FILE_LRU1 + i-1,FILENAME2MENU( i, MENU2FILENAME( pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1) ) )); - } - } - aConfig.WriteKey(LRUNr(1), rtl::OUStringToOString(aFile, RTL_TEXTENCODING_UTF8) ); - if ( pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND ) - pPopup->InsertItem(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile)); - else - pPopup->SetItemText(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile)); -} - -void BasicFrame::LoadLRU() -{ - Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); - sal_Bool bAddSep = sal_True; - - aConfig.SetGroup("LRU"); - sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").toInt32(); - - if ( pPopup ) - bAddSep = pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND; - - sal_uInt16 i; - for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++) - { - String aFile = rtl::OStringToOUString(aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8); - - if (aFile.Len() != 0) - { - if (bAddSep) - { - pPopup->InsertSeparator(); - bAddSep = sal_False; - } - - if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND ) - pPopup->InsertItem(IDM_FILE_LRU1 + i-1, FILENAME2MENU( i, aFile )); - else - pPopup->SetItemText(IDM_FILE_LRU1 + i-1, FILENAME2MENU( i, aFile )); - } - } - i = nMaxLRU+1; - while ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) != MENU_ITEM_NOTFOUND ) - { - pPopup->RemoveItem( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) ); - i++; - } -} - -IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) -{ - sal_Bool bNormal = sal_Bool( !bInBreak ); - pMenu->EnableItem( RID_RUNCOMPILE, bNormal ); - - sal_Bool bHasEdit = sal_Bool( pWork != NULL ); - - pMenu->EnableItem( RID_FILECLOSE, bHasEdit ); - pMenu->EnableItem( RID_FILESAVE, bHasEdit ); - pMenu->EnableItem( RID_FILESAVEAS, bHasEdit ); - pMenu->EnableItem( RID_FILELOADLIB, bNormal ); - pMenu->EnableItem( RID_FILESAVELIB, bHasEdit ); - - sal_Bool bHasErr = sal_Bool( bNormal && pBasic->GetErrors() != 0 ); - sal_Bool bNext = bHasErr & bNormal; - sal_Bool bPrev = bHasErr & bNormal; - if( bHasErr ) - { - size_t n = pBasic->GetCurrentError(); - if( n == 0 ) - 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 ) - pWork->InitMenu( pMenu ); - - return sal_True; -} - -IMPL_LINK_INLINE_START( BasicFrame, DeInitMenu, Menu *, pMenu ) -{ - (void) pMenu; /* avoid warning about unused parameter */ - - SetAutoRun( sal_False ); - String aString; - pStatus->Message( aString ); - return 0L; -} -IMPL_LINK_INLINE_END( BasicFrame, DeInitMenu, Menu *, pMenu ) - -IMPL_LINK_INLINE_START( BasicFrame, HighlightMenu, Menu *, pMenu ) -{ - String s = pMenu->GetHelpText( pMenu->GetCurItemId() ); - pStatus->Message( s ); - return 0L; -} -IMPL_LINK_INLINE_END( BasicFrame, HighlightMenu, Menu *, pMenu ) - -IMPL_LINK_INLINE_START( BasicFrame, MenuCommand, Menu *, pMenu ) -{ - 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( 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 */ - String aPos; - if ( pWork && pWork->ISA(AppBasEd)) - { - aPos = String::CreateFromInt32(pWork->GetLineNr()); - } - pStatus->Pos( aPos ); - return 0L; -} -IMPL_LINK_INLINE_END( BasicFrame, ShowLineNr, AutoTimer *, pTimer ) - - -MsgEdit* BasicFrame::GetMsgTree( String aLogFileName ) -{ - if ( FindErrorWin( aLogFileName ) ) - { - return FindErrorWin( aLogFileName )->GetMsgTree(); - } - else - { // create new Window on the fly - AppError *pNewWindow = new AppError( this, aLogFileName ); - pNewWindow->Show(); - pNewWindow->GrabFocus(); - return pNewWindow->GetMsgTree(); - } -} - -IMPL_LINK( BasicFrame, Log, TTLogMsg *, pLogMsg ) -{ - GetMsgTree( pLogMsg->aLogFileName )->AddAnyMsg( pLogMsg ); - return 0L; -} - -IMPL_LINK( BasicFrame, WinInfo, WinInfoRec*, pWinInfo ) -{ - if ( !pDisplayHidDlg ) - pDisplayHidDlg = new DisplayHidDlg( this ); - if ( pDisplayHidDlg ) - { - pDisplayHidDlg->AddData( pWinInfo ); - pDisplayHidDlg->Show(); - } - return 0; -} - -AppBasEd* BasicFrame::CreateModuleWin( SbModule* pMod ) -{ - String aModName = pMod->GetName(); - if ( aModName.Copy(0,2).CompareToAscii("--") == COMPARE_EQUAL ) - aModName.Erase(0,2); - pMod->SetName(aModName); - AppBasEd* p = new AppBasEd( this, pMod ); - p->Show(); - p->GrabFocus(); - p->ToTop(); - return p; -} - -sal_Bool BasicFrame::LoadFile( String aFilename ) -{ - 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; - sal_Bool bSuccess = sal_True; - if ( bIsResult ) - { - p = new AppError( this, aFilename ); - } - else if ( bIsBasic ) - { - p = new AppBasEd( this, NULL ); - bSuccess = p->Load( aFilename ); - } - else - { - p = new AppEdit( this ); - bSuccess = p->Load( aFilename ); - } - if ( bSuccess ) - { - p->Show(); - p->GrabFocus(); - } - else - delete p; - - return bSuccess; -} - -// Execute command -long BasicFrame::Command( short nID, sal_Bool bChecked ) -{ - BasicError* pErr; - - switch( nID ) { - case RID_FILENEW: { - AppBasEd* p = new AppBasEd( this, NULL ); - p->Show(); - p->GrabFocus(); - } break; - case RID_FILEOPEN: - { - String s; - if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, sal_False ) ) { - AddToLRU( s ); - LoadFile( s ); - } - } break; - case RID_FILELOADLIB: - LoadLibrary(); - break; - case RID_FILESAVELIB: - SaveLibrary(); - break; - case RID_FILECLOSE: - if( pWork && pWork->Close() ){}; - break; - case RID_QUIT: - if( Close() ) aBasicApp.Quit(); - break; - - - case RID_RUNSTART: - nFlags = SbDEBUG_BREAK; - goto start; - case RID_RUNSTEPOVER: - nFlags = SbDEBUG_STEPINTO | SbDEBUG_STEPOVER; - goto start; - case RID_RUNSTEPINTO: - nFlags = SbDEBUG_STEPINTO; - goto start; - case RID_RUNTOCURSOR: - if ( pWork && pWork->ISA(AppBasEd) && ((AppBasEd*)pWork)->GetModule()->SetBP(pWork->GetLineNr()) ) - { - SbModule *pModule = ((AppBasEd*)pWork)->GetModule(); -#if OSL_DEBUG_LEVEL > 1 - sal_uInt16 x; - x = pWork->GetLineNr(); - x = ((AppBasEd*)pWork)->GetModule()->GetBPCount(); - if ( !x ) - x = pModule->SetBP(pWork->GetLineNr()); - x = pModule->GetBPCount(); -#endif - - for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) - { - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); - DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); - } - } - nFlags = SbDEBUG_BREAK; - goto start; - start: { - if ( !Basic().IsRunning() || bInBreak ) - { - AppBasEd* p = NULL; - if( pWork && pWork->ISA(AppBasEd) ) - { - p = ((AppBasEd*)pWork); - p->ToTop(); - } - else - { - AppWin *w = NULL; - 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); - p->ToTop(); - } - else - if ( IsAutoRun() ) - printf( "No file loaded to run.\n" ); - } - - if( bInBreak ) - // Reset the flag - bInBreak = sal_False; - else - { - if( IsAutoSave() && !SaveAll() ) break; - if( !CompileAll() ) break; - String aString; - pStatus->Message( aString ); - if( p ) - { - BasicDLL::SetDebugMode( sal_True ); - Basic().ClearGlobalVars(); - p->Run(); - BasicDLL::SetDebugMode( sal_False ); - // If cancelled during Interactive=FALSE - } - }} - } - break; - case RID_RUNCOMPILE: - if( pWork && pWork->ISA(AppBasEd) && SaveAll() ) - { - ((AppBasEd*)pWork)->Compile(); - pWork->ToTop(); - pWork->GrabFocus(); - } - break; - case RID_RUNDISAS: - bDisas = sal_Bool( !bChecked ); - break; - case RID_RUNBREAK: - if ( Basic().IsRunning() && !bInBreak ) - { - pINST->nBreakCallLvl = pINST->nCallLvl; - } - break; - case RID_RUNSTOP: - Basic().Stop(); - bInBreak = sal_False; - break; - case RID_RUNNEXTERR: - pErr = pBasic->NextError(); - if( pErr ) pErr->Show(); - break; - case RID_RUNPREVERR: - pErr = pBasic->PrevError(); - if( pErr ) pErr->Show(); - break; - - case RID_OPTIONS: - { - OptionsDialog *pOptions = new OptionsDialog( this, SttResId(IDD_OPTIONS_DLG) ); - pOptions->Show(); - } - break; - case RID_DECLARE_HELPER: - InfoBox( this, SttResId( IDS_NOT_YET_IMPLEMENTED ) ).Execute(); - break; - - case RID_WINTILE: - { - WindowArrange aArange; - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - aArange.AddWindow( pList->at( i ) ); - pList->at( i )->Restore(); - } - - sal_Int32 nTitleHeight; - { - sal_Int32 nDummy1, nDummy2, nDummy3; - GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); - } - - Size aSize = GetOutputSizePixel(); - aSize.Height() -= nTitleHeight; - Rectangle aRect( Point( 0, nTitleHeight ), aSize ); - - aArange.Arrange( WINDOWARRANGE_TILE, aRect ); - - } - break; - case RID_WINTILEHORZ: - { - WindowArrange aArange; - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - aArange.AddWindow( pList->at( i ) ); - pList->at( i )->Restore(); - } - - - sal_Int32 nTitleHeight; - { - sal_Int32 nDummy1, nDummy2, nDummy3; - GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); - } - - Size aSize = GetOutputSizePixel(); - aSize.Height() -= nTitleHeight; - Rectangle aRect( Point( 0, nTitleHeight ), aSize ); - - aArange.Arrange( WINDOWARRANGE_HORZ, aRect ); - - } - break; - case RID_WINTILEVERT: - { - WindowArrange aArange; - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - aArange.AddWindow( pList->at( i ) ); - pList->at( i )->Restore(); - } - - - sal_Int32 nTitleHeight; - { - sal_Int32 nDummy1, nDummy2, nDummy3; - GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); - } - - Size aSize = GetOutputSizePixel(); - aSize.Height() -= nTitleHeight; - Rectangle aRect( Point( 0, nTitleHeight ), aSize ); - - aArange.Arrange( WINDOWARRANGE_VERT, aRect ); - - } - break; - case RID_WINCASCADE: - { - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - pList->at( i )->Cascade( i ); - } - } - break; - - case RID_HELPABOUT: - { - SttResId aResId( IDD_ABOUT_DIALOG ); - if ( Basic().pTestObject ) // Are we TestTool? - aResId = SttResId( IDD_TT_ABOUT_DIALOG ); - else - aResId = SttResId( IDD_ABOUT_DIALOG ); - AboutDialog aAbout( this, aResId ); - aAbout.Execute(); - } - break; - case RID_POPUPEDITVAR: - { - new VarEditDialog( this, pEditVar ); - } - break; - default: - if ( nID >= RID_WIN_FILE1 && nID <= RID_WIN_FILEn ) - { - MenuBar* pMenu = GetMenuBar(); - PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - rtl::OUString aName = comphelper::string::remove(pWinMenu->GetItemText(nID), '~'); - AppWin* pWin = FindWin( aName ); - if ( pWin ) - pWin->ToTop(); - } - else if ( nID >= IDM_FILE_LRU1 && nID <= IDM_FILE_LRUn ) - { - String s = MENU2FILENAME( GetMenuBar()->GetPopupMenu(RID_APPFILE)->GetItemText(nID) ); - - AddToLRU( s ); - LoadFile( s ); - } - else - { - if( pWork ) - pWork->Command( CommandEvent( Point(), nID ) ); - } - } - return sal_True; -} - -sal_Bool BasicFrame::SaveAll() -{ - AppWin* p, *q = pWork; - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - 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 sal_False; - } - if ( q ) - q->ToTop(); - return sal_True; -} - -IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename ) -{ - return FindModuleWin( *pFilename ) != NULL; -} - -AppBasEd* BasicFrame::FindModuleWin( const String& rName ) -{ - AppWin* p; - 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); - } - return NULL; -} - -AppError* BasicFrame::FindErrorWin( const String& rName ) -{ - AppWin* p; - 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); - } - return NULL; -} - -AppWin* BasicFrame::FindWin( const String& rName ) -{ - AppWin* p; - 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( sal_uInt16 nWinId ) -{ - AppWin* p; - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - p = pList->at( i ); - if( p->GetWinId() == nWinId ) - return p; - } - return NULL; -} - -AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin ) -{ - AppWin* p; - for ( size_t i = 0, n = pList->size(); i < n ; i++ ) - { - p = pList->at( i ); - if( p == pMaybeWin ) - return p; - } - return NULL; -} - -IMPL_LINK( BasicFrame, WriteString, String*, pString ) -{ - if ( !pList->empty() ) - { - pList->back()->pDataEdit->ReplaceSelected( *pString ); - return sal_True; - } - else - return sal_False; -} - -class NewFileDialog : public FileDialog -{ -private: - String aLastPath; -public: - rtl::OString aFilterType; - NewFileDialog( Window* pParent, WinBits nWinStyle ):FileDialog( pParent, nWinStyle ){}; - virtual short Execute(); - virtual void FilterSelect(); -}; - -void NewFileDialog::FilterSelect() -{ - String aTemp = GetPath(); - if ( aLastPath.Len() == 0 ) - aLastPath = DirEntry( GetPath() ).GetPath().GetFull(); - if ( aLastPath.CompareIgnoreCaseToAscii( DirEntry( GetPath() ).GetPath().GetFull() ) != COMPARE_EQUAL ) - return; // User decides after he has changed the path - - String aCurFilter = GetCurFilter(); - sal_uInt16 nFilterNr = 0; - while ( nFilterNr < GetFilterCount() && aCurFilter != GetFilterName( nFilterNr ) ) - { - nFilterNr++; - } - aFilterType = rtl::OUStringToOString(GetFilterType(nFilterNr), RTL_TEXTENCODING_UTF8); - - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup( "Misc" ); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - aLastPath = rtl::OStringToOUString(aConf.ReadKey(aFilterType, aConf.ReadKey( "BaseDir")), RTL_TEXTENCODING_UTF8); - SetPath( aLastPath ); -} - -short NewFileDialog::Execute() -{ - sal_Bool bRet = (sal_Bool)FileDialog::Execute(); - if ( bRet ) - { - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup( "Misc" ); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - aConf.WriteKey( aFilterType, rtl::OUStringToOString(DirEntry(GetPath()).GetPath().GetFull(), RTL_TEXTENCODING_UTF8) ); - aConf.WriteKey( "LastFilterName", rtl::OUStringToOString(GetCurFilter(), RTL_TEXTENCODING_UTF8) ); - } - return bRet; -} - -sal_Bool BasicFrame::QueryFileName - (String& rName, FileType nFileType, sal_Bool bSave ) -{ - NewFileDialog aDlg( this, bSave ? WinBits( WB_SAVEAS ) : - WinBits( WB_OPEN ) ); - aDlg.SetText( String( SttResId( bSave ? IDS_SAVEDLG : IDS_LOADDLG ) ) ); - - if ( nFileType & FT_RESULT_FILE ) - { - aDlg.SetDefaultExt( String( SttResId( IDS_RESFILE ) ) ); - aDlg.AddFilter( String( SttResId( IDS_RESFILTER ) ), String( SttResId( IDS_RESFILE ) ) ); - aDlg.AddFilter( String( SttResId( IDS_TXTFILTER ) ), String( SttResId( IDS_TXTFILE ) ) ); - aDlg.SetCurFilter( SttResId( IDS_RESFILTER ) ); - } - - if ( nFileType & FT_BASIC_SOURCE ) - { - aDlg.SetDefaultExt( String( SttResId( IDS_NONAMEFILE ) ) ); - aDlg.AddFilter( String( SttResId( IDS_BASFILTER ) ), String( SttResId( IDS_NONAMEFILE ) ) ); - aDlg.AddFilter( String( SttResId( IDS_INCFILTER ) ), String( SttResId( IDS_INCFILE ) ) ); - aDlg.SetCurFilter( SttResId( IDS_BASFILTER ) ); - } - - if ( nFileType & FT_BASIC_LIBRARY ) - { - aDlg.SetDefaultExt( String( SttResId( IDS_LIBFILE ) ) ); - aDlg.AddFilter( String( SttResId( IDS_LIBFILTER ) ), String( SttResId( IDS_LIBFILE ) ) ); - aDlg.SetCurFilter( SttResId( IDS_LIBFILTER ) ); - } - - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup( "Misc" ); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - ByteString aFilter( aConf.ReadKey( "LastFilterName") ); - if ( aFilter.Len() ) - aDlg.SetCurFilter( String( aFilter, RTL_TEXTENCODING_UTF8 ) ); - else - aDlg.SetCurFilter( String( SttResId( IDS_BASFILTER ) ) ); - - aDlg.FilterSelect(); // Selects the last used path - if ( rName.Len() > 0 ) - aDlg.SetPath( rName ); - - if( aDlg.Execute() ) - { - rName = aDlg.GetPath(); - return sal_True; - } else return sal_False; -} - -sal_uInt16 BasicFrame::BreakHandler() -{ - bInBreak = sal_True; - SetAppMode( String( SttResId ( IDS_APPMODE_BREAK ) ) ); - - while( bInBreak ) { - GetpApp()->Yield(); - } - - SetAppMode( String( SttResId ( IDS_APPMODE_RUN ) ) ); - - return nFlags; -} - -void BasicFrame::LoadLibrary() -{ - String s; - if( QueryFileName( s, FT_BASIC_LIBRARY, sal_False ) ) - { - CloseAll(); - SvFileStream aStrm( s, STREAM_STD_READ ); - MyBasic* pNew = (MyBasic*) SbxBase::Load( aStrm ); - if( pNew && pNew->ISA( MyBasic ) ) - { - pBasic = pNew; - // Show all contents if existing - SbxArray* pMods = pBasic->GetModules(); - for( sal_uInt16 i = 0; i < pMods->Count(); i++ ) - { - SbModule* pMod = (SbModule*) pMods->Get( i ); - AppWin* p = new AppBasEd( this, pMod ); - p->Show(); - } - } - else - { - delete pNew; - ErrorBox( this, SttResId( IDS_READERROR ) ).Execute(); - } - } -} - -void BasicFrame::SaveLibrary() -{ - String s; - if( QueryFileName( s, FT_BASIC_LIBRARY, sal_True ) ) - { - SvFileStream aStrm( s, STREAM_STD_WRITE ); - if( !Basic().Store( aStrm ) ) - ErrorBox( this, SttResId( IDS_WRITEERROR ) ).Execute(); - } -} - -String BasicFrame::GenRealString( const String &aResString ) -{ - xub_StrLen nStart,nGleich = 0,nEnd = 0,nStartPos = 0; - String aType,aValue,aResult(aResString); - String aString; - xub_StrLen nInsertPos = 0; - sal_Bool bFound; - bFound = sal_False; - - while ( (nStart = aResult.Search(StartKenn,nStartPos)) != STRING_NOTFOUND && - (nGleich = aResult.SearchAscii("=",nStart+StartKenn.Len())) != STRING_NOTFOUND && - (nEnd = aResult.Search(EndKenn,nGleich+1)) != STRING_NOTFOUND) - { - aType = aResult.Copy(nStart,nGleich-nStart); - aValue = aResult.Copy(nGleich+1,nEnd-nGleich-1); - if ( aType.CompareTo(ResKenn) == COMPARE_EQUAL ) - { - if ( bFound ) - { - // insert results of previous resource - DBG_ASSERT( aString.SearchAscii( "($Arg" ) == STRING_NOTFOUND, "Argument missing in String"); - aResult.Insert( aString, nInsertPos ); - nStart = nStart + aString.Len(); - nEnd = nEnd + aString.Len(); - aString.Erase(); - } - - aString = String( SttResId( (sal_uInt16)(aValue.ToInt32()) ) ); - nInsertPos = nStart; - nStartPos = nStart; - aResult.Erase( nStart, nEnd-nStart+1 ); - bFound = sal_True; - } - else if ( aType.Search(BaseArgKenn) == 0 ) // Starts with BaseArgKenn - { - // TODO: What the hell is that for?? - 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; - aResult.Erase( nStart, nEnd-nStart+1 ); - } - else - { - SAL_WARN( - "basic", - "Unknown replacement in String: " - << rtl::OUString(aResult.Copy(nStart, nEnd - nStart))); - nStartPos = nStartPos + StartKenn.Len(); - } - } - if ( bFound ) - { - DBG_ASSERT( aString.SearchAscii( "($Arg" ) == STRING_NOTFOUND, "Argument missing in String"); - aResult.Insert( aString, nInsertPos ); - } - return aResult; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx deleted file mode 100644 index b703cd501bfc..000000000000 --- a/basic/source/app/app.hxx +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASICAPP_HXX -#define _BASICAPP_HXX - -#include <vcl/svapp.hxx> -#include <vcl/help.hxx> -#include <vcl/menu.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/timer.hxx> -#include <svl/brdcst.hxx> -#include <svl/lstner.hxx> - -class BasicFrame; -#include <basic/mybasic.hxx> -#include <vector> - -class AppWin; -class AppEdit; -class AppBasEd; -class MsgEdit; -class AppError; -class StatusLine; -struct TTLogMsg; - -typedef ::std::vector< AppWin* > EditList; - -class BasicApp : public Application { - short nWait; // wait counter -public: - BasicFrame* pFrame; // frame window - Accelerator* pMainAccel; // accelerators - - int Main( ); - - void LoadIniFile(); - void SetFocus(); - void Wait( sal_Bool ); - DECL_LINK( LateInit, void * ); - -#ifdef DBG_UTIL - DbgPrintLine DbgPrintMsgBox; -#endif -}; - - -typedef sal_uInt16 FileType; - -#define FT_NO_FILE (FileType)0x00 // An error has occurred ... -#define FT_BASIC_SOURCE (FileType)0x01 -#define FT_BASIC_INCLUDE (FileType)0x02 -#define FT_RESULT_FILE (FileType)0x04 -#define FT_RESULT_FILE_TXT (FileType)0x08 -#define FT_BASIC_LIBRARY (FileType)0x10 - -struct WinInfoRec; -class DisplayHidDlg; - -class FloatingExecutionStatus; - -class BasicFrame : public WorkWindow, public SfxBroadcaster, public SfxListener -{ -using SystemWindow::Notify; -using Window::Command; - - virtual sal_Bool Close(); - sal_Bool CloseAll(); // Close all windows - sal_Bool CompileAll(); // Compile all texts - AutoTimer aLineNum; // Show the line numbers - virtual void Resize(); - virtual void Move(); - virtual void GetFocus(); - void LoadLibrary(); - void SaveLibrary(); - sal_Bool bIsAutoRun; - DisplayHidDlg* pDisplayHidDlg; - - - SbxVariable *pEditVar; - - - - Timer aCheckFiles; // Checks the files for changes - sal_Bool bAutoReload; - sal_Bool bAutoSave; - DECL_LINK( CheckAllFiles, Timer* ); - - MyBasicRef pBasic; // BASIC-Engine - - String aAppName; // Title bar content - String aAppFile; // AppName AppFile [AppMode] - String aAppMode; - void UpdateTitle(); - DECL_LINK( CloseButtonClick, void* ); - DECL_LINK( FloatButtonClick, void* ); - DECL_LINK( HideButtonClick, void* ); - - FloatingExecutionStatus *pExecutionStatus; - -public: - sal_Bool IsAutoRun(); - void SetAutoRun( sal_Bool bAuto ); - sal_Bool bInBreak; // sal_True if in Break-Handler - StatusLine* pStatus; // Status line - EditList* pList; // List of edit windows - AppWin* pWork; // Current edit window - sal_Bool bDisas; // sal_True: disassemble - sal_uInt16 nFlags; // Debugging-Flags - sal_uInt16 nMaximizedWindows; // Number of maximized windows - void FocusWindow( AppWin *pWin ); - void WinMax_Restore(); - void WinShow_Hide(); - void RemoveWindow( AppWin *pWin ); - void AddWindow( AppWin *pWin ); - void WindowRenamed( AppWin *pWin ); - - BasicFrame(); - ~BasicFrame(); - MyBasic& Basic() { return *pBasic; } - void AddToLRU(String const& aFile); - void LoadLRU(); - DECL_LINK( InitMenu, Menu * ); - DECL_LINK( DeInitMenu, Menu * ); - DECL_LINK( HighlightMenu, Menu * ); - DECL_LINK( MenuCommand, Menu * ); - DECL_LINK( Accel, Accelerator * ); - DECL_LINK( ShowLineNr, AutoTimer * ); - MsgEdit* GetMsgTree( String aLogFileName ); - DECL_LINK( Log, TTLogMsg * ); - DECL_LINK( WinInfo, WinInfoRec * ); - sal_Bool LoadFile( String aFilename ); - long Command( short,sal_Bool=sal_False ); // Command handler - virtual void Command( const CommandEvent& rCEvt ); // Command handler - sal_Bool SaveAll(); // Save all windows - sal_Bool QueryFileName( String& rName, FileType nFileType, sal_Bool bSave ); // Query for filename - DECL_LINK( ModuleWinExists, String* ); - DECL_LINK( WriteString, String* ); - AppBasEd* CreateModuleWin( SbModule* pMod ); - AppBasEd* FindModuleWin( const String& ); - AppError* FindErrorWin( const String& ); - AppWin* FindWin( const String& ); - AppWin* FindWin( sal_uInt16 nWinId ); - AppWin* IsWinValid( AppWin* pMaybeWin ); - sal_uInt16 BreakHandler(); // Break-Handler-Callback - - void SetEditVar( SbxVariable *pVar ){ pEditVar = pVar;} - SbxVariable* GetEditVar(){ return pEditVar;} - sal_Bool IsAutoReload() { return bAutoReload; } - sal_Bool IsAutoSave() { return bAutoSave; } - void LoadIniFile(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - void SetAppMode( const String &aNewMode ){ aAppMode = aNewMode; UpdateTitle(); } - - String GenRealString( const String &aResString ); - Rectangle GetInnerRect() const; - -}; - -extern BasicApp aBasicApp; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx deleted file mode 100644 index 808c517a7220..000000000000 --- a/basic/source/app/appbased.cxx +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <vcl/msgbox.hxx> -#include <basic/sbx.hxx> -#include <svtools/texteng.hxx> -#include <svtools/textview.hxx> -#include <basic/sbmeth.hxx> -#include <svtools/stringtransfer.hxx> - -#include <basic/ttstrhlp.hxx> - -#include "basic.hrc" -#include "status.hxx" -#include "appbased.hxx" -#include "brkpnts.hxx" -#include <basic/testtool.hxx> // defines for Syntaxhighlighting -#include "basrid.hxx" - - -TYPEINIT1(AppBasEd,AppEdit); -AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p ) -: AppEdit( pParent ) -, pBreakpoints( NULL ) -{ - pBreakpoints = new BreakpointWindow( this ); - pBreakpoints->SetFont( ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->GetFont() ); - - pBreakpoints->Show(); - - ((TextEdit*)pDataEdit)->GetTextEditImp().pTextView->SetAutoIndentMode( sal_True ); - ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetMaxTextLen( STRING_MAXLEN ); - ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( sal_True ); - ((TextEdit*)pDataEdit)->SaveAsUTF8( sal_True ); - - String aEmpty; - - pMod = p; - if( !pMod ) - { - String aModName = *pNoName; - aModName += String::CreateFromInt32( nCount ); - pMod = pFrame->Basic().MakeModule( aModName, aEmpty ); - } - bCompiled = pMod->IsCompiled(); - - pBreakpoints->SetModule( pMod ); - - SetText( pMod->GetName() ); - pDataEdit->SetText( pMod->GetSource() ); - - // If a module was given, load the source from harddisk - if ( p ) - LoadSource(); - - // Dispatch event AFTER loading the sourcecode - ((TextEdit*)pDataEdit)->SetBreakpointWindow( pBreakpoints ); - - // Touch compile flag - pDataEdit->SetModifyHdl( LINK( this, AppBasEd, EditChange ) ); - -} - -AppBasEd::~AppBasEd() -{ - pBreakpoints->SaveBreakpoints( GetText() ); - delete pBreakpoints; - pMod->SetName( CUniString("--").Append( pMod->GetName() ) ); -} - -void AppBasEd::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - const SfxSimpleHint* p = PTR_CAST(SfxSimpleHint,&rHint); - if( p ) - { - sal_uIntPtr nHintId = p->GetId(); - if( nHintId == SBX_HINT_LANGUAGE_EXTENSION_LOADED ) - { - ((TextEdit*)pDataEdit)->GetTextEditImp().InvalidateSyntaxHighlight(); - } - } -} - -FileType AppBasEd::GetFileType() -{ - return FT_BASIC_SOURCE; -} - -IMPL_LINK_INLINE_START( AppBasEd, EditChange, void *, p ) -{ - (void) p; /* avoid warning about unused parameter */ - bCompiled = sal_False; - return sal_True; -} -IMPL_LINK_INLINE_END( AppBasEd, EditChange, void *, p ) - -// Set up the menu -long AppBasEd::InitMenu( Menu* pMenu ) -{ - AppEdit::InitMenu (pMenu ); - sal_Bool bRunning = pFrame->Basic().IsRunning(); - pMenu->EnableItem( RID_RUNCOMPILE, !bCompiled && !bRunning ); - return sal_True; -} - -long AppBasEd::DeInitMenu( Menu* pMenu ) -{ - AppEdit::DeInitMenu (pMenu ); - pMenu->EnableItem( RID_RUNCOMPILE ); - return sal_True; -} - -// Menu Handler -void AppBasEd::Command( const CommandEvent& rCEvt ) -{ - switch( rCEvt.GetCommand() ) { - case RID_TOGLEBRKPNT: - ((TextEdit*)pDataEdit)->GetBreakpointWindow()->ToggleBreakpoint( pDataEdit->GetLineNr() ); - break; - default: - AppEdit::Command( rCEvt ); - } -} - -void AppBasEd::Resize() -{ - if( pDataEdit ) - { - AppEdit::Resize(); - - // Insert breakpoint window - Size aEditSize = pDataEdit->GetSizePixel(); - Point aEditPos = pDataEdit->GetPosPixel(); - - pBreakpoints->SetPosPixel( aEditPos ); - - aEditPos.X() += BREAKPOINTSWIDTH; - pDataEdit->SetPosPixel( aEditPos ); - aEditSize.Width() -= BREAKPOINTSWIDTH; - pDataEdit->SetSizePixel( aEditSize ); - - aEditSize.Width() = BREAKPOINTSWIDTH; - pBreakpoints->SetSizePixel( aEditSize ); - } -} - -void AppBasEd::PostLoad() -{ - pMod->SetName( GetText() ); - pMod->Clear(); - pMod->SetSource( pDataEdit->GetText() ); - bCompiled = sal_False; // because the code might have changed in the meantime - AppEdit::PostLoad(); - - pBreakpoints->LoadBreakpoints( GetText() ); -} - -sal_uInt16 AppBasEd::ImplSave() -{ - pBreakpoints->SaveBreakpoints( GetText() ); - return AppEdit::ImplSave(); -} - -void AppBasEd::Reload() -{ - TextSelection aSelMemo = pDataEdit->GetSelection(); - LoadSource(); - pDataEdit->SetSelection( aSelMemo ); -} - -// Reload source code file after change -void AppBasEd::LoadSource() -{ - sal_Bool bErr; - - String aName = pMod->GetName(); - bErr = !pDataEdit->Load( aName ); - pBreakpoints->LoadBreakpoints( GetText() ); - if( bErr ) - ErrorBox( this, SttResId( IDS_READERROR ) ).Execute(); - else - UpdateFileInfo( HAS_BEEN_LOADED ); - bCompiled = sal_False; // because the code might have changed in the meantime -} - -// Save as (new name) -void AppBasEd::PostSaveAs() -{ - pMod->SetName( GetText() ); - AppEdit::PostSaveAs(); -} - -// Compile -sal_Bool AppBasEd::Compile() -{ - if( !pDataEdit->HasText() || bCompiled ) - return sal_True; - pMod->SetSource( pDataEdit->GetText() ); - sal_Bool bRes = sal_False; - if( pFrame->Basic().Compile( pMod ) ) - { - bRes = sal_True; - if( pFrame->bDisas ) - Disassemble(); - TextSelection aSel( pDataEdit->GetSelection() ); - String aString; - pFrame->pStatus->Message( aString ); - if( aSel.HasRange() ) - aSel.GetStart() = aSel.GetEnd(), pDataEdit->SetSelection( aSel ); - - pBreakpoints->SetBPsInModule(); - } - else - { - BasicError* pErr = pFrame->Basic().FirstError(); - if( pErr ) pErr->Show(); - } - return bCompiled = bRes; -} - -void AppBasEd::Disassemble() -{ - String aText; - if( pFrame->Basic().Disassemble( pMod, aText ) ) - ::svt::OStringTransfer::CopyString( aText, this ); -} - -void AppBasEd::Run() -{ - pFrame->Basic().Reset(); - SbxArray* pAllModules = pFrame->Basic().GetModules(); - for (sal_uInt16 i = 0; i < pAllModules->Count(); i++) - { - if ( (pAllModules->Get(i)->GetName()).Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) - { - // Little hack to get around basic - SbxVariableRef pRMod = pAllModules->Get(i); - pFrame->Basic().Remove(pRMod); - i--; - } - } - - SbMethod* pMain = (SbMethod*) pMod->Find( CUniString("Main"), SbxCLASS_METHOD ); - if( pMain ) - { - pMain->SetDebugFlags( pFrame->nFlags ); - // Triggers a call! - pFrame->SetAppMode( String( SttResId( IDS_APPMODE_RUN ) ) ); - pMain->Run(); - if (aBasicApp.pFrame) - { - BasicError* pErr = aBasicApp.pFrame->Basic().FirstError(); - if( pErr ) - pErr->Show(); - aBasicApp.pFrame->SetAppMode( String() ); - } - pMain->SetDebugFlags( 0 ); - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx deleted file mode 100644 index 22e9afa37bc1..000000000000 --- a/basic/source/app/appbased.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _APPBASED_HXX -#define _APPBASED_HXX - -#include <basic/sbmod.hxx> -#include "appedit.hxx" -#include "textedit.hxx" - -class BasicFrame; -class BreakpointWindow; - -class AppBasEd : public AppEdit { // Editor-Window: -using DockingWindow::Notify; - - SbModuleRef pMod; // compile module - sal_Bool bCompiled; // sal_True if compiled -protected: - DECL_LINK( EditChange, void * ); -#define BREAKPOINTSWIDTH 15 - BreakpointWindow *pBreakpoints; - virtual sal_uInt16 ImplSave(); // Save file - -public: - TYPEINFO(); - AppBasEd( BasicFrame*, SbModule* ); - ~AppBasEd(); - FileType GetFileType(); // Returns Filetype - SbModule* GetModule() { return pMod; } - long InitMenu( Menu* ); // Initialision of the menus - virtual long DeInitMenu( Menu* ); // Reset to enable all shortcuts - virtual void Command( const CommandEvent& rCEvt ); // Command handler - virtual void Resize(); // Includes the breakpoint bar - virtual void PostLoad(); // Set source of module - virtual void PostSaveAs(); // Postprocess of module... - void Reload(); - void LoadSource(); // Load source for object - sal_Bool Compile(); // Compile text - void Run(); // Run image - void Disassemble(); // Disassemble image - const String& GetModName() const { return pMod->GetName(); } - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx deleted file mode 100644 index 48f7814857d4..000000000000 --- a/basic/source/app/appedit.cxx +++ /dev/null @@ -1,291 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/config.hxx> -#include <svtools/ctrltool.hxx> -#include <svtools/textview.hxx> -#include <svtools/texteng.hxx> -#include <svl/undo.hxx> - -#include <basic/ttstrhlp.hxx> - -#include "basic.hrc" -#include "appedit.hxx" -#include "brkpnts.hxx" - -TYPEINIT1(AppEdit,AppWin); -AppEdit::AppEdit( BasicFrame* pParent ) -: AppWin( pParent ) -, pVScroll( NULL ) -, pHScroll( NULL ) -, nCurTextWidth(5) -{ - String aEmpty; - // perhaps load the Untitled-String: - - pDataEdit = new TextEdit( this, WB_LEFT ); - LoadIniFile(); - - pDataEdit->SetText( aEmpty ); - - pDataEdit->Show(); - - pVScroll = new ScrollBar( this, WB_VSCROLL|WB_DRAG ); - pVScroll->Show(); - pVScroll->SetScrollHdl( LINK( this, AppEdit, Scroll ) ); - pHScroll = new ScrollBar( this, WB_HSCROLL|WB_DRAG ); - pHScroll->Show(); - pHScroll->SetScrollHdl( LINK( this, AppEdit, Scroll ) ); - - InitScrollBars(); -} - -AppEdit::~AppEdit() -{ - DataEdit *pHold = pDataEdit; - pDataEdit = NULL; - delete pHold; - delete pHScroll; - delete pVScroll; -} - -void AppEdit::LoadIniFile() -{ - TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; - sal_Bool bWasModified = pTextView->GetTextEngine()->IsModified(); - pTextView->GetTextEngine()->SetModified( sal_False ); - - FontList aFontList( pFrame ); // Just some Window is needed - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("Misc"); - String aFontName = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8); - String aFontStyle = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8); - String aFontSize = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8); - Font aFont = aFontList.Get( aFontName, aFontStyle ); - sal_uIntPtr nFontSize = aFontSize.ToInt32(); - aFont.SetHeight( nFontSize ); - -#if OSL_DEBUG_LEVEL > 1 - { - Font aFont2( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0, pFrame )); - } -#endif - aFont.SetTransparent( sal_False ); - pDataEdit->SetFont( aFont ); - - if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() ) - { - ((TextEdit*)pDataEdit)->GetBreakpointWindow()->SetFont( aFont ); - ((TextEdit*)pDataEdit)->GetBreakpointWindow()->Invalidate(); - } - - pTextView->GetTextEngine()->SetModified( bWasModified ); // Perhaps reset the flag -} - -void AppEdit::Command( const CommandEvent& rCEvt ) -{ - switch( rCEvt.GetCommand() ) { - case COMMAND_WHEEL: - { - HandleScrollCommand( rCEvt, pHScroll, pVScroll ); - } - break; - default: - AppWin::Command( rCEvt ); - } -} - - -IMPL_LINK( AppEdit, Scroll, ScrollBar*, pScroll ) -{ - (void) pScroll; /* avoid warning about unused parameter */ - if ( !pHScroll || !pVScroll ) - return 0; - - TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; - pTextView->SetStartDocPos( Point( pHScroll->GetThumbPos(), pVScroll->GetThumbPos() ) ); - pTextView->Invalidate(); - - if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() ) - ((TextEdit*)pDataEdit)->GetBreakpointWindow()->Scroll( 0, ((TextEdit*)pDataEdit)->GetBreakpointWindow()->GetCurYOffset() - pTextView->GetStartDocPos().Y() ); - - return 0L; -} - - -void AppEdit::InitScrollBars() -{ - if ( !pHScroll || !pVScroll ) - return; - - TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; - - SetScrollBarRanges(); - - Size aOutSz( pTextView->GetWindow()->GetOutputSizePixel() ); - pVScroll->SetVisibleSize( aOutSz.Height() ); - pVScroll->SetPageSize( aOutSz.Height() * 8 / 10 ); - pVScroll->SetLineSize( GetTextHeight() +2 ); // +2 is empirical. don't know why - pVScroll->SetThumbPos( pTextView->GetStartDocPos().Y() ); - pVScroll->Show(); - - pHScroll->SetVisibleSize( aOutSz.Width() ); - pHScroll->SetPageSize( aOutSz.Width() * 8 / 10 ); - pHScroll->SetLineSize( GetTextWidth( CUniString("x") ) ); - pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); - pHScroll->Show(); -} - -void AppEdit::SetScrollBarRanges() -{ - // Extra-Method, not InitScrollBars, but for EditEngine-Events. - - if ( !pHScroll || !pVScroll ) - return; - - pHScroll->SetRange( Range( 0, nCurTextWidth ) ); - pVScroll->SetRange( Range( 0, ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetTextHeight() ) ); -} - - - -sal_uInt16 AppEdit::GetLineNr() -{ - return pDataEdit->GetLineNr(); -} - -FileType AppEdit::GetFileType() -{ - return FT_BASIC_SOURCE; -} - -// Set up the menu -long AppEdit::InitMenu( Menu* pMenu ) -{ - AppWin::InitMenu (pMenu ); - - if( pDataEdit ) - { - size_t UndoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetUndoActionCount(); - size_t RedoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetRedoActionCount(); - - pMenu->EnableItem( RID_EDITUNDO, UndoCount > 0 ); - pMenu->EnableItem( RID_EDITREDO, RedoCount > 0 ); - } - - return sal_True; -} - -long AppEdit::DeInitMenu( Menu* pMenu ) -{ - AppWin::DeInitMenu (pMenu ); - - pMenu->EnableItem( RID_EDITUNDO ); - pMenu->EnableItem( RID_EDITREDO ); - - return sal_True; -} - -void AppEdit::Resize() -{ - if( !pDataEdit ) - return; - - Point rHStart,rVStart; - Size rHSize,rVSize; - Size rNewSize( GetOutputSizePixel() ); - - if ( pHScroll ) - { - rHSize = pHScroll->GetSizePixel(); - sal_uIntPtr nHieght = rHSize.Height(); - rNewSize.Height() -= nHieght; - rHStart.Y() = rNewSize.Height(); - } - - if ( pVScroll ) - { - rVSize = pVScroll->GetSizePixel(); - sal_uIntPtr nWidth = rVSize.Width(); - rNewSize.Width() -= nWidth; - rVStart.X() = rNewSize.Width(); - } - - rHSize.Width() = rNewSize.Width(); - rVSize.Height() = rNewSize.Height(); - - if ( pHScroll ) - { - pHScroll->SetPosPixel( rHStart ); - pHScroll->SetSizePixel( rHSize ); - } - - if ( pVScroll ) - { - pVScroll->SetPosPixel( rVStart ); - pVScroll->SetSizePixel( rVSize ); - } - pDataEdit->SetPosPixel( Point() ); - pDataEdit->SetSizePixel( rNewSize ); - - - TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; - long nVisY = pTextView->GetStartDocPos().Y(); - pTextView->ShowCursor(); - Size aOutSz( pTextView->GetWindow()->GetOutputSizePixel() ); - long nMaxVisAreaStart = pTextView->GetTextEngine()->GetTextHeight() - aOutSz.Height(); - if ( nMaxVisAreaStart < 0 ) - nMaxVisAreaStart = 0; - if ( pTextView->GetStartDocPos().Y() > nMaxVisAreaStart ) - { - Point aStartDocPos( pTextView->GetStartDocPos() ); - aStartDocPos.Y() = nMaxVisAreaStart; - pTextView->SetStartDocPos( aStartDocPos ); - pTextView->ShowCursor(); - } - InitScrollBars(); - if ( nVisY != pTextView->GetStartDocPos().Y() ) - pTextView->GetWindow()->Invalidate(); - -} - -void AppEdit::PostLoad() -{ -} - -void AppEdit::PostSaveAs() -{ -} - -void AppEdit::Highlight( sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 ) -{ - ((TextEdit*)pDataEdit)->Highlight( nLine, nCol1, nCol2 ); - ToTop(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx deleted file mode 100644 index 67cb4337c6b0..000000000000 --- a/basic/source/app/appedit.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _APPEDIT_HXX -#define _APPEDIT_HXX - -#include <vcl/scrbar.hxx> - -#include "appwin.hxx" -#include "textedit.hxx" - -class BasicFrame; - -class AppEdit : public AppWin { // Editor window -using Window::Scroll; - -public: - ScrollBar *pVScroll; - ScrollBar *pHScroll; - void SetScrollBarRanges(); - sal_uIntPtr nCurTextWidth; -private: - void InitScrollBars(); -protected: - DECL_LINK( Scroll, ScrollBar* ); -public: - TYPEINFO(); - AppEdit( BasicFrame* ); - ~AppEdit(); - sal_uInt16 GetLineNr(); // Current line number - FileType GetFileType(); // Returns the file type - virtual long InitMenu( Menu* ); // Inits the menu - virtual long DeInitMenu( Menu* ); // Reset to enable all Shortcuts - virtual void Command( const CommandEvent& rCEvt ); // Command Handler - void Resize(); - void PostLoad(); - void PostSaveAs(); - void Mark( short, short, short ); // Select text - void Highlight( sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 ); - virtual sal_Bool ReloadAllowed(){ return !StarBASIC::IsRunning(); } - virtual void LoadIniFile(); // (re)load ini file after change -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx deleted file mode 100644 index 0b6be684e492..000000000000 --- a/basic/source/app/apperror.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/config.hxx> -#include <svtools/ctrltool.hxx> -#include <basic/ttstrhlp.hxx> -#include "basic.hrc" -#include "apperror.hxx" - -TYPEINIT1(AppError,AppWin); -AppError::AppError( BasicFrame* pParent, String aFileName ) -: AppWin( pParent ) -{ - SetText( aFileName ); // Call before MsgEdit!! - pDataEdit = new MsgEdit( this, pParent, WB_HSCROLL | WB_VSCROLL | WB_LEFT ); - LoadIniFile(); - bHasFile = pDataEdit->Load( aFileName ); - DirEntry aEntry( aFileName ); - UpdateFileInfo( HAS_BEEN_LOADED ); - - pDataEdit->Show(); - GrabFocus(); -} - -AppError::~AppError() -{ - DataEdit* pTemp = pDataEdit; - pDataEdit = NULL; - delete pTemp; -} - -// Set up the menu -long AppError::InitMenu( Menu* pMenu ) -{ - AppWin::InitMenu (pMenu ); - - pMenu->EnableItem( RID_EDITUNDO, sal_False ); - pMenu->EnableItem( RID_EDITREDO, sal_False ); - - return sal_True; -} - -long AppError::DeInitMenu( Menu* pMenu ) -{ - AppWin::DeInitMenu (pMenu ); - - pMenu->EnableItem( RID_EDITUNDO ); - pMenu->EnableItem( RID_EDITREDO ); - - return sal_True; -} - -sal_uInt16 AppError::GetLineNr(){ return pDataEdit->GetLineNr(); } - -FileType AppError::GetFileType() -{ - return FT_RESULT_FILE; -} - -void AppError::LoadIniFile() -{ - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("Misc"); - rtl::OString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - aBaseDir = DirEntry( aConf.ReadKey("BaseDir") ); - - - FontList aFontList( pFrame ); // Just some Window is needed - aConf.SetGroup("Misc"); - String aFontName = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8); - String aFontStyle = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8); - String aFontSize = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8); - Font aFont = aFontList.Get( aFontName, aFontStyle ); - sal_uIntPtr nFontSize = aFontSize.ToInt32(); - aFont.SetHeight( nFontSize ); - - aFont.SetTransparent( sal_False ); - pDataEdit->SetFont( aFont ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx deleted file mode 100644 index a56645a262d8..000000000000 --- a/basic/source/app/apperror.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <appwin.hxx> -#include <msgedit.hxx> - -class AppError : public AppWin -{ -protected: - DECL_LINK( EditChange, MsgEdit * ); -public: - TYPEINFO(); - AppError( BasicFrame*, String ); - ~AppError(); - virtual long InitMenu( Menu* ); - virtual long DeInitMenu( Menu* ); - sal_uInt16 GetLineNr(); - FileType GetFileType(); - MsgEdit* GetMsgTree() { return ((MsgEdit*)pDataEdit); } - virtual sal_Bool ReloadAllowed(){ return !StarBASIC::IsRunning(); } - virtual void LoadIniFile(); // (re)load ini file after change - DirEntry aBaseDir; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx deleted file mode 100644 index d19da42822f0..000000000000 --- a/basic/source/app/appwin.cxx +++ /dev/null @@ -1,632 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <stdio.h> -#include <vcl/msgbox.hxx> -#include <tools/fsys.hxx> -#include <svtools/stringtransfer.hxx> - -#include "basic.hrc" -#include "app.hxx" -#include <basic/mybasic.hxx> -#include "status.hxx" -#include "appwin.hxx" -#include "dataedit.hxx" -#include "dialogs.hxx" -#include "basrid.hxx" - -String *AppWin::pNoName = NULL; // contains the "Untitled"-String -short AppWin::nNumber = 0; // consecutive number -short AppWin::nCount = 0; // number of edit windows - -TYPEINIT0(AppWin); -AppWin::AppWin( BasicFrame* pParent ) -: DockingWindow( pParent, WB_SIZEMOVE | WB_CLOSEABLE | WB_PINABLE ) -, nSkipReload(0) -, bHasFile( sal_False ) -, bReloadAborted( sal_False ) -, pFrame( pParent ) -, bFind( sal_True ) -, pDataEdit(NULL) -{ - // Load the Untitled string if not yet loaded - if( !pNoName ) - pNoName = new String( SttResId( IDS_NONAME ) ); - nCount++; - - // Get maximized state from current window - sal_uInt16 nInitialWinState; - if ( pFrame->pWork ) - { - nInitialWinState = pFrame->pWork->GetWinState(); - nInitialWinState &= TT_WIN_STATE_MAX | TT_WIN_STATE_FLOAT; - } - else - nInitialWinState = TT_WIN_STATE_MAX; - - StartListening( *pFrame ); - pFrame->AddWindow( this ); - - ShowTitleButton( TITLE_BUTTON_DOCKING ); - ShowTitleButton( TITLE_BUTTON_HIDE ); - SetActivateMode( ACTIVATE_MODE_GRABFOCUS ); - - Cascade( nCount ); - if ( TT_WIN_STATE_MAX == nInitialWinState ) - Maximize(); -} - -AppWin::~AppWin() -{ - nCount--; - pFrame->RemoveWindow( this ); - pFrame = NULL; // Set to stop setting window text after BasicRun -} - -void AppWin::SetText( const XubString& rStr ) -{ - DockingWindow::SetText( rStr ); - pFrame->WindowRenamed( this ); -} - -void AppWin::TitleButtonClick( sal_uInt16 nButton ) -{ - if ( TITLE_BUTTON_DOCKING == nButton ) - if ( TT_WIN_STATE_MAX != nWinState ) - Maximize(); - else - Restore(); - else // if ( TITLE_BUTTON_HIDE == nButton ) - Minimize( sal_True ); -} - -void AppWin::Maximize() -{ - if ( TT_WIN_STATE_MAX != nWinState ) - { - nNormalPos = GetPosPixel(); - nNormalSize = GetSizePixel(); - - SetFloatingMode( sal_False ); - - pFrame->nMaximizedWindows++; - nWinState = TT_WIN_STATE_MAX; - } - - Size aSize = pFrame->GetInnerRect().GetSize(); - aSize.Height() -= 2; - aSize.Width() -= 2; - SetSizePixel( aSize ); - SetPosPixel( Point( 1,1 ) ); - pFrame->WinMax_Restore(); -} - -void AppWin::Restore() -{ - SetFloatingMode( sal_True ); - SetPosSizePixel( nNormalPos, nNormalSize ); - - if ( TT_WIN_STATE_MAX == nWinState ) - pFrame->nMaximizedWindows--; - - nWinState = TT_WIN_STATE_FLOAT; - pFrame->WinMax_Restore(); -} - -void AppWin::Minimize( sal_Bool bMinimize ) -{ - if ( bMinimize ) - nWinState |= TT_WIN_STATE_HIDE; - else - nWinState &= ~TT_WIN_STATE_HIDE; - pFrame->WinMax_Restore(); -} - -void AppWin::Cascade( sal_uInt16 nNr ) -{ - Restore(); - - nNr--; - nNr %= 10; - nNr++; - - sal_Int32 nTitleHeight; - { - sal_Int32 nDummy1, nDummy2, nDummy3; - pFrame->GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); - } - - Size aWinSize = pFrame->GetOutputSizePixel(); - aWinSize.Width() -= aWinSize.Width() / 5; // reduce to 80 % - aWinSize.Height() -= nTitleHeight * nNr; // snip height to appropriate value - aWinSize.Height() -= 2; - - Point nPos( nTitleHeight * nNr, nTitleHeight * nNr ); - - SetPosSizePixel( nPos, aWinSize ); -} - -void AppWin::RequestHelp( const HelpEvent& ) -{ - Help(); -} - -void AppWin::Help() -{ - String s = pDataEdit->GetSelected(); - if( s.Len() > 0 ) - { - // Trim leading whitespaces - while( s.GetChar(0) == ' ' ) - s.Erase( 0, 1 ); - } - else - { - } -} - -void AppWin::Resize() -{ - if( pDataEdit ) - { - pDataEdit->SetPosPixel( Point( 0, 0 ) ); - pDataEdit->SetSizePixel( GetOutputSizePixel() ); - } -} - -void AppWin::GetFocus() -{ - pFrame->FocusWindow( this ); - if( pDataEdit ) // GetFocus is called by the destructor, so this check - { - pDataEdit->GrabFocus(); - } -} - -long AppWin::PreNotify( NotifyEvent& rNEvt ) -{ - - if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) - Activate(); - if ( rNEvt.GetType() == EVENT_GETFOCUS ) - if ( pFrame->pList->back() != this ) - Activate(); - return sal_False; // the event shall continue to be handled -} - -void AppWin::Activate() -{ - GrabFocus(); -} - -// Set up the menu -long AppWin::InitMenu( Menu* pMenu ) -{ - - ::rtl::OUString aTemp; - sal_Bool bMarked; - if( pDataEdit ) - { - TextSelection r = pDataEdit->GetSelection(); - bMarked = r.HasRange(); - } - else - bMarked = sal_False; - pMenu->EnableItem( RID_EDITREPEAT, (aFind.Len() != 0 ) ); - pMenu->EnableItem( RID_EDITCUT, bMarked ); - pMenu->EnableItem( RID_EDITCOPY, bMarked ); - pMenu->EnableItem( RID_EDITPASTE, ( ::svt::OStringTransfer::PasteString( aTemp, this ) ) ); - pMenu->EnableItem( RID_EDITDEL, bMarked ); - - sal_Bool bHasText; - if( pDataEdit ) - bHasText = pDataEdit->HasText(); - else - bHasText = sal_False; - sal_Bool bRunning = pFrame->Basic().IsRunning(); - sal_Bool bCanExecute = sal_Bool( (!bRunning && bHasText) || pFrame->bInBreak ); - pMenu->EnableItem( RID_RUNSTART, bCanExecute ); - pMenu->EnableItem( RID_RUNBREAK, bRunning && !pFrame->bInBreak); - pMenu->EnableItem( RID_RUNSTOP, bRunning ); - pMenu->EnableItem( RID_RUNTOCURSOR, bCanExecute ); - pMenu->EnableItem( RID_RUNSTEPINTO, bCanExecute ); - pMenu->EnableItem( RID_RUNSTEPOVER, bCanExecute ); - return sal_True; -} - -long AppWin::DeInitMenu( Menu* pMenu ) -{ - pMenu->EnableItem( RID_EDITREPEAT ); - pMenu->EnableItem( RID_EDITCUT ); - pMenu->EnableItem( RID_EDITCOPY ); - pMenu->EnableItem( RID_EDITPASTE ); - pMenu->EnableItem( RID_EDITDEL ); - - pMenu->EnableItem( RID_RUNSTART ); - pMenu->EnableItem( RID_RUNBREAK ); - pMenu->EnableItem( RID_RUNSTOP ); - pMenu->EnableItem( RID_RUNTOCURSOR ); - pMenu->EnableItem( RID_RUNSTEPINTO ); - pMenu->EnableItem( RID_RUNSTEPOVER ); - return sal_True; -} - -// Menu Handler - -void AppWin::Command( const CommandEvent& rCEvt ) -{ - TextSelection r = pDataEdit->GetSelection(); - sal_Bool bHasMark = r.HasRange(); - switch( rCEvt.GetCommand() ) { - case RID_FILESAVE: - QuerySave( QUERY_DISK_CHANGED | SAVE_NOT_DIRTY ); break; - case RID_FILESAVEAS: - SaveAs(); break; - case RID_EDITSEARCH: - Find(); break; - case RID_EDITREPLACE: - Replace(); break; - case RID_EDITREPEAT: - Repeat(); break; - case RID_EDITCUT: - if( bHasMark ) - pDataEdit->Cut(); - break; - case RID_EDITCOPY: - if( bHasMark ) - pDataEdit->Copy(); - break; - case RID_EDITPASTE: - { - ::rtl::OUString aTemp; - if( ::svt::OStringTransfer::PasteString( aTemp, this ) ) - pDataEdit->Paste(); - } - break; - case RID_EDITDEL: - pDataEdit->Delete(); - break; - case RID_EDITUNDO: - pDataEdit->Undo(); - break; - case RID_EDITREDO: - pDataEdit->Redo(); - break; - case COMMAND_CONTEXTMENU: - { - PopupMenu *pKontext = NULL; - pDataEdit->BuildKontextMenu( pKontext ); - if ( pKontext ) - { - sal_uInt16 nRes = pKontext->Execute( this, GetPointerPosPixel() ); - if ( nRes ) - pFrame->Command( nRes ); - delete pKontext; - } - } - break; - } -} - - -sal_Bool AppWin::IsSkipReload() -{ - return nSkipReload != 0; -} - -void AppWin::SkipReload( sal_Bool bSkip ) -{ - DBG_ASSERT( bSkip || nSkipReload, "SkipReload aufgehoben ohne es zu aktivieren"); - if ( bSkip ) - nSkipReload++; - else - nSkipReload--; -} - -sal_Bool AppWin::DiskFileChanged( sal_uInt16 nWhat ) -{ - if ( !bHasFile ) - return sal_False; - - switch ( nWhat ) - { - case SINCE_LAST_LOAD: - { - if ( bReloadAborted ) - return sal_True; - else - return DiskFileChanged( SINCE_LAST_ASK_RELOAD ); - } - case SINCE_LAST_ASK_RELOAD: - { - String aFilename( GetText() ); - - DirEntry aFile( aFilename ); - FileStat aStat( aFile ); - - return ( !aLastAccess.GetError() != !aStat.GetError() ) - || aLastAccess.IsYounger( aStat ) || aStat.IsYounger( aLastAccess ); - } - default: - OSL_FAIL("Not Implemented in AppWin::DiskFileChanged"); - } - return sal_True; -} - -void AppWin::UpdateFileInfo( sal_uInt16 nWhat ) -{ - switch ( nWhat ) - { - case HAS_BEEN_LOADED: - { - bReloadAborted = sal_False; - UpdateFileInfo( ASKED_RELOAD ); - - } - break; - case ASKED_RELOAD: - { - String aFilename( GetText() ); - - DirEntry aFile( aFilename ); - aLastAccess.Update( aFile ); - } - break; - default: - OSL_FAIL("Not Implemented in AppWin::UpdateFileInfo"); - } -} - -void AppWin::CheckReload() -{ - if ( IsSkipReload() || !bHasFile ) - return; - - String aFilename( GetText() ); - DirEntry aFile( aFilename ); - if ( !aFilename.Len() ) - return; - - if ( !aFile.Exists() ) - return; - - - if ( DiskFileChanged( SINCE_LAST_ASK_RELOAD ) && ReloadAllowed() ) - { - UpdateFileInfo( ASKED_RELOAD ); - ToTop(); - Update(); - if ( (IsModified() && QueryBox( this, SttResId( IDS_ASKDIRTYRELOAD ) ).Execute() == RET_YES ) - || ( !IsModified() && ( pFrame->IsAutoReload() || QueryBox( this, SttResId( IDS_ASKRELOAD ) ).Execute() == RET_YES ) ) ) - { - Reload(); - } - else - { - bReloadAborted = sal_True; - } - } -} - -void AppWin::Reload() -{ - SkipReload(); - TextSelection aSelMemo = pDataEdit->GetSelection(); - Load( GetText() ); - pDataEdit->SetSelection( aSelMemo ); - SkipReload( sal_False ); -} - -// Load file -sal_Bool AppWin::Load( const String& aName ) -{ - SkipReload(); - sal_Bool bErr; - - bErr = !pDataEdit->Load( aName ); - if( bErr ) - { - ErrorBox aBox( this, SttResId( IDS_READERROR ) ); - String aMsg = aBox.GetMessText(); - aMsg.AppendAscii("\n\""); - aMsg.Append( aName ); - aMsg.AppendAscii("\""); - if ( pFrame->IsAutoRun() ) - { - printf( "%s\n", rtl::OUStringToOString(aMsg, osl_getThreadTextEncoding()).getStr() ); - } - else - { - aBox.SetMessText( aMsg ); - aBox.Execute(); - } - } - else - { - DirEntry aEntry( aName ); - String aModName = aEntry.GetFull(); - SetText( aModName ); - UpdateFileInfo( HAS_BEEN_LOADED ); - PostLoad(); - bHasFile = sal_True; - } - SkipReload( sal_False ); - return !bErr; -} - -// Save file -sal_uInt16 AppWin::ImplSave() -{ - SkipReload(); - sal_uInt16 nResult = SAVE_RES_NOT_SAVED; - String s1 = *pNoName; - String s2 = GetText().Copy( 0, s1.Len() ); - if( s1 == s2 ) - nResult = SaveAs(); - else { - String aName = GetText(); - if ( pDataEdit->Save( aName ) ) - { - nResult = SAVE_RES_SAVED; - bHasFile = sal_True; - } - else - { - nResult = SAVE_RES_ERROR; - ErrorBox( this, SttResId( IDS_WRITEERROR ) ).Execute(); - } - UpdateFileInfo( HAS_BEEN_LOADED ); - } - SkipReload( sal_False ); - return nResult; -} - -// Save to new file name -sal_uInt16 AppWin::SaveAs() -{ - SkipReload(); - String s1 = *pNoName; - String s2 = GetText().Copy( 0, s1.Len() ); - if( s1 == s2 ) s2.Erase(); - else s2 = GetText(); - if( pFrame->QueryFileName( s2, GetFileType(), sal_True ) ) - { - SetText( s2 ); - PostSaveAs(); - SkipReload( sal_False ); - return ImplSave(); - } - else - { - SkipReload( sal_False ); - return SAVE_RES_CANCEL; - } -} - -// Should we save the file? -sal_uInt16 AppWin::QuerySave( QueryBits nBits ) -{ - sal_Bool bQueryDirty = ( nBits & QUERY_DIRTY ) != 0; - sal_Bool bQueryDiskChanged = ( nBits & QUERY_DISK_CHANGED ) != 0; - sal_Bool bSaveNotDirty = ( nBits & SAVE_NOT_DIRTY ) != 0; - - SkipReload(); - short nResult; - if ( IsModified() || bSaveNotDirty ) - nResult = RET_YES; - else - nResult = RET_NO; - - sal_Bool bAlwaysEnableInput = pFrame->IsAlwaysEnableInput(); - pFrame->AlwaysEnableInput( sal_False ); - if( ( ( IsModified() || bSaveNotDirty ) && bQueryDirty ) || ( DiskFileChanged( SINCE_LAST_LOAD ) && bQueryDiskChanged ) ) - { - ToTop(); - if ( ( ( IsModified() && bQueryDirty ) && DiskFileChanged( SINCE_LAST_LOAD ) ) - || ( IsModified() && ( DiskFileChanged( SINCE_LAST_LOAD ) && bQueryDiskChanged ) ) ) - nResult = QueryBox( this, SttResId( IDS_ASK_DIRTY_AND_DISKCHANGE_SAVE ) ).Execute(); - else if ( ( IsModified() && bQueryDirty ) ) - nResult = QueryBox( this, SttResId( IDS_ASK_DIRTY_SAVE ) ).Execute(); - else - nResult = QueryBox( this, SttResId( IDS_ASK_DISKCHANGE_SAVE ) ).Execute(); - } - pFrame->AlwaysEnableInput( bAlwaysEnableInput ); - - sal_uInt16 nReturn; - switch( nResult ) - { - case RET_YES: - nReturn = ImplSave(); - break; - case RET_NO: - nReturn = SAVE_RES_NOT_SAVED; - break; - case RET_CANCEL: - nReturn = SAVE_RES_CANCEL; - break; - default: - OSL_FAIL("switch default where no default should be: Internal error"); - nReturn = SAVE_RES_CANCEL; - } - SkipReload( sal_False ); - return nReturn; -} - -sal_Bool AppWin::Close() -{ - switch ( QuerySave( QUERY_DIRTY ) ) - { - case SAVE_RES_NOT_SAVED: - case SAVE_RES_SAVED: - { - DockingWindow::Close(); - delete this; - return sal_True; - } - case SAVE_RES_ERROR: - return sal_False; - case SAVE_RES_CANCEL: - return sal_False; - default: - OSL_FAIL("Not Implemented in AppWin::Close"); - return sal_False; - } -} - -// Search and find text -void AppWin::Find() -{ - SttResId aResId( IDD_FIND_DIALOG ); - FindDialog aDlg( this, aResId, aFind ); - if( aDlg.Execute() ) { - bFind = sal_True; - Repeat(); - } -} - -// Replace text -void AppWin::Replace() -{ - SttResId aResId( IDD_REPLACE_DIALOG ); - ReplaceDialog* pDlg = new ReplaceDialog - (this, aResId, aFind, aReplace ); - if( pDlg->Execute() ) { - bFind = sal_False; - Repeat(); - } -} - -// Repeat search/replace operation -void AppWin::Repeat() -{ - if( (aFind.Len() != 0 ) && ( pDataEdit->Find( aFind ) || (ErrorBox(this,SttResId(IDS_PATTERNNOTFOUND)).Execute() && sal_False) ) && !bFind ) - pDataEdit->ReplaceSelected( aReplace ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx deleted file mode 100644 index e5a79e042d8b..000000000000 --- a/basic/source/app/appwin.hxx +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _APPWIN_HXX -#define _APPWIN_HXX - -#include <vcl/dockwin.hxx> -#include <tools/fsys.hxx> - -#include "app.hxx" -#include "dataedit.hxx" - -#include <vector> -typedef sal_uInt16 QueryBits; - -#define QUERY_NONE ( QueryBits ( 0x00 ) ) -#define QUERY_DIRTY ( QueryBits ( 0x01 ) ) -#define QUERY_DISK_CHANGED ( QueryBits ( 0x02 ) ) -#define QUERY_ALL ( QUERY_DIRTY | QUERY_DISK_CHANGED ) -#define SAVE_NOT_DIRTY ( QueryBits ( 0x04 ) ) - -#define SAVE_RES_SAVED sal_True -#define SAVE_RES_NOT_SAVED sal_False -#define SAVE_RES_ERROR 3 -#define SAVE_RES_CANCEL 4 - - -#define SINCE_LAST_LOAD 1 -#define SINCE_LAST_ASK_RELOAD 2 - -#define HAS_BEEN_LOADED 1 // includes ASKED_RELOAD -#define ASKED_RELOAD 2 - - -#define TT_WIN_STATE_MAX 0x01 -#define TT_WIN_STATE_FLOAT 0x02 -#define TT_WIN_STATE_HIDE 0x04 - -class BasicFrame; - -class AppWin : public DockingWindow, public SfxListener // Document window -{ - friend class MsgEdit; -protected: - static short nNumber; // serial number - static short nCount; // number of edit windows - static String *pNoName; // "Untitled" - FileStat aLastAccess; // Last access time of loaded file - sal_uInt16 nSkipReload; // Sometimes there must not be a reload - sal_Bool bHasFile; // Otherwise reload does not make sense - sal_Bool bReloadAborted; // Is set if reload was cancelled so that we can ask again wehn closing - - short nId; // ID-Nummer( "Unnamed n" ) - BasicFrame* pFrame; // Parent-Window - String aFind; // Search string - String aReplace; // Replace string - sal_Bool bFind; // sal_True if search not replace - void RequestHelp( const HelpEvent& ); // Help handler - void GetFocus(); // activate - virtual sal_uInt16 ImplSave(); // Save file - sal_uInt16 nWinState; // Maximized, Iconized or Normal - Point nNormalPos; // Position if normal - Size nNormalSize; // Size if Normal - virtual long PreNotify( NotifyEvent& rNEvt ); - sal_uInt16 nWinId; - -public: - TYPEINFO(); - AppWin( BasicFrame* ); - ~AppWin(); - DataEdit* pDataEdit; // Data area - virtual sal_uInt16 GetLineNr()=0; // Current line number - virtual long InitMenu( Menu* ); // Init of the menu - virtual long DeInitMenu( Menu* ); // reset to enable all shortcuts - virtual void Command( const CommandEvent& rCEvt ); // Command handler - virtual void Resize(); - virtual void Help(); - virtual sal_Bool Load( const String& ); // Load file - virtual void PostLoad(){} // Set source at module - virtual sal_uInt16 SaveAs(); // Save file as - virtual void PostSaveAs(){} - virtual void Find(); // find text - virtual void Replace(); // replace text - virtual void Repeat(); // repeat find/replace - virtual sal_Bool Close(); // close window - virtual void Activate(); // window was activated - virtual FileType GetFileType()=0; // returns the filetype - virtual sal_Bool ReloadAllowed(){ return sal_True; } - virtual void Reload(); // Reload after change on disk - virtual void LoadIniFile(){;} // (re)load ini file after change - void CheckReload(); // Checks and asks if reload should performed - sal_Bool DiskFileChanged( sal_uInt16 nWhat ); // Checks file for changes - void UpdateFileInfo( sal_uInt16 nWhat ); // Remembers last file state - sal_Bool IsSkipReload(); // Should we test reload? - void SkipReload( sal_Bool bSkip = sal_True ); - sal_uInt16 GetWinState(){ return nWinState; } - void Maximize(); - void Restore(); - void Minimize( sal_Bool bMinimize ); - void Cascade( sal_uInt16 nNr ); - - sal_uInt16 QuerySave( QueryBits nBits = QUERY_ALL ); - sal_Bool IsModified() { return pDataEdit->IsModified(); } - BasicFrame* GetBasicFrame() { return pFrame; } - virtual void TitleButtonClick( sal_uInt16 nButton ); - virtual void SetText( const XubString& rStr ); - - sal_uInt16 GetWinId() { return nWinId; } - void SetWinId( sal_uInt16 nWId ) { nWinId = nWId; } -}; - -typedef ::std::vector< AppWin* > EditList; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/basic.hrc b/basic/source/app/basic.hrc deleted file mode 100755 index 4517223fc733..000000000000 --- a/basic/source/app/basic.hrc +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define RID_OPTLIST 101 -#define RID_OPTLINES 102 -#define RID_OPTPACKS 103 -#define RID_OPTPACKD 104 -#define RID_OPTWARN1 105 -#define RID_OPTWARN2 106 -#define RID_OPTVIRT 107 -#define RID_PARAMS 108 -#define RID_RETTYPE 109 -#define RID_RETVAL 110 -//#define RID_APPICON 500 -//#define RID_APPICON2 501 -//#define RID_WORKICON 502 -//#define RID_LOADICON 503 -//#define RID_SAVEICON 504 -#define RID_APPMENUBAR 1000 -#define RID_APPFILE 1001 -#define RID_APPEDIT 1002 -#define RID_APPRUN 1003 -#define RID_APPWINDOW 1004 -#define RID_APPHELP 1005 -#define RID_FILE 1100 -#define RID_FILENEW 1101 -#define RID_FILEOPEN 1102 -#define RID_FILECLOSE 1103 -#define RID_FILESAVE 1104 -#define RID_FILESAVEAS 1105 -#define RID_FILELOADLIB 1106 -#define RID_FILESAVELIB 1107 -#define RID_QUIT 1111 -#define IDM_FILE_LRU1 1112 -#define IDM_FILE_LRUn 1199 -#define RID_EDIT 1200 -#define RID_EDITUNDO 1201 -#define RID_EDITREDO 1202 -#define RID_EDITCUT 1203 -#define RID_EDITCOPY 1204 -#define RID_EDITPASTE 1205 -#define RID_EDITDEL 1206 -#define RID_EDITSEARCH 1207 -#define RID_EDITREPLACE 1208 -#define RID_EDITREPEAT 1209 -#define RID_RUN 1300 -#define RID_RUNCOMPILE 1301 -#define RID_RUNSTART 1302 -#define RID_RUNBREAK 1304 -#define RID_RUNSTOP 1303 -#define RID_RUNNEXTERR 1307 -#define RID_RUNPREVERR 1308 -#define RID_RUNDISAS 1310 -#define RID_RUNSTEPINTO 1311 -#define RID_RUNSTEPOVER 1312 -#define RID_RUNTOCURSOR 1313 -#define RID_TOGLEBRKPNT 1314 -#define RID_TT_EXTRAS_NAME 1400 -#define RID_TT_EXTRAS 1401 -#define RID_OPTIONS 1402 -#define RID_DECLARE_HELPER 1403 -#define RID_WINDOW 1501 -#define RID_WINTILE 1502 -#define RID_WINTILEHORZ 1503 -#define RID_WINTILEVERT 1504 -#define RID_WINCASCADE 1505 -#define RID_WIN_FILE1 1520 -#define RID_WIN_FILEn 1599 - -#define RID_HELP 1601 -//#define RID_HELPINDEX 1602 -//#define RID_HELPKEYS 1603 -//#define RID_HELPINTRO 1604 -//#define RID_HELPTOPIC 1605 -#define RID_HELPABOUT 1606 -#define RID_POPUP 1700 -#define RID_POPUPEDITVAR 1701 - - - -#define IDS_APPNAME 2000 -#define IDS_APPNAME2 2001 -#define IDS_APPMODE_BREAK 2002 -#define IDS_APPMODE_RUN 2003 -#define IDS_NONAME 2100 -#define IDS_NONAMEFILE 2101 -#define IDS_INCFILE 2102 -#define IDS_LIBFILE 2103 -#define IDS_RESFILE 2104 -#define IDS_TXTFILE 2105 -#define IDS_READERROR 2103 -#define IDS_WRITEERROR 2104 -#define IDS_COMPERROR 2105 -#define IDS_CONTINUE 2106 -#define IDS_CANCEL 2107 -#define IDS_NOPRINTERERROR 2108 -#define IDS_PATTERNNOTFOUND 2109 -#define IDS_INVALID_VALUE 2110 -#define IDS_ASK_DIRTY_SAVE 2200 -#define IDS_ASK_DISKCHANGE_SAVE 2201 -#define IDS_ASK_DIRTY_AND_DISKCHANGE_SAVE 2202 -#define IDS_ASKSAVEERROR 2203 -#define IDS_ASKRELOAD 2204 -#define IDS_ASKDIRTYRELOAD 2205 -#define IDS_LOADDLG 2300 -#define IDS_SAVEDLG 2301 -#define IDS_BASFILTER 2304 -#define IDS_LIBFILTER 2305 -#define IDS_INCFILTER 2306 -#define IDS_RESFILTER 2307 -#define IDS_TXTFILTER 2308 -#define IDS_PAGE 2401 -#define IDS_PRINTMSG 2402 -#define IDS_CANTLOAD 2501 -#define IDS_CANTSAVE 2502 -#define IDS_ERROR1 2601 -#define IDS_ERROR2 2602 -#define IDS_WARNING1 2603 -#define IDS_NO_LONGNAME 2604 -#define IDS_WARNING_PREFIX 2605 -#define IDS_OBJECT 2606 -#define IDS_EDIT_VAR 2607 - -#define IDS_NOMAINPGM 2701 -#define IDS_DISASWIN 2702 -#define IDS_RUNNING 2703 -#define IDS_NOT_YET_IMPLEMENTED 2704 -#define IDS_LOSS_OF_INFORMATION 2705 - -#define RID_ACCEL 3000 - -#define IDD_LOADSAVE_DIALOG 4001 -#define IDD_ABOUT_DIALOG 4002 -#define IDD_TT_ABOUT_DIALOG 4003 -#define IDD_FIND_DIALOG 4004 -#define IDD_REPLACE_DIALOG 4005 -#define IDD_PRINT_DIALOG 4006 -#define IDD_OPTIONS_DLG 4007 -#define RID_TP_PROFILE 4008 -#define RID_TP_CRASH 4009 -#define RID_TP_MISC 4010 -#define RID_TP_FONT 4011 -#define RID_TP_GENERIC 4012 -#define IDD_DISPLAY_HID 4013 -#define IDD_EDIT_VAR 4014 - - -//#define RID_APPFONT 5000 -//#define RID_APPEDITFONT 5001 -//#define RID_DLGBRUSH 5002 -#define RID_CALLDLG 6001 -#define MBP_PLUS 8001 -#define MBP_MINUS 8002 -#define RID_IMGLST_LAYOUT 8005 -#define MAIN_ACCEL 9001 - -#define LOAD_CONF 10001 -#define WORK 10002 -#define FILENAME 10003 diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src deleted file mode 100644 index aa9e1f9603da..000000000000 --- a/basic/source/app/basic.src +++ /dev/null @@ -1,1400 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "basic.hrc" -#include "resids.hrc" - -ModalDialog RID_CALLDLG { - HelpID = "basic:ModalDialog:RID_CALLDLG"; - PosSize = MAP_SYSFONT (18,18,142,142); - SVLook = TRUE; - MOVEABLE = TRUE; - CLOSEABLE = TRUE; - FixedText RID_RETTYPE { - PosSize = MAP_SYSFONT (10,70,120,8); - }; - Edit RID_RETVAL { - HelpID = "basic:Edit:RID_CALLDLG:RID_RETVAL"; - PosSize = MAP_SYSFONT (10,85,120,12); - Border = TRUE; - TabStop = TRUE; - }; - ListBox RID_PARAMS { - HelpID = "basic:ListBox:RID_CALLDLG:RID_PARAMS"; - PosSize = MAP_SYSFONT (10,25,120,40); - TabStop = TRUE; - Border = TRUE; - }; - OKButton RID_OK { - PosSize = MAP_SYSFONT (50,105,40,14); - TabStop = TRUE; - DefButton = TRUE; - }; - Text[ en-US ] = "Dynamic Link No. "; -}; - -ModalDialog IDD_ABOUT_DIALOG { - HelpID = "basic:ModalDialog:IDD_ABOUT_DIALOG"; - Pos = MAP_APPFONT( 58, 17 ); - Size = MAP_APPFONT( 155, 106 ); - SVLook = TRUE; - OKButton RID_OK { - Pos = MAP_APPFONT( 55, 80 ); - Size = MAP_APPFONT( 40, 14 ); - DefButton = TRUE; - }; -}; - -ModalDialog IDD_TT_ABOUT_DIALOG { - HelpID = "basic:ModalDialog:IDD_TT_ABOUT_DIALOG"; - Pos = MAP_APPFONT( 58, 17 ); - Size = MAP_APPFONT( 120, 81 ); - SVLook = TRUE; - MOVEABLE = TRUE; - FixedText 1 { - Pos = MAP_APPFONT( 5, 10 ); - Size = MAP_APPFONT( 110, 10 ); - CENTER = TRUE; - TEXT[ en-US ] = "VCLTestTool"; - }; - FixedText RID_VERSIONSTRING { - Pos = MAP_APPFONT( 5, 25 ); - Size = MAP_APPFONT( 110, 10 ); - CENTER = TRUE; - }; - FixedText 4 { - Pos = MAP_APPFONT( 5, 40 ); - Size = MAP_APPFONT( 110, 10 ); - CENTER = TRUE; - TEXT[ en-US ] = "©1995-2010 Oracle"; - }; - OKButton RID_OK { - Pos = MAP_APPFONT( 40, 60 ); - Size = MAP_APPFONT( 40, 14 ); - DefButton = TRUE; - }; - TEXT[ en-US ] = "About VCLTestTool"; -}; - -ModalDialog IDD_FIND_DIALOG { - HelpID = "basic:ModalDialog:IDD_FIND_DIALOG"; - Pos = MAP_APPFONT( 69, 30 ); - Size = MAP_APPFONT( 185, 70 ); - SVLook = TRUE; - MOVEABLE = TRUE; - - FixedText RID_FIXEDTEXT1 { - Pos = MAP_APPFONT( 5, 10 ); - Size = MAP_APPFONT( 30, 10 ); - TEXT[ en-US ] = "~Text"; - }; - Edit RID_FIND { - HelpID = "basic:Edit:IDD_FIND_DIALOG:RID_FIND"; - BORDER = TRUE; - Pos = MAP_APPFONT( 40, 8 ); - Size = MAP_APPFONT( 135, 12 ); - TABSTOP = TRUE; - }; - OKButton RID_OK { - Pos = MAP_APPFONT( 30, 30 ); - Size = MAP_APPFONT( 50, 14 ); - TABSTOP = TRUE; - DefButton = TRUE; - TEXT[ en-US ] = "~Find"; - }; - CancelButton RID_CANCEL { - Pos = MAP_APPFONT( 105, 30 ); - Size = MAP_APPFONT( 50, 14 ); - TABSTOP = TRUE; - TEXT[ en-US ] = "~Cancel"; - }; - TEXT[ en-US ] = "Testtool: Find Text"; -}; - -ModalDialog IDD_REPLACE_DIALOG { - HelpID = "basic:ModalDialog:IDD_REPLACE_DIALOG"; - Pos = MAP_APPFONT( 69, 30 ); - Size = MAP_APPFONT( 185, 88 ); - SVLook = TRUE; - MOVEABLE = TRUE; - FixedText RID_FIXEDTEXT1 { - Pos = MAP_APPFONT( 5, 10 ); - Size = MAP_APPFONT( 55, 10 ); - TEXT[ en-US ] = "~Search for"; - }; - FixedText RID_FIXEDTEXT2 { - Pos = MAP_APPFONT( 5, 30 ); - Size = MAP_APPFONT( 55, 10 ); - TEXT[ en-US ] = "~Replace by"; - }; - Edit RID_FIND { - HelpID = "basic:Edit:IDD_REPLACE_DIALOG:RID_FIND"; - BORDER = TRUE; - Pos = MAP_APPFONT( 65, 8 ); - Size = MAP_APPFONT( 110, 12 ); - TABSTOP = TRUE; - }; - Edit RID_REPLACE { - HelpID = "basic:Edit:IDD_REPLACE_DIALOG:RID_REPLACE"; - BORDER = TRUE; - Pos = MAP_APPFONT( 65, 28 ); - Size = MAP_APPFONT( 110, 12 ); - TABSTOP = TRUE; - }; - OKButton RID_OK { - Pos = MAP_APPFONT( 30, 50 ); - Size = MAP_APPFONT( 50, 14 ); - TABSTOP = TRUE; - DefButton = TRUE; - TEXT[ en-US ] = "~Replace"; - }; - CancelButton RID_CANCEL { - Pos = MAP_APPFONT( 105, 50 ); - Size = MAP_APPFONT( 50, 14 ); - TABSTOP = TRUE; - TEXT[ en-US ] = "~Cancel"; - }; - TEXT[ en-US ] = "Testtool: Replace Text"; -}; - -InfoBox IDS_NOPRINTERERROR { - MESSAGE[ en-US ] = "The print function is not available!"; -}; -ErrorBox IDS_CANTLOAD { - MESSAGE[ en-US ] = "Library cannot be loaded!"; - Title[ en-US ] = "Testtool Error"; -}; -ErrorBox IDS_CANTSAVE { - MESSAGE[ en-US ] = "Library cannot be saved!"; - Title[ en-US ] = "Testtool Error"; -}; -ErrorBox IDS_NOMAINPGM { - MESSAGE[ en-US ] = "This window does not contain a main program!"; - Title[ en-US ] = "Testtool Error"; -}; -ErrorBox IDS_READERROR { - MESSAGE[ en-US ] = "File cannot be read!"; - Title[ en-US ] = "Testtool Error"; -}; -ErrorBox IDS_WRITEERROR { - MESSAGE[ en-US ] = "File cannot be saved!"; - Title[ en-US ] = "Testtool Error"; -}; -ErrorBox IDS_PATTERNNOTFOUND { - MESSAGE[ en-US ] = "Search key not found!"; - Title[ en-US ] = "Testtool Error"; -}; -ErrorBox IDS_INVALID_VALUE { - MESSAGE[ en-US ] = "The value is invalid and cannot be set."; - Title[ en-US ] = "Testtool Error"; -}; - -QueryBox IDS_ASKSAVEERROR { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO; - MESSAGE[ en-US ] = "Error saving files! Run anyway?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_ASK_DIRTY_SAVE { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO_CANCEL; - MESSAGE[ en-US ] = "File has been changed. Save?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_ASK_DIRTY_AND_DISKCHANGE_SAVE { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO_CANCEL; - MESSAGE[ en-US ] = "File has been changed on data medium\nand in the Editor. Save?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_ASK_DISKCHANGE_SAVE { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO_CANCEL; - MESSAGE[ en-US ] = "File has been changed on data medium.\nOverwrite?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_ASKRELOAD { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO; - MESSAGE[ en-US ] = "File has been changed on data medium. Reload?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_ASKDIRTYRELOAD { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO; - MESSAGE[ en-US ] = "File has been changed on data medium\nand in the Editor. Reload?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_RUNNING { - TITLE = "Testtool"; - BUTTONS = WB_YES_NO; - MESSAGE[ en-US ] = "BASIC is still running! Exit anyway?"; - Title[ en-US ] = "Testtool"; -}; -QueryBox IDS_LOSS_OF_INFORMATION { - TITLE = "Testtool"; - BUTTONS = WB_OK_CANCEL; - MESSAGE[ en-US ] = "Saving in an external format causes information loss."; - Title[ en-US ] = "Testtool"; -}; - -InfoBox IDS_NOT_YET_IMPLEMENTED -{ - MESSAGE[ en-US ] = "Not yet implemented"; -}; - - -String IDS_WARNING1 { - TEXT[ en-US ] = "Warning "; -}; -String IDS_ERROR1 { - TEXT[ en-US ] = "Error "; -}; -String IDS_ERROR2 { - TEXT[ en-US ] = " in line "; -}; -String IDS_NO_LONGNAME { - TEXT[ en-US ] = "No entries in Hid.Lst"; -}; -String IDS_WARNING_PREFIX -{ - Text[ en-US ] = "Warning: "; -}; -String IDS_OBJECT -{ - Text[ en-US ] = "Object"; -}; -String IDS_EDIT_VAR -{ - Text[ en-US ] = "Edit ($Arg1)"; -}; - -String IDS_APPNAME { - TEXT[ en-US ] = "Testtool"; -}; -String IDS_APPNAME2 { - TEXT[ en-US ] = "VCLTestTool"; -}; -String IDS_APPMODE_BREAK { - text[ en-US ] = "Break"; -}; -String IDS_APPMODE_RUN { - text[ en-US ] = "Run"; -}; -String IDS_NONAME { - TEXT[ en-US ] = "Unnamed"; -}; - -String IDS_NONAMEFILE { -#if defined ( UNX ) -TEXT = "*.bas"; -#else -TEXT = "*.BAS"; -#endif -}; -String IDS_INCFILE { -#if defined ( UNX ) -TEXT = "*.inc"; -#else -TEXT = "*.INC"; -#endif -}; -String IDS_LIBFILE { -#if defined ( UNX ) -TEXT = "*.sb"; -#else -TEXT = "*.SB"; -#endif -}; -String IDS_RESFILE { -#if defined ( UNX ) -TEXT = "*.res"; -#else -TEXT = "*.RES"; -#endif -}; -String IDS_TXTFILE { -#if defined ( UNX ) -TEXT = "*.txt"; -#else -TEXT = "*.TXT"; -#endif -}; - -String IDS_LOADDLG { - TEXT[ en-US ] = "Testtool: Load File"; -}; -String IDS_SAVEDLG { - TEXT[ en-US ] = "Testtool: Save File"; -}; -String IDS_BASFILTER { - TEXT[ en-US ] = "Source files (*.BAS)"; -}; -String IDS_INCFILTER { - TEXT[ en-US ] = "Include files (*.INC)"; -}; -String IDS_LIBFILTER { - TEXT[ en-US ] = "Libraries (*.SB)"; -}; -String IDS_RESFILTER { - TEXT[ en-US ] = "Result files (*.RES)"; -}; -String IDS_TXTFILTER { - TEXT[ en-US ] = "Results as text file (*.TXT)"; -}; -String IDS_PAGE { - TEXT[ en-US ] = "Page "; -}; -String IDS_PRINTMSG { - TEXT[ en-US ] = "Printout of "; -}; -String IDS_CONTINUE { - TEXT[ en-US ] = "Continue"; -}; -String IDS_CANCEL { - TEXT[ en-US ] = "Cancel"; -}; -String IDS_DISASWIN { - TEXT[ en-US ] = "Disassembly"; -}; - -Bitmap MBP_PLUS { - File = "plus.bmp"; -}; -Bitmap MBP_MINUS { - File = "minus.bmp"; -}; - -Menu RID_APPMENUBAR { - ItemList = { - MenuItem { - Identifier = RID_APPFILE; - SUBMENU = Menu ,RID_FILE; - TEXT[ en-US ] = "~File"; - }; - MenuItem { - Identifier = RID_APPEDIT; - SUBMENU = Menu ,RID_EDIT; - TEXT[ en-US ] = "~Edit"; - }; - MenuItem { - Identifier = RID_APPRUN; - SUBMENU = Menu ,RID_RUN; - TEXT[ en-US ] = "~Program"; - }; - MenuItem { - Identifier = RID_APPWINDOW; - SUBMENU = Menu ,RID_WINDOW; - TEXT[ en-US ] = "~Window"; - }; - MenuItem { - SEPARATOR = TRUE; - }; - MenuItem { - HELP = TRUE; - Identifier = RID_APPHELP; - SUBMENU = Menu ,RID_HELP; - TEXT[ en-US ] = "~Help"; - }; - }; -}; -Menu RID_FILE { - ITEMLIST = { - MenuItem { - Identifier = RID_FILENEW; - TEXT[ en-US ] = "~New"; - AccelKey = KeyCode { Function = KEYFUNC_NEW; }; - }; - MenuItem { - Identifier = RID_FILEOPEN; - TEXT[ en-US ] = "~Open..."; - AccelKey = KeyCode { Function = KEYFUNC_OPEN; }; - }; - MenuItem { - SEPARATOR = TRUE; - }; - MenuItem { - Identifier = RID_FILECLOSE; - TEXT[ en-US ] = "~Close"; - AccelKey = KeyCode { Function = KEYFUNC_CLOSE; }; - }; - MenuItem { - Identifier = RID_FILESAVE; - TEXT[ en-US ] = "~Save"; - AccelKey = KeyCode { Function = KEYFUNC_SAVE; }; - }; - MenuItem { - Identifier = RID_FILESAVEAS; - TEXT[ en-US ] = "Save~ As..."; - AccelKey = KeyCode { Function = KEYFUNC_SAVEAS; }; - }; - MenuItem { - SEPARATOR = TRUE; - }; - MenuItem { - Identifier = RID_FILELOADLIB; - TEXT[ en-US ] = "~Load Library..."; - }; - MenuItem { - Identifier = RID_FILESAVELIB; - TEXT[ en-US ] = "Save Li~brary..."; - }; - MenuItem { - SEPARATOR = TRUE; - }; - MenuItem { - Identifier = RID_QUIT; - TEXT[ en-US ] = "~Exit"; - AccelKey = KeyCode { Function = KEYFUNC_QUIT; }; - }; - }; -}; -Menu RID_EDIT { - ITEMLIST = { - MenuItem { - Identifier = RID_EDITUNDO; - TEXT[ en-US ] = "~Undo"; - }; - MenuItem { - Identifier = RID_EDITREDO; - TEXT[ en-US ] = "~Redo"; - }; - MenuItem { - SEPARATOR = TRUE; - }; - MenuItem { - Identifier = RID_EDITCUT; - TEXT[ en-US ] = "~Cut"; - AccelKey = KeyCode { Function = KEYFUNC_CUT; }; - }; - MenuItem { - Identifier = RID_EDITCOPY; - TEXT[ en-US ] = "~Copy"; - AccelKey = KeyCode { Function = KEYFUNC_COPY; }; - }; - MenuItem { - Identifier = RID_EDITPASTE; - TEXT[ en-US ] = "~Paste"; - AccelKey = KeyCode { Function = KEYFUNC_PASTE; }; - }; - MenuItem { - Identifier = RID_EDITDEL; - TEXT[ en-US ] = "~Delete"; - AccelKey = KeyCode { Function = KEYFUNC_DELETE; }; - }; - MenuItem { - SEPARATOR = TRUE; - }; - MenuItem { - Identifier = RID_EDITSEARCH; - TEXT[ en-US ] = "~Find..."; - AccelKey = KeyCode { Function = KEYFUNC_FIND; }; - }; - MenuItem { - Identifier = RID_EDITREPLACE; - TEXT[ en-US ] = "~Replace..."; - }; - MenuItem { - Identifier = RID_EDITREPEAT; - TEXT[ en-US ] = "Repeat S~earch"; - AccelKey = KeyCode { Code = KEY_F3; }; - }; - }; -}; -Menu RID_RUN { - ITEMLIST = { - MenuItem { - Identifier = RID_RUNCOMPILE; - TEXT[ en-US ] = "~Compile"; - }; - MenuItem { - Identifier = RID_RUNDISAS; - TEXT[ en-US ] = "~Disassemble"; - }; - MenuItem { - Identifier = RID_RUNSTART; - TEXT[ en-US ] = "~Start"; - AccelKey = KeyCode { Code = KEY_F5; }; - }; - MenuItem { - Identifier = RID_RUNSTEPINTO; - TEXT[ en-US ] = "~Single Step"; - AccelKey = KeyCode { Code = KEY_F8; }; - }; - MenuItem { - Identifier = RID_RUNSTEPOVER; - TEXT[ en-US ] = "Si~ngle Step over Procedure"; - AccelKey = KeyCode { Code = KEY_F10; }; - }; - MenuItem { - Identifier = RID_TOGLEBRKPNT; - TEXT[ en-US ] = "Set / Delete Break Point"; - AccelKey = KeyCode { Code = KEY_F9; }; - }; - MenuItem { - Identifier = RID_RUNBREAK; - TEXT[ en-US ] = "~Break"; - AccelKey = KeyCode { Code = KEY_F5; Modifier1 = TRUE; }; - }; - MenuItem { - Identifier = RID_RUNSTOP; - TEXT[ en-US ] = "~Stop"; - AccelKey = KeyCode { Code = KEY_F5; Shift = TRUE; }; - }; - MenuItem { - Identifier = RID_RUNNEXTERR; - TEXT[ en-US ] = "~Next Error"; - AccelKey = KeyCode { Code = KEY_F8; Shift = TRUE; }; - }; - MenuItem { - Identifier = RID_RUNPREVERR; - TEXT[ en-US ] = "~Previous Error"; - AccelKey = KeyCode { Code = KEY_F7; Shift = TRUE; }; - }; - MenuItem { - SEPARATOR = TRUE; - }; - }; -}; -// This will be inserted from the Test Tool - -// under the following name -String RID_TT_EXTRAS_NAME -{ - Text[ en-US ] = "E~xtra"; -}; - -Menu RID_TT_EXTRAS { - ITEMLIST = { - MenuItem { - Identifier = RID_OPTIONS; - TEXT[ en-US ] = "~Settings"; - }; -/* comment out till it gets functionality #i26908 - MenuItem { - Identifier = RID_DECLARE_HELPER; - Text [ en-US ] = "~Record Dialogs"; - };*/ - }; -}; -Menu RID_WINDOW { - ITEMLIST = { - }; -}; -Menu RID_HELP { - ITEMLIST = { - MenuItem { - ABOUT = TRUE; - Identifier = RID_HELPABOUT; - TEXT[ en-US ] = "~About..."; - }; - }; -}; -ModelessDialog IDD_PRINT_DIALOG { - HelpID = "basic:ModelessDialog:IDD_PRINT_DIALOG"; - Pos = MAP_APPFONT( 83, 42 ); - Size = MAP_APPFONT( 171, 94 ); - MOVEABLE = TRUE; - SVLook = TRUE; - FixedText RID_TEXT { - Pos = MAP_APPFONT( 11, 9 ); - Size = MAP_APPFONT( 146, 28 ); - CENTER = TRUE; - TEXT[ en-US ] = "Print "; - }; - CancelButton RID_CANCEL { - Pos = MAP_APPFONT( 56, 46 ); - Size = MAP_APPFONT( 47, 19 ); - TEXT[ en-US ] = "Cancel"; - }; - TEXT[ en-US ] = "Testtool: Print File"; -}; - - -TabDialog IDD_OPTIONS_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 248, 140 ); - Text[ en-US ] = "Settings"; - Moveable = TRUE ; - Closeable = TRUE ; - TabControl RES_TC_OPTIONS - { - OutputSize = TRUE ; - Pos = MAP_APPFONT( 4, 4 ); - Size = MAP_APPFONT( 240, 116 ); - Hide = FALSE ; - PageList = - { - PageItem - { - Identifier = RID_TP_GEN ; - Text[ en-US ] = "Generic"; - }; - PageItem - { - Identifier = RID_TP_PRO ; - Text[ en-US ] = "Profile"; - }; - PageItem - { - Identifier = RID_TP_CRA ; - Text[ en-US ] = "Crashreport"; - }; - PageItem - { - Identifier = RID_TP_MIS ; - Text[ en-US ] = "Misc"; - }; - PageItem - { - Identifier = RID_TP_FON ; - Text[ en-US ] = "Font"; - }; - }; - }; -}; - - -TabPage RID_TP_GENERIC { - HelpID = "basic:TabPage:RID_TP_GENERIC"; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 244, 100 ); - FixedLine RID_FL_AREA { - Pos = MAP_APPFONT( 4, 2 ); - Size = MAP_APPFONT( 228, 8 ); - Text[ en-US ] = "Area"; - }; - ComboBox RID_CB_AREA { - HelpID = "basic:ComboBox:RID_TP_GENERIC:RID_CB_AREA"; - HScroll = TRUE; - VScroll = TRUE; - AutoHScroll = TRUE; - Border = TRUE; - Pos = MAP_APPFONT( 8, 12 ); - Size = MAP_APPFONT( 132, 88 ); - TabStop = TRUE; - DropDown = TRUE; - }; - PushButton RID_PB_NEW_AREA { - HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_NEW_AREA"; - Pos = MAP_APPFONT( 144, 12 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "New"; - }; - PushButton RID_PD_DEL_AREA { - HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PD_DEL_AREA"; - Pos = MAP_APPFONT( 188, 12 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Delete"; - }; - FixedLine RID_FL_VALUE { - Pos = MAP_APPFONT( 4, 32 ); - Size = MAP_APPFONT( 228, 8 ); - Text[ en-US ] = "Setting"; - }; - ComboBox RID_CB_VALUE { - HelpID = "basic:ComboBox:RID_TP_GENERIC:RID_CB_VALUE"; - HScroll = TRUE; - VScroll = TRUE; - AutoHScroll = TRUE; - Border = TRUE; - Pos = MAP_APPFONT( 8, 48 ); - Size = MAP_APPFONT( 176, 44 ); - TabStop = TRUE; - }; - PushButton RID_PB_SELECT_FILE { - HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_SELECT_FILE"; - Pos = MAP_APPFONT( 188, 48 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Path ..."; - Disable = TRUE; - Hide = TRUE; - }; - PushButton RID_PB_NEW_VALUE { - HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_NEW_VALUE"; - Pos = MAP_APPFONT( 188, 48 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "New"; - }; - PushButton RID_PB_DEL_VALUE { - HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_DEL_VALUE"; - Pos = MAP_APPFONT( 188, 64 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Delete"; - }; -}; - - -TabPage RID_TP_PROFILE { - HelpID = "basic:TabPage:RID_TP_PROFILE"; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 244, 100 ); - FixedLine RID_FL_PROFILE { - Pos = MAP_APPFONT( 4, 4 ); - Size = MAP_APPFONT( 22, 8 ); - Text[ en-US ] = "Profile"; - }; - ComboBox RID_CB_PROFILE { - HelpID = "basic:ComboBox:RID_TP_PROFILE:RID_CB_PROFILE"; - HScroll = TRUE; - VScroll = TRUE; - AutoHScroll = TRUE; - Border = TRUE; - Pos = MAP_APPFONT( 30, 2 ); - Size = MAP_APPFONT( 110, 88 ); - TabStop = TRUE; - DropDown = TRUE; - }; - PushButton RID_PB_NEW_PROFILE { - HelpID = "basic:PushButton:RID_TP_PROFILE:RID_PB_NEW_PROFILE"; - Pos = MAP_APPFONT( 144, 2 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "New"; - }; - PushButton RID_PD_DEL_PROFILE { - HelpID = "basic:PushButton:RID_TP_PROFILE:RID_PD_DEL_PROFILE"; - Pos = MAP_APPFONT( 188, 2 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Delete"; - }; - FixedLine FL_DIRECTORIES { - Pos = MAP_APPFONT( 4, 16 ); - Size = MAP_APPFONT( 230, 8 ); - Text[ en-US ] = "Profile settings"; - }; - FixedText LOG_TEXT { - Pos = MAP_APPFONT( 7, 26 ); - Size = MAP_APPFONT( 86, 12 ); - Text[ en-US ] = "Log base directory"; - }; - FixedText BASIS_TEXT { - Pos = MAP_APPFONT( 7, 42 ); - Size = MAP_APPFONT( 86, 12 ); - Text[ en-US ] = "Base directory"; - }; - CheckBox HID_CHECK { - HelpID = "basic:CheckBox:RID_TP_PROFILE:HID_CHECK"; - Pos = MAP_APPFONT( 7, 58 ); - Size = MAP_APPFONT( 86, 12 ); - Text[ en-US ] = "Default HID directory"; - TabStop = TRUE; - Hide = FALSE; - }; - Edit LOG_NAME { - HelpID = "basic:Edit:RID_TP_PROFILE:LOG_NAME"; - Border = TRUE; - Pos = MAP_APPFONT( 97, 26 ); - Size = MAP_APPFONT( 116, 12 ); - TabStop = TRUE; - }; - Edit BASIS_NAME { - HelpID = "basic:Edit:RID_TP_PROFILE:BASIS_NAME"; - Border = TRUE; - Pos = MAP_APPFONT( 97, 42 ); - Size = MAP_APPFONT( 116, 12 ); - TabStop = TRUE; - }; - Edit HID_NAME { - HelpID = "basic:Edit:RID_TP_PROFILE:HID_NAME"; - Border = TRUE; - Pos = MAP_APPFONT( 97, 58 ); - Size = MAP_APPFONT( 116, 12 ); - TabStop = TRUE; - }; - PushButton LOG_SET { - HelpID = "basic:PushButton:RID_TP_PROFILE:LOG_SET"; - Pos = MAP_APPFONT( 217, 26 ); - Size = MAP_APPFONT( 12, 12 ); - TabStop = TRUE; - Text[ en-US ] = "..."; - }; - PushButton BASIS_SET { - HelpID = "basic:PushButton:RID_TP_PROFILE:BASIS_SET"; - Pos = MAP_APPFONT( 217, 42 ); - Size = MAP_APPFONT( 12, 12 ); - TabStop = TRUE; - Text[ en-US ] = "..."; - }; - PushButton HID_SET { - HelpID = "basic:PushButton:RID_TP_PROFILE:HID_SET"; - Pos = MAP_APPFONT( 217, 58 ); - Size = MAP_APPFONT( 12, 12 ); - TabStop = TRUE; - Text[ en-US ] = "..."; - }; - CheckBox CB_AUTORELOAD { - HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_AUTORELOAD"; - Pos = MAP_APPFONT( 7, 74 ); - Size = MAP_APPFONT( 115, 12 ); - Text[ en-US ] = "AutoReload"; - }; - CheckBox CB_AUTOSAVE { - HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_AUTOSAVE"; - Pos = MAP_APPFONT( 7, 87 ); - Size = MAP_APPFONT( 115, 12 ); - Text[ en-US ] = "Save before execute"; - }; - CheckBox CB_STOPONSYNTAXERRORS { - HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_STOPONSYNTAXERRORS"; - Pos = MAP_APPFONT( 132, 74 ); - Size = MAP_APPFONT( 115, 12 ); - Text[ en-US ] = "Stop on Syntax Errors"; - }; -}; - -TabPage RID_TP_CRASH { - HelpID = "basic:TabPage:RID_TP_CRASH"; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 244, 100 ); - FixedLine FL_CRASHREPORT { - Pos = MAP_APPFONT( 4, 2 ); - Size = MAP_APPFONT( 230, 8 ); - Text[ en-US ] = "Crashreport"; - }; - CheckBox CB_USEPROXY { - HelpID = "basic:CheckBox:RID_TP_CRASH:CB_USEPROXY"; - Pos = MAP_APPFONT( 8, 12 ); - Size = MAP_APPFONT( 120, 12 ); - Text[ en-US ] = "Use Proxy"; - }; - FixedText FT_CRHOST { - Pos = MAP_APPFONT( 8+12, 12+13 ); - Size = MAP_APPFONT( 30, 12 ); - Text[ en-US ] = "Host"; - }; - Edit ED_CRHOST { - HelpID = "basic:Edit:RID_TP_CRASH:ED_CRHOST"; - Border = TRUE; - Pos = MAP_APPFONT( 43+12, 12+13 ); - Size = MAP_APPFONT( 80, 12 ); - TabStop = TRUE; - }; - FixedText FT_CRPORT { - Pos = MAP_APPFONT( 8+12, 12+13+16 ); - Size = MAP_APPFONT( 30, 12 ); - Text[ en-US ] = "Port"; - }; - NumericField NF_CRPORT { - HelpID = "basic:NumericField:RID_TP_CRASH:NF_CRPORT"; - Border = TRUE; - Pos = MAP_APPFONT( 43+12, 12+13+16 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Right = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = 1024; - Maximum = 0xffff; - First = 1024; - Last = 0xffff; - }; - CheckBox CB_ALLOWCONTACT { - HelpID = "basic:CheckBox:RID_TP_CRASH:CB_ALLOWCONTACT"; - Pos = MAP_APPFONT( 8, 12+13+16+16 ); - Size = MAP_APPFONT( 120, 12 ); - Text[ en-US ] = "Allow Contact"; - }; - FixedText FT_EMAIL { - Pos = MAP_APPFONT( 8+12, 12+13+16+16+13 ); - Size = MAP_APPFONT( 30, 12 ); - Text[ en-US ] = "EMail"; - }; - Edit ED_EMAIL { - HelpID = "basic:Edit:RID_TP_CRASH:ED_EMAIL"; - Border = TRUE; - Pos = MAP_APPFONT( 43+12, 12+13+16+16+13 ); - Size = MAP_APPFONT( 80, 12 ); - TabStop = TRUE; - }; -}; - - -TabPage RID_TP_MISC { - HelpID = "basic:TabPage:RID_TP_MISC"; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 244, 100 ); - FixedLine FL_COMMUNICATION { - Pos = MAP_APPFONT( 4, 2 ); - Size = MAP_APPFONT( 230, 8 ); - Text[ en-US ] = "Communication"; - }; - FixedText FT_HOST { - Pos = MAP_APPFONT( 8, 12 ); - Size = MAP_APPFONT( 30, 12 ); - Text[ en-US ] = "Host"; - }; - Edit ED_HOST { - HelpID = "basic:Edit:RID_TP_MISC:ED_HOST"; - Border = TRUE; - Pos = MAP_APPFONT( 43, 12); - Size = MAP_APPFONT( 80, 12 ); - TabStop = TRUE; - }; - FixedText FT_TTPORT { - Pos = MAP_APPFONT( 132, 12 ); - Size = MAP_APPFONT( 70, 12 ); - Text[ en-US ] = "Testtool Port"; - }; - NumericField NF_TTPORT { - HelpID = "basic:NumericField:RID_TP_MISC:NF_TTPORT"; - Border = TRUE; - Pos = MAP_APPFONT( 191, 12); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Right = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = 1024; - Maximum = 0xffff; - First = 1024; - Last = 0xffff; - }; - FixedText FT_UNOPORT { - Pos = MAP_APPFONT( 132, 12+15 ); - Size = MAP_APPFONT( 70, 12 ); - Text[ en-US ] = "Remote UNO Port"; - }; - NumericField NF_UNOPORT { - HelpID = "basic:NumericField:RID_TP_MISC:NF_UNOPORT"; - Border = TRUE; - Pos = MAP_APPFONT( 191, 12+15); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Right = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = 1024; - Maximum = 0xffff; - First = 1024; - Last = 0xffff; - }; - - FixedLine FL_OTHER { - Pos = MAP_APPFONT( 4, 27 +13 ); - Size = MAP_APPFONT( 230, 8 ); - Text[ en-US ] = "Other settings"; - }; - FixedText TIMEOUT_TEXT { - Pos = MAP_APPFONT( 8, 50 ); - Size = MAP_APPFONT( 70, 12 ); - Text[ en-US ] = "Server Timeout"; - }; - TimeField SERVER_TIMEOUT { - HelpID = "basic:TimeField:RID_TP_MISC:SERVER_TIMEOUT"; - Border = TRUE; - Pos = MAP_APPFONT( 83, 50 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Repeat = TRUE; - Spin = TRUE; - Format = TIMEF_SEC; - Duration = TRUE; - }; - FixedText FT_LRU { - Pos = MAP_APPFONT( 132, 50 ); - Size = MAP_APPFONT( 70, 12 ); - Text[ en-US ] = "Max LRU Files"; - }; - NumericField TF_MAX_LRU { - HelpID = "basic:NumericField:RID_TP_MISC:TF_MAX_LRU"; - Border = TRUE; - Pos = MAP_APPFONT( 191, 50); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Right = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = 0; - Maximum = IDM_FILE_LRUn - IDM_FILE_LRU1 +1; - }; - FixedText FT_PROGDIR { - Pos = MAP_APPFONT( 8, 50+15 ); - Size = MAP_APPFONT( 76, 12 ); - Text[ en-US ] = "OOo Program Dir"; - }; - Edit ED_PROGDIR { - HelpID = "basic:Edit:RID_TP_MISC:ED_PROGDIR"; - Border = TRUE; - Pos = MAP_APPFONT( 83, 50+15 ); - Size = MAP_APPFONT( 219-83-4, 12 ); - TabStop = TRUE; - }; - PushButton PB_PROGDIR { - HelpID = "basic:PushButton:RID_TP_MISC:PB_PROGDIR"; - Pos = MAP_APPFONT( 219, 50+15 ); - Size = MAP_APPFONT( 12, 12 ); - TabStop = TRUE; - Text[ en-US ] = "..."; - }; -}; - - -TabPage RID_TP_FONT { - HelpID = "basic:TabPage:RID_TP_FONT"; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 244, 100 ); - FixedText FT_FONTNAME { - Pos = MAP_APPFONT( 4, 2 ); - Size = MAP_APPFONT( 123, 8 ); - Text[ en-US ] = "Type"; - }; - ComboBox CB_FONTNAME { - HelpID = "basic:ComboBox:RID_TP_FONT:CB_FONTNAME"; - Pos = MAP_APPFONT( 4, 12 ); - Size = MAP_APPFONT( 123, 12*4 ); - Sort = TRUE; - AutoHScroll = TRUE; - }; - FixedText FT_FONTSTYLE { - Pos = MAP_APPFONT( 131, 2 ); - Size = MAP_APPFONT( 65, 8 ); - Text[ en-US ] = "Typeface"; - }; - ComboBox CB_FONTSTYLE { - HelpID = "basic:ComboBox:RID_TP_FONT:CB_FONTSTYLE"; - Pos = MAP_APPFONT( 131, 12 ); - Size = MAP_APPFONT( 65, 12*4 ); - AutoHScroll = TRUE; - }; - FixedText FT_FONTSIZE { - Pos = MAP_APPFONT( 200, 2 ); - Size = MAP_APPFONT( 29, 8 ); - Text[ en-US ] = "Size"; - }; - MetricBox MB_FONTSIZE { - HelpID = "basic:MetricBox:RID_TP_FONT:MB_FONTSIZE"; - Pos = MAP_APPFONT( 200, 12 ); - Size = MAP_APPFONT( 29, 12*4 ); - AutoHScroll = TRUE; - }; - FixedText FT_PREVIEW { - Pos = MAP_APPFONT( 4, 12*5+5 ); - Size = MAP_APPFONT( 229, 30 ); - Center = TRUE; - Border = TRUE; - }; - // 229 is max -}; - - -FloatingWindow IDD_DISPLAY_HID { - HelpID = "basic:FloatingWindow:IDD_DISPLAY_HID"; - OutputSize = TRUE; - SVLook = TRUE; - Size = MAP_APPFONT( 261, 160 ); - Moveable = TRUE; - Closeable = TRUE; - Sizeable = TRUE; - Zoomable = TRUE; - Hide = TRUE; - ClipChildren = TRUE; - ToolBox RID_TB_CONF { - Border = TRUE; - Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 260, 14 ); - }; - FixedText RID_FT_CONTROLS { - Pos = MAP_APPFONT( 4, 16 ); - Size = MAP_APPFONT( 128, 10 ); - Text[ en-US ] = "Controls"; - }; - MultiListBox RID_MLB_CONTROLS { - HelpID = "basic:MultiListBox:IDD_DISPLAY_HID:RID_MLB_CONTROLS"; - Border = TRUE; - AutoHScroll = TRUE; - Pos = MAP_APPFONT( 4, 28 ); - Size = MAP_APPFONT( 208, 88 ); - TabStop = TRUE; - }; - FixedText RID_FT_SLOTS { - Pos = MAP_APPFONT( 4, 120 ); - Size = MAP_APPFONT( 128, 10 ); - Text[ en-US ] = "Slots"; - }; - MultiListBox RID_MLB_SLOTS { - HelpID = "basic:MultiListBox:IDD_DISPLAY_HID:RID_MLB_SLOTS"; - Border = TRUE; - AutoHScroll = TRUE; - Pos = MAP_APPFONT( 4, 132 ); - Size = MAP_APPFONT( 208, 24 ); - TabStop = TRUE; - }; - PushButton RID_PB_KOPIEREN { - HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_KOPIEREN"; - Pos = MAP_APPFONT( 216, 28 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Copy"; - }; - PushButton RID_PB_BENENNEN { - HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_BENENNEN"; - Pos = MAP_APPFONT( 216, 44 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Hide = TRUE; - Text[ en-US ] = "Name"; - }; - PushButton RID_PB_SELECTALL { - HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_SELECTALL"; - Pos = MAP_APPFONT( 216, 44 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Select all"; - }; - OKButton RID_OK_CLOSE { - Pos = MAP_APPFONT( 216, 144 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Close"; - }; - Text[ en-US ] = "Display HId"; -}; - - - -Accelerator MAIN_ACCEL { - ItemList = { - AcceleratorItem { - Identifier = RID_FILENEW; - Key = KeyCode { Function = KEYFUNC_NEW; }; - }; - AcceleratorItem { - Identifier = RID_FILEOPEN; - Key = KeyCode { Function = KEYFUNC_OPEN; }; - }; - AcceleratorItem { - Identifier = RID_FILECLOSE; - Key = KeyCode { Function = KEYFUNC_CLOSE; }; - }; - AcceleratorItem { - Identifier = RID_FILESAVE; - Key = KeyCode { Function = KEYFUNC_SAVE; }; - }; - AcceleratorItem { - Identifier = RID_FILESAVEAS; - Key = KeyCode { Function = KEYFUNC_SAVEAS; }; - }; - AcceleratorItem { - Identifier = RID_QUIT; - Key = KeyCode { Function = KEYFUNC_QUIT; }; - }; - AcceleratorItem { - Identifier = RID_EDITSEARCH; - Key = KeyCode { Function = KEYFUNC_FIND; }; - }; - AcceleratorItem { - Identifier = RID_EDITREPEAT; - Key = KeyCode { Code = KEY_F3; }; - }; - AcceleratorItem { - Identifier = RID_RUNSTART; - Key = KeyCode { Code = KEY_F5; }; - }; - AcceleratorItem { - Identifier = RID_RUNSTEPINTO; - Key = KeyCode { Code = KEY_F8; }; - }; - AcceleratorItem { - Identifier = RID_TOGLEBRKPNT; - Key = KeyCode { Code = KEY_F9; }; - }; - AcceleratorItem { - Identifier = RID_RUNSTEPOVER; - Key = KeyCode { Code = KEY_F10; }; - }; - AcceleratorItem { - Identifier = RID_RUNTOCURSOR; - Key = KeyCode { Code = KEY_F7; }; - }; - AcceleratorItem { - Identifier = RID_RUNBREAK; - Key = KeyCode { Code = KEY_F5; Modifier1 = TRUE; }; - }; - AcceleratorItem { - Identifier = RID_RUNSTOP; - Key = KeyCode { Code = KEY_F5; Shift = TRUE; }; - }; - AcceleratorItem { - Identifier = RID_RUNNEXTERR; - Key = KeyCode { Code = KEY_F8; Shift = TRUE; }; - }; - AcceleratorItem { - Identifier = RID_RUNPREVERR; - Key = KeyCode { Code = KEY_F7; Shift = TRUE; }; - }; - }; -}; - -ImageList RID_IMGLST_LAYOUT -{ - Prefix = "im"; - MaskColor = Color { Red = 0xFFFF ; Green = 0xFFFF ; Blue = 0xFFFF ; }; - IdList = - { - IMGID_BRKENABLED ; - IMGID_BRKDISABLED ; - IMGID_STEPMARKER ; - IMGID_ERRORMARKER ; - }; -}; - -ModelessDialog IDD_EDIT_VAR { - HelpID = "basic:ModelessDialog:IDD_EDIT_VAR"; - Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 171, 87 ); - Moveable = TRUE; - Closeable = TRUE; - FixedText RID_FT_NAME { - Pos = MAP_APPFONT( 8, 8 ); - Size = MAP_APPFONT( 40, 10 ); - Text[ en-US ] = "Name"; - }; - FixedText RID_FT_CONTENT { - Pos = MAP_APPFONT( 8, 21 ); - Size = MAP_APPFONT( 40, 10 ); - Text[ en-US ] = "Content"; - }; - FixedText RID_FT_NEW_CONTENT { - Pos = MAP_APPFONT( 8, 38 ); - Size = MAP_APPFONT( 40, 10 ); - Text[ en-US ] = "New content"; - }; - FixedText RID_FT_NAME_VALUE { - Pos = MAP_APPFONT( 53, 8 ); - Size = MAP_APPFONT( 111, 10 ); - Text[ en-US ] = "Name of variable"; - }; - FixedText RID_FT_CONTENT_VALUE { - Pos = MAP_APPFONT( 53, 21 ); - Size = MAP_APPFONT( 111, 10 ); - Text[ en-US ] = "Previous contents"; - }; - RadioButton RID_RB_NEW_BOOL_T { - HelpID = "basic:RadioButton:IDD_EDIT_VAR:RID_RB_NEW_BOOL_T"; - Hide = TRUE; - Pos = MAP_APPFONT( 53, 37 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "True"; - }; - RadioButton RID_RB_NEW_BOOL_F { - HelpID = "basic:RadioButton:IDD_EDIT_VAR:RID_RB_NEW_BOOL_F"; - Hide = TRUE; - Pos = MAP_APPFONT( 98, 37 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - Text[ en-US ] = "False"; - }; - NumericField RID_NF_NEW_INTEGER { - HelpID = "basic:NumericField:IDD_EDIT_VAR:RID_NF_NEW_INTEGER"; - Border = TRUE; - Hide = TRUE; - Pos = MAP_APPFONT( 53, 37 ); - Size = MAP_APPFONT( 111, 12 ); - TabStop = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = -32768; - Maximum = 32767; - First = -32768; - Last = 32767; - SpinSize = 10; - }; - NumericField RID_NF_NEW_LONG { - HelpID = "basic:NumericField:IDD_EDIT_VAR:RID_NF_NEW_LONG"; - Border = TRUE; - Hide = TRUE; - Pos = MAP_APPFONT( 53, 37 ); - Size = MAP_APPFONT( 111, 12 ); - TabStop = TRUE; - Repeat = TRUE; - Spin = TRUE; - Minimum = -2147483648; - Maximum = 2147483647; - First = -2147483648; - Last = 2147483647; - SpinSize = 10; - }; - Edit RID_ED_NEW_STRING { - HelpID = "basic:Edit:IDD_EDIT_VAR:RID_ED_NEW_STRING"; - Hide = TRUE; - Border = TRUE; - Pos = MAP_APPFONT( 53, 37 ); - Size = MAP_APPFONT( 111, 12 ); - TabStop = TRUE; - Text[ en-US ] = "Edit"; - }; - OKButton RID_OK { - Pos = MAP_APPFONT( 33, 58 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - }; - CancelButton RID_CANCEL { - Pos = MAP_APPFONT( 93, 58 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - }; - Text[ en-US ] = "Edit variable"; -}; - -FloatingWindow LOAD_CONF { - HelpID = "basic:FloatingWindow:LOAD_CONF"; - SVLook = TRUE; - Pos = MAP_APPFONT( 66, 23 ); - Size = MAP_APPFONT( 156, 51 ); - Moveable = TRUE; - FixedText WORK { - SVLook = TRUE; - Pos = MAP_APPFONT( 0, 8 ); - Size = MAP_APPFONT( 155, 10 ); - Center = TRUE; - Text[ en-US ] = "Slot IDs"; - }; - FixedText FILENAME { - SVLook = TRUE; - Pos = MAP_APPFONT( 0, 21 ); - Size = MAP_APPFONT( 155, 10 ); - Center = TRUE; - Text[ en-US ] = "File.win"; - }; - Text[ en-US ] = "Reading Configuration Files"; -}; - diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx deleted file mode 100644 index a8e653179d1c..000000000000 --- a/basic/source/app/basicrt.cxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - - -#include "sbintern.hxx" -#include "runtime.hxx" -#include <basic/basicrt.hxx> - -const String BasicRuntime::GetSourceRevision() -{ - return pRun->GetModule()->GetComment(); -} - -const String BasicRuntime::GetModuleName( SbxNameType nType ) -{ - return pRun->GetModule()->GetName( nType ); -} - -const String BasicRuntime::GetMethodName( SbxNameType nType ) -{ - return pRun->GetMethod()->GetName( nType ); -} - -xub_StrLen BasicRuntime::GetLine() -{ - return pRun->nLine; -} - -xub_StrLen BasicRuntime::GetCol1() -{ - return pRun->nCol1; -} - -xub_StrLen BasicRuntime::GetCol2() -{ - return pRun->nCol2; -} - -sal_Bool BasicRuntime::IsRun() -{ - return pRun->IsRun(); -} - -BasicRuntime BasicRuntime::GetNextRuntime() -{ - return BasicRuntime ( pRun->pNext ); -} - - - -const String BasicErrorStackEntry::GetSourceRevision() -{ - return pEntry->aMethod->GetModule()->GetComment(); -} - -const String BasicErrorStackEntry::GetModuleName( SbxNameType nType ) -{ - return pEntry->aMethod->GetModule()->GetName( nType ); -} - -const String BasicErrorStackEntry::GetMethodName( SbxNameType nType ) -{ - return pEntry->aMethod->GetName( nType ); -} - -xub_StrLen BasicErrorStackEntry::GetLine() -{ - return pEntry->nLine; -} - -xub_StrLen BasicErrorStackEntry::GetCol1() -{ - return pEntry->nCol1; -} - -xub_StrLen BasicErrorStackEntry::GetCol2() -{ - return pEntry->nCol2; -} - - - -BasicRuntime BasicRuntimeAccess::GetRuntime() -{ - return BasicRuntime( pINST->pRun ); -} - -bool BasicRuntimeAccess::HasRuntime() -{ - return pINST && pINST->pRun != NULL; -} - -sal_uInt16 BasicRuntimeAccess::GetStackEntryCount() -{ - return GetSbData()->pErrStack->Count(); -} - -BasicErrorStackEntry BasicRuntimeAccess::GetStackEntry( sal_uInt16 nIndex ) -{ - return BasicErrorStackEntry( GetSbData()->pErrStack->GetObject( nIndex ) ); -} - -sal_Bool BasicRuntimeAccess::HasStack() -{ - return GetSbData()->pErrStack != NULL; -} - -void BasicRuntimeAccess::DeleteStack() -{ - delete GetSbData()->pErrStack; - GetSbData()->pErrStack = NULL; -} - -sal_Bool BasicRuntimeAccess::IsRunInit() -{ - return GetSbData()->bRunInit; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/basmsg.hrc b/basic/source/app/basmsg.hrc deleted file mode 100755 index bfabe2c9759e..000000000000 --- a/basic/source/app/basmsg.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "basic/ttglobal.hrc" - - -// Here are included the messages of the folder /basic/source/app - - -/////////////////////////////// -// Error messages which go to the result file. -// ********************* -// *** !!ATTENTION!! *** -// ********************* -// The numbers must NEVER(!) change, -// because they are saved in the result files and a renewed display -// would display new strings or no strings. -/////////////////////////////// - -#define S_PROG_START ( BAS_START + 0 ) -#define S_ERROR_OUTSIDE_TESTCASE ( BAS_START + 1 ) -#define S_WARNING_PREFIX ( BAS_START + 2 ) diff --git a/basic/source/app/basmsg.src b/basic/source/app/basmsg.src deleted file mode 100644 index 1e0e3f5799e7..000000000000 --- a/basic/source/app/basmsg.src +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "basmsg.hrc" - - -// Here are included the messages of the folder /basic/source/app - - -// Error messages which go to the result file. -// ********************* -// *** !!ATTENTION!! *** -// ********************* -// The numbers must NEVER(!) change, -// because they are saved in the result files and a renewed display -// would display new strings or no strings. - -String S_PROG_START -{ - Text[ en-US ] = "Program start: ($Arg1); ($Arg2)"; -}; -String S_ERROR_OUTSIDE_TESTCASE -{ - Text[ en-US ] = "Error outside of test case"; -}; -String S_WARNING_PREFIX -{ - Text[ en-US ] = "Warning: "; -}; - diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx deleted file mode 100644 index bb9b3a0aa15d..000000000000 --- a/basic/source/app/brkpnts.cxx +++ /dev/null @@ -1,333 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <basic/sbx.hxx> -#include <basic/sbmod.hxx> -#include <basic/sbstar.hxx> -#include <basic/sbmeth.hxx> -#include <vcl/image.hxx> -#include <svtools/textdata.hxx> -#include <tools/config.hxx> -#include <vcl/gradient.hxx> - -#include <basic/ttstrhlp.hxx> - -#include <rtl/strbuf.hxx> - -#include "brkpnts.hxx" -#include "basic.hrc" -#include "resids.hrc" -#include "basrid.hxx" - -struct Breakpoint -{ - sal_uInt32 nLine; - Breakpoint( sal_uInt32 nL ) { nLine = nL; } -}; - -ImageList* BreakpointWindow::pImages = NULL; - -BreakpointWindow::BreakpointWindow( Window *pParent ) -: Window( pParent ) -, nCurYOffset( 0 ) -, nMarkerPos( MARKER_NOMARKER ) -, pModule( NULL ) -, bErrorMarker( sal_False ) -{ - if ( !pImages ) - pImages = new ImageList( SttResId( RID_IMGLST_LAYOUT ) ); - - Gradient aGradient( GRADIENT_AXIAL, Color( 185, 182, 215 ), Color( 250, 245, 255 ) ); - aGradient.SetAngle(900); - SetBackground( aGradient ); - Show(); -} - -void BreakpointWindow::SetModule( SbModule *pMod ) -{ - pModule = pMod; - sal_uInt16 i; - for ( i=0 ; i < pModule->GetBPCount() ; i++ ) - { - InsertBreakpoint( pModule->GetBP( i ) ); - } - SetBPsInModule(); -} - - -void BreakpointWindow::SetBPsInModule() -{ - pModule->ClearAllBP(); - - for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i ) - { - Breakpoint* pBrk = BreakpointList[ i ]; - pModule->SetBP( (sal_uInt16)pBrk->nLine ); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (sal_uInt16)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ); -#endif - } - for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) - { - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); - DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); - } -} - - -void BreakpointWindow::InsertBreakpoint( sal_uInt32 nLine ) -{ - Breakpoint* pNewBrk = new Breakpoint( nLine ); - - for ( ::std::vector< Breakpoint* >::iterator i = BreakpointList.begin(); - i < BreakpointList.end(); - ++ i - ) - { - Breakpoint* pBrk = *i; - if ( nLine <= pBrk->nLine ) - { - if ( nLine != pBrk->nLine ) - BreakpointList.insert( i, pNewBrk ); - else - delete pNewBrk; - pNewBrk = NULL; - break; - } - } - - // No insert position found => LIST_APPEND - if ( pNewBrk ) - BreakpointList.push_back( pNewBrk ); - - Invalidate(); - - if ( pModule->SetBP( nLine ) ) - { -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( nLine ), "Brechpunkt wurde nicht gesetzt" ); -#endif - if ( StarBASIC::IsRunning() ) - { - for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) - { - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); - DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); - } - } - } -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( nLine ), "Brechpunkt wurde nicht gesetzt" ); -#endif -} - -void BreakpointWindow::AdjustBreakpoints( sal_uInt32 nLine, bool bInserted ) -{ - if ( nLine == 0 ) //TODO: nLine == TEXT_PARA_ALL+1 - return; - - for ( size_t i = 0; i < BreakpointList.size(); ) - { - Breakpoint* pBrk = BreakpointList[ i ]; - bool bDelBrk = false; - - if ( pBrk->nLine == nLine ) - { - if ( bInserted ) - pBrk->nLine++; - else - bDelBrk = true; - } - else if ( pBrk->nLine > nLine ) - { - if ( bInserted ) - pBrk->nLine++; - else - pBrk->nLine--; - } - if ( bDelBrk ) - { - delete pBrk; - ::std::vector< Breakpoint* >::iterator it = BreakpointList.begin(); - ::std::advance( it, i ); - BreakpointList.erase( it ); - } - else - { - ++i; - } - } - - Invalidate(); -} - - -void BreakpointWindow::LoadBreakpoints( String aFilename ) -{ - Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - - aConfig.SetGroup("Breakpoints"); - - rtl::OString aBreakpoints = - aConfig.ReadKey(rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8)); - - sal_Int32 nIndex = 0; - do - { - rtl::OString aBreakpoint = aBreakpoints.getToken(0, ';', nIndex); - InsertBreakpoint(static_cast<sal_uInt16>(aBreakpoint.toInt32())); - } - while ( nIndex >= 0 ); -} - - -void BreakpointWindow::SaveBreakpoints( String aFilename ) -{ - rtl::OStringBuffer aBreakpoints; - - for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i ) - { - Breakpoint* pBrk = BreakpointList[ i ]; - if (aBreakpoints.getLength()) - aBreakpoints.append(';'); - aBreakpoints.append(static_cast<sal_Int32>(pBrk->nLine)); - } - - Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - - aConfig.SetGroup("Breakpoints"); - - if (aBreakpoints.getLength()) - aConfig.WriteKey( rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8), aBreakpoints.makeStringAndClear() ); - else - aConfig.DeleteKey( rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8) ); -} - - -void BreakpointWindow::Paint( const Rectangle& ) -{ - Size aOutSz( GetOutputSize() ); - long nLineHeight = GetTextHeight(); - - Image aBrk( pImages->GetImage( IMGID_BRKENABLED ) ); - Size aBmpSz( aBrk.GetSizePixel() ); - aBmpSz = PixelToLogic( aBmpSz ); - Point aBmpOff( 0, 0 ); - aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2; - aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2; - - for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i ) - { - Breakpoint* pBrk = BreakpointList[ i ]; -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ); -#endif - sal_Int32 nLine = pBrk->nLine-1; - sal_Int32 nY = nLine*nLineHeight - nCurYOffset; - DrawImage( Point( 0, nY ) + aBmpOff, aBrk ); - } - ShowMarker( sal_True ); -} - -void BreakpointWindow::ToggleBreakpoint( sal_uInt32 nLine ) -{ - bool Removed = false; - for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i ) - { - Breakpoint* pBP = BreakpointList[ i ]; - if ( pBP->nLine == nLine ) // remove - { - pModule->ClearBP( nLine ); - delete pBP; - ::std::vector< Breakpoint* >::iterator it = BreakpointList.begin(); - ::std::advance( it, i ); - BreakpointList.erase( it ); - Removed = true; - break; - } - } - - if ( !Removed ) // create one - InsertBreakpoint( nLine ); - - Invalidate(); -} - -void BreakpointWindow::ShowMarker( bool bShow ) -{ - if ( nMarkerPos == MARKER_NOMARKER ) - return; - - Size aOutSz( GetOutputSize() ); - long nLineHeight = GetTextHeight(); - - Image aMarker; - if ( bErrorMarker ) - aMarker = pImages->GetImage( IMGID_ERRORMARKER ); - else - aMarker = pImages->GetImage( IMGID_STEPMARKER ); - - Size aMarkerSz( aMarker.GetSizePixel() ); - aMarkerSz = PixelToLogic( aMarkerSz ); - Point aMarkerOff( 0, 0 ); - aMarkerOff.X() = ( aOutSz.Width() - aMarkerSz.Width() ) / 2; - aMarkerOff.Y() = ( nLineHeight - aMarkerSz.Height() ) / 2; - - sal_uIntPtr nY = nMarkerPos*nLineHeight - nCurYOffset; - Point aPos( 0, nY ); - aPos += aMarkerOff; - if ( bShow ) - DrawImage( aPos, aMarker ); - else - Invalidate( Rectangle( aPos, aMarkerSz ) ); -} - - -void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if ( rMEvt.GetClicks() == 2 ) - { - Point aMousePos( PixelToLogic( rMEvt.GetPosPixel() ) ); - long nLineHeight = GetTextHeight(); - long nYPos = aMousePos.Y() + nCurYOffset; - long nLine = nYPos / nLineHeight + 1; - ToggleBreakpoint( sal::static_int_cast< sal_uInt16 >(nLine) ); - Invalidate(); - } -} - -void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags ) -{ - (void) nFlags; /* avoid warning about unused parameter */ - nCurYOffset -= nVertScroll; - Window::Scroll( nHorzScroll, nVertScroll ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx deleted file mode 100644 index dc4d4471a4af..000000000000 --- a/basic/source/app/brkpnts.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <vcl/window.hxx> -#include <vector> - -#define MARKER_NOMARKER 0xFFFF - -class SbModule; -struct Breakpoint; -class ImageList; - -class BreakpointWindow : public Window -{ -using Window::Scroll; - -public: - BreakpointWindow( Window *pParent ); - - void SetModule( SbModule *pMod ); - void SetBPsInModule(); - - void InsertBreakpoint( sal_uInt32 nLine ); - void ToggleBreakpoint( sal_uInt32 nLine ); - void AdjustBreakpoints( sal_uInt32 nLine, bool bInserted ); - - void LoadBreakpoints( String aFilename ); - void SaveBreakpoints( String aFilename ); - -private: - ::std::vector< Breakpoint* > BreakpointList; - long nCurYOffset; - sal_uInt32 nMarkerPos; - SbModule* pModule; - bool bErrorMarker; - static ImageList* pImages; - -protected: - virtual void Paint( const Rectangle& ); - void ShowMarker( bool bShow ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - -public: - virtual void Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags = 0 ); - long& GetCurYOffset() { return nCurYOffset; } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx deleted file mode 100644 index 60ab6626a85f..000000000000 --- a/basic/source/app/dataedit.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef DATAEDIT_HXX -#define DATAEDIT_HXX - -#include <vcl/menu.hxx> -#include <tools/link.hxx> -#include <tools/gen.hxx> -#include <svtools/textdata.hxx> - -class String; -class Font; - -// Find, Load and Save must be implemented, -// the others must exist in MemberType -#define DATA_FUNC_DEF( MemberName, MemberType ) \ -public: \ - MemberType MemberName; \ - sal_Bool Find( const String& rStr ); \ - sal_Bool Load( const String& rStr ); \ - sal_Bool Save( const String& rStr ); \ - \ - void GrabFocus(){ MemberName.GrabFocus(); } \ - void Show(){ MemberName.Show(); } \ - void SetPosPixel( const Point& rNewPos ){ MemberName.SetPosPixel(rNewPos); }\ - void SetSizePixel( const Size& rNewSize ){ MemberName.SetSizePixel(rNewSize); } \ - Size GetSizePixel(){ return MemberName.GetSizePixel(); } \ - Point GetPosPixel(){ return MemberName.GetPosPixel(); } \ - void Update(){ MemberName.Update(); } \ - void SetFont( const Font& rNewFont ){ MemberName.SetFont(rNewFont); } \ - \ - void Delete(); \ - void Cut(); \ - void Copy(); \ - void Paste(); \ - void Undo(); \ - void Redo(); \ - String GetText() const; \ - void SetText( const String& rStr ); \ - sal_Bool HasText() const; \ - String GetSelected(); \ - TextSelection GetSelection() const; \ - void SetSelection( const TextSelection& rSelection ); \ - sal_uInt16 GetLineNr() const; \ - void ReplaceSelected( const String& rStr ); \ - sal_Bool IsModified(); \ - void SetModifyHdl( Link l ); - - -class DataEdit -{ -public: - virtual ~DataEdit(){} - - virtual void Delete()=0; - virtual void Cut()=0; - virtual void Copy()=0; - virtual void Paste()=0; - - virtual void Undo()=0; - virtual void Redo()=0; - - virtual sal_Bool Find( const String& )=0; // Find and select text - virtual sal_Bool Load( const String& )=0; // Load text from file - virtual sal_Bool Save( const String& )=0; // Save text to file - virtual String GetSelected()=0; - virtual void GrabFocus()=0; - virtual TextSelection GetSelection() const=0; - virtual void SetSelection( const TextSelection& rSelection )=0; - virtual sal_uInt16 GetLineNr() const=0; - virtual String GetText() const=0; - virtual void SetText( const String& rStr )=0; - virtual sal_Bool HasText() const=0; // to avoid GetText.Len() - virtual void ReplaceSelected( const String& rStr )=0; - virtual sal_Bool IsModified()=0; - virtual void SetModifyHdl( Link )=0; - virtual void Show()=0; - virtual void SetPosPixel( const Point& rNewPos )=0; - virtual void SetSizePixel( const Size& rNewSize )=0; - virtual Size GetSizePixel()=0; - virtual Point GetPosPixel()=0; - virtual void Update()=0; - virtual void SetFont( const Font& rNewFont )=0; - - virtual void BuildKontextMenu( PopupMenu *&pMenu ) - { - (void) pMenu; /* avoid warning about unused parameter */ - } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx deleted file mode 100644 index ef59b25dda88..000000000000 --- a/basic/source/app/dialogs.cxx +++ /dev/null @@ -1,1433 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/solar.h> - -#include <algorithm> -#include <tools/rc.hxx> -#include <vcl/metric.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/edit.hxx> -#include <tools/config.hxx> -#include <vcl/msgbox.hxx> -#include <tools/debug.hxx> -#include <svtools/filedlg.hxx> -#include <tools/stream.hxx> -#include <tools/fsys.hxx> -#include <svtools/stringtransfer.hxx> -#include <vcl/splitwin.hxx> -#include <svl/zformat.hxx> -#include <svtools/ctrltool.hxx> -#include <unotools/bootstrap.hxx> - -#include <svtools/svtdata.hxx> -#include <svl/solar.hrc> - - -#include <basic/dispdefs.hxx> -#include <basic/testtool.hxx> -#include <rtl/strbuf.hxx> -#include "dialogs.hxx" -#include "resids.hrc" -#include "basic.hrc" - -#include "app.hxx" -#include "basrid.hxx" - - -AboutDialog::AboutDialog( Window* pParent, const ResId& id ) -: ModalDialog( pParent, id ) -, a1( this, ResId( 1, *id.GetResMgr() ) ) -, a4( this, ResId( 4, *id.GetResMgr() ) ) -, aVersionString( this, ResId( RID_VERSIONSTRING, *id.GetResMgr() ) ) -, aOk ( this, ResId( RID_OK, *id.GetResMgr() ) ) -{ - FreeResource(); - rtl::OUString sDefault; - aVersionString.SetText( utl::Bootstrap::getBuildIdData( sDefault ) ); -} - - -FindDialog::FindDialog( Window* pParent, const ResId& id, String& Text ) -: ModalDialog( pParent, id ) -, aFT1( this, ResId( RID_FIXEDTEXT1, *id.GetResMgr() ) ) -, aFind( this, ResId( RID_FIND, *id.GetResMgr() ) ) -, aOk( this, ResId( RID_OK, *id.GetResMgr() ) ) -, aCancel( this, ResId( RID_CANCEL, *id.GetResMgr() ) ) -{ - FreeResource(); - pFind = &Text; - // Button-Handler: - aOk.SetClickHdl( LINK( this, FindDialog, ButtonClick ) ); - aCancel.SetClickHdl( LINK( this, FindDialog, ButtonClick ) ); - aFind.SetText( Text ); -} - -IMPL_LINK_INLINE_START( FindDialog, ButtonClick, Button *, pB ) -{ - if( pB == &aOk ) { - *pFind = aFind.GetText(); - EndDialog( sal_True ); - } else EndDialog( sal_False ); - return sal_True; -} -IMPL_LINK_INLINE_END( FindDialog, ButtonClick, Button *, pB ) - -ReplaceDialog::ReplaceDialog(Window* pParent, const ResId& id, String& Old, String& New ) -: ModalDialog( pParent, id ) -, aFT1( this, ResId( RID_FIXEDTEXT1, *id.GetResMgr() ) ) -, aFT2( this, ResId( RID_FIXEDTEXT2, *id.GetResMgr() ) ) -, aFind( this, ResId( RID_FIND, *id.GetResMgr() ) ) -, aReplace(this, ResId( RID_REPLACE, *id.GetResMgr() ) ) -, aOk( this, ResId( RID_OK, *id.GetResMgr() ) ) -, aCancel( this, ResId( RID_CANCEL, *id.GetResMgr() ) ) -{ - FreeResource(); - pFind = &Old; - pReplace = &New; - // Button-Handler: - aOk.SetClickHdl( LINK( this, ReplaceDialog, ButtonClick ) ); - aCancel.SetClickHdl( LINK( this, ReplaceDialog, ButtonClick ) ); - aFind.SetText( Old ); - aReplace.SetText( New ); -} - -IMPL_LINK( ReplaceDialog, ButtonClick, Button *, pB ) -{ - if( pB == &aOk ) { - *pFind = aFind.GetText(); - *pReplace = aReplace.GetText(); - EndDialog( sal_True ); - } else EndDialog( sal_False ); - return sal_True; -} - - - -void CheckButtons( ComboBox &aCB, Button &aNewB, Button &aDelB ) -{ - aNewB.Enable( aCB.GetEntryPos( aCB.GetText() ) == COMBOBOX_ENTRY_NOTFOUND && aCB.GetText().Len() ); - aDelB.Enable( aCB.GetEntryPos( aCB.GetText() ) != COMBOBOX_ENTRY_NOTFOUND ); -} - - -void ConfEdit::Init( Config &aConf ) -{ - aConf.SetGroup("Misc"); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - - String aTemp = rtl::OStringToOUString(aConf.ReadKey(aKeyName), RTL_TEXTENCODING_UTF8); - aEdit.SetText( aTemp ); -} - -ConfEdit::ConfEdit( Window* pParent, sal_uInt16 nResText, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ) -: PushButton( pParent, SttResId(nResButton) ) -, aText( pParent, SttResId(nResText) ) -, aEdit( pParent, SttResId(nResEdit) ) -, aKeyName(aKN) -{ - Init( aConf ); -} - -ConfEdit::ConfEdit( Window* pParent, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ) -: PushButton( pParent, SttResId(nResButton) ) -, aText( pParent ) -, aEdit( pParent, SttResId(nResEdit) ) -, aKeyName(aKN) -{ - Init( aConf ); - aText.Hide(); -} - -void ConfEdit::Save( Config &aConf ) -{ - aConf.SetGroup("Misc"); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - aConf.WriteKey( aKeyName, rtl::OUStringToOString(aEdit.GetText(), RTL_TEXTENCODING_UTF8) ); -} - -void ConfEdit::Reload( Config &aConf ) -{ - aConf.SetGroup("Misc"); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - String aValue = rtl::OStringToOUString(aConf.ReadKey(aKeyName), RTL_TEXTENCODING_UTF8); - aEdit.SetText( aValue ); -} - -void ConfEdit::Click() -{ - PathDialog aPD( this ); - aPD.SetPath( aEdit.GetText() ); - if ( aPD.Execute() ) - { - aEdit.SetText( aPD.GetPath() ); - aEdit.Modify(); - } -} - -OptConfEdit::OptConfEdit( Window* pParent, sal_uInt16 nResCheck, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, ConfEdit& rBaseEdit, Config& aConf ) -: ConfEdit( pParent, nResEdit, nResButton, aKN, aConf ) -, aCheck( pParent, SttResId( nResCheck ) ) -, rBase( rBaseEdit ) -{ - aCheck.SetToggleHdl( LINK( this, OptConfEdit, ToggleHdl ) ); - rBase.SetModifyHdl( LINK( this, OptConfEdit, BaseModifyHdl ) ); -} - -#if defined(WNT) - #define FSYS_STYLE_DEFAULT FSYS_STYLE_NTFS -# else - #define FSYS_STYLE_DEFAULT FSYS_STYLE_UNX -#endif - -void OptConfEdit::Reload( Config &aConf ) -{ - ConfEdit::Reload( aConf ); - - DirEntry aCalculatedHIDDir( rBase.GetValue() ); - aCalculatedHIDDir += DirEntry( "global/hid", FSYS_STYLE_DEFAULT ); - - DirEntry aCurrentHIDDir( aEdit.GetText() ); - - aCheck.Check( aCalculatedHIDDir == aCurrentHIDDir || aEdit.GetText().Len() == 0 ); - aEdit.Enable( !aCheck.IsChecked() ); - Enable( !aCheck.IsChecked() ); -} - -IMPL_LINK( OptConfEdit, ToggleHdl, CheckBox*, EMPTYARG ) -{ - BaseModifyHdl( &aEdit ); - aEdit.Enable( !aCheck.IsChecked() ); - Enable( !aCheck.IsChecked() ); - return 0; -} - -IMPL_LINK( OptConfEdit, BaseModifyHdl, Edit*, EMPTYARG ) -{ - if ( aCheck.IsChecked() ) - { - DirEntry aCalculatedHIDDir( rBase.GetValue() ); - aCalculatedHIDDir += DirEntry( "global/hid", FSYS_STYLE_DEFAULT ); - aEdit.SetText( aCalculatedHIDDir.GetFull() ); - } - return 0; -} - - -OptionsDialog::OptionsDialog( Window* pParent, const ResId& aResId ) -: TabDialog( pParent, aResId ) -, aTabCtrl( this, ResId( RES_TC_OPTIONS, *aResId.GetResMgr() ) ) -, aOK( this ) -, aCancel( this ) -, aConfig( Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ) ) -{ - aConfig.EnablePersistence( sal_False ); - FreeResource(); - aTabCtrl.SetActivatePageHdl( LINK( this, OptionsDialog, ActivatePageHdl ) ); - aTabCtrl.SetCurPageId( RID_TP_PRO ); - ActivatePageHdl( &aTabCtrl ); - - aOK.SetClickHdl( LINK( this, OptionsDialog, OKClick ) ); - - aOK.Show(); - aCancel.Show(); -} - -OptionsDialog::~OptionsDialog() -{ - for ( sal_uInt16 i = 0; i < aTabCtrl.GetPageCount(); i++ ) - delete aTabCtrl.GetTabPage( aTabCtrl.GetPageId( i ) ); -}; - -sal_Bool OptionsDialog::Close() -{ - if ( TabDialog::Close() ) - { - delete this; - return sal_True; - } - else - return sal_False; -} - - -IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl ) -{ - sal_uInt16 nId = pTabCtrl->GetCurPageId(); - // If TabPage was not yet created, do it - if ( !pTabCtrl->GetTabPage( nId ) ) - { - TabPage *pNewTabPage = NULL; - switch ( nId ) - { - case RID_TP_GEN: - pNewTabPage = new GenericOptions( pTabCtrl, aConfig ); - break; - case RID_TP_PRO: - pNewTabPage = new ProfileOptions( pTabCtrl, aConfig ); - break; - case RID_TP_CRA: - pNewTabPage = new CrashreportOptions( pTabCtrl, aConfig ); - break; - case RID_TP_MIS: - pNewTabPage = new MiscOptions( pTabCtrl, aConfig ); - break; - case RID_TP_FON: - pNewTabPage = new FontOptions( pTabCtrl, aConfig ); - break; - default: OSL_FAIL( "PageHdl: Unbekannte ID!" ); - } - DBG_ASSERT( pNewTabPage, "Keine Page!" ); - pTabCtrl->SetTabPage( nId, pNewTabPage ); - } - return 0; -} - - - - -IMPL_LINK( OptionsDialog, OKClick, Button *, pButton ) -{ - (void) pButton; /* avoid warning about unused parameter */ - aConfig.EnablePersistence(); - GenericOptions *pGeneric; - pGeneric = (GenericOptions*)aTabCtrl.GetTabPage( RID_TP_GEN ); - if ( pGeneric ) - pGeneric->Save( aConfig ); - - ProfileOptions *pProfile; - pProfile = (ProfileOptions*)aTabCtrl.GetTabPage( RID_TP_PRO ); - if ( pProfile ) - pProfile->Save( aConfig ); - - CrashreportOptions *pCrash; - pCrash = (CrashreportOptions*)aTabCtrl.GetTabPage( RID_TP_CRA ); - if ( pCrash ) - pCrash->Save( aConfig ); - - MiscOptions *pMisc; - pMisc = (MiscOptions*)aTabCtrl.GetTabPage( RID_TP_MIS ); - if ( pMisc ) - pMisc->Save( aConfig ); - - FontOptions *pFonts; - pFonts = (FontOptions*)aTabCtrl.GetTabPage( RID_TP_FON ); - if ( pFonts ) - pFonts->Save( aConfig ); - - aConfig.Flush(); - - ((BasicApp*)GetpApp())->LoadIniFile(); - Close(); - return 0; -} - -const ByteString ProfilePrefix("_profile_"); -const sal_uInt16 ProfilePrefixLen = ProfilePrefix.Len(); - -ProfileOptions::ProfileOptions( Window* pParent, Config &rConfig ) -: TabPage( pParent, SttResId( RID_TP_PROFILE ) ) -, rConf( rConfig ) - -, aFlProfile( this, SttResId( RID_FL_PROFILE ) ) -, aCbProfile( this, SttResId( RID_CB_PROFILE ) ) -, aPbNewProfile( this, SttResId( RID_PB_NEW_PROFILE ) ) -, aPbDelProfile( this, SttResId( RID_PD_DEL_PROFILE ) ) - -, aDirs( this, SttResId(FL_DIRECTORIES) ) -, aLog( this, LOG_TEXT, LOG_NAME, LOG_SET, "LogBaseDir", rConfig ) -, aBasis( this, BASIS_TEXT, BASIS_NAME, BASIS_SET, "BaseDir", rConfig ) -, aHID( this, HID_CHECK, HID_NAME, HID_SET, "HIDDir", aBasis, rConfig ) - -, aAutoReload( this, SttResId(CB_AUTORELOAD) ) -, aAutoSave( this, SttResId(CB_AUTOSAVE) ) -, aStopOnSyntaxError( this, SttResId(CB_STOPONSYNTAXERRORS) ) -{ - FreeResource(); - - aCbProfile.EnableAutocomplete( sal_True ); - - aCbProfile.SetSelectHdl( LINK( this, ProfileOptions, Select ) ); - - aPbNewProfile.SetClickHdl( LINK( this, ProfileOptions, NewProfile ) ); - aPbDelProfile.SetClickHdl( LINK( this, ProfileOptions, DelProfile ) ); - aCbProfile.SetModifyHdl( LINK( this, ProfileOptions, CheckButtonsHdl ) ); - - LoadData(); - ReloadProfile(); -} - -void ProfileOptions::LoadData() -{ - // collect all profiles (all groups starting with the ProfilePrefix) - for ( sal_uInt16 i = 0 ; i < rConf.GetGroupCount() ; i++ ) - { - ByteString aProfile = rConf.GetGroupName( i ); - if ( aProfile.Match( ProfilePrefix ) ) - aCbProfile.InsertEntry( String( aProfile.Copy( ProfilePrefixLen ), RTL_TEXTENCODING_UTF8 ) ); - } - // set the current profile - rConf.SetGroup( "Misc" ); - ByteString aCurrentProfile = rConf.ReadKey( "CurrentProfile", "Path" ); - aCbProfile.SetText( String( aCurrentProfile.Copy( ProfilePrefixLen ), RTL_TEXTENCODING_UTF8 ) ); - CheckButtons( aCbProfile, aPbNewProfile, aPbDelProfile ); -} - -IMPL_LINK( ProfileOptions, Select, ComboBox*, EMPTYARG ) -{ - if ( aCbProfile.GetEntryPos( aCbProfile.GetText() ) == LISTBOX_ENTRY_NOTFOUND ) - return 1; - Save(); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aCbProfile.GetText(), RTL_TEXTENCODING_UTF8) ) ); - rConf.SetGroup( "Misc" ); - rConf.WriteKey( "CurrentProfile", aProfileKey ); - ReloadProfile(); - - return 0; -} - -void ProfileOptions::ReloadProfile() -{ - aLog.Reload( rConf ); - aBasis.Reload( rConf ); - aHID.Reload( rConf ); - - ByteString aTemp; - rConf.SetGroup( "Misc" ); - ByteString aCurrentProfile = rConf.ReadKey( "CurrentProfile", "Misc" ); - rConf.SetGroup( aCurrentProfile ); - aTemp = rConf.ReadKey( "AutoReload", "0" ); - aAutoReload.Check( aTemp.Equals("1") ); - aTemp = rConf.ReadKey( "AutoSave", "0" ); - aAutoSave.Check( aTemp.Equals("1") ); - aTemp = rConf.ReadKey( "StopOnSyntaxError", "0" ); - aStopOnSyntaxError.Check( aTemp.Equals("1") ); - - CheckButtons( aCbProfile, aPbNewProfile, aPbDelProfile ); -} - -IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) -{ - String aProfile = aCbProfile.GetText(); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aProfile, RTL_TEXTENCODING_UTF8) ) ); - if ( aCbProfile.GetEntryPos( aProfile ) != COMBOBOX_ENTRY_NOTFOUND ) - { - aCbProfile.RemoveEntry( aProfile ); - rConf.DeleteGroup( aProfileKey ); - } - // Set first remaining profile as current profile - aCbProfile.SetText( aCbProfile.GetEntry( 0 ) ); - aProfile = aCbProfile.GetText(); - aProfileKey = ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aProfile, RTL_TEXTENCODING_UTF8) ); - rConf.SetGroup( "Misc" ); - rConf.WriteKey( "CurrentProfile", aProfileKey ); - ReloadProfile(); - CheckButtons( aCbProfile, aPbNewProfile, aPbDelProfile ); - - return 0; -} - -IMPL_LINK( ProfileOptions, NewProfile, Button*, EMPTYARG ) -{ - aCbProfile.InsertEntry( aCbProfile.GetText() ); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aCbProfile.GetText(), RTL_TEXTENCODING_UTF8) ) ); - rConf.SetGroup( "Misc" ); - rConf.WriteKey( "CurrentProfile", aProfileKey ); - // save last profile as new data for new profile - Save(); - CheckButtons( aCbProfile, aPbNewProfile, aPbDelProfile ); - - return 0; -} - -IMPL_LINK( ProfileOptions, CheckButtonsHdl, ComboBox*, pCB ) -{ - (void) pCB; /* avoid warning about unused parameter */ - CheckButtons( aCbProfile, aPbNewProfile, aPbDelProfile ); - return 0; -} - -void ProfileOptions::Save() -{ - Save(rConf); -} - -void ProfileOptions::Save( Config &rConfig ) -{ - // save data to current profile - aLog.Save( rConfig ); - aBasis.Save( rConfig ); - aHID.Save( rConfig ); - - rConfig.SetGroup( "Misc" ); - ByteString aCurrentProfile = rConfig.ReadKey( "CurrentProfile", "Misc" ); - rConfig.SetGroup( aCurrentProfile ); - rConfig.WriteKey( "AutoReload", aAutoReload.IsChecked()?"1":"0" ); - rConfig.WriteKey( "AutoSave", aAutoSave.IsChecked()?"1":"0" ); - rConfig.WriteKey( "StopOnSyntaxError", aStopOnSyntaxError.IsChecked()?"1":"0" ); -} - -CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) -: TabPage( pParent, SttResId( RID_TP_CRASH ) ) -, aFLCrashreport( this, SttResId( FL_CRASHREPORT ) ) -, aCBUseProxy( this, SttResId( CB_USEPROXY ) ) -, aFTCRHost( this, SttResId( FT_CRHOST ) ) -, aEDCRHost( this, SttResId( ED_CRHOST ) ) -, aFTCRPort( this, SttResId( FT_CRPORT ) ) -, aNFCRPort( this, SttResId( NF_CRPORT ) ) -, aCBAllowContact( this, SttResId( CB_ALLOWCONTACT ) ) -, aFTEMail( this, SttResId( FT_EMAIL ) ) -, aEDEMail( this, SttResId( ED_EMAIL ) ) -{ - FreeResource(); - - aNFCRPort.SetUseThousandSep( sal_False ); - - aConfig.SetGroup("Crashreporter"); - - rtl::OString aTemp = aConfig.ReadKey( "UseProxy", "false" ); - if ( aTemp.equalsIgnoreAsciiCase("true") || aTemp.equals("1") ) - aCBUseProxy.Check(); - else - aCBUseProxy.Check( sal_False ); - - aCBUseProxy.SetToggleHdl( LINK( this, CrashreportOptions, CheckProxy ) ); - LINK( this, CrashreportOptions, CheckProxy ).Call( NULL ); // call once to initialize - - aTemp = aConfig.ReadKey( "ProxyServer" ); - aEDCRHost.SetText(rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_UTF8)); - aTemp = aConfig.ReadKey( "ProxyPort", "8080" ); - aNFCRPort.SetValue(aTemp.toInt32()); - - - aTemp = aConfig.ReadKey( "AllowContact", "false" ); - if ( aTemp.equalsIgnoreAsciiCase("true") || aTemp.equals("1") ) - aCBAllowContact.Check(); - else - aCBAllowContact.Check( sal_False ); - - aCBAllowContact.SetToggleHdl( LINK( this, CrashreportOptions, CheckResponse ) ); - LINK( this, CrashreportOptions, CheckResponse ).Call( NULL ); // call once to initialize - - aTemp = aConfig.ReadKey( "ReturnAddress" ); - aEDEMail.SetText(rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_UTF8)); -} - - -void CrashreportOptions::Save( Config &aConfig ) -{ - aConfig.SetGroup("Crashreporter"); - - if ( aCBUseProxy.IsChecked() ) - aConfig.WriteKey( "UseProxy", "true" ); - else - aConfig.WriteKey( "UseProxy", "false" ); - - aConfig.WriteKey( "ProxyServer", rtl::OUStringToOString(aEDCRHost.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey("ProxyPort", - rtl::OString::valueOf(static_cast<sal_Int64>(aNFCRPort.GetValue()))); - - if ( aCBAllowContact.IsChecked() ) - aConfig.WriteKey( "AllowContact", "true" ); - else - aConfig.WriteKey( "AllowContact", "false" ); - - aConfig.WriteKey( "ReturnAddress", rtl::OUStringToOString(aEDEMail.GetText(), RTL_TEXTENCODING_UTF8) ); -} - -IMPL_LINK( CrashreportOptions, CheckProxy, void*, EMPTYARG ) -{ - aFTCRHost.Enable( aCBUseProxy.IsChecked() ); - aEDCRHost.Enable( aCBUseProxy.IsChecked() ); - aFTCRPort.Enable( aCBUseProxy.IsChecked() ); - aNFCRPort.Enable( aCBUseProxy.IsChecked() ); - - return 0; -} -IMPL_LINK( CrashreportOptions, CheckResponse, void*, EMPTYARG ) -{ - aFTEMail.Enable( aCBAllowContact.IsChecked() ); - aEDEMail.Enable( aCBAllowContact.IsChecked() ); - return 0; -} - -MiscOptions::MiscOptions( Window* pParent, Config &aConfig ) -: TabPage( pParent, SttResId( RID_TP_MISC ) ) -, aFLCommunication( this, SttResId(FL_COMMUNICATION) ) -, aFTHost( this, SttResId(FT_HOST) ) -, aEDHost( this, SttResId(ED_HOST) ) -, aFTTTPort( this, SttResId(FT_TTPORT) ) -, aNFTTPort( this, SttResId(NF_TTPORT) ) -, aFTUNOPort( this, SttResId(FT_UNOPORT) ) -, aNFUNOPort( this, SttResId(NF_UNOPORT) ) -, aOther( this, SttResId(FL_OTHER) ) -, aTimeoutText( this, SttResId(TIMEOUT_TEXT) ) -, aServerTimeout( this, SttResId(SERVER_TIMEOUT) ) -, aFTLRU( this, SttResId(FT_LRU) ) -, aTFMaxLRU( this, SttResId(TF_MAX_LRU) ) -, aFTProgDir( this, SttResId(FT_PROGDIR) ) -, aEDProgDir( this, SttResId(ED_PROGDIR) ) -, aPBProgDir( this, SttResId(PB_PROGDIR) ) -{ - FreeResource(); - - aNFTTPort.SetUseThousandSep( sal_False ); - aNFUNOPort.SetUseThousandSep( sal_False ); - aTFMaxLRU.SetUseThousandSep( sal_False ); - - rtl::OString aTemp; - - aConfig.SetGroup("Communication"); - aTemp = aConfig.ReadKey( "Host", DEFAULT_HOST ); - aEDHost.SetText(rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_UTF8)); - aTemp = aConfig.ReadKey("TTPort", - rtl::OString::valueOf(static_cast<sal_Int32>(TESTTOOL_DEFAULT_PORT))); - aNFTTPort.SetValue(aTemp.toInt32()); - aTemp = aConfig.ReadKey("UnoPort", - rtl::OString::valueOf(static_cast<sal_Int32>(UNO_DEFAULT_PORT))); - aNFUNOPort.SetValue(aTemp.toInt32()); - - aConfig.SetGroup("Misc"); - aTemp = aConfig.ReadKey( "ServerTimeout", "10000" ); // Default 1 Minute - aServerTimeout.SetTime(Time(aTemp.toInt32())); - - aConfig.SetGroup("LRU"); - aTemp = aConfig.ReadKey( "MaxLRU", "4" ); - aTFMaxLRU.SetValue(aTemp.toInt32()); - - aConfig.SetGroup("OOoProgramDir"); - aTemp = aConfig.ReadKey( "Current" ); - aEDProgDir.SetText(rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_UTF8)); - aPBProgDir.SetClickHdl( LINK( this, MiscOptions, Click ) ); -} - -IMPL_LINK( MiscOptions, Click, void*, EMPTYARG ) -{ - PathDialog aPD( this ); - aPD.SetPath( aEDProgDir.GetText() ); - if ( aPD.Execute() ) - aEDProgDir.SetText( aPD.GetPath() ); - return 0; -} - - -void MiscOptions::Save( Config &aConfig ) -{ - aConfig.SetGroup("Communication"); - aConfig.WriteKey( "Host", rtl::OUStringToOString(aEDHost.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey("TTPort", - rtl::OString::valueOf(static_cast<sal_Int64>(aNFTTPort.GetValue()))); - aConfig.WriteKey("UnoPort", - rtl::OString::valueOf(static_cast<sal_Int64>(aNFUNOPort.GetValue()))); - - aConfig.SetGroup("Misc"); - aConfig.WriteKey("ServerTimeout", - rtl::OString::valueOf(static_cast<sal_Int32>(aServerTimeout.GetTime().GetTime()))); - - aConfig.SetGroup("LRU"); - rtl::OString aTemp = aConfig.ReadKey( "MaxLRU", "4" ); - sal_uInt16 nOldMaxLRU = (sal_uInt16)aTemp.toInt32(); - sal_uInt16 n; - for ( n = nOldMaxLRU ; n > aTFMaxLRU.GetValue() ; n-- ) - { - aConfig.DeleteKey(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("LRU")) - .append(static_cast<sal_Int32>(n)) - .makeStringAndClear()); - } - aConfig.WriteKey("MaxLRU", - rtl::OString::valueOf(static_cast<sal_Int64>(aTFMaxLRU.GetValue()))); - - aConfig.SetGroup("OOoProgramDir"); - aConfig.WriteKey( C_KEY_AKTUELL, rtl::OUStringToOString(aEDProgDir.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( C_KEY_TYPE, ByteString( "PATH" ) ); -} - - -FontOptions::FontOptions( Window* pParent, Config &aConfig ) -: TabPage( pParent, SttResId( RID_TP_FONT ) ) -, aFTFontName( this, SttResId(FT_FONTNAME) ) -, aFontName( this, SttResId(CB_FONTNAME) ) -, aFTStyle( this, SttResId(FT_FONTSTYLE) ) -, aFontStyle( this, SttResId(CB_FONTSTYLE) ) -, aFTSize( this, SttResId(FT_FONTSIZE) ) -, aFontSize( this, SttResId(MB_FONTSIZE) ) -, aFTPreview( this, SttResId(FT_PREVIEW) ) -, aFontList( this ) -{ - FreeResource(); - - aFontName.Fill( &aFontList ); - aFontName.EnableWYSIWYG(); - aFontName.EnableSymbols(); - - - aFontName.SetModifyHdl( LINK( this, FontOptions, FontNameChanged ) ); - aFontStyle.SetModifyHdl( LINK( this, FontOptions, FontStyleChanged ) ); - aFontSize.SetModifyHdl( LINK( this, FontOptions, FontSizeChanged ) ); - - ByteString aTemp; - aConfig.SetGroup("Misc"); - aTemp = aConfig.ReadKey( "ScriptFontName", "Courier" ); - aFontName.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) ); - aFontName.Modify(); - aTemp = aConfig.ReadKey( "ScriptFontStyle", "normal" ); - aFontStyle.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) ); - aFontStyle.Modify(); - aTemp = aConfig.ReadKey( "ScriptFontSize", "12" ); - aFontSize.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) ); - aFontSize.Modify(); -} - -IMPL_LINK( FontOptions, FontNameChanged, void*, EMPTYARG ) -{ - aFontStyle.Fill( aFontName.GetText(), &aFontList ); - FontStyleChanged( NULL ); - return 0; -} - -IMPL_LINK( FontOptions, FontStyleChanged, void*, EMPTYARG ) -{ - FontInfo aFontInfo( aFontList.Get( aFontName.GetText(), aFontStyle.GetText() ) ); - aFontSize.Fill( &aFontInfo, &aFontList ); - FontSizeChanged( NULL ); - return 0; -} - -IMPL_LINK( FontOptions, FontSizeChanged, void*, EMPTYARG ) -{ - UpdatePreview(); - return 0; -} - -void FontOptions::UpdatePreview() -{ - Font aFont = aFontList.Get( aFontName.GetText(), aFontStyle.GetText() ); - sal_uIntPtr nFontSize = static_cast<sal_uIntPtr>((aFontSize.GetValue() + 5) / 10); - aFont.SetHeight( nFontSize ); - aFTPreview.SetFont( aFont ); - aFTPreview.SetText( aFontName.GetText() ); - aFTPreview.Invalidate(); -} - - -void FontOptions::Save( Config &aConfig ) -{ - aConfig.SetGroup("Misc"); - aConfig.WriteKey( "ScriptFontName", rtl::OUStringToOString(aFontName.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( "ScriptFontStyle", rtl::OUStringToOString(aFontStyle.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( "ScriptFontSize", rtl::OUStringToOString(aFontSize.GetText(), RTL_TEXTENCODING_UTF8) ); -} - - -GenericOptions::GenericOptions( Window* pParent, Config &aConfig ) -: TabPage( pParent, SttResId( RID_TP_GENERIC ) ) -, aConf( aConfig ) - -, aFlArea( this, SttResId( RID_FL_AREA ) ) -, aCbArea( this, SttResId( RID_CB_AREA ) ) -, aPbNewArea( this, SttResId( RID_PB_NEW_AREA ) ) -, aPbDelArea( this, SttResId( RID_PD_DEL_AREA ) ) - -, aFlValue( this, SttResId( RID_FL_VALUE ) ) -, aCbValue( this, SttResId( RID_CB_VALUE ) ) - -, aPbSelectPath( this, SttResId( RID_PB_SELECT_FILE ) ) -, aPbNewValue( this, SttResId( RID_PB_NEW_VALUE ) ) -, aPbDelValue( this, SttResId( RID_PB_DEL_VALUE ) ) - -, nMoveButtons( 0 ) -, bShowSelectPath( sal_False ) -{ - FreeResource(); - LoadData(); - - aCbArea.EnableAutocomplete( sal_True ); - aCbValue.EnableAutocomplete( sal_True ); - - aCbArea.SetSelectHdl( LINK( this, GenericOptions, LoadGroup ) ); - - aPbNewArea.SetClickHdl( LINK( this, GenericOptions, NewGroup ) ); - aPbDelArea.SetClickHdl( LINK( this, GenericOptions, DelGroup ) ); - - aPbSelectPath.SetClickHdl( LINK( this, GenericOptions, SelectPath ) ); - aPbNewValue.SetClickHdl( LINK( this, GenericOptions, NewValue ) ); - aPbDelValue.SetClickHdl( LINK( this, GenericOptions, DelValue ) ); - - aCbArea.SetModifyHdl( LINK( this, GenericOptions, CheckButtonsHdl ) ); - aCbValue.SetModifyHdl( LINK( this, GenericOptions, CheckButtonsHdl ) ); - aCbValue.SetSelectHdl( LINK( this, GenericOptions, CheckButtonsHdl ) ); - - aMoveTimer.SetTimeout( 60 ); - aMoveTimer.SetTimeoutHdl( LINK( this, GenericOptions, MoveButtons ) ); -} - -GenericOptions::~GenericOptions() -{ -} - -StringList* GenericOptions::GetAllGroups() -{ - StringList* pGroups = new StringList(); - for ( sal_uInt16 i = 0 ; i < aConf.GetGroupCount() ; i++ ) - { - String *pGroup = new String(rtl::OStringToOUString(aConf.GetGroupName(i), RTL_TEXTENCODING_UTF8)); - pGroups->push_back( pGroup ); - } - return pGroups; -} - -void GenericOptions::LoadData() -{ - StringList* pGroups = GetAllGroups(); - for ( size_t i = 0, n = pGroups->size(); i < n; ++i ) - { - String* pGroup = pGroups->at( i ); - aConf.SetGroup( rtl::OUStringToOString(*pGroup, RTL_TEXTENCODING_UTF8) ); - if ( aConf.ReadKey( C_KEY_AKTUELL ).getLength() > 0 ) - aCbArea.InsertEntry( *pGroup ); - delete pGroup; - } - pGroups->clear(); - delete pGroups; - aCbArea.SetText( aCbArea.GetEntry( 0 ) ); - CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); - - // Add load the data - LINK( this, GenericOptions, LoadGroup ).Call( NULL ); -} - -void GenericOptions::ShowSelectPath( const String &rType ) -{ - Point aNPos = aPbNewValue.GetPosPixel(); - Point aDPos = aPbDelValue.GetPosPixel(); - long nDelta = aDPos.Y() - aNPos.Y(); - if ( rType.EqualsIgnoreCaseAscii( "PATH" ) && !bShowSelectPath ) - { // Show Path button - nMoveButtons += nDelta; - aMoveTimer.Start(); - bShowSelectPath = sal_True; - aPbSelectPath.Show( sal_True ); - aPbSelectPath.Enable( sal_True ); - } - else if ( !rType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath ) - { // Hide Path button - nMoveButtons -= nDelta; - aMoveTimer.Start(); - bShowSelectPath = sal_False; - aPbSelectPath.Enable( sal_False ); - } -} - -IMPL_LINK( GenericOptions, MoveButtons, AutoTimer*, aTimer ) -{ - if ( nMoveButtons == 0 ) - { - aTimer->Stop(); - aPbSelectPath.Show( bShowSelectPath ); - return 0; - } - - int nStep = (nMoveButtons > 0) ? 2 : -2; - if ( nMoveButtons <= 1 && nMoveButtons >= -1 ) - nStep = nMoveButtons; - - nMoveButtons -= nStep ; - - Point aPos; - - aPos = aPbNewValue.GetPosPixel(); - aPos.Y() += nStep; - aPbNewValue.SetPosPixel( aPos ); - - aPos = aPbDelValue.GetPosPixel(); - aPos.Y() += nStep; - aPbDelValue.SetPosPixel( aPos ); - return 0; -} - -String GenericOptions::ReadKey( const ByteString &aGroup, const ByteString &aKey ) -{ - aConf.SetGroup( aGroup ); - return rtl::OStringToOUString(aConf.ReadKey(aKey), RTL_TEXTENCODING_UTF8); -} - -IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) -{ - String aCurrentValue; - String aAllValues; - String aType; - - if ( aLastGroupName.Len() ) - { // Cache values? - aCurrentValue = aCbValue.GetText(); - if ( aCbValue.GetEntryPos( aCurrentValue ) == COMBOBOX_ENTRY_NOTFOUND ) - { // Create a new value - LINK( this, GenericOptions, NewValue ).Call( NULL ); - } - - aConf.SetGroup( aLastGroupName ); - aConf.WriteKey( C_KEY_AKTUELL, rtl::OUStringToOString(aCurrentValue, RTL_TEXTENCODING_UTF8) ); - sal_uInt16 i; - for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ ) - { - if ( i > 0 ) - aAllValues += ';'; - aAllValues += aCbValue.GetEntry( i ); - } - aConf.WriteKey( C_KEY_ALLE, rtl::OUStringToOString(aAllValues, RTL_TEXTENCODING_UTF8) ); - } - - aCbValue.Clear(); - - rtl::OString aGroupName = rtl::OUStringToOString(aCbArea.GetText(), RTL_TEXTENCODING_UTF8); - aCurrentValue = ReadKey( aGroupName, C_KEY_AKTUELL ); - aAllValues = ReadKey( aGroupName, C_KEY_ALLE ); - aType = ReadKey( aGroupName, C_KEY_TYPE ); - - xub_StrLen i; - for ( i=0 ; i < aAllValues.GetTokenCount() ; i++ ) - { - aCbValue.InsertEntry( aAllValues.GetToken( i ) ); - } - aCbValue.SetText( aCurrentValue ); - - aLastGroupName = aGroupName; - CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); - CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); - ShowSelectPath( aType ); - return 0; -} - -IMPL_LINK( GenericOptions, DelGroup, Button*, EMPTYARG ) -{ - String aGroup = aCbArea.GetText(); - if ( aCbArea.GetEntryPos( aGroup ) != COMBOBOX_ENTRY_NOTFOUND ) - { - aCbArea.RemoveEntry( aGroup ); - rtl::OString aByteGroup(rtl::OUStringToOString(aGroup, RTL_TEXTENCODING_UTF8)); - aConf.DeleteGroup( aByteGroup ); - } - - aCbArea.SetText( aCbArea.GetEntry( 0 ) ); - LINK( this, GenericOptions, LoadGroup ).Call( NULL ); - - return 0; -} - -IMPL_LINK( GenericOptions, NewGroup, Button*, EMPTYARG ) -{ - aCbArea.InsertEntry( aCbArea.GetText() ); - - LINK( this, GenericOptions, LoadGroup ).Call( NULL ); - - return 0; -} - -IMPL_LINK( GenericOptions, SelectPath, Button*, EMPTYARG ) -{ - PathDialog aPD( this ); - aPD.SetPath( aCbValue.GetText() ); - if ( aPD.Execute() ) - { - aCbValue.SetText( aPD.GetPath() ); - CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); - if ( aPbNewValue.IsEnabled() ) - { - LINK( this, GenericOptions, NewValue ).Call( NULL ); - } - } - return 1; -} - -IMPL_LINK( GenericOptions, DelValue, Button*, EMPTYARG ) -{ - String aValue = aCbValue.GetText(); - if ( aCbValue.GetEntryPos( aValue ) != COMBOBOX_ENTRY_NOTFOUND ) - { - aCbValue.RemoveEntry( aValue ); - } - - aCbValue.SetText( aCbValue.GetEntry( 0 ) ); - CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); - return 0; -} - -IMPL_LINK( GenericOptions, NewValue, Button*, EMPTYARG ) -{ - aCbValue.InsertEntry( aCbValue.GetText() ); - CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); - return 0; -} - -IMPL_LINK( GenericOptions, CheckButtonsHdl, ComboBox*, pCB ) -{ - if ( pCB == &aCbArea ) - CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); - if ( pCB == &aCbValue ) - CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); - return 0; -} - -void GenericOptions::Save( Config &aConfig ) -{ - (void) aConfig; /* avoid warning about unused parameter */ - DBG_ASSERT( &aConfig == &aConf, "Saving to different Configuration" ); - - // Save changes - LINK( this, GenericOptions, LoadGroup ).Call( NULL ); -} - - -class TextAndWin : public DockingWindow -{ - FixedText *pFt; - Window *pWin; - Window* pFtOriginalParent; - Window* pWinOriginalParent; - long nSpace; // default space - sal_Bool bAlignTop; - -public: - TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, sal_Bool bAlignTopP ); - ~TextAndWin(); - - virtual void Resize(); -}; - -TextAndWin::TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, sal_Bool bAlignTopP ) -: DockingWindow( pParent ) -, pFt( pFtP ) -, pWin( pWinP ) -, nSpace( nSpaceP ) -, bAlignTop( bAlignTopP ) -{ - pFtOriginalParent = pFt->GetParent(); - pWinOriginalParent = pWin->GetParent(); - pFt->SetParent( this ); - pWin->SetParent( this ); -} - -TextAndWin::~TextAndWin() -{ - pFt->SetParent( pFtOriginalParent ); - pWin->SetParent( pWinOriginalParent ); -} - -void TextAndWin::Resize() -{ - long nTopSpace = bAlignTop ? 0 : nSpace; - long nBottomSpace = bAlignTop ? nSpace : 0; - - long nFixedTextOffset; - if ( GetOutputSizePixel().Height() < 3 * pFt->GetSizePixel().Height() ) - { - pFt->Hide(); - nFixedTextOffset = 0; - } - else - { - pFt->Show(); - nFixedTextOffset = pFt->GetSizePixel().Height() + nSpace; - - // FixedText positioning - pFt->SetPosPixel( Point( 0, nTopSpace ) ); - } - - // Window positioning - long nWinPosY = nFixedTextOffset; - nWinPosY += nTopSpace; - pWin->SetPosPixel( Point( 0, nWinPosY ) ); - - // Set size of window - long nWinHeight = GetOutputSizePixel().Height(); - nWinHeight -= nWinPosY; - nWinHeight -= nBottomSpace; - pWin->SetSizePixel( Size( GetOutputSizePixel().Width(), nWinHeight ) ); -} - -DisplayHidDlg::DisplayHidDlg( Window * pParent ) -: FloatingWindow( pParent, SttResId( IDD_DISPLAY_HID ) ) -, aTbConf( this, SttResId( RID_TB_CONF ) ) -, aFtControls( this, SttResId( RID_FT_CONTROLS ) ) -, aMlbControls( this, SttResId( RID_MLB_CONTROLS ) ) -, aFtSlots( this, SttResId( RID_FT_SLOTS ) ) -, aMlbSlots( this, SttResId( RID_MLB_SLOTS ) ) -, aPbKopieren( this, SttResId( RID_PB_KOPIEREN ) ) -, aPbBenennen( this, SttResId( RID_PB_BENENNEN ) ) -, aPbSelectAll( this, SttResId( RID_PB_SELECTALL ) ) -, aOKClose( this, SttResId( RID_OK_CLOSE ) ) -, nDisplayMode( DH_MODE_KURZNAME | DH_MODE_LANGNAME ) // If we have an old office use this default -{ - FreeResource(); - - aTbConf.SetOutStyle( TOOLBOX_STYLE_FLAT ); - -#if OSL_DEBUG_LEVEL < 2 - aTbConf.Hide(); -#endif - - pSplit = new SplitWindow( this ); - pControls = new TextAndWin( pSplit, &aFtControls, &aMlbControls, aMlbControls.GetPosPixel().X(), sal_True ); - pSlots = new TextAndWin( pSplit, &aFtSlots, &aMlbSlots, aMlbControls.GetPosPixel().X(), sal_False ); - - pSplit->SetPosPixel( aFtControls.GetPosPixel() ); - pSplit->InsertItem( 1, pControls, 70, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); - pSplit->InsertItem( 2, pSlots, 30, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); - pSplit->Show(); - - aTbConf.SetBorderStyle( WINDOW_BORDER_NORMAL ); - aPbKopieren.SetClickHdl( LINK( this, DisplayHidDlg, CopyToClipboard ) ); - aPbSelectAll.SetClickHdl( LINK( this, DisplayHidDlg, SelectAll ) ); - - aMlbControls.SetSelectHdl( LINK( this, DisplayHidDlg, Select ) ); - aMlbSlots.SetSelectHdl( LINK( this, DisplayHidDlg, Select ) ); - Select( NULL ); -} - -DisplayHidDlg::~DisplayHidDlg() -{ - delete pControls; - delete pSlots; - delete pSplit; -} - -IMPL_LINK( DisplayHidDlg, CopyToClipboard, void*, EMPTYARG ) -{ - String aSammel; - sal_uInt16 i; - - for ( i=0 ; i < aMlbControls.GetSelectEntryCount() ; i++ ) - { - if ( aSammel.Len() ) - aSammel += '\n'; - aSammel += aMlbControls.GetSelectEntry( i ); - } - for ( i=0 ; i < aMlbSlots.GetSelectEntryCount() ; i++ ) - { - if ( aSammel.Len() ) - aSammel += '\n'; - aSammel += aMlbSlots.GetSelectEntry( i ); - } - ::svt::OStringTransfer::CopyString( aSammel, this ); - return 0; -} - -IMPL_LINK( DisplayHidDlg, SelectAll, PushButton*, pButton ) -{ - if ( pButton->GetState() != STATE_CHECK ) - { - sal_uInt16 i; - for ( i=0 ; i < aMlbControls.GetEntryCount() ; i++ ) - aMlbControls.SelectEntryPos( i ); - for ( i=0 ; i < aMlbSlots.GetEntryCount() ; i++ ) - aMlbSlots.SelectEntryPos( i ); - } - else - { - aMlbControls.SetNoSelection(); - aMlbControls.Invalidate(); - aMlbSlots.SetNoSelection(); - aMlbSlots.Invalidate(); - } - Select( NULL ); - return 0; -} - -IMPL_LINK( DisplayHidDlg, Select, void*, EMPTYARG ) -{ - if ( !aMlbControls.GetSelectEntryCount() && !aMlbSlots.GetSelectEntryCount() ) - aPbSelectAll.SetState( STATE_NOCHECK ); - else if ( aMlbControls.GetSelectEntryCount() == aMlbControls.GetEntryCount() - && aMlbSlots.GetSelectEntryCount() == aMlbSlots.GetEntryCount() ) - aPbSelectAll.SetState( STATE_CHECK ); - else - aPbSelectAll.SetState( STATE_DONTKNOW ); - return 0; -} - -void DisplayHidDlg::AddData( WinInfoRec* pWinInfo ) -{ - if ( pWinInfo->bIsReset ) - { - aMlbControls.Clear(); - aMlbSlots.Clear(); - - if ( pWinInfo->nRType & DH_MODE_DATA_VALID ) // no old office - nDisplayMode = pWinInfo->nRType; // Is used for mode transmission while reset - - return; - } - - String aMsg; - if ( ( nDisplayMode & DH_MODE_KURZNAME ) ) - { - if ( pWinInfo->aKurzname.Len() > 0 ) - aMsg += pWinInfo->aKurzname; - else - { - aMsg.AppendAscii( "--" ); - aMsg += pWinInfo->aUId; - aMsg.AppendAscii( ": " ); - aMsg += pWinInfo->aRName; - } - aMsg.Expand(20); - } - else - { - aMsg += pWinInfo->aUId; - aMsg.Expand(13); - } - aMsg.AppendAscii( " " ); // At least three blanks - - if ( nDisplayMode & DH_MODE_LANGNAME ) - { - if ( pWinInfo->aLangname.Len() > 0 ) - aMsg += pWinInfo->aLangname; - else - aMsg += String( SttResId( IDS_NO_LONGNAME ) ); - } - - aMlbControls.InsertEntry( aMsg ); - - - // Do we have a Slotname? - if ( ( nDisplayMode & DH_MODE_KURZNAME ) && pWinInfo->aSlotname.Len() > 0 ) - { - aMsg = pWinInfo->aSlotname; - aMsg.Expand(20); - aMsg.AppendAscii( " " ); - - if ( nDisplayMode & DH_MODE_LANGNAME ) - { - if ( pWinInfo->aLangname.Len() > 0 ) - aMsg += pWinInfo->aLangname; - else - aMsg += String( SttResId( IDS_NO_LONGNAME ) ); - } - - aMlbSlots.InsertEntry( aMsg ); - } -} - -void DisplayHidDlg::Resize() -{ - - if ( IsRollUp() ) - { - // We want only the toolbox to be seend - SetOutputSizePixel( aTbConf.GetSizePixel() ); - } - else - { - // Minimum size - Size aSize( GetOutputSizePixel() ); - aSize.Width() = std::max( aSize.Width(), (long)(aOKClose.GetSizePixel().Width() * 3 )); - aSize.Height() = std::max( aSize.Height(), (long)(aOKClose.GetSizePixel().Height() * 8 )); - SetOutputSizePixel( aSize ); - - // Default space - long nSpace = pSplit->GetPosPixel().X(); - - // Adapt ToolBox width - aTbConf.SetSizePixel( Size ( GetSizePixel().Width(), aTbConf.CalcWindowSizePixel().Height() ) ); - aTbConf.SetSizePixel( Size() ); // Hide at first - - // SplitWindow positioning - pSplit->SetPosPixel( Point( nSpace, nSpace + aTbConf.GetPosPixel().Y() + aTbConf.GetSizePixel().Height() ) ); - - // Calculate width of SplitWindows - long nSplitWidth = GetSizePixel().Width(); - nSplitWidth -= aPbBenennen.GetSizePixel().Width(); - nSplitWidth -= 3 * nSpace; // Spaces - nSplitWidth -= nSpace / 2; // Little more space at right margin - - // Calculate hight of SplitWindows - long nSplitHeight = GetOutputSizePixel().Height(); - nSplitHeight -= pSplit->GetPosPixel().Y(); - nSplitHeight -= nSpace; // bottom margin - - // Set size of SplitWindows - pSplit->SetSizePixel( Size( nSplitWidth, nSplitHeight ) ); - - Point aPos; - - // Button "Copy" positioning - aPos = pSplit->GetPosPixel(); - aPos.Move( nSplitWidth, 0 ); - aPos.Move( nSpace, 0 ); - aPbKopieren.SetPosPixel( aPos ); - - // Button "Get all" - aPos.Move( 0, aPbKopieren.GetSizePixel().Height() ); - aPos.Move( 0, nSpace ); - aPbSelectAll.SetPosPixel( aPos ); - - // Button "Name" - aPos.Move( 0, aPbSelectAll.GetSizePixel().Height() ); - aPos.Move( 0, nSpace ); - aPbBenennen.SetPosPixel( aPos ); - - // "Close" Button - aPos = pSplit->GetPosPixel(); - aPos.Move( nSpace, -aOKClose.GetSizePixel().Height() ); - aPos.Move( pSplit->GetSizePixel().Width(), pSplit->GetSizePixel().Height() ); - aOKClose.SetPosPixel( aPos ); - } - FloatingWindow::Resize(); -} - - -VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar ) -: ModelessDialog( pParent, SttResId( IDD_EDIT_VAR ) ) -, aFixedTextRID_FT_NAME( this, SttResId( RID_FT_NAME ) ) -, aFixedTextRID_FT_CONTENT( this, SttResId( RID_FT_CONTENT ) ) -, aFixedTextRID_FT_NEW_CONTENT( this, SttResId( RID_FT_NEW_CONTENT ) ) -, aFixedTextRID_FT_NAME_VALUE( this, SttResId( RID_FT_NAME_VALUE ) ) -, aFixedTextRID_FT_CONTENT_VALUE( this, SttResId( RID_FT_CONTENT_VALUE ) ) - -, aRadioButtonRID_RB_NEW_BOOL_T( this, SttResId( RID_RB_NEW_BOOL_T ) ) -, aRadioButtonRID_RB_NEW_BOOL_F( this, SttResId( RID_RB_NEW_BOOL_F ) ) -, aNumericFieldRID_NF_NEW_INTEGER( this, SttResId( RID_NF_NEW_INTEGER ) ) -, aNumericFieldRID_NF_NEW_LONG( this, SttResId( RID_NF_NEW_LONG ) ) -, aEditRID_ED_NEW_STRING( this, SttResId( RID_ED_NEW_STRING ) ) - -, aOKButtonRID_OK( this, SttResId( RID_OK ) ) -, aCancelButtonRID_CANCEL( this, SttResId( RID_CANCEL ) ) -, pVar( pPVar ) -{ - aFixedTextRID_FT_NAME_VALUE.SetText( pVar->GetName() ); - aFixedTextRID_FT_CONTENT_VALUE.SetText( pVar->GetString() ); - - SbxDataType eType = pVar->GetType(); - if ( ( eType & ( SbxVECTOR | SbxARRAY | SbxBYREF )) == 0 ) - { - switch ( eType ) - { - case SbxBOOL: - aRadioButtonRID_RB_NEW_BOOL_T.Show(); - aRadioButtonRID_RB_NEW_BOOL_F.Show(); - if ( pVar->GetBool() ) - aRadioButtonRID_RB_NEW_BOOL_T.Check(); - else - aRadioButtonRID_RB_NEW_BOOL_F.Check(); - break; - case SbxINTEGER: - aNumericFieldRID_NF_NEW_INTEGER.Show(); - aNumericFieldRID_NF_NEW_INTEGER.SetText( pVar->GetString() ); - aNumericFieldRID_NF_NEW_INTEGER.Reformat(); - break; - case SbxLONG: - aNumericFieldRID_NF_NEW_LONG.Show(); - aNumericFieldRID_NF_NEW_LONG.SetText( pVar->GetString() ); - aNumericFieldRID_NF_NEW_LONG.Reformat(); - // Must be hardcoded otherwise the Rsc Compiler will fail - aNumericFieldRID_NF_NEW_LONG.SetMin( -aNumericFieldRID_NF_NEW_LONG.GetMax()-1 ); - aNumericFieldRID_NF_NEW_LONG.SetFirst( -aNumericFieldRID_NF_NEW_LONG.GetLast()-1 ); - break; - case SbxSINGLE: - case SbxDOUBLE: - case SbxSTRING: - case SbxVARIANT: - case SbxEMPTY: - aEditRID_ED_NEW_STRING.Show(); - aEditRID_ED_NEW_STRING.SetText( pVar->GetString() ); - break; - default: // don't know how to edit - ; - } - } - - - aOKButtonRID_OK.SetClickHdl( LINK( this, VarEditDialog, OKClick ) ); -} - - -IMPL_LINK( VarEditDialog, OKClick, Button *, pButton ) -{ - (void) pButton; /* avoid warning about unused parameter */ - sal_Bool bWasError = SbxBase::IsError(); // Probably an error is thrown - - - SbxDataType eType = pVar->GetType(); - - - - String aContent( aEditRID_ED_NEW_STRING.GetText() ); - sal_Bool bError = sal_False; - switch ( eType ) - { - case SbxBOOL: - pVar->PutBool( aRadioButtonRID_RB_NEW_BOOL_T.IsChecked() ); - break; - case SbxINTEGER: - pVar->PutInteger( (sal_Int16)aNumericFieldRID_NF_NEW_INTEGER.GetValue() ); - break; - case SbxLONG: - pVar->PutLong( static_cast<sal_Int32>(aNumericFieldRID_NF_NEW_LONG.GetValue()) ); - break; - case SbxDOUBLE: - case SbxSINGLE: - bError = !pVar->PutStringExt( aContent ); - break; - case SbxSTRING: - pVar->PutString( aContent ); - break; - case SbxVARIANT: - case SbxEMPTY: - bError = !pVar->PutStringExt( aContent ); - break; - default: // don't know how to edit - ; - } - - - if ( !bWasError && SbxBase::IsError() ) - { - bError = sal_True; - SbxBase::ResetError(); - } - - if ( bError ) - { - ErrorBox( this, SttResId( IDS_INVALID_VALUE ) ).Execute(); - return 1; - } - - - Close(); - return 0; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx deleted file mode 100644 index ce06a1154420..000000000000 --- a/basic/source/app/dialogs.hxx +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DIALOGS_HXX -#define _DIALOGS_HXX - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> -#include <vcl/field.hxx> -#include <vcl/fixed.hxx> -#include <vcl/tabdlg.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/tabpage.hxx> -#include <tools/config.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/floatwin.hxx> -#include <vcl/toolbox.hxx> -#include <svtools/ctrltool.hxx> -#include <svtools/ctrlbox.hxx> -#include <vector> - -class SbxVariable; - -#include <basic/ttstrhlp.hxx> - -class AboutDialog : public ModalDialog { - FixedText a1,a4,aVersionString; - OKButton aOk; -public: - AboutDialog (Window*, const ResId&); -}; - -class FindDialog : public ModalDialog { - FixedText aFT1; - Edit aFind; - OKButton aOk; - CancelButton aCancel; - String* pFind; - DECL_LINK( ButtonClick, Button * ); -public: - FindDialog (Window*, const ResId&, String&); -}; - -class ReplaceDialog : public ModalDialog { - FixedText aFT1; - FixedText aFT2; - Edit aFind; - Edit aReplace; - OKButton aOk; - CancelButton aCancel; - String* pFind; - String* pReplace; - DECL_LINK( ButtonClick, Button * ); -public: - ReplaceDialog (Window*, const ResId&, String&, String&); -}; - - -class ConfEdit : public PushButton -{ -protected: - FixedText aText; - Edit aEdit; - ByteString aKeyName; - - void Init( Config &aConf ); - -public: - ConfEdit( Window* pParent, sal_uInt16 nResText, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ); - ConfEdit( Window* pParent, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ); - void Save( Config &aConf ); - void Reload( Config &aConf ); - void Click(); - String GetValue() { return aEdit.GetText(); }; - void SetModifyHdl( Link aLink ) { aEdit.SetModifyHdl( aLink ); }; -}; - - -class OptConfEdit : public ConfEdit -{ -protected: - CheckBox aCheck; - ConfEdit& rBase; - DECL_LINK( ToggleHdl, CheckBox* ); -public: - OptConfEdit( Window* pParent, sal_uInt16 nResCheck, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, ConfEdit& rBaseEdit, Config& aConf ); - void Reload( Config &aConf ); - DECL_LINK( BaseModifyHdl, Edit* ); -}; - - -class OptionsDialog : public TabDialog -{ -private: - TabControl aTabCtrl; - - OKButton aOK; - CancelButton aCancel; - DECL_LINK( OKClick, Button * ); - - Config aConfig; - -public: - OptionsDialog( Window* pParent, const ResId& ); - ~OptionsDialog(); - virtual sal_Bool Close(); - - - DECL_LINK( ActivatePageHdl, TabControl * ); -}; - -class ProfileOptions : public TabPage -{ - Config &rConf; - - FixedLine aFlProfile; - ComboBox aCbProfile; - PushButton aPbNewProfile; - PushButton aPbDelProfile; - - FixedLine aDirs; - ConfEdit aLog; - ConfEdit aBasis; - OptConfEdit aHID; - - CheckBox aAutoReload; - CheckBox aAutoSave; - CheckBox aStopOnSyntaxError; - - void LoadData(); - - DECL_LINK( Select, ComboBox* ); - DECL_LINK( DelProfile, Button* ); - DECL_LINK( NewProfile, Button* ); - DECL_LINK( CheckButtonsHdl, ComboBox* ); - - void ReloadProfile(); - void Save(); - -public: - ProfileOptions( Window*, Config &rConfig ); - void Save( Config &rConfig ); -}; - - -class CrashreportOptions : public TabPage -{ - FixedLine aFLCrashreport; - CheckBox aCBUseProxy; - FixedText aFTCRHost; - Edit aEDCRHost; - FixedText aFTCRPort; - NumericField aNFCRPort; - - CheckBox aCBAllowContact; - FixedText aFTEMail; - Edit aEDEMail; - - DECL_LINK( CheckProxy, void*); - DECL_LINK( CheckResponse, void*); - -public: - CrashreportOptions( Window*, Config &aConfig ); - void Save( Config &aConfig ); -}; - -class MiscOptions : public TabPage -{ - FixedLine aFLCommunication; - FixedText aFTHost; - Edit aEDHost; - FixedText aFTTTPort; - NumericField aNFTTPort; - FixedText aFTUNOPort; - NumericField aNFUNOPort; - FixedLine aOther; - FixedText aTimeoutText; - TimeField aServerTimeout; - FixedText aFTLRU; - NumericField aTFMaxLRU; - FixedText aFTProgDir; - Edit aEDProgDir; - PushButton aPBProgDir; - - DECL_LINK( Click, void*); - -public: - MiscOptions( Window*, Config &aConfig ); - void Save( Config &aConfig ); -}; - -class FontOptions : public TabPage -{ - FixedText aFTFontName; - FontNameBox aFontName; - FixedText aFTStyle; - FontStyleBox aFontStyle; - FixedText aFTSize; - FontSizeBox aFontSize; - FixedText aFTPreview; - - FontList aFontList; - - DECL_LINK( FontNameChanged, void* ); - DECL_LINK( FontStyleChanged, void* ); - DECL_LINK( FontSizeChanged, void* ); - - void UpdatePreview(); - -public: - FontOptions( Window*, Config &aConfig ); - void Save( Config &aConfig ); -}; - -typedef ::std::vector< String* > StringList; -#define C_KEY_ALLE CByteString("All") -#define C_KEY_AKTUELL CByteString("Current") -#define C_KEY_TYPE CByteString("Type") -#define C_KEY_DELETE CByteString("Deleted Groups") - -class GenericOptions : public TabPage -{ - Config &aConf; - - FixedLine aFlArea; - ComboBox aCbArea; - PushButton aPbNewArea; - PushButton aPbDelArea; - - FixedLine aFlValue; - ComboBox aCbValue; - PushButton aPbSelectPath; - PushButton aPbNewValue; - PushButton aPbDelValue; - - int nMoveButtons; - sal_Bool bShowSelectPath; - AutoTimer aMoveTimer; - DECL_LINK( MoveButtons, AutoTimer* ); - - ByteString aLastGroupName; - - String ReadKey( const ByteString &aGroup, const ByteString &aKey ); - - StringList* GetAllGroups(); - void LoadData(); - - void ShowSelectPath( const String& rType ); - - DECL_LINK( LoadGroup, ComboBox* ); - DECL_LINK( DelGroup, Button* ); - DECL_LINK( NewGroup, Button* ); - DECL_LINK( SelectPath, Button* ); - DECL_LINK( DelValue, Button* ); - DECL_LINK( NewValue, Button* ); - DECL_LINK( CheckButtonsHdl, ComboBox* ); - -public: - GenericOptions( Window*, Config &aConfig ); - ~GenericOptions(); - void Save( Config &aConfig ); -}; - - -struct WinInfoRec; -class SplitWindow; - -class DisplayHidDlg : public FloatingWindow -{ -protected: - ToolBox aTbConf; - FixedText aFtControls; - MultiListBox aMlbControls; - FixedText aFtSlots; - MultiListBox aMlbSlots; - PushButton aPbKopieren; - PushButton aPbBenennen; - PushButton aPbSelectAll; - OKButton aOKClose; - - DockingWindow* pControls; - DockingWindow* pSlots; - SplitWindow *pSplit; - - sal_uIntPtr nDisplayMode; - - DECL_LINK( Select, void* ); - DECL_LINK( SelectAll, PushButton* ); - DECL_LINK( CopyToClipboard, void* ); - -public: - DisplayHidDlg( Window * pParent ); - virtual ~DisplayHidDlg(); - - virtual void Resize(); - - void AddData( WinInfoRec* pWinInfo ); - -}; - - -class VarEditDialog : public ModelessDialog -{ -protected: - FixedText aFixedTextRID_FT_NAME; - FixedText aFixedTextRID_FT_CONTENT; - FixedText aFixedTextRID_FT_NEW_CONTENT; - FixedText aFixedTextRID_FT_NAME_VALUE; - FixedText aFixedTextRID_FT_CONTENT_VALUE; - - RadioButton aRadioButtonRID_RB_NEW_BOOL_T; - RadioButton aRadioButtonRID_RB_NEW_BOOL_F; - NumericField aNumericFieldRID_NF_NEW_INTEGER; - NumericField aNumericFieldRID_NF_NEW_LONG; - Edit aEditRID_ED_NEW_STRING; - - OKButton aOKButtonRID_OK; - CancelButton aCancelButtonRID_CANCEL; - - SbxVariable *pVar; - - DECL_LINK( OKClick, Button * ); - -public: - VarEditDialog( Window * pParent, SbxVariable *pPVar ); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx deleted file mode 100644 index cda2c4fa3e6f..000000000000 --- a/basic/source/app/msgedit.cxx +++ /dev/null @@ -1,902 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* -File Versions so far: -No Version Initial Implementation without Version Information -Version 2 changed order of entries(New Entries at the end) -Version 3 Changed Charset from CHARSET_IBMPC to RTL_TEXTENCODING_UTF8 - -*************************************************************************/ -#include <cstdio> -#include <tools/time.hxx> -#include <tools/stream.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/sound.hxx> -#include <tools/fsys.hxx> -#include <svtools/stringtransfer.hxx> -#include <unotools/syslocale.hxx> -#include <basic/ttstrhlp.hxx> -#include "basic.hrc" -#include "msgedit.hxx" -#include "app.hxx" -#include "apperror.hxx" -#include "appbased.hxx" -#include "basmsg.hrc" -#include "basrid.hxx" - -sal_uInt16 MsgEdit::nMaxLogLen = 0; -sal_Bool MsgEdit::bLimitLogLen = sal_False; -sal_Bool MsgEdit::bPrintLogToStdout = sal_False; -sal_Bool MsgEdit::bPrintLogToStdoutSet = sal_False; - -#define WARNING_PREFIX String( SttResId( S_WARNING_PREFIX ) ) -#define VERSION_STRING CUniString("File Format Version: ") -#define THIS_VERSION 2 - -#define LOGTYPE( pEntry ) ((pEntry && pEntry->GetUserData())?((TTDebugData*)pEntry->GetUserData())->aLogType:LOG_ERROR) - -MsgEdit::MsgEdit( AppError* pParent, BasicFrame *pBF, const WinBits& aBits ) -: pBasicFrame(pBF) -, pCurrentRun(NULL) -, pCurrentTestCase(NULL) -, pCurrentAssertion( NULL ) -, pCurrentError(NULL) -, bModified(sal_False) -, bFileLoading(sal_False) -, nVersion(0) -, pAppError( pParent ) -, aEditTree( pParent, pBF, aBits | WB_HASBUTTONS | WB_HASLINES | WB_HASBUTTONSATROOT ) -{ - aEditTree.SetNodeBitmaps( Bitmap( SttResId (MBP_PLUS) ), Bitmap( SttResId (MBP_MINUS) ) ); - aEditTree.SetSelectionMode( MULTIPLE_SELECTION ); - if ( aEditTree.GetModel()->GetSortMode() != SortNone ) - aEditTree.GetModel()->SetSortMode( SortNone ); - - if ( !bPrintLogToStdoutSet ) - { - bPrintLogToStdoutSet = sal_True; - for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("-printlog") == COMPARE_EQUAL - #ifndef UNX - || Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("/printlog") == COMPARE_EQUAL - #endif - ) - bPrintLogToStdout = sal_True; - } - } -} - -MsgEdit::~MsgEdit() -{} - -// set the LogType since calling the add method can be from other add methods -#define COPY_TTDEBUGDATA( LOGTYPE ) \ - TTDebugData *pTTDebugData = new TTDebugData; \ - *pTTDebugData = aDebugData; \ - pTTDebugData->aLogType = LOGTYPE; \ - - -void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) -{ - if ( LogMsg->aDebugData.aFilename.Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) - LogMsg->aDebugData.aFilename.Erase(0,2); - - xub_StrLen nPos; - LogMsg->aDebugData.aMsg.ConvertLineEnd(); - // does the message have several lines -> repeat the call for each line - if ( (nPos = LogMsg->aDebugData.aMsg.Search( CUniString("\n").ConvertLineEnd() )) != STRING_NOTFOUND ) - { - String aOriginalMsg = LogMsg->aDebugData.aMsg; - xub_StrLen nSysLineEndLen = CUniString("\n").ConvertLineEnd().Len(); - String aLastPart = LogMsg->aDebugData.aMsg.Copy( nPos+nSysLineEndLen ); - LogMsg->aDebugData.aMsg.Erase( nPos ); - AddAnyMsg( LogMsg ); - if ( aLastPart.Len() ) - { - LogMsg->aDebugData.aMsg = aLastPart; - AddAnyMsg( LogMsg ); - } - LogMsg->aDebugData.aMsg = aOriginalMsg; - } - else - { - String aUILogMsg( pBasicFrame->GenRealString( LogMsg->aDebugData.aMsg ) ); - switch ( LogMsg->aDebugData.aLogType ) - { - case LOG_RUN: - { - if ( LogMsg->aDebugData.aMsg.Len() == 0 ) - { - SvtSysLocale aLocale; - LogMsg->aDebugData.aMsg = GEN_RES_STR2( S_PROG_START, - aLocale.GetLocaleData().getDate(Date( Date::SYSTEM)), - aLocale.GetLocaleData().getTime(Time( Time::SYSTEM)) ); - aUILogMsg = pBasicFrame->GenRealString( LogMsg->aDebugData.aMsg ); - } - AddRun( aUILogMsg, LogMsg->aDebugData ); break; - } - case LOG_TEST_CASE: AddTestCase( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_ERROR: AddError( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_CALL_STACK:AddCallStack( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_MESSAGE: AddMessage( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_WARNING: AddWarning( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_ASSERTION: AddAssertion( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_ASSERTION_STACK: AddAssertionStack( aUILogMsg, LogMsg->aDebugData ); break; - case LOG_QA_ERROR: AddQAError( aUILogMsg, LogMsg->aDebugData ); break; - default:OSL_FAIL("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust"); - } - - if ( !bFileLoading ) - { // Comes from Testtool and must be written immediately - sal_Bool bFileWasChanged = pAppError->DiskFileChanged( SINCE_LAST_LOAD ); - - DBG_ASSERT( aLogFileName == LogMsg->aLogFileName, "Logging to different logfile as before" ); - DirEntry aEntry( LogMsg->aLogFileName ); - sal_Bool bNewFile = !aEntry.Exists(); - SvFileStream aStrm( LogMsg->aLogFileName, STREAM_STD_WRITE ); - if ( bNewFile ) - { - String aSave = VERSION_STRING.Append( UniString::CreateFromInt32( 3 ) ).AppendAscii("\n"); // Version 3 - aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_IBM_850).getStr(); - } - - String aLogMsg = Impl_MakeSaveText( LogMsg->aDebugData ).AppendAscii("\n"); - - if( aStrm.IsOpen() ) - { - aLogMsg.ConvertLineEnd(LINEEND_CRLF); - aStrm.Seek(STREAM_SEEK_TO_END); - aStrm << rtl::OUStringToOString(aLogMsg, RTL_TEXTENCODING_UTF8).getStr(); - aStrm.Close(); - } - if ( !bFileWasChanged ) - pAppError->UpdateFileInfo( HAS_BEEN_LOADED ); - - - // now write to stdout - if ( bPrintLogToStdout ) - { - String aPrintMsg, aOriginalMsg; - - aOriginalMsg = LogMsg->aDebugData.aMsg; - // converting to human readable string for adding errors to list in testobject - LogMsg->aDebugData.aMsg = pBasicFrame->GenRealString( LogMsg->aDebugData.aMsg ); - - aPrintMsg = Impl_MakeSaveText( LogMsg->aDebugData ).AppendAscii("\n"); - - // restore Original Msg - LogMsg->aDebugData.aMsg = aOriginalMsg; - - printf( "%s", rtl::OUStringToOString(aPrintMsg, RTL_TEXTENCODING_UTF8).getStr() ); - } - } - } - // converting to human readable string for adding errors to list in testobject - LogMsg->aDebugData.aMsg = pBasicFrame->GenRealString( LogMsg->aDebugData.aMsg ); -} - -void MsgEdit::AddRun( String aMsg, TTDebugData aDebugData ) -{ - if ( !bFileLoading && bLimitLogLen ) - { - sal_uInt16 nSkip = nMaxLogLen; - SvLBoxEntry *pRun = aEditTree.First(); - while ( nSkip-- && pRun ) - pRun = aEditTree.NextSibling( pRun ); - // Remove all Entries thereafter - if ( pRun ) - { - while ( pRun && aEditTree.NextSibling( pRun ) ) - aEditTree.GetModel()->Remove( aEditTree.NextSibling( pRun ) ); - - aEditTree.GetModel()->Remove( pRun ); - bModified = sal_True; - lModify.Call( NULL ); - Save( aLogFileName ); - pAppError->UpdateFileInfo( HAS_BEEN_LOADED ); - } - } - - COPY_TTDEBUGDATA( LOG_RUN ); - if ( !bFileLoading || ( bFileLoading && nVersion >= 2 ) ) - pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, sal_False, 0, pTTDebugData ); - else // First file format - pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, sal_False, LIST_APPEND, pTTDebugData ); // and therefor at the end - - aEditTree.ShowEntry( pCurrentRun ); - pCurrentTestCase = NULL; - pCurrentAssertion = NULL; - pCurrentError = NULL; -} - -void MsgEdit::AddTestCase( String aMsg, TTDebugData aDebugData ) -{ - if ( pCurrentRun ) - { - if ( aMsg.Len() == 0 ) // End of Testcase - { - pCurrentTestCase = NULL; - } - else - { - COPY_TTDEBUGDATA( LOG_TEST_CASE ); - pCurrentTestCase = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pCurrentTestCase ); - } - } - pCurrentAssertion = NULL; - pCurrentError = NULL; -} - -void MsgEdit::AddError( String aMsg, TTDebugData aDebugData ) -{ - if ( !pCurrentTestCase ) - { - TTLogMsg aLogMsg; - aLogMsg.aDebugData = aDebugData; - aLogMsg.aDebugData.aMsg = GEN_RES_STR0( S_ERROR_OUTSIDE_TESTCASE ); - aLogMsg.aDebugData.aLogType = LOG_TEST_CASE; - aLogMsg.aLogFileName = aLogFileName; - AddAnyMsg( &aLogMsg ); - } - if ( pCurrentTestCase ) - { - COPY_TTDEBUGDATA( LOG_ERROR ); - pCurrentError = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pCurrentError ); - } -} - -void MsgEdit::AddCallStack( String aMsg, TTDebugData aDebugData ) -{ - DBG_ASSERT( pCurrentError, "Callstack ohne CurrentError im Journal" ); - if ( pCurrentError ) - { - COPY_TTDEBUGDATA( LOG_CALL_STACK ); - aEditTree.InsertEntry( aMsg, pCurrentError, sal_False, LIST_APPEND, pTTDebugData ); - } -} - -void MsgEdit::AddMessage( String aMsg, TTDebugData aDebugData ) -{ - SvLBoxEntry *pThisEntry = NULL; - COPY_TTDEBUGDATA( LOG_MESSAGE ); - if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); - else if ( pCurrentRun ) - { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - else - { - AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } -} - -void MsgEdit::AddWarning( String aMsg, TTDebugData aDebugData ) -{ - SvLBoxEntry *pThisEntry = NULL; - String aCompleteMsg; - aCompleteMsg = WARNING_PREFIX.Append( aMsg ); - COPY_TTDEBUGDATA( LOG_WARNING ); - - if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); - else if ( pCurrentRun ) - { - pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - else - { - AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - - while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) != NULL ) - aEditTree.InvalidateEntry( pThisEntry ); -} - -void MsgEdit::AddAssertion( String aMsg, TTDebugData aDebugData ) -{ - const String aAssertionStackPrefix( CUniString(ASSERTION_STACK_PREFIX) ); - if ( aMsg.Match( aAssertionStackPrefix ) == aAssertionStackPrefix.Len() ) - { - AddAssertionStack( aMsg, aDebugData ); - return; - } - SvLBoxEntry *pThisEntry = NULL; - COPY_TTDEBUGDATA( LOG_ASSERTION ); - if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); - else if ( pCurrentRun ) - { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - else - { - AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - - pCurrentAssertion = pThisEntry; - - while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) != NULL ) - aEditTree.InvalidateEntry( pThisEntry ); -} - -void MsgEdit::AddAssertionStack( String aMsg, TTDebugData aDebugData ) -{ - SvLBoxEntry *pThisEntry = NULL; - COPY_TTDEBUGDATA( LOG_ASSERTION_STACK ); - if ( pCurrentAssertion ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentAssertion, sal_False, LIST_APPEND, pTTDebugData ); - else if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); - else if ( pCurrentRun ) - { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - else - { - AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - - while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) != NULL ) - aEditTree.InvalidateEntry( pThisEntry ); -} - -void MsgEdit::AddQAError( String aMsg, TTDebugData aDebugData ) -{ - SvLBoxEntry *pThisEntry = NULL; - COPY_TTDEBUGDATA( LOG_QA_ERROR ); - if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); - else if ( pCurrentRun ) - { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - else - { - AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); - aEditTree.ShowEntry( pThisEntry ); - } - - while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) != NULL ) - aEditTree.InvalidateEntry( pThisEntry ); -} - -#define CHECK( pMemo ) if ( pMemo && !aEditTree.GetModel()->IsInChildList( NULL, pMemo ) ) pMemo = NULL -void MsgEdit::Delete() -{ - aEditTree.RemoveSelection(); - CHECK( pCurrentRun ); - CHECK( pCurrentTestCase ); - CHECK( pCurrentAssertion ); - CHECK( pCurrentError ); - bModified = sal_True; - lModify.Call( NULL ); -} - -void MsgEdit::Cut(){ Copy(); Delete(); bModified = sal_True; lModify.Call( NULL ); } -void MsgEdit::Copy(){ ::svt::OStringTransfer::CopyString( GetSelected(), &aEditTree ); } -/**/void MsgEdit::Paste(){ Sound::Beep(); } -void MsgEdit::Undo(){ Sound::Beep(); } -void MsgEdit::Redo(){ Sound::Beep(); } - - -String MsgEdit::Impl_MakeText( SvLBoxEntry *pEntry ) const -{ - String aRet; - TTDebugData *aData = (TTDebugData*)pEntry->GetUserData(); - switch ( aData->aLogType ) - { - case LOG_RUN: aRet.AppendAscii("\n"); break; - case LOG_TEST_CASE: break; - case LOG_ERROR: break; - case LOG_CALL_STACK:aRet.AppendAscii("--> "); break; - case LOG_MESSAGE: break; - case LOG_WARNING: break; - case LOG_ASSERTION: break; - case LOG_ASSERTION_STACK:aRet.AppendAscii("--> "); break; - case LOG_QA_ERROR: break; - default:OSL_FAIL("Unknown type in ResultWindow!"); - } - aRet += aEditTree.GetEntryText( pEntry ); - return aRet; -} - -String MsgEdit::Impl_MakeSaveText( TTDebugData aData ) const -{ -// LogType;Filename;Line;Col1;Col2;Message - String aRet; - aRet += String::CreateFromInt32( (int)aData.aLogType ); - aRet += ';'; - aRet += aData.aFilename; - aRet += ';'; - aRet += String::CreateFromInt32( aData.nLine ); - aRet += ';'; - aRet += String::CreateFromInt32( aData.nCol1 ); - aRet += ';'; - aRet += String::CreateFromInt32( aData.nCol2 ); - aRet += ';'; - aRet += '"'; - aRet += aData.aMsg; - aRet += '"'; - return aRet; -} - -String MsgEdit::Impl_MakeSaveText( SvLBoxEntry *pEntry ) const -{ -// LogType;Filename;Line;Col1;Col2;Message - String aRet; - TTDebugData *aData = (TTDebugData*)pEntry->GetUserData(); - - if ( aEditTree.PrevSibling( pEntry ) && LOGTYPE( aEditTree.PrevSibling( pEntry ) ) == LOG_TEST_CASE ) - { // To properly finish cases and warnings/msgs are in correct hierarchie - aRet += String::CreateFromInt32( (int)LOG_TEST_CASE ); - aRet.AppendAscii(";;0;0;0;\"\"\n"); - } - aRet += Impl_MakeSaveText( *aData ); - return aRet; -} - -String MsgEdit::GetSelected() -{ - String aRet; - SvLBoxEntry *pEntry = aEditTree.FirstSelected(); - while ( pEntry ) - { - aRet += Impl_MakeText( pEntry ); - aRet += '\n'; - pEntry = aEditTree.NextSelected( pEntry ); - } - aRet.ConvertLineEnd(); - return aRet; -} - -TextSelection MsgEdit::GetSelection() const -{ - if ( aEditTree.FirstSelected() ) - { - sal_uIntPtr nStart=0,nEnd=0; - nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() ); - if ( aEditTree.LastSelected() ) - nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() ); - return TextSelection( TextPaM( nStart, 0 ), TextPaM( nEnd, STRING_MAXLEN ) ); - } - else - return TextSelection(); -} - -void MsgEdit::SetSelection( const TextSelection& rSelection ) -{ - sal_uIntPtr nStart,nEnd; - - while ( aEditTree.GetSelectionCount() ) - aEditTree.Select( aEditTree.FirstSelected(), sal_False ); - - if ( rSelection.HasRange() ) - { - nStart = rSelection.GetStart().GetPara(); - nEnd = rSelection.GetEnd().GetPara(); - - for ( sal_uIntPtr i = nStart ; i <= nEnd ; i++ ) - aEditTree.Select( aEditTree.GetModel()->GetEntryAtAbsPos( i ), sal_True ); - } -} - -sal_uInt16 MsgEdit::GetLineNr() const -{ - if ( aEditTree.GetCurEntry() ) - return (sal_uInt16)aEditTree.GetModel()->GetAbsPos(aEditTree.GetCurEntry() ) + 1; - else - return 0; -} - -void MsgEdit::ReplaceSelected( const String& rStr ) -{ - (void) rStr; /* avoid warning about unused parameter */ - Sound::Beep(); - OSL_FAIL("Not Implemented"); -} - -sal_Bool MsgEdit::IsModified(){ return bModified; } -void MsgEdit::SetModifyHdl( Link l ){ lModify = l; } - -String MsgEdit::GetText() const -{ - String aRet; - SvLBoxEntry *pEntry = aEditTree.First(); - while ( pEntry ) - { - aRet += Impl_MakeText( pEntry ); - aRet += '\n'; - pEntry = aEditTree.Next( pEntry ); - } - aRet.ConvertLineEnd(); - return aRet; -} - -void MsgEdit::SetText( const String& rStr ) -{ - (void) rStr; /* avoid warning about unused parameter */ - Sound::Beep(); - OSL_FAIL("Not Implemented"); -} - -sal_Bool MsgEdit::HasText() const -{ - return aEditTree.First() != NULL; -} - -// Search from the beginning or mark start + 1 -sal_Bool MsgEdit::Find( const String& s ) -{ - TextSelection r = GetSelection(); - sal_uInt16 bgn = (sal_uInt16) r.GetStart().GetPara() + 1; - if ( r.GetStart().GetPara() == 0 ) - bgn = 0; // Search from the beginning - - SvLBoxEntry *pEntry = aEditTree.GetModel()->GetEntryAtAbsPos( bgn ); - while ( pEntry ) - { - if( aEditTree.GetEntryText( pEntry ).Search( s, 0 ) != STRING_NOTFOUND ) - { - aEditTree.SetCurEntry( pEntry ); - return sal_True; - } - pEntry = aEditTree.Next( pEntry ); - } - return sal_False; -} - -/****************************************************************** - - Fileformat of *.res file: - Information are stored as semicolon separated strings - Order: - - LogType;Filename;Line;Col1;Col2;Message - -******************************************************************/ - -sal_Bool MsgEdit::Load( const String& aName ) -{ - aLogFileName = aName; - sal_Bool bOk = sal_True, bFirstLine = sal_True; - sal_Bool bLoadError = sal_False; - SvFileStream aStrm( aName, STREAM_STD_READ ); - if( aStrm.IsOpen() ) - { - aEditTree.Clear(); - String aLine; - bFileLoading = sal_True; // To avoid logging to disk - TTLogMsg *pLogMsg = new TTLogMsg; - while( !aStrm.IsEof() && bOk ) - { - if ( nVersion >= 3 ) // utf8 - aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_UTF8 ); - else - aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_IBM_850 ); - - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - -#define TOKEN( n ) aLine.GetToken( n ) - - if ( aLine.GetTokenCount() >= 6 ) - { -// LogType;Filename;Line;Col1;Col2;Message - TTDebugData aDebugData; - aDebugData.aLogType = TTLogType( TOKEN(0).ToInt32() ); - aDebugData.aFilename = TOKEN(1); - aDebugData.nLine = sal_uInt16( TOKEN(2).ToInt32() ); - aDebugData.nCol1 = sal_uInt16( TOKEN(3).ToInt32() ); - aDebugData.nCol2 = sal_uInt16( TOKEN(4).ToInt32() ); - aDebugData.aMsg = aLine.GetQuotedToken( 5, CUniString("\"\"") ); - - // Remove leading and trailing quotes - aDebugData.aMsg.Erase(0,1); - aDebugData.aMsg.Erase(aDebugData.aMsg.Len()-1,1); - - pLogMsg->aLogFileName.Erase(); - pLogMsg->aDebugData = aDebugData; - - AddAnyMsg( pLogMsg ); - } - else if ( bFirstLine && (aLine.Search( VERSION_STRING ) == 0) ) - nVersion = sal_uInt16( aLine.Copy( VERSION_STRING.Len() ).ToInt32() ); - else if ( aLine.Len() ) - bLoadError = sal_True; - - bFirstLine = sal_False; - } - bFileLoading = sal_False; - delete pLogMsg; - aStrm.Close(); - if ( nVersion < 2 && !bLoadError ) - Save( aName ); // Necessary to avoid mess - - } - else - bOk = sal_False; - return bOk; -} - -sal_Bool MsgEdit::Save( const String& aName ) -{ - sal_Bool bOk = sal_True; - sal_Bool bIsText = DirEntry( aName ).GetExtension().CompareIgnoreCaseToAscii("TXT") == COMPARE_EQUAL; - if ( bIsText && !QueryBox( NULL, SttResId( IDS_LOSS_OF_INFORMATION ) ).Execute() ) - return sal_False; - SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC ); - if( aStrm.IsOpen() ) - { - if ( bIsText ) - { - String aSave = GetText(); - aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_UTF8).getStr(); - } - else - { -// LogType;Filename;Line;Col1;Col2;Message - String aSave = VERSION_STRING.Append( UniString::CreateFromInt32( 3 ) ).AppendAscii("\n"); // Version 3 - SvLBoxEntry *pRun = aEditTree.First(); - while ( pRun && aEditTree.NextSibling( pRun ) ) - pRun = aEditTree.NextSibling( pRun ); - - aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_IBM_850).getStr(); - - SvLBoxEntry *pEntry; - while ( pRun ) - { - pEntry = pRun; - while ( pEntry && ( pEntry == pRun || LOGTYPE( pEntry ) != LOG_RUN ) ) - { - aSave = Impl_MakeSaveText( pEntry ); - aSave += '\n'; - aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_UTF8).getStr(); - pEntry = aEditTree.Next( pEntry ); - } - pRun = aEditTree.PrevSibling( pRun ); - - } - } - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - else - { - bModified = sal_False; - lModify.Call( NULL ); - } - - } - else - bOk = sal_False; - return bOk; -} - - -TTTreeListBox::TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinStyle ) -: SvTreeListBox( pParent, nWinStyle ) -, pBasicFrame(pBF) -, pAppError( pParent ) -{} - -sal_Bool TTTreeListBox::JumpToSourcecode( SvLBoxEntry *pThisEntry ) -{ - if ( pThisEntry && pThisEntry->GetUserData() && ((TTDebugData*)pThisEntry->GetUserData())->aFilename.Len() > 0 ) - { - TTDebugData *aData = (TTDebugData*)pThisEntry->GetUserData(); - String aFilename = aData->aFilename; - if ( aData->aFilename.GetChar(0) == '~' ) - { - if ( aData->aFilename.GetChar(1) == '-' ) - { - aFilename.Erase( 0,2 ); - } - else - { - aFilename.Erase( 0,1 ); - } - } - - if ( pBasicFrame->FindModuleWin( aFilename ) ) - { - AppWin *pWin = pBasicFrame->FindModuleWin( aFilename ); - pWin->ToTop(); - } - else if ( pBasicFrame->Basic().FindModule( CUniString( "--" ).Append( aFilename ) ) ) - { - SbModule* pMod = pBasicFrame->Basic().FindModule( CUniString( "--" ).Append( aFilename ) ); - pBasicFrame->CreateModuleWin( pMod ); - } - else - pBasicFrame->LoadFile( aFilename ); - - if ( pBasicFrame->pWork && pBasicFrame->pWork->ISA(AppEdit) ) - ((AppEdit*)pBasicFrame->pWork)->Highlight( aData->nLine, aData->nCol1, aData->nCol2 ); - return sal_False; - } - return sal_True; -} - -sal_Bool TTTreeListBox::DoubleClickHdl() -{ - return JumpToSourcecode( GetHdlEntry() ); -} - -void TTTreeListBox::KeyInput( const KeyEvent& rKEvt ) -{ - switch ( rKEvt.GetKeyCode().GetFunction() ) - { - case KEYFUNC_CUT: - Control::GetParent()->Command( CommandEvent( Point(), RID_EDITCUT ) ); - break; - case KEYFUNC_COPY: - Control::GetParent()->Command( CommandEvent( Point(), RID_EDITCOPY ) ); - break; - case KEYFUNC_PASTE: - Control::GetParent()->Command( CommandEvent( Point(), RID_EDITPASTE ) ); - break; - case KEYFUNC_DELETE: - Control::GetParent()->Command( CommandEvent( Point(), RID_EDITDEL ) ); - break; - default: - if ( rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) - JumpToSourcecode( GetCurEntry() ); - else - SvTreeListBox::KeyInput( rKEvt ); - } -} - - -TTFeatures TTTreeListBox::GetFeatures( SvLBoxEntry* pEntry ) -{ - switch ( LOGTYPE( pEntry ) ) - { - case LOG_MESSAGE: - return HasNothing; - case LOG_WARNING : - return HasWarning; - case LOG_ERROR: - case LOG_CALL_STACK: - return HasError; - case LOG_RUN: - case LOG_TEST_CASE: - { - SvLBoxEntry* pThisEntry = FirstChild( pEntry ); - TTFeatures aResult = HasNothing; - while ( pThisEntry && !( (aResult & HasError) == HasError ) ) - { - if ( !IsEntryVisible( pThisEntry ) ) - aResult |= GetFeatures( pThisEntry ); - pThisEntry = NextSibling( pThisEntry ); - } - return aResult; - } - case LOG_ASSERTION: - case LOG_ASSERTION_STACK: - return HasAssertion; - case LOG_QA_ERROR: - return HasQAError; - default: - OSL_FAIL("Unknown type in ResultWindow"); - } - return HasNothing; -} - - -class TTLBoxString : public SvLBoxString -{ -public: - - TTLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, - const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {} - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, - SvLBoxEntry* pEntry); -}; - - -void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, - SvLBoxEntry* pEntry ) -{ - TTFeatures aFeatures = ((TTTreeListBox*)&rDev)->GetFeatures( pEntry ); - - Font aOldFont( rDev.GetFont()); - Font aFont( aOldFont ); - if ( aFeatures != HasNothing ) - { - Color aCol; - if ( ( aFeatures & HasError ) == HasError ) - aCol = Color( 255, 130, 130 ); // Red - else if ( ( aFeatures & HasWarning ) == HasWarning ) - aCol = Color( 255, 200, 120 ); // Ochre or so - else if ( ( aFeatures & HasAssertion ) == HasAssertion ) - aCol = Color( 0xd0, 0xd0, 0xff ); // blueish - else - aCol = Color( 0xd0, 0xff, 0xd0 ); // greenish - - if( rDev.IsSelected(pEntry) ) - aFont.SetColor( aCol ); - else - { - aFont.SetFillColor( aCol ); - aFont.SetTransparent( sal_False ); - Color aCol2( COL_BLACK ); - aFont.SetColor( aCol2 ); - } - - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - } - else - { - if( !rDev.IsSelected(pEntry) ) - { - Color aCol( COL_BLACK ); - aFont.SetColor( aCol ); - } - rDev.SetFont( aFont ); - SvLBoxString::Paint( rPos, rDev, nFlags, pEntry ); - } - rDev.SetFont( aOldFont ); -} - - -void TTTreeListBox::InitEntry(SvLBoxEntry* pEntry, - const String& rStr ,const Image& rImg1, const Image& rImg2, - SvLBoxButtonKind eButtonKind ) -{ - sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" - SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); - TTLBoxString* pStr = new TTLBoxString( pEntry, 0, pCol->GetText() ); - pEntry->ReplaceItem( pStr, nColToHilite ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx deleted file mode 100644 index 0da878cf48f5..000000000000 --- a/basic/source/app/msgedit.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MSGEDIT_HXX -#define _MSGEDIT_HXX - -#include <svtools/svtreebx.hxx> -#include <basic/testtool.hxx> -#include "dataedit.hxx" - -class BasicFrame; -class AppError; - -#define SelectChildren SelectChilds - -typedef sal_uInt16 TTFeatures; // Bitfield for features of the entries -#define HasNothing TTFeatures(0x00) -#define HasError TTFeatures(0x01) -#define HasWarning TTFeatures(0x02) -#define HasAssertion TTFeatures(0x04) -#define HasQAError TTFeatures(0x08) - - -class TTTreeListBox : public SvTreeListBox -{ -protected: - BasicFrame *pBasicFrame; - void InitEntry( SvLBoxEntry*, const String&, const Image&, - const Image&, SvLBoxButtonKind eButtonKind ); - AppError *pAppError; - - sal_Bool JumpToSourcecode( SvLBoxEntry *pThisEntry ); - -public: - TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinStyle=0 ); - ~TTTreeListBox(){} - - virtual sal_Bool DoubleClickHdl(); - - virtual void KeyInput( const KeyEvent& rKEvt ); - - TTFeatures GetFeatures( SvLBoxEntry* ); -}; - -class MsgEdit : public DataEdit -{ - BasicFrame *pBasicFrame; - - SvLBoxEntry *pCurrentRun; - SvLBoxEntry *pCurrentTestCase; - SvLBoxEntry *pCurrentAssertion; - SvLBoxEntry *pCurrentError; - sal_Bool bModified; - Link lModify; - sal_Bool bFileLoading; // sal_True while loading a file - String Impl_MakeText( SvLBoxEntry *pEntry ) const; - String Impl_MakeSaveText( SvLBoxEntry *pEntry ) const; - String Impl_MakeSaveText( TTDebugData aData ) const; - sal_uInt16 nVersion; // Stores file version - AppError* pAppError; - String aLogFileName; - - static sal_uInt16 nMaxLogLen; - static sal_Bool bLimitLogLen; - static sal_Bool bPrintLogToStdout; - static sal_Bool bPrintLogToStdoutSet; // has it been initialized yet -public: - MsgEdit( AppError*, BasicFrame *pBF, const WinBits& ); - ~MsgEdit(); - void AddAnyMsg( TTLogMsg *LogMsg ); - void AddRun( String aMsg, TTDebugData aDebugData ); - void AddTestCase( String aMsg, TTDebugData aDebugData ); - void AddError( String aMsg, TTDebugData aDebugData ); - void AddCallStack( String aMsg, TTDebugData aDebugData ); - void AddMessage( String aMsg, TTDebugData aDebugData ); - void AddWarning( String aMsg, TTDebugData aDebugData ); - void AddAssertion( String aMsg, TTDebugData aDebugData ); - void AddAssertionStack( String aMsg, TTDebugData aDebugData ); - void AddQAError( String aMsg, TTDebugData aDebugData ); - - static void SetMaxLogLen( sal_uInt16 nLen ) { nMaxLogLen = nLen; bLimitLogLen = sal_True; } -DATA_FUNC_DEF( aEditTree, TTTreeListBox ) -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx deleted file mode 100644 index 74afcfa8a699..000000000000 --- a/basic/source/app/mybasic.cxx +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <vcl/msgbox.hxx> -#include <basic/sbx.hxx> - -#include "sbintern.hxx" - -#include <basic/ttstrhlp.hxx> -#include <basic/mybasic.hxx> -#include "basic.hrc" -#include "appbased.hxx" - -#include "status.hxx" -#include "basic.hrc" - -#include "object.hxx" - -#include "processw.hxx" -#include "basrid.hxx" - -TYPEINIT1(MyBasic,StarBASIC) - -class MyFactory : public SbxFactory -{ -public: - virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); -}; - -static SampleObjectFac aFac1; -static MyFactory aFac2; -static ProcessFactory aProcessFac; -static short nInst = 0; - -SbxBase* MyFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCr ) -{ - if( nCr == SBXCR_TEST && nSbxId == SBXID_MYBASIC ) - return new MyBasic; - else - return NULL; -} - -MyBasic::MyBasic() : StarBASIC() -{ - nError = 0; - CurrentError = 0; - if( !nInst++ ) - { - AddFactory( &aFac1 ); - AddFactory( &aFac2 ); - AddFactory( &aProcessFac ); - } - SbxVariable* p = new SbxCollection( CUniString("MyColl") ); - p->SetName( CUniString("Objects") ); - Insert( p ); - - pTestObject = NULL; -} - -Link MyBasic::GenLogHdl() -{ - return LINK( GetpApp()->GetAppWindow(), BasicFrame, Log ); -} - -Link MyBasic::GenWinInfoHdl() -{ - return LINK( GetpApp()->GetAppWindow(), BasicFrame, WinInfo ); -} - -Link MyBasic::GenModuleWinExistsHdl() -{ - return LINK( GetpApp()->GetAppWindow(), BasicFrame, ModuleWinExists ); -} - -Link MyBasic::GenWriteStringHdl() -{ - return LINK( GetpApp()->GetAppWindow(), BasicFrame, WriteString ); -} - -void MyBasic::StartListeningTT( SfxBroadcaster &rBroadcaster ) -{ - ((BasicFrame*)GetpApp()->GetAppWindow())->StartListening( rBroadcaster ); -} - -void MyBasic::SetCompileModule( SbModule *pMod ) -{ - GetSbData()->pCompMod = pMod; -} - -SbModule *MyBasic::GetCompileModule() -{ - return GetSbData()->pCompMod; -} - -String MyBasic::GenRealString( const String &aResString ) -{ - return ((BasicFrame*)GetpApp()->GetAppWindow())->GenRealString( aResString ); -} - -void MyBasic::LoadIniFile() -{ -} - -SbTextType MyBasic::GetSymbolType( const String &rSymbol, sal_Bool bWasTTControl ) -{ - (void) rSymbol; /* avoid warning about unused parameter */ - (void) bWasTTControl; /* avoid warning about unused parameter */ - return SB_SYMBOL; // Everything here is of type SB_SYMBOL and continues to be so -} - - -MyBasic::~MyBasic() -{ - Reset(); - if( !--nInst ) - { - RemoveFactory( &aFac1 ); - RemoveFactory( &aFac2 ); - RemoveFactory( &aProcessFac ); - } -} - -void MyBasic::Reset() -{ - for ( size_t i = 0, n = aErrors.size(); i < n; ++i ) delete aErrors[ i ]; - aErrors.clear(); - nError = 0; - CurrentError = 0; -} - -sal_Bool MyBasic::Compile( SbModule* p ) -{ - Reset(); - return StarBASIC::Compile( p ); -} - -BasicError* MyBasic::NextError() -{ - if ( CurrentError < ( aErrors.size() - 1 ) ) - { - ++CurrentError; - return aErrors[ CurrentError ]; - } - return NULL; -} - -BasicError* MyBasic::PrevError() -{ - if ( !aErrors.empty() && CurrentError > 0 ) - { - --CurrentError; - return aErrors[ CurrentError ]; - } - return NULL; -} - -BasicError* MyBasic::FirstError() -{ - if ( !aErrors.empty() ) - { - CurrentError = 0; - return aErrors[ CurrentError ]; - } - return NULL; -} - -sal_Bool MyBasic::ErrorHdl() -{ - AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() ); - if( !pWin ) - { // open a window - pWin = aBasicApp.pFrame->CreateModuleWin( GetActiveModule() ); - } - else - pWin->ToTop(); - if( IsCompilerError() ) - { - aErrors.push_back( - new BasicError - ( pWin, - 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ) - ); - nError++; - CurrentError = aErrors.size() - 1; - return sal_Bool( nError < 20 ); // Cancel after 20 errors - } - else - { - ReportRuntimeError( pWin ); - return sal_False; - } -} - -void MyBasic::ReportRuntimeError( AppBasEd *pEditWin ) -{ - String nErrorText; - nErrorText = GetSpecialErrorText(); - - if ( pEditWin ) // just in case the focus is not right - pEditWin->ToTop(); - - BasicError( pEditWin, - GetVBErrorCode( GetErrorCode() ), nErrorText, GetLine(), - GetCol1(), GetCol2() ).Show(); -} - -void MyBasic::DebugFindNoErrors( sal_Bool bDebugFindNoErrors ) -{ - (void) bDebugFindNoErrors; /* avoid warning about unused parameter */ -} - -const String MyBasic::GetSpecialErrorText() -{ - return GetErrorText(); -} - -sal_uInt16 MyBasic::BreakHdl() -{ - SbModule* pMod = GetActiveModule(); - if( pMod ) - { - AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( pMod->GetName() ); - if( !pWin ) - { // open a window - pWin = aBasicApp.pFrame->CreateModuleWin( pMod ); - } - else - pWin->ToTop(); - pWin->Highlight( GetLine(), GetCol1(), GetCol2() ); - } - - return aBasicApp.pFrame->BreakHandler(); -} - -/*************************************************************************** -|* -|* class BasicError -|* -***************************************************************************/ - -BasicError::BasicError - ( AppBasEd* w, sal_uInt16 nE, const String& r, sal_uInt16 nL, sal_uInt16 nC1, sal_uInt16 nC2 ) - : aText( SttResId( IDS_ERROR1 ) ) -{ - pWin = w; - nLine = nL; - nCol1 = nC1; - nCol2 = nC2; - if( nE ) - { - aText += String::CreateFromInt32( nE ); - aText.AppendAscii(": "); - aText += r; - } - else - aText = r; -} - -// This is a sample how to build the error information -// to highlight a statement -void BasicError::Show() -{ - if( pWin && aBasicApp.pFrame->IsWinValid( pWin ) ) - { - pWin->Highlight( nLine, nCol1, nCol2 ); - aBasicApp.pFrame->pStatus->Message( aText ); - } - else - MessBox( aBasicApp.pFrame, WB_OK, aBasicApp.pFrame->GetText(), - aText ).Execute(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx deleted file mode 100644 index 8060f3223789..000000000000 --- a/basic/source/app/process.cxx +++ /dev/null @@ -1,237 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - - -#include <tools/errcode.hxx> -#include <basic/sbxcore.hxx> -#include <tools/string.hxx> -#include <osl/file.hxx> -#include <osl/process.h> - -#include <basic/ttstrhlp.hxx> -#include <basic/process.hxx> - -#ifdef WNT -#include <windows.h> -#endif - -Process::Process() -: m_nArgumentCount( 0 ) -, m_pArgumentList( NULL ) -, m_nEnvCount( 0 ) -, m_pEnvList( NULL ) -, m_aProcessName() -, m_pProcess( NULL ) -, bWasGPF( sal_False ) -, bHasBeenStarted( sal_False ) -{ -} - -#define FREE_USTRING_LIST( count, list ) \ - if ( count && list ) \ - { \ - for ( unsigned int i = 0; i < count; ++i ) \ - { \ - rtl_uString_release( list[i] ); \ - list[i] = NULL; \ - } \ - delete[] list; \ - } \ - count = 0; \ - list = NULL; - -Process::~Process() -{ - FREE_USTRING_LIST( m_nArgumentCount, m_pArgumentList ); - FREE_USTRING_LIST( m_nEnvCount, m_pEnvList ); - if ( m_pProcess ) - osl_freeProcessHandle( m_pProcess ); -} - - -sal_Bool Process::ImplIsRunning() -{ - if ( m_pProcess && bHasBeenStarted ) - { - oslProcessInfo aProcessInfo; - aProcessInfo.Size = sizeof(oslProcessInfo); - osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo ); - if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) ) - return sal_True; - else - return sal_False; - } - else - return sal_False; -} - -long Process::ImplGetExitCode() -{ - if ( m_pProcess ) - { - oslProcessInfo aProcessInfo; - aProcessInfo.Size = sizeof(oslProcessInfo); - osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo ); - if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) ) - SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); - return aProcessInfo.Code; - } - else - SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); - return 0; -} - - - -void Process::SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv ) -{ // Set image file of executable - if ( m_pProcess && ImplIsRunning() ) - SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); - else - { - FREE_USTRING_LIST( m_nArgumentCount, m_pArgumentList ); - FREE_USTRING_LIST( m_nEnvCount, m_pEnvList ); - osl_freeProcessHandle( m_pProcess ); - m_pProcess = NULL; - - xub_StrLen i, nCount = aAppParams.GetQuotedTokenCount( CUniString("\"\"" ), ' ' ); - ::rtl::OUString *pParamList = new ::rtl::OUString[nCount]; - - xub_StrLen nParamCount = 0; - for ( i = 0 ; i < nCount ; i++ ) - { - ::rtl::OUString aTemp = ::rtl::OUString(aAppParams.GetQuotedToken( i, CUniString("\"\"''" ), ' ' )); - if ( aTemp.getLength() ) - { - pParamList[nParamCount] = aTemp; - nParamCount++; - } - } - m_nArgumentCount = nParamCount; - m_pArgumentList = new rtl_uString*[m_nArgumentCount]; - for ( i = 0 ; i < m_nArgumentCount ; i++ ) - { - m_pArgumentList[i] = NULL; - rtl_uString_assign( &(m_pArgumentList[i]), pParamList[i].pData ); - } - delete [] pParamList; - - if ( pEnv ) - { - m_pEnvList = new rtl_uString*[pEnv->size()]; - - m_nEnvCount = 0; - Environment::const_iterator aIter = pEnv->begin(); - while ( aIter != pEnv->end() ) - { - ::rtl::OUString aTemp = ::rtl::OUString( (*aIter).first ); - aTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "=" )); - aTemp += ::rtl::OUString( (*aIter).second ); - m_pEnvList[m_nEnvCount] = NULL; - rtl_uString_assign( &(m_pEnvList[m_nEnvCount]), aTemp.pData ); - ++m_nEnvCount; - ++aIter; - } - } - - ::rtl::OUString aNormalizedAppPath; - osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath ); - m_aProcessName = aNormalizedAppPath;; - bHasBeenStarted = sal_False; - - } -} - -sal_Bool Process::Start() -{ // Start program - sal_Bool bSuccess=sal_False; - if ( m_aProcessName.getLength() && !ImplIsRunning() ) - { - bWasGPF = sal_False; -#ifdef WNT - sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX); - try - { -#endif - bSuccess = osl_executeProcess( - m_aProcessName.pData, - m_pArgumentList, - m_nArgumentCount, - osl_Process_SEARCHPATH - /*| osl_Process_DETACHED*/ - /*| osl_Process_WAIT*/, - NULL, - NULL, - m_pEnvList, - m_nEnvCount, - &m_pProcess ) == osl_Process_E_None; - -#ifdef WNT - } - catch( ... ) - { - bWasGPF = sal_True; - // TODO: Output debug message !! - } - nErrorMode = SetErrorMode(nErrorMode); -#endif - bHasBeenStarted = bSuccess; - } - else - SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); - return bSuccess; -} - -sal_uIntPtr Process::GetExitCode() -{ // ExitCode of program after execution - return ImplGetExitCode(); -} - -sal_Bool Process::IsRunning() -{ - return ImplIsRunning(); -} - -sal_Bool Process::WasGPF() -{ // Did the process fail? -#ifdef WNT - return ImplGetExitCode() == 3221225477; -#else - return bWasGPF; -#endif -} - -sal_Bool Process::Terminate() -{ - if ( ImplIsRunning() ) - return osl_terminateProcess(m_pProcess) == osl_Process_E_None; - return sal_True; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx deleted file mode 100644 index 33a13627d21d..000000000000 --- a/basic/source/app/processw.cxx +++ /dev/null @@ -1,272 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - - -#include <tools/errcode.hxx> -#include <basic/sbxobj.hxx> -#include <basic/sbx.hxx> -#include <basic/sbxvar.hxx> - -#include <basic/ttstrhlp.hxx> - -#include "processw.hxx" - -// Process has the following elements: -// 1) Properties: -// none -// 2) Methods: -// SetImage( Filename ) -// sal_Bool Start -// sal_uInt16 GetExitCode -// sal_Bool IsRunning -// sal_Bool WasGPF - - -// This implementation is a sample for a table driven version that -// can contain lots of elements. The elements are taken into the object -// when they are needed. - -// The nArgs field of a table entry is scrambled as follows: -#define _ARGSMASK 0x00FF // Up to 255 arguments -#define _RWMASK 0x0F00 // Mask for R/W-Bits -#define _TYPEMASK 0xF000 // Mask for entry type - -#define _READ 0x0100 // can be read -#define _BWRITE 0x0200 // can be used as Lvaluen -#define _LVALUE _BWRITE -#define _READWRITE 0x0300 // can read and written -#define _OPT 0x0400 // sal_True: optional parameter -#define _METHOD 0x1000 // Mask-Bit for a method -#define _PROPERTY 0x2000 // Mask-Bit for a property -#define _COLL 0x4000 // Mask-Bit for a collection - -// Combination of the bits above: -#define _FUNCTION 0x1100 // Mask for a Function -#define _LFUNCTION 0x1300 // Mask for a Function, that can be uses as Lvalue -#define _ROPROP 0x2100 // Mask Read Only-Property -#define _WOPROP 0x2200 // Mask Write Only-Property -#define _RWPROP 0x2300 // Mask Read/Write-Property -#define _COLLPROP 0x4100 // Mask Read-Collection-Element - - -ProcessWrapper::Methods ProcessWrapper::aProcessMethods[] = { -// Imagefile of the Executable -{ "SetImage", SbxEMPTY, &ProcessWrapper::PSetImage, 1 | _FUNCTION }, - // Two Named Parameter - { "Filename", SbxSTRING, NULL, 0 }, - { "Params", SbxSTRING, NULL, _OPT }, -// Program is started -{ "Start", SbxBOOL, &ProcessWrapper::PStart, 0 | _FUNCTION }, -// ExitCode of the program -{ "GetExitCode", SbxULONG, &ProcessWrapper::PGetExitCode, 0 | _FUNCTION }, -// Program is running -{ "IsRunning", SbxBOOL, &ProcessWrapper::PIsRunning, 0 | _FUNCTION }, -// Program has faulted with GPF etc. -{ "WasGPF", SbxBOOL, &ProcessWrapper::PWasGPF, 0 | _FUNCTION }, - -{ NULL, SbxNULL, NULL, -1 }}; // End of table - - -ProcessWrapper::ProcessWrapper() : SbxObject( CUniString("Process") ) -{ - pProcess = new Process(); - SetName( CUniString("Process") ); - pMethods = &aProcessMethods[0]; -} - -ProcessWrapper::~ProcessWrapper() -{ - delete pProcess; -} - -// Search for an element: -// Linear search through the method table until an appropriate one -// can be found. -// If the the method/property cannot be found, NULL is return -// without an error code, so that we can ask the whole -// chain of objects for the method/property. -SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) -{ - // Is the element already available? - SbxVariable* pRes = SbxObject::Find( rName, t ); - if( !pRes && t != SbxCLASS_OBJECT ) - { - // otherwise search - Methods* p = pMethods; - short nIndex = 0; - sal_Bool bFound = sal_False; - while( p->nArgs != -1 ) - { - if( rName.EqualsIgnoreCaseAscii( p->pName ) ) - { - bFound = sal_True; break; - } - nIndex += ( p->nArgs & _ARGSMASK ) + 1; - p = pMethods + nIndex; - } - if( bFound ) - { - // isolate Args fields: - short nAccess = ( p->nArgs & _RWMASK ) >> 8; - short nType = ( p->nArgs & _TYPEMASK ); - String aMethodName( p->pName, RTL_TEXTENCODING_ASCII_US ); - SbxClassType eCT = SbxCLASS_OBJECT; - if( nType & _PROPERTY ) - eCT = SbxCLASS_PROPERTY; - else if( nType & _METHOD ) - eCT = SbxCLASS_METHOD; - pRes = Make( aMethodName, eCT, p->eType ); - // We set array index + 1 because there are other - // default properties that must be activated - pRes->SetUserData( nIndex + 1 ); - pRes->SetFlags( nAccess ); - } - } - return pRes; -} - -// Activation of an element or request for an info block -void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, - const SfxHint& rHint, const TypeId& rHT ) -{ - const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); - if( pHint ) - { - SbxVariable* pVar = pHint->GetVar(); - SbxArray* pNotifyPar = pVar->GetParameters(); - sal_uInt16 nIndex = (sal_uInt16) pVar->GetUserData(); - // No index: put through - if( nIndex ) - { - sal_uIntPtr t = pHint->GetId(); - if( t == SBX_HINT_INFOWANTED ) - pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); - else - { - sal_Bool bWrite = sal_False; - if( t == SBX_HINT_DATACHANGED ) - bWrite = sal_True; - if( t == SBX_HINT_DATAWANTED || bWrite ) - { - // Parameter-Test for methods: - sal_uInt16 nPar = pMethods[ --nIndex ].nArgs & 0x00FF; - // Element 0 is the return value - if( ( !pNotifyPar && nPar ) - || ( pNotifyPar && pNotifyPar->Count() < nPar+1 ) ) - SetError( SbxERR_WRONG_ARGS ); - // ready for call - else - { - (this->*(pMethods[ nIndex ].pFunc))( pVar, pNotifyPar, bWrite ); - } - } - } - } - SbxObject::SFX_NOTIFY( rBC, rBCT, rHint, rHT ); - } -} - -// Building the info struct for single elements -SbxInfo* ProcessWrapper::GetInfo( short nIdx ) -{ - Methods* p = &pMethods[ nIdx ]; - // In case there is a help file available: - SbxInfo* pResultInfo = new SbxInfo; - short nPar = p->nArgs & _ARGSMASK; - for( short i = 0; i < nPar; i++ ) - { - p++; - String aMethodName( p->pName, RTL_TEXTENCODING_ASCII_US ); - sal_uInt16 nInfoFlags = ( p->nArgs >> 8 ) & 0x03; - if( p->nArgs & _OPT ) - nInfoFlags |= SBX_OPTIONAL; - pResultInfo->AddParam( aMethodName, p->eType, nInfoFlags ); - } - return pResultInfo; -} - - - - - -// Properties and methods save the return value in argv[0] (Get, bPut = sal_False) -// and store the value from argv[0] (Put, bPut = sal_True) - -void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) -{ // Imagefile of the executable - (void) pVar; /* avoid warning about unused parameter */ - (void) bWriteIt; /* avoid warning about unused parameter */ - if ( pMethodePar->Count() >= 2 ) - pProcess->SetImage(pMethodePar->Get( 1 )->GetString(), pMethodePar->Get( 2 )->GetString() ); - else - pProcess->SetImage(pMethodePar->Get( 1 )->GetString(), String() ); -} - -void ProcessWrapper::PStart( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) -{ // Program is started - (void) pMethodePar; /* avoid warning about unused parameter */ - (void) bWriteIt; /* avoid warning about unused parameter */ - pVar->PutBool( pProcess->Start() ); -} - -void ProcessWrapper::PGetExitCode( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) -{ // ExitCode of the program after it was finished - (void) pMethodePar; /* avoid warning about unused parameter */ - (void) bWriteIt; /* avoid warning about unused parameter */ - pVar->PutULong( pProcess->GetExitCode() ); -} - -void ProcessWrapper::PIsRunning( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) -{ // Program is still running - (void) pMethodePar; /* avoid warning about unused parameter */ - (void) bWriteIt; /* avoid warning about unused parameter */ - pVar->PutBool( pProcess->IsRunning() ); -} - -void ProcessWrapper::PWasGPF( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) -{ // Program faulted with GPF etc. - (void) pMethodePar; /* avoid warning about unused parameter */ - (void) bWriteIt; /* avoid warning about unused parameter */ - pVar->PutBool( pProcess->WasGPF() ); -} - - - - - - -// The factory creates our object -SbxObject* ProcessFactory::CreateObject( const String& rClass ) -{ - if( rClass.CompareIgnoreCaseToAscii( "Process" ) == COMPARE_EQUAL ) - return new ProcessWrapper(); - return NULL; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx deleted file mode 100644 index 4fb737f50c9e..000000000000 --- a/basic/source/app/processw.hxx +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _PROCESSW_HXX -#define _PROCESSW_HXX - -#include <basic/sbxfac.hxx> -#include <basic/sbxvar.hxx> -#include <basic/sbxobj.hxx> -#include <basic/process.hxx> - -class ProcessWrapper : public SbxObject -{ -using SbxVariable::GetInfo; -// Definition of a table entry. This is done here because -// through this methods and property can declared as private. -#if defined ( ICC ) || defined ( C50 ) -public: -#endif - typedef void( ProcessWrapper::*pMeth ) - ( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite ); -#if defined ( ICC ) -private: -#endif - - struct Methods { - const char* pName; // Name of the entry - SbxDataType eType; // Data type - pMeth pFunc; // Function Pointer - short nArgs; // Arguments and flags - }; - static Methods aProcessMethods[]; // Method table - Methods *pMethods; // Current method table - - void PSetImage( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void PStart( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void PGetExitCode( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void PIsRunning( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void PWasGPF( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - - // Internal members and methods - Process *pProcess; - - // Fill info block - SbxInfo* GetInfo( short nIdx ); - - // Broadcaster Notification - virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, - const SfxHint& rHint, const TypeId& rHintType ); -public: - ProcessWrapper(); - ~ProcessWrapper(); - // Search for an element - virtual SbxVariable* Find( const String&, SbxClassType ); -}; - -// Factory -class ProcessFactory : public SbxFactory -{ -public: - virtual SbxObject* CreateObject( const String& ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/resids.hrc b/basic/source/app/resids.hrc deleted file mode 100755 index 5d3fbb098dde..000000000000 --- a/basic/source/app/resids.hrc +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _RESIDS_HRC -#define _RESIDS_HRC - -#define RID_OK 1 -#define RID_CANCEL 2 -#define RID_FILENAME 3 -#define RID_PATHNAME 4 -#define RID_FILELIST 5 -#define RID_DIRSLIST 6 -#define RID_FIND 7 -#define RID_REPLACE 8 -//#define RID_ICON 9 -//#define RID_EDITFIELD 10 -#define RID_TEXT 11 -//#define RID_FRAME1 12 -//#define RID_FRAME2 13 -#define RID_VERSIONSTRING 14 -#define RID_FIXEDTEXT1 15 -#define RID_FIXEDTEXT2 16 - - -// OptionsDialog -#define RES_TC_OPTIONS 20 - -// GenericOptions -#define RID_TP_GEN 30 -#define RID_FL_AREA 31 -#define RID_CB_AREA 32 -#define RID_PB_NEW_AREA 33 -#define RID_PD_DEL_AREA 34 -#define RID_FL_VALUE 35 -#define RID_CB_VALUE 36 -#define RID_PB_SELECT_FILE 37 -#define RID_PB_NEW_VALUE 38 -#define RID_PB_DEL_VALUE 39 - -// ProfileOptions -#define RID_TP_PRO 40 -#define RID_FL_PROFILE 41 -#define RID_CB_PROFILE 42 -#define RID_PB_NEW_PROFILE 43 -#define RID_PD_DEL_PROFILE 44 -#define FL_DIRECTORIES 45 -#define LOG_TEXT 46 -#define BASIS_TEXT 47 -#define HID_CHECK 48 -#define LOG_NAME 49 -#define BASIS_NAME 50 -#define HID_NAME 51 -#define LOG_SET 52 -#define BASIS_SET 53 -#define HID_SET 54 -#define CB_AUTORELOAD 55 -#define CB_AUTOSAVE 56 -#define CB_STOPONSYNTAXERRORS 57 - -// Crashreporter Options -#define RID_TP_CRA 50 -#define FL_CRASHREPORT 51 -#define CB_USEPROXY 52 -#define FT_CRHOST 53 -#define ED_CRHOST 54 -#define FT_CRPORT 55 -#define NF_CRPORT 56 -#define CB_ALLOWCONTACT 57 -#define FT_EMAIL 58 -#define ED_EMAIL 59 - -// MiscOptions -#define RID_TP_MIS 60 -#define FL_COMMUNICATION 61 -#define FT_HOST 62 -#define ED_HOST 63 -#define FT_TTPORT 64 -#define NF_TTPORT 65 -#define FT_UNOPORT 66 -#define NF_UNOPORT 67 -#define FL_OTHER 68 -#define TIMEOUT_TEXT 69 -#define SERVER_TIMEOUT 70 -#define FT_LRU 71 -#define TF_MAX_LRU 72 -#define FT_PROGDIR 73 -#define ED_PROGDIR 74 -#define PB_PROGDIR 75 - - -// Font Settings -#define RID_TP_FON 70 -#define FT_FONTNAME 71 -#define CB_FONTNAME 72 -#define FT_FONTSTYLE 73 -#define CB_FONTSTYLE 74 -#define FT_FONTSIZE 75 -#define MB_FONTSIZE 76 -#define FT_PREVIEW 77 - -// DisplayHId -#define RID_TB_CONF 80 -#define RID_FT_CONTROLS 81 -#define RID_MLB_CONTROLS 82 -#define RID_FT_SLOTS 83 -#define RID_MLB_SLOTS 84 -#define RID_PB_KOPIEREN 85 -#define RID_PB_BENENNEN 86 -#define RID_PB_SELECTALL 87 -#define RID_OK_CLOSE 88 - - -// BreakpointWindow -#define IMGID_BRKENABLED 30838 -#define IMGID_BRKDISABLED 30839 -#define IMGID_STEPMARKER 30840 -#define IMGID_ERRORMARKER 30841 - - -// Edit Variables -#define RID_FT_NAME 100 -#define RID_FT_CONTENT 101 -#define RID_FT_NEW_CONTENT 102 -#define RID_FT_NAME_VALUE 103 -#define RID_FT_CONTENT_VALUE 104 - -#define RID_RB_NEW_BOOL_T 105 -#define RID_RB_NEW_BOOL_F 106 -#define RID_NF_NEW_INTEGER 107 -#define RID_NF_NEW_LONG 108 -#define RID_ED_NEW_STRING 109 - -#endif - diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx deleted file mode 100644 index a317590d8246..000000000000 --- a/basic/source/app/status.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "app.hxx" -#include "basic.hrc" -#include "appwin.hxx" -#include "status.hxx" - -#include <comphelper/string.hxx> -#include <vcl/decoview.hxx> - -StatusLine::StatusLine( BasicFrame* p ) -: TaskBar( p ) -, pFrame( p ) -{ - // initialize TaskToolBox - TaskToolBox* pTempTaskToolBox = GetTaskToolBox(); - pTempTaskToolBox->SetActivateTaskHdl( LINK( this, StatusLine, ActivateTask ) ); - - // initialize TaskStatusBar - TaskStatusBar* pTempStatusBar = GetStatusBar(); - long nCharWidth = GetTextWidth( '0' ); // We state: All numbers has the same width - pTempStatusBar->InsertItem( ST_MESSAGE, GetTextWidth( 'X' ) * 20, SIB_LEFT | SIB_IN | SIB_AUTOSIZE ); - pTempStatusBar->InsertItem( ST_LINE, 5*nCharWidth ); - pTempStatusBar->InsertItem( ST_PROF, GetTextWidth( 'X' ) * 10 ); - pTempStatusBar->InsertStatusField(); - - Show(); -} - -void StatusLine::Message( const String& s ) -{ - GetStatusBar()->SetItemText( ST_MESSAGE, s ); -} - -void StatusLine::Pos( const String& s ) -{ - GetStatusBar()->SetItemText( ST_LINE, s ); -} - -void StatusLine::SetProfileName( const String& s ) -{ - GetStatusBar()->SetItemText( ST_PROF, s ); -} - - -IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) -{ - sal_uInt16 nFirstWinPos=0; - MenuBar* pMenu = pFrame->GetMenuBar(); - PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - - while ( pWinMenu->GetItemId( nFirstWinPos ) < RID_WIN_FILE1 && nFirstWinPos < pWinMenu->GetItemCount() ) - nFirstWinPos++; - - nFirstWinPos += pTTB->GetItemPos( pTTB->GetCurItemId() ) / 2; - - AppWin* pWin = pFrame->FindWin(comphelper::string::remove(pWinMenu->GetItemText(pWinMenu->GetItemId(nFirstWinPos)), '~')); - if ( pWin ) - { - pWin->Minimize( sal_False ); - pWin->ToTop(); - } - return 0; -} - -void StatusLine::LoadTaskToolBox() -{ - sal_uInt16 nFirstWinPos=0; - MenuBar* pMenu = pFrame->GetMenuBar(); - PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - - while ( pWinMenu->GetItemId( nFirstWinPos ) < RID_WIN_FILE1 && nFirstWinPos < pWinMenu->GetItemCount() ) - nFirstWinPos++; - - TaskToolBox* pTaskToolBox = GetTaskToolBox(); - - pTaskToolBox->StartUpdateTask(); - - while ( nFirstWinPos < pWinMenu->GetItemCount() ) - { // There are windows - Window* pWin = pFrame->FindWin( pWinMenu->GetItemId( nFirstWinPos ) ); - - if ( pWin ) - pTaskToolBox->UpdateTask( Image(), pWin->GetText(), pWin == pFrame->pList->back() && !( pFrame->pList->back()->GetWinState() & TT_WIN_STATE_HIDE ) ); - - nFirstWinPos++; - } - - pTaskToolBox->EndUpdateTask(); - Resize(); - Invalidate(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx deleted file mode 100644 index 7c3b04bed8cc..000000000000 --- a/basic/source/app/status.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASICSTATUS_HXX -#define _BASICSTATUS_HXX - -#include <svtools/taskbar.hxx> -#include <vcl/status.hxx> - -#define ST_MESSAGE 1 -#define ST_LINE 2 -#define ST_PROF 3 - -class BasicFrame; - -class StatusLine : public TaskBar -{ -protected: - BasicFrame* pFrame; - DECL_LINK( ActivateTask, TaskToolBox* ); - -public: - StatusLine( BasicFrame* ); - void Message( const String& ); // Show text - void Pos( const String& s ); // Show text position - void SetProfileName( const String& s ); // Current Profile - void LoadTaskToolBox(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src deleted file mode 100644 index 68b92fcfe30f..000000000000 --- a/basic/source/app/svtmsg.src +++ /dev/null @@ -1,337 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "basic/svtmsg.hrc" - - -// Here are included the messages of the folder /basic/source/app - - -// Error messages which go to the result file. -// ********************* -// *** !!ATTENTION!! *** -// ********************* -// The numbers must NEVER(!) change, -// because they are saved in the result files and a renewed display -// would display new strings or no strings. -String S_GPF_ABORT -{ - Text[ en-US ] = "Program aborted with GPF"; -}; -String S_APP_SHUTDOWN -{ - Text[ en-US ] = "Application has been shut down"; -}; -String S_SID_EXECUTE_FAILED_NO_DISPATCHER -{ - Text[ en-US ] = "Slot ID cannot be executed. No ActiveDispatcher"; -}; -String S_SID_EXECUTE_FAILED -{ - Text[ en-US ] = "Slot ID could not be executed"; -}; -String S_UNO_PROPERTY_NITIALIZE_FAILED -{ - Text[ en-US ] = "UnoSlot: Properties could not be initialized"; -}; -String S_RESETAPPLICATION_FAILED_COMPLEX -{ - Text[ en-US ] = "ResetApplication failed: too complex"; -}; -String S_RESETAPPLICATION_FAILED_UNKNOWN -{ - Text[ en-US ] = "ResetApplication failed: unknown window type"; -}; -String S_NO_ACTIVE_WINDOW -{ - Text[ en-US ] = "No active window found (GetNextCloseWindow)"; -}; -String S_NO_DIALOG_IN_GETACTIVE -{ - Text[ en-US ] = "GetActive does not return a dialog! Inform development"; -}; -String S_NO_POPUP -{ - Text[ en-US ] = "Pop-up menu not open"; -}; -String S_NO_SUBMENU -{ - Text[ en-US ] = "Submenu does not exist"; -}; -String S_CONTROLTYPE_NOT_SUPPORTED -{ - Text[ en-US ] = "ControlType ($Arg1) is not supported"; -}; -String S_SELECTION_BY_ATTRIBUTE_ONLY_DIRECTORIES -{ - Text[ en-US ] = "Selection by attributes only possible for directories"; -}; -String S_NO_MORE_FILES -{ - Text[ en-US ] = "No more files"; -}; -String S_UNKNOWN_METHOD -{ - Text[ en-US ] = "Unknown method '($Arg1)' on ($Arg2)"; -}; -String S_INVALID_PARAMETERS -{ - Text[ en-US ] = "Invalid Parameters"; -}; -String S_POINTER_OUTSIDE_APPWIN -{ - Text[ en-US ] = "Pointer not inside application window at '($Arg1)'"; -}; -String S_UNKNOWN_COMMAND -{ - Text[ en-US ] = "Unknown command '($Arg1)'"; -}; -String S_WIN_NOT_FOUND -{ - Text[ en-US ] = "($Arg1) could not be found"; -}; -String S_WIN_INVISIBLE -{ - Text[ en-US ] = "($Arg1) is not visible"; -}; -String S_WIN_DISABLED -{ - Text[ en-US ] = "($Arg1) could not be accessed. Disabled"; -}; -String S_NUMBER_TOO_BIG -{ - Text[ en-US ] = "Entry number ($Arg2) is too large in ($Arg1). Maximum allowed is ($Arg3)"; -}; -String S_NUMBER_TOO_SMALL -{ - Text[ en-US ] = "The entry number ($Arg2) is too small in ($Arg1). Minimum allowed is ($Arg3)"; -}; -String S_WINDOW_DISAPPEARED -{ - Text[ en-US ] = "Window disappeared in the meantime at ($Arg1)"; -}; -String S_ERROR_SAVING_IMAGE -{ - Text[ en-US ] = "Error #($Arg1) when saving the image"; -}; -String S_INVALID_POSITION -{ - Text[ en-US ] = "Invalid position at ($Arg1)"; -}; -String S_SPLITWIN_NOT_FOUND -{ - Text[ en-US ] = "SplitWindow not found at ($Arg1)"; -}; -String S_INTERNAL_ERROR -{ - Text[ en-US ] = "Internal error at ($Arg1)"; -}; -String S_NO_STATUSBAR -{ - Text[ en-US ] = "No status bar at ($Arg1)"; -}; -String S_ITEMS_INVISIBLE -{ - Text[ en-US ] = "The items are hidden at ($Arg1)"; -}; -String S_TABPAGE_NOT_FOUND -{ - Text[ en-US ] = "Tab page not found at ($Arg1)"; -}; -String S_TRISTATE_NOT_ALLOWED -{ - Text[ en-US ] = "Tristate cannot be set at ($Arg1)"; -}; -String S_ERROR_IN_SET_TEXT -{ - Text[ en-US ] = "Set text did not function"; -}; -String S_ATTEMPT_TO_WRITE_READONLY -{ - Text[ en-US ] = "Attempt to write on read-only ($Arg1)"; -}; -String S_NO_SELECT_FALSE -{ - Text[ en-US ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; -}; -String S_ENTRY_NOT_FOUND -{ - Text[ en-US ] = "\"($Arg2)\" entry at ($Arg1) not found"; -}; -String S_METHOD_FAILED -{ - Text[ en-US ] = "($Arg1) of entry \"($Arg2)\" failed"; -}; -String S_HELPID_ON_TOOLBOX_NOT_FOUND -{ - Text[ en-US ] = "HelpID in ToolBox not found at ($Arg1)"; -}; -String S_BUTTON_DISABLED_ON_TOOLBOX -{ - Text[ en-US ] = "The button is disabled in ToolBox at ($Arg1)"; -}; -String S_BUTTON_HIDDEN_ON_TOOLBOX -{ - Text[ en-US ] = "The button is hidden in ToolBox at ($Arg1)"; -}; -String S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX -{ - Text[ en-US ] = "Button cannot be made visible in ToolBox at ($Arg1)"; -}; -String S_TEAROFF_FAILED -{ - Text[ en-US ] = "TearOff failed in ToolBox at ($Arg1)"; -}; - -// Has to stay in for old res files -String S_NO_SELECTED_ENTRY_DEPRECATED -{ - Text[ en-US ] = "No entry is selected in TreeListBox at ($Arg1)"; -}; -String S_NO_SELECTED_ENTRY -{ - Text[ en-US ] = "No entry is selected in ($Arg2) at ($Arg1)"; -}; -String S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED -{ - Text[ en-US ] = "Select/Deselect with string not implemented at ($Arg1)"; -}; -String S_ALLOWED_ONLY_IN_FLOATING_MODE -{ - Text[ en-US ] = "Method only allowed in floating mode at ($Arg1)"; -}; -String S_ALLOWED_ONLY_IN_DOCKING_MODE -{ - Text[ en-US ] = "Method only allowed in docking mode at ($Arg1)"; -}; -String S_SIZE_NOT_CHANGEABLE -{ - Text[ en-US ] = "Size cannot be altered at ($Arg1)"; -}; -String S_NO_OK_BUTTON -{ - Text[ en-US ] = "There is no OK button at ($Arg1)"; -}; -String S_NO_CANCEL_BUTTON -{ - Text[ en-US ] = "There is no Cancel button at ($Arg1)"; -}; -String S_NO_YES_BUTTON -{ - Text[ en-US ] = "There is no Yes button at ($Arg1)"; -}; -String S_NO_NO_BUTTON -{ - Text[ en-US ] = "There is no No button at ($Arg1)"; -}; -String S_NO_RETRY_BUTTON -{ - Text[ en-US ] = "There is no Repeat button at ($Arg1)"; -}; -String S_NO_HELP_BUTTON -{ - Text[ en-US ] = "There is no Help button at ($Arg1)"; -}; -String S_NO_DEFAULT_BUTTON -{ - Text[ en-US ] = "There is no Default button defined at ($Arg1)"; -}; -String S_BUTTON_ID_NOT_THERE -{ - Text[ en-US ] = "There is no button with ID ($Arg1) at ($Arg2)"; -}; -String S_BUTTONID_REQUIRED -{ - Text[ en-US ] = "A button ID needs to be given at ($Arg1)"; -}; -String S_UNKNOWN_TYPE -{ - Text[ en-US ] = "Unknown object type ($Arg1) from UId or method '($Arg2)' not supported"; -}; -String S_UNPACKING_STORAGE_FAILED -{ - Text[ en-US ] = "Unpacking storage \"($Arg1)\" to \"($Arg2)\" failed"; -}; -String S_NO_LIST_BOX_BUTTON -{ - Text[ en-US ] = "ListBoxButton does not exist in ($Arg1)"; -}; -String S_UNO_URL_EXECUTE_FAILED_NO_DISPATCHER -{ - Text[ en-US ] = "UNO URL \"($Arg1)\" could not be executed: No dispatcher was found."; -}; -String S_UNO_URL_EXECUTE_FAILED_NO_FRAME -{ - Text[ en-US ] = "UNO URL \"($Arg1)\" could not be executed: No ActiveFrame on desktop."; -}; -String S_NO_MENU -{ - Text[ en-US ] = "There is no menu at ($Arg1)"; -}; -String S_UNO_URL_EXECUTE_FAILED_DISABLED -{ - Text[ en-US ] = "UNO URL \"($Arg1)\" could not be run: Disabled"; -}; -String S_NO_SCROLLBAR -{ - Text[ en-US ] = "No scroll bar at ($Arg1)"; -}; -String S_NO_SAX_PARSER -{ - Text[ en-US ] = "No SAX Parser when using ($Arg1). Initialize with 'SAXReadFile' first."; -}; -String S_CANNOT_CREATE_DIRECTORY -{ - Text[ en-US ] = "Cannot create Directory: \"($Arg1)\""; -}; -String S_DIRECTORY_NOT_EMPTY -{ - Text[ en-US ] = "Directory has to be Empty to unpack to. Directory: \"($Arg1)\""; -}; -String S_DEPRECATED -{ - Text[ en-US ] = "Deprecated! Please change the script."; -}; -String S_SIZE_BELOW_MINIMUM -{ - Text[ en-US ] = "The Size is below the minimum. x=($Arg1) ,y=($Arg2)"; -}; -String S_CANNOT_FIND_FLOATING_WIN -{ - Text[ en-US ] = "Cannot find FloatingWindow for floating DockingWindow at ($Arg1)."; -}; -String S_NO_LIST_BOX_STRING -{ - Text[ en-US ] = "String does not exist in ($Arg1)"; -}; -String S_SLOT_IN_EXECUTE -{ - Text[ en-US ] = "Another Slot is being executed already."; -}; -String S_MENU_NOT_CLOSING -{ - Text[ en-US ] = "Menu not closing."; -}; diff --git a/basic/source/app/testtool.idl b/basic/source/app/testtool.idl deleted file mode 100644 index acda657881c7..000000000000 --- a/basic/source/app/testtool.idl +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -module -"484E40E0-1F23-101C-9961-04021C007002" -"5A30E000-1F23-101C-9961-04021C007002" -App -[ -HelpText( "Test" ), -TypeLibFile( "testtool.tlb" ) -] -{ - interface TestToolAutomation - [ - uuid( "6706E171-FB05-101B-804c-04021c007002" ) - ] - { - void Start( String aFilePath ); - BOOL Call( String aProcName, UINT32 nUId ); - void Close( ); - } -} - - diff --git a/basic/source/app/testtool.src b/basic/source/app/testtool.src deleted file mode 100644 index 9b89f6da14b1..000000000000 --- a/basic/source/app/testtool.src +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "basic/testtool.hrc" - - -// Strings -String S_INVALID_KEYCODE -{ - Text[ en-US ] = "Is an invalid KeyCode!"; -}; -String S_MANDATORY_FILE -{ - Text[ en-US ] = "\ncould not be found.\nThis file is indispensable."; -}; -String S_READING_LONGNAMES -{ - Text[ en-US ] = "Reading long-names"; -}; -String S_READING_SLOT_IDS -{ - Text[ en-US ] = "Reading Slot IDs"; -}; -String S_READING_CONTROLS -{ - Text[ en-US ] = "Reading Controls"; -}; -String S_READING_BASIC_MODULE -{ - Text[ en-US ] = "Reading BASIC module"; -}; -String S_STARTING_APPLICATION -{ - Text[ en-US ] = "Starting application"; -}; - diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx deleted file mode 100644 index 9bdbf8cf6f27..000000000000 --- a/basic/source/app/textedit.cxx +++ /dev/null @@ -1,839 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/stream.hxx> -#include <svtools/texteng.hxx> -#include <svtools/textview.hxx> -#include <svtools/txtattr.hxx> -#include <basic/sbxmeth.hxx> -#include <basic/ttstrhlp.hxx> - -#include "basic.hrc" -#include "textedit.hxx" -#include "appedit.hxx" -#include "brkpnts.hxx" -#include <basic/testtool.hxx> // defines for syntax highlighting - -TextEditImp::TextEditImp( AppEdit* pParent, const WinBits& aBits ) -: Window( pParent, aBits ) -, pAppEdit( pParent ) -, bHighlightning( sal_False ) -, bDoSyntaxHighlight( sal_False ) -, bDelayHighlight( sal_True ) -, nTipId( 0 ) -, bViewMoved( sal_False ) -{ - pTextEngine = new TextEngine(); - pTextEngine->SetMaxTextLen( STRING_MAXLEN ); - pTextEngine->EnableUndo( sal_True ); - - pTextView = new TextView( pTextEngine, this ); - pTextEngine->InsertView( pTextView ); - pTextEngine->SetModified( sal_False ); - - aSyntaxIdleTimer.SetTimeout( 200 ); - aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, TextEditImp, SyntaxTimerHdl ) ); - - aImplSyntaxIdleTimer.SetTimeout( 1 ); - aImplSyntaxIdleTimer.SetTimeoutHdl( LINK( this, TextEditImp, SyntaxTimerHdl ) ); - - StartListening( *pTextEngine ); - - HideTipTimer.SetTimeout( 5000 ); // 5 seconds - ShowTipTimer.SetTimeout( 500 ); // 1/2 seconds - HideTipTimer.SetTimeoutHdl( LINK( this, TextEditImp, HideVarContents ) ); - ShowTipTimer.SetTimeoutHdl( LINK( this, TextEditImp, ShowVarContents ) ); -} - -TextEditImp::~TextEditImp() -{ - pTextEngine->RemoveView( pTextView ); - delete pTextView; - delete pTextEngine; -} - -sal_Bool TextEditImp::ViewMoved() -{ - sal_Bool bOld = bViewMoved; - bViewMoved = sal_False; - return bOld; -} - -void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) -{ - (void) rBC; /* avoid warning about unused parameter */ - if ( rHint.ISA( TextHint ) ) - { - const TextHint& rTextHint = (const TextHint&)rHint; - if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED ) - { - pAppEdit->pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); - pAppEdit->pVScroll->SetThumbPos( pTextView->GetStartDocPos().Y() ); - if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) - ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->Scroll( 0, ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->GetCurYOffset() - pTextView->GetStartDocPos().Y() ); - bViewMoved = sal_True; - } - else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED ) - { - if ( pTextView->GetStartDocPos().Y() ) - { - long nOutHeight = GetOutputSizePixel().Height(); - long nTextHeight = pTextEngine->GetTextHeight(); - if ( nTextHeight < nOutHeight ) - pTextView->Scroll( 0, pTextView->GetStartDocPos().Y() ); - } - - pAppEdit->SetScrollBarRanges(); - } - else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED ) - { - sal_uIntPtr nWidth = pTextEngine->CalcTextWidth(); - if ( (sal_uIntPtr)nWidth != pAppEdit->nCurTextWidth ) - { - pAppEdit->nCurTextWidth = nWidth; - if ( pAppEdit->pHScroll ) - { // Initialization finished? - pAppEdit->pHScroll->SetRange( Range( 0, (long)nWidth) ); - pAppEdit->pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); - } - } - } - else if( rTextHint.GetId() == TEXT_HINT_PARAINSERTED ) - { - if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) - ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, sal_True ); - } - else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) - { - if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) - ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, sal_False ); - - // Itchy adaption for two signs at line ends instead of one (hard coded default) - pTextEngine->SetMaxTextLen( STRING_MAXLEN - pTextEngine->GetParagraphCount() ); - } - else if( rTextHint.GetId() == TEXT_HINT_FORMATPARA ) - { - DoDelayedSyntaxHighlight( - sal::static_int_cast< xub_StrLen >( rTextHint.GetValue() ) ); - if ( pTextView->GetTextEngine()->IsModified() ) - ModifyHdl.Call( NULL ); - } - } -} - -#define TEXTATTR_SPECIAL 55 -class TextAttribSpecial : public TextAttrib -{ -private: - FontWeight maFontWeight; - -public: - TextAttribSpecial( const FontWeight& rFontWeight ); - TextAttribSpecial( const TextAttribSpecial& rAttr ); - ~TextAttribSpecial() {;} - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; - -TextAttribSpecial::TextAttribSpecial( const FontWeight& rFontWeight ) - : TextAttrib( TEXTATTR_SPECIAL ), maFontWeight( rFontWeight ) -{} - -TextAttribSpecial::TextAttribSpecial( const TextAttribSpecial& rAttr ) - : TextAttrib( rAttr ), maFontWeight( rAttr.maFontWeight ) -{} - -void TextAttribSpecial::SetFont( Font& rFont ) const -{ - rFont.SetWeight( maFontWeight ); -} - -TextAttrib* TextAttribSpecial::Clone() const -{ - return new TextAttribSpecial( *this ); -} - -int TextAttribSpecial::operator==( const TextAttrib& rAttr ) const -{ - return ( ( TextAttrib::operator==(rAttr ) ) && - ( maFontWeight == ((const TextAttribSpecial&)rAttr).maFontWeight ) ); -} - -void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff ) -{ - SbTextPortions aPortionList; - pAppEdit->GetBasicFrame()->Basic().Highlight( rSource, aPortionList ); - - sal_uInt16 nCount = aPortionList.Count(); - if ( !nCount ) - return; - - SbTextPortion& rLast = aPortionList[nCount-1]; - if ( rLast.nStart > rLast.nEnd ) // Only up to the bug of MD repaired - { -#if OSL_DEBUG_LEVEL > 1 - OSL_FAIL( "MD-Bug is not repaired!" ); -#endif - nCount--; - aPortionList.Remove( nCount); - if ( !nCount ) - return; - } - - // here is the postprocessing for types for the TestTool - sal_uInt16 i; - sal_Bool bWasTTControl = sal_False; - for ( i = 0; i < aPortionList.Count(); i++ ) - { - SbTextPortion& r = aPortionList[i]; - if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired - continue; - - SbTextType eType = r.eType; - Color aColor; - switch ( eType ) - { - case SB_SYMBOL: - { - String aSymbol = rSource.Copy( r.nStart, r.nEnd - r.nStart +1 ); - r.eType = pAppEdit->GetBasicFrame()->Basic().GetSymbolType( aSymbol, bWasTTControl ); - - if ( r.eType == TT_CONTROL ) - bWasTTControl = sal_True; - else - bWasTTControl = sal_False; - } - break; - case SB_PUNCTUATION: - { - String aPunctuation = rSource.Copy( r.nStart, r.nEnd - r.nStart +1 ); - if ( aPunctuation.CompareToAscii( "." ) != COMPARE_EQUAL ) - bWasTTControl = sal_False; - } - break; - default: - bWasTTControl = sal_False; - } - } - - // Only the blanks and tabs had to be attributed. - // If there are two equal attributes one after another, - // they are optimized by the EditEngine. - xub_StrLen nLastEnd = 0; -#ifdef DBG_UTIL - xub_StrLen nLine1 = aPortionList[0].nLine; -#endif - for ( i = 0; i < nCount; i++ ) - { - SbTextPortion& r = aPortionList[i]; - DBG_ASSERT( r.nLine == nLine1, "still more lines ?" ); - DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" ); - if ( r.nStart > r.nEnd ) // only fix Bug until MD - continue; - - if ( r.nStart > nLastEnd ) - { - // can I trust that all of them except - // blank und tab will be highlighted?! - r.nStart = nLastEnd; - } - nLastEnd = r.nEnd+1; - if ( ( i == (nCount-1) ) && ( r.nEnd < rSource.Len() ) ) - r.nEnd = rSource.Len()-1; - } - - sal_Bool bWasModified = pTextEngine->IsModified(); - for ( i = 0; i < aPortionList.Count(); i++ ) - { - SbTextPortion& r = aPortionList[i]; - if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired - continue; - - SbTextType eCol = r.eType; - Color aColor; - sal_uIntPtr nLine = nLineOff+r.nLine-1; // -1, because BASIC starts with 1 - switch ( +eCol ) - { - case SB_KEYWORD: - aColor = Color( COL_BLUE ); - break; - case SB_SYMBOL: - aColor = Color( RGB_COLORDATA( 0x00, 0x60, 0x00 ) ); - break; - case SB_STRING: - aColor = Color( COL_RED ); - break; - case SB_NUMBER: - aColor = Color( COL_MAGENTA ); - break; - case SB_PUNCTUATION: - aColor = Color( COL_BLACK ); - break; - case SB_COMMENT: - aColor = Color( COL_GRAY ); - break; - case TT_KEYWORD: - case TT_LOCALCMD: - aColor = Color( COL_LIGHTBLUE ); - break; - case TT_REMOTECMD: - aColor = Color( RGB_COLORDATA( 0x00, 0xB0, 0xB0 ) ); - break; - case TT_CONTROL: - case TT_SLOT: - aColor = Color( RGB_COLORDATA( 0x00, 0xB0, 0x00 ) ); - break; - case TT_METHOD: - aColor = Color( RGB_COLORDATA( 0x00, 0xB0, 0x00 ) ); - break; - case TT_NOMETHOD: - { - aColor = Color( COL_RED ); - pTextEngine->SetAttrib( TextAttribSpecial( WEIGHT_BOLD ), nLine, r.nStart, r.nEnd+1 ); - } - break; - default: - { - aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) ); - OSL_FAIL( "Unknown syntax color" ); - } - } - pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 ); - } - // Highlighting should not modify the text - pTextEngine->SetModified( bWasModified ); -} - -void TextEditImp::DoSyntaxHighlight( sal_uIntPtr nPara ) -{ - // Due to delayed syntax highlight it can happen that the - // paragraph does no longer exist - if ( nPara < pTextEngine->GetParagraphCount() ) - { - // unfortunatly I don't know if exact this line Modified() ... - pTextEngine->RemoveAttribs( nPara ); - String aSource( pTextEngine->GetText( nPara ) ); - ImpDoHighlight( aSource, nPara ); - } -} - -void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara ) -{ - // Paragraph is added to 'List', processed in TimerHdl. - // => Do not manipulate paragraphs while EditEngine is formatting - - if ( !bHighlightning && bDoSyntaxHighlight ) - { - if ( bDelayHighlight ) - { - aSyntaxLineTable.Insert( nPara, (void*)(sal_uIntPtr)1 ); - aSyntaxIdleTimer.Start(); - } - else - DoSyntaxHighlight( nPara ); - } -} - -IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG ) -{ - DBG_ASSERT( pTextView, "Not yet a View but Syntax-Highlight ?!" ); - pTextEngine->SetUpdateMode( sal_False ); - - bHighlightning = sal_True; - sal_uInt16 nLine; - while ( aSyntaxLineTable.First() && !Application::AnyInput( VCL_INPUT_MOUSEANDKEYBOARD ) ) - { - nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey(); - DoSyntaxHighlight( nLine ); - aSyntaxLineTable.Remove( nLine ); - } - - sal_Bool bWasModified = pTextEngine->IsModified(); - if ( aSyntaxLineTable.Count() > 3 ) // Without VDev - { - pTextEngine->SetUpdateMode( sal_True ); - pTextView->ShowCursor( sal_True, sal_True ); - } - else - pTextEngine->SetUpdateMode( sal_True ); // ! With VDev - - // SetUpdateMode (sal_True ) shouldn't set Modify - pTextEngine->SetModified( bWasModified ); - - // SyntaxTimerHdl will be called when the text changes - // => Good opportunity to get the text width - - bHighlightning = sal_False; - - if ( aSyntaxLineTable.First() ) - aImplSyntaxIdleTimer.Start(); - - return 0; -} - -void TextEditImp::InvalidateSyntaxHighlight() -{ - for ( xub_StrLen i = 0; i < pTextEngine->GetParagraphCount(); i++ ) - DoDelayedSyntaxHighlight( i ); -} - -void TextEditImp::SyntaxHighlight( sal_Bool bNew ) -{ - if ( ( bNew && bDoSyntaxHighlight ) || ( !bNew && !bDoSyntaxHighlight ) ) - return; - - bDoSyntaxHighlight = bNew; - if ( !pTextEngine ) - return; - - - if ( bDoSyntaxHighlight ) - { - InvalidateSyntaxHighlight(); - } - else - { - aSyntaxIdleTimer.Stop(); - pTextEngine->SetUpdateMode( sal_False ); - for ( sal_uIntPtr i = 0; i < pTextEngine->GetParagraphCount(); i++ ) - pTextEngine->RemoveAttribs( i ); - - pTextEngine->SetUpdateMode( sal_True ); - pTextView->ShowCursor(sal_True, sal_True ); - } -} - - -void TextEditImp::SetFont( const Font& rNewFont ) -{ - pTextEngine->SetFont(rNewFont); -} - -sal_Bool TextEditImp::IsModified() -{ - return pTextEngine->IsModified(); -} - -void TextEditImp::KeyInput( const KeyEvent& rKeyEvent ) -{ - sal_Bool bWasModified = pTextView->GetTextEngine()->IsModified(); - pTextView->GetTextEngine()->SetModified( sal_False ); - - if ( !pTextView->KeyInput( rKeyEvent ) ) - Window::KeyInput( rKeyEvent ); - - if ( pTextView->GetTextEngine()->IsModified() ) - ModifyHdl.Call( NULL ); - else - pTextView->GetTextEngine()->SetModified( bWasModified ); -} - -void TextEditImp::Paint( const Rectangle& rRect ) -{ - pTextView->Paint( rRect ); -} - -void TextEditImp::MouseButtonUp( const MouseEvent& rMouseEvent ) -{ - pTextView->MouseButtonUp( rMouseEvent ); -} - - -void TextEditImp::Command( const CommandEvent& rCEvt ) -{ - switch( rCEvt.GetCommand() ) { - case COMMAND_CONTEXTMENU: - case COMMAND_WHEEL: - GetParent()->Command( rCEvt ); - break; - default: - pTextView->Command( rCEvt ); - } -} - - -void TextEditImp::MouseButtonDown( const MouseEvent& rMouseEvent ) -{ - pTextView->MouseButtonDown( rMouseEvent ); - HideVarContents( NULL ); - ShowTipTimer.Stop(); -} - - -void TextEditImp::MouseMove( const MouseEvent& rMEvt ) -{ - pTextView->MouseMove( rMEvt ); - HideVarContents( NULL ); - if ( rMEvt.GetButtons() == 0 ) - ShowTipTimer.Start(); - if ( rMEvt.IsLeaveWindow() ) - ShowTipTimer.Stop(); -} - - -IMPL_LINK( TextEditImp, HideVarContents, void*, EMPTYARG ) -{ - if ( nTipId ) - { - Help::HideTip( nTipId ); - nTipId = 0; - aTipWord = String(); - } - return 0; -} - -static const char cSuffixes[] = "%&!#@$"; - - -SbxBase* TextEditImp::GetSbxAtMousePos( String &aWord ) -{ - Point aPos = GetPointerPosPixel(); - Point aDocPos = pTextView->GetDocPos( aPos ); - aWord = pTextEngine->GetWord( pTextEngine->GetPaM( aDocPos ) ); - - if ( aWord.Len() ) - { - xub_StrLen nLastChar = aWord.Len()-1; - String aSuffixes = CUniString( cSuffixes ); - if ( aSuffixes.Search( aWord.GetChar(nLastChar) ) != STRING_NOTFOUND ) - aWord.Erase( nLastChar, 1 ); - // because perhaps TestTools throws an error - sal_Bool bWasError = SbxBase::IsError(); - pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( sal_True ); - SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); - pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( sal_False ); - DBG_ASSERT( !( !bWasError && SbxBase::IsError()), "Error generated while retrieving Variable data for viewing" ); - if ( !bWasError && SbxBase::IsError() ) - SbxBase::ResetError(); - - return pSBX; - } - return NULL; -} - - -IMPL_LINK( TextEditImp, ShowVarContents, void*, EMPTYARG ) -{ - String aWord; - SbxBase* pSBX = GetSbxAtMousePos( aWord ); - String aHelpText; - Point aPos = GetPointerPosPixel(); - - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) - { - SbxVariable* pVar = (SbxVariable*)pSBX; - SbxDataType eType = pVar->GetType(); - if ( eType == SbxOBJECT ) - { - // Can cause a crash: Type == Object does not mean pVar == Object - if ( pVar->GetObject() && pVar->GetObject()->ISA( SbxObject ) ) - aHelpText = ((SbxObject*)(pVar->GetObject()))->GetClassName(); - else - aHelpText = CUniString("Object"); - } - else if ( eType & SbxARRAY ) - aHelpText = CUniString("{...}"); - else if ( eType != SbxEMPTY ) - { - aHelpText = pVar->GetName(); - if ( !aHelpText.Len() ) // Name is not copied in arguments - aHelpText = aWord; - aHelpText += '='; - aHelpText += pVar->GetString(); - } - } - - - if ( aHelpText.Len() && aTipPos != aPos && aTipWord != aWord ) - { - if ( nTipId ) - Help::HideTip( nTipId ); - nTipId = Help::ShowTip( this, Rectangle(), aHelpText ); - - HideTipTimer.Start(); - aTipWord = aWord; - aTipPos = aPos; - } - if ( nTipId && aTipPos != aPos ) - { - Help::HideTip( nTipId ); - nTipId = 0; - aTipWord = String(); - } - - return 0; -} - - -void TextEditImp::BuildKontextMenu( PopupMenu *&pMenu ) -{ - String aWord; - SbxBase* pSBX = GetSbxAtMousePos( aWord ); - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) - { - SbxVariable* pVar = (SbxVariable*)pSBX; - SbxDataType eType = pVar->GetType(); - - if ( ( eType & ( SbxVECTOR | SbxARRAY | SbxBYREF )) == 0 ) - { - -/* -Boolean -Currency -Date -Double -Integer -Long -Object -Single -String -Variant(Empty) -*/ - switch ( eType ) - { - case SbxBOOL: - case SbxDOUBLE: - case SbxINTEGER: - case SbxLONG: - case SbxSINGLE: - case SbxSTRING: - - case SbxVARIANT: // does not occure, instead SbxEMPTY - case SbxEMPTY: - { - pAppEdit->GetBasicFrame()->SetEditVar( pVar ); - if ( !pMenu ) - pMenu = new PopupMenu(); - else - pMenu->InsertSeparator(); - - pMenu->InsertItem( RID_POPUPEDITVAR, ((BasicFrame*)GetpApp()->GetAppWindow())->GenRealString( GEN_RES_STR1( IDS_EDIT_VAR, aWord ) ) ); - } - break; - default: - ; - } - } - } -} - - - - -DBG_NAME(TextEdit) - -TextEdit::TextEdit( AppEdit* pParent, const WinBits& aBits ) -: pBreakpointWindow( NULL ) -, bFileWasUTF8( sal_False ) -, bSaveAsUTF8( sal_False ) -, aEdit( pParent, aBits | WB_NOHIDESELECTION ) -{ -DBG_CTOR(TextEdit,0); -} - -TextEdit::~TextEdit() -{DBG_DTOR(TextEdit,0);} - -void TextEdit::Highlight( sal_uIntPtr nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) -{ - if ( nLine ) // Should not occure but at 'Sub expected' in first line - nLine--; - - String s = aEdit.pTextEngine->GetText( nLine ); - - if( nCol1 == STRING_NOTFOUND ) - { - // No column given - nCol1 = 0; - nCol2 = STRING_NOTFOUND; - } - if( nCol2 == STRING_NOTFOUND ) - { - nCol2 = s.Len(); - } - // Adaption to the Precompiler | EditText != Compilied Text - if ( nCol2 > s.Len() ) - nCol2 = s.Len(); - if ( nCol1 >= nCol2 ) - nCol1 = 0; - - // Because nCol2 *may* point after the current statement - // (because the next one starts there) there are space - // that must be removed - sal_Bool bColon = sal_False; - - while ( s.GetChar( nCol2 ) == ' ' && nCol2 > nCol1 && !bColon ) - { - nCol2--; - if ( s.GetChar( nCol2 ) == ':' ) - { - nCol2--; - bColon = sal_True; - } - } - - aEdit.ViewMoved(); - aEdit.pTextView->SetSelection( TextSelection(TextPaM(nLine,nCol2+1), TextPaM(nLine,nCol1)) ); - if ( aEdit.ViewMoved() ) - { - aEdit.pTextView->SetSelection( TextSelection(TextPaM(TEXT_PARA_ALL,1)) ); - aEdit.pTextView->SetSelection( TextSelection(TextPaM((nLine>=2?nLine-2:0),nCol2+1)) ); - aEdit.pTextView->SetSelection( TextSelection(TextPaM(nLine,nCol2+1), TextPaM(nLine,nCol1)) ); - } -} - - -void TextEdit::Delete(){ aEdit.pTextView->KeyInput( KeyEvent( 0, KeyCode( KEYFUNC_DELETE ) )); } -void TextEdit::Cut(){ aEdit.pTextView->Cut(); } -void TextEdit::Copy(){ aEdit.pTextView->Copy(); } -void TextEdit::Paste(){ aEdit.pTextView->Paste(); } -void TextEdit::Undo(){ aEdit.pTextView->Undo(); } -void TextEdit::Redo(){ aEdit.pTextView->Redo(); } -String TextEdit::GetSelected(){ return aEdit.pTextView->GetSelected(); } -TextSelection TextEdit::GetSelection() const{ return aEdit.pTextView->GetSelection(); } -void TextEdit::SetSelection( const TextSelection& rSelection ){ aEdit.pTextView->SetSelection( rSelection ); } - -sal_uInt16 TextEdit::GetLineNr() const -{ - return sal::static_int_cast< sal_uInt16 >( - aEdit.pTextView->GetSelection().GetEnd().GetPara()+1); -} - -void TextEdit::ReplaceSelected( const String& rStr ){ aEdit.pTextView->InsertText(rStr); } -sal_Bool TextEdit::IsModified(){ return aEdit.IsModified(); } - -String TextEdit::GetText() const -{ - return aEdit.pTextEngine->GetText( GetSystemLineEnd() ); -} - -void TextEdit::SetText( const String& rStr ){ aEdit.pTextEngine->SetText(rStr); aEdit.pTextEngine->SetModified( sal_False ); } -void TextEdit::SetModifyHdl( Link l ){ aEdit.SetModifyHdl(l); } -sal_Bool TextEdit::HasText() const { return aEdit.pTextEngine->GetTextLen() > 0; } - -// Search from the beginning or at mark + 1 -sal_Bool TextEdit::Find( const String& s ) -{ - DBG_CHKTHIS(TextEdit,0); - - TextSelection aSelection = aEdit.pTextView->GetSelection(); - sal_uIntPtr nPara = aSelection.GetStart().GetPara(); - xub_StrLen nIndex = aSelection.GetStart().GetIndex(); - - if ( aSelection.HasRange() ) - nIndex ++; - - while ( nPara <= aEdit.pTextEngine->GetParagraphCount() ) - { - String aText = aEdit.pTextEngine->GetText( nPara ); - - nIndex = aText.Search( s, nIndex ); - if( nIndex != STRING_NOTFOUND ) - { - aEdit.pTextView->SetSelection( TextSelection( TextPaM( nPara, nIndex ), TextPaM( nPara, nIndex + s.Len() ) ) ); - return sal_True; - } - nIndex = 0; - nPara++; - } - return sal_False; -} - -sal_Bool TextEdit::Load( const String& aName ) -{ -DBG_CHKTHIS(TextEdit,0); - sal_Bool bOk = sal_True; - SvFileStream aStrm( aName, STREAM_STD_READ ); - if( aStrm.IsOpen() ) - { - String aText, aLine, aLineBreak; - sal_Bool bIsFirstLine = sal_True; - aLineBreak += '\n'; - aLineBreak.ConvertLineEnd(); - rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; - while( !aStrm.IsEof() && bOk ) - { - aStrm.ReadByteStringLine( aLine, aFileEncoding ); - if ( bIsFirstLine && IsTTSignatureForUnicodeTextfile( aLine ) ) - { - aFileEncoding = RTL_TEXTENCODING_UTF8; - bFileWasUTF8 = sal_True; - } - else - { - if ( !bIsFirstLine ) - aText += aLineBreak; - aText += aLine; - bIsFirstLine = sal_False; - } - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - } - SetText( aText ); - } - else - bOk = sal_False; - return bOk; -} - -sal_Bool TextEdit::Save( const String& aName ) -{ -DBG_CHKTHIS(TextEdit,0); - sal_Bool bOk = sal_True; - SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC ); - rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; - if( aStrm.IsOpen() ) - { - if ( bFileWasUTF8 || bSaveAsUTF8 ) - { - aStrm << TT_SIGNATURE_FOR_UNICODE_TEXTFILES; - aStrm << sal_Char(_LF); - aFileEncoding = RTL_TEXTENCODING_UTF8; - } - String aSave = GetText(); - aSave.ConvertLineEnd(LINEEND_LF); - aStrm << rtl::OUStringToOString(aSave, aFileEncoding).getStr(); - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - else - aEdit.pTextEngine->SetModified(sal_False); - } else bOk = sal_False; - return bOk; -} - - -void TextEdit::BuildKontextMenu( PopupMenu *&pMenu ) -{ - DataEdit::BuildKontextMenu( pMenu ); - aEdit.BuildKontextMenu( pMenu ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/textedit.hxx b/basic/source/app/textedit.hxx deleted file mode 100644 index 2d68d11541db..000000000000 --- a/basic/source/app/textedit.hxx +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TEXTEDIT_HXX -#define _TEXTEDIT_HXX - -class AppEdit; -class TextEngine; -class TextView; -class TextEdit; -class BreakpointWindow; - -#include <vcl/timer.hxx> -#include <tools/table.hxx> -#include <tools/debug.hxx> -#include <svl/lstner.hxx> -#include <svtools/svmedit.hxx> - -#include "dataedit.hxx" - - -class TextEditImp : public Window, public SfxListener -{ -using Window::Notify; - -protected: - void DoSyntaxHighlight( sal_uIntPtr nPara ); - - -private: - AppEdit *pAppEdit; - Link ModifyHdl; - - Timer aSyntaxIdleTimer; - Timer aImplSyntaxIdleTimer; - DECL_LINK( SyntaxTimerHdl, Timer * ); - Table aSyntaxLineTable; - - void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - void ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff ); - sal_Bool bHighlightning; - sal_Bool bDoSyntaxHighlight; - sal_Bool bDelayHighlight; - - - SbxBase* GetSbxAtMousePos( String &aWord ); - virtual void MouseMove( const MouseEvent& rMEvt ); - DECL_LINK( HideVarContents, void* ); - DECL_LINK( ShowVarContents, void* ); - Point aTipPos; - String aTipWord; - sal_uIntPtr nTipId; - - Timer HideTipTimer; - Timer ShowTipTimer; - - sal_Bool bViewMoved; - -public: - TextEditImp( AppEdit *pParent, const WinBits& aBits ); - ~TextEditImp(); - - TextEngine *pTextEngine; - TextView *pTextView; - - void SetFont( const Font& rNewFont ); - sal_Bool IsModified(); - void SetModifyHdl( Link l ){ ModifyHdl = l; } - - void KeyInput( const KeyEvent& rKeyEvent ); - void Paint( const Rectangle& rRect ); - void MouseButtonUp( const MouseEvent& rMouseEvent ); - void MouseButtonDown( const MouseEvent& rMouseEvent ); - void Command( const CommandEvent& rCEvt ); - - sal_Bool ViewMoved(); - - void DoDelayedSyntaxHighlight( xub_StrLen nPara ); - void InvalidateSyntaxHighlight(); - void SyntaxHighlight( sal_Bool bNew ); - void BuildKontextMenu( PopupMenu *&pMenu ); -}; - - - -DBG_NAMEEX(TextEdit) -class TextEdit : public DataEdit { - - BreakpointWindow *pBreakpointWindow; - sal_Bool bFileWasUTF8; - sal_Bool bSaveAsUTF8; - -public: - TextEdit( AppEdit*, const WinBits& ); - ~TextEdit(); - void Highlight( sal_uIntPtr nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); - TextEditImp& GetTextEditImp() { return aEdit; } - - void SetBreakpointWindow( BreakpointWindow *pBPWindow ){ pBreakpointWindow = pBPWindow; } - BreakpointWindow *GetBreakpointWindow(){ return pBreakpointWindow; } - - DATA_FUNC_DEF( aEdit, TextEditImp ) - - virtual void BuildKontextMenu( PopupMenu *&pMenu ); - - void SaveAsUTF8( sal_Bool bUTF8 ) { bSaveAsUTF8 = bUTF8; } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/ttbasic.hxx b/basic/source/app/ttbasic.hxx deleted file mode 100644 index 8810da66b5e9..000000000000 --- a/basic/source/app/ttbasic.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -class TTBasic -{ -public: - static MyBasic* CreateMyBasic(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src deleted file mode 100644 index d5ac293e5115..000000000000 --- a/basic/source/app/ttmsg.src +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "basic/ttmsg.hrc" - - -// Here are included the messages of the folder /basic/source/testtool - - -// Error messages which go to the result file. -// ********************* -// *** !!ATTENTION!! *** -// ********************* -// The numbers must NEVER(!) change, -// because they are saved in the result files and a renewed display -// would display new strings or no strings. - -String S_NAME_NOT_THERE -{ - Text[ en-US ] = "Name doesn't exist: #($Arg1)"; -}; -String S_DOUBLE_NAME -{ - Text[ en-US ] = "Name double: ($Arg1)"; -}; -String S_READING_FILE -{ - Text[ en-US ] = "Reading the files"; -}; -String S_CANNOT_OPEN_FILE -{ - Text[ en-US ] = "File cannot be opened: ($Arg1)"; -}; -String S_INVALID_LINE -{ - Text[ en-US ] = "Line \"($Arg1)\" is invalid."; -}; -String S_SHORTNAME_UNKNOWN -{ - Text[ en-US ] = "Short-name unknown during copying: ($Arg1)"; -}; -String S_LONGNAME_UNKNOWN -{ - Text[ en-US ] = "Long-name unknown: ($Arg1)"; -}; -String S_FIRST_SHORTNAME_REQ_ASTRX -{ - Text[ en-US ] = "First short-name must start with * . Ignoring."; -}; -String S_TIMOUT_WAITING -{ - Text[ en-US ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; -}; -String S_APPLICATION_RESTARTED -{ - Text[ en-US ] = "Application has been restarted."; -}; -String S_APPLICATION_START_FAILED -{ - Text[ en-US ] = "Application \"($Arg1)\" cannot be started. "; -}; -String S_TIMOUT_SENDING -{ - Text[ en-US ] = "Server Timeout while sending. Sequence No: ($Arg1)"; -}; -String S_NO_CONNECTION -{ - Text[ en-US ] = "No connection. Sequence No: ($Arg1)"; -}; -String S_NO_FILES_FOUND // Not used anymore. needed only for old *.res files -{ - Text[ en-US ] = "No ($Arg1) files found"; -}; -String S_ERRORS_DETECTED -{ - Text[ en-US ] = "** ($Arg1) errors occurred"; -}; -String S_NO_ERRORS_DETECTED -{ - Text[ en-US ] = "** No errors have occurred"; -}; -String S_WARNINGS_DETECTED -{ - Text[ en-US ] = "** ($Arg1) warnings occurred"; -}; -String S_NO_WARNINGS_DETECTED -{ - Text[ en-US ] = "** No warnings have occurred"; -}; -String S_INCLUDE_FILE_WARNINGS_DETECTED -{ - Text[ en-US ] = "** ($Arg1) warnings occurred during initialization"; -}; -String S_NO_INCLUDE_FILE_WARNINGS_DETECTED -{ - Text[ en-US ] = "** No warnings occurred during initialization"; -}; -String S_UNKNOWN_SLOT_CONTROL -{ - Text[ en-US ] = "Slot/Control unknown :\"($Arg1)\""; -}; -String S_RETURN_SEQUENCE_MISSMATCH -{ - Text[ en-US ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; -}; -String S_RETURNED_VALUE_ID_MISSMATCH -{ - Text[ en-US ] = "Return value received but different Id expected"; -}; -String S_RETURNED_VALUE_NO_RECEIVER -{ - Text[ en-US ] = "Return value received but no receiver defined"; -}; -String S_UNKNOWN_METHOD -{ - Text[ en-US ] = "Unknown method on object :($Arg1).($Arg2)"; -}; - |