summaryrefslogtreecommitdiff
path: root/basic/source/app
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/app')
-rw-r--r--basic/source/app/app.cxx1995
-rw-r--r--basic/source/app/app.hxx199
-rw-r--r--basic/source/app/appbased.cxx302
-rw-r--r--basic/source/app/appbased.hxx77
-rw-r--r--basic/source/app/appedit.cxx304
-rw-r--r--basic/source/app/appedit.hxx73
-rw-r--r--basic/source/app/apperror.cxx118
-rw-r--r--basic/source/app/apperror.hxx52
-rw-r--r--basic/source/app/appwin.cxx660
-rw-r--r--basic/source/app/appwin.hxx141
-rw-r--r--basic/source/app/basic.hrc187
-rw-r--r--basic/source/app/basic.src1475
-rw-r--r--basic/source/app/basicrt.cxx147
-rw-r--r--basic/source/app/basmsg.hrc48
-rw-r--r--basic/source/app/basmsg.src57
-rw-r--r--basic/source/app/brkpnts.cxx389
-rw-r--r--basic/source/app/brkpnts.hxx97
-rw-r--r--basic/source/app/dataedit.hxx119
-rw-r--r--basic/source/app/dialogs.cxx1510
-rw-r--r--basic/source/app/dialogs.hxx374
-rw-r--r--basic/source/app/makefile.mk104
-rw-r--r--basic/source/app/msgedit.cxx1002
-rw-r--r--basic/source/app/msgedit.hxx117
-rw-r--r--basic/source/app/mybasic.cxx307
-rw-r--r--basic/source/app/printer.cxx197
-rw-r--r--basic/source/app/printer.hxx61
-rw-r--r--basic/source/app/process.cxx232
-rw-r--r--basic/source/app/processw.cxx285
-rw-r--r--basic/source/app/processw.hxx93
-rw-r--r--basic/source/app/resids.hrc161
-rw-r--r--basic/source/app/status.cxx128
-rw-r--r--basic/source/app/status.hxx57
-rw-r--r--basic/source/app/svtmsg.src342
-rw-r--r--basic/source/app/testbasi.cxx34
-rw-r--r--basic/source/app/testtool.idl50
-rw-r--r--basic/source/app/testtool.src64
-rw-r--r--basic/source/app/textedit.cxx869
-rw-r--r--basic/source/app/textedit.hxx141
-rw-r--r--basic/source/app/ttbasic.cxx39
-rw-r--r--basic/source/app/ttbasic.hxx35
-rw-r--r--basic/source/app/ttmsg.src163
41 files changed, 12805 insertions, 0 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
new file mode 100644
index 000000000000..31385f2f6e9e
--- /dev/null
+++ b/basic/source/app/app.cxx
@@ -0,0 +1,1995 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: app.cxx,v $
+ * $Revision: 1.79.14.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <tools/fsys.hxx>
+#ifndef _SV_FILEDLG_HXX //autogen
+#include <svtools/filedlg.hxx>
+#endif
+#include <tools/config.hxx>
+
+#include <vcl/font.hxx>
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+#include <basic/sbx.hxx>
+#include <svtools/filedlg.hxx>
+
+#include <osl/module.h>
+
+#include "basic.hrc"
+#include "app.hxx"
+#include "printer.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"
+
+#ifndef _RUNTIME_HXX
+#include "runtime.hxx"
+#endif
+#include "sbintern.hxx"
+
+#ifdef _USE_UNO
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/configurationkeys.hxx>
+#include <comphelper/regpathhelper.hxx>
+#include <comphelper/processfactory.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>
+
+using namespace comphelper;
+using namespace cppu;
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::beans;
+
+#endif /* _USE_UNO */
+
+IMPL_GEN_RES_STR;
+
+#ifdef DBG_UTIL
+// filter Messages generated due to missing configuration Bug:#83887#
+void TestToolDebugMessageFilter( const sal_Char *pString, BOOL bIsOsl )
+{
+ static BOOL static_bInsideFilter = FALSE;
+
+ // Ignore messages during filtering to avoid endless recursions
+ if ( static_bInsideFilter )
+ return;
+
+ static_bInsideFilter = TRUE;
+
+ ByteString aMessage( pString );
+
+ BOOL bIgnore = FALSE;
+
+ if ( bIsOsl )
+ {
+ // OSL
+ if ( aMessage.Search( CByteString("Cannot open Configuration: Connector: unknown delegatee com.sun.star.connection.Connector.portal") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ }
+ else
+ {
+ // DBG
+#if ! (OSL_DEBUG_LEVEL > 1)
+ if ( aMessage.Search( CByteString("SelectAppIconPixmap") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+#endif
+ if ( aMessage.Search( CByteString("PropertySetRegistry::") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ if ( aMessage.Search( CByteString("property value missing") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ if ( aMessage.Search( CByteString("getDateFormatsImpl") ) != STRING_NOTFOUND
+ && aMessage.Search( CByteString("no date formats") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ if ( aMessage.Search( CByteString("ucb::configureUcb(): Bad arguments") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ if ( aMessage.Search( CByteString("CreateInstance with arguments exception") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ if ( aMessage.Search( CByteString("AcquireTree failed") ) != STRING_NOTFOUND )
+ bIgnore = TRUE;
+ }
+
+
+ if ( bIgnore )
+ {
+ static_bInsideFilter = 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 );
+ }
+ }
+/* DBG_INSTOUTERROR( DBG_OUT_MSGBOX )
+ DBG_ERROR( pString );
+ DBG_INSTOUTERROR( DBG_OUT_TESTTOOL )*/
+ static_bInsideFilter = FALSE;
+}
+void SAL_CALL DBG_TestToolDebugMessageFilter( const sal_Char *pString )
+{
+ TestToolDebugMessageFilter( pString, FALSE );
+}
+extern "C" void SAL_CALL osl_TestToolDebugMessageFilter( const sal_Char *pString )
+{
+ if ( !getenv( "DISABLE_SAL_DBGBOX" ) )
+ TestToolDebugMessageFilter( pString, TRUE );
+}
+#endif
+
+// #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors
+// this routine became necessary
+BOOL IsTTSignatureForUnicodeTextfile( String aLine )
+{
+ 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
+
+static const char * const components[] =
+{
+ SAL_MODULENAME( "ucb1" ) // KSO, ABI
+ , SAL_MODULENAME( "ucpfile1" )
+ , "configmgr2.uno" SAL_DLLEXTENSION
+ , "sax.uno" SAL_DLLEXTENSION
+ , "stocservices.uno" SAL_DLLEXTENSION
+ , SAL_MODULENAME( "fileacc" )
+ , SAL_MODULENAME( "mcnttype" ) // Clipboard Ask Oliver Braun
+ , "i18npool.uno" SAL_DLLEXTENSION
+ // Reading of files in specific encodings like UTF-8 using
+ // createUnoService( "com.sun.star.io.TextInputStream" ) and such
+ , "textinstream.uno" SAL_DLLEXTENSION
+ , "textoutstream.uno" SAL_DLLEXTENSION
+ , "introspection.uno" SAL_DLLEXTENSION
+ , "reflection.uno" SAL_DLLEXTENSION
+ // RemoteUno
+ , "connector.uno" SAL_DLLEXTENSION
+ , "bridgefac.uno" SAL_DLLEXTENSION
+ , "remotebridge.uno" SAL_DLLEXTENSION
+#ifdef SAL_UNX
+#ifdef QUARTZ
+ , SVLIBRARY( "dtransaqua" ) // Mac OS X Aqua uses a dedicated libdtransaqua
+#else
+ , SVLIBRARY( "dtransX11" ) // OBR
+#endif
+#endif
+#ifdef SAL_W32
+ , SAL_MODULENAME( "sysdtrans" )
+ , SAL_MODULENAME( "ftransl" )
+ , SAL_MODULENAME( "dnd" )
+#endif
+ , 0
+};
+
+uno::Reference< XContentProviderManager > InitializeUCB( void )
+{
+ uno::Reference< XMultiServiceFactory > xSMgr;
+ try
+ {
+ xSMgr = uno::Reference< XMultiServiceFactory >(
+ defaultBootstrap_InitialComponentContext()->getServiceManager(),
+ UNO_QUERY_THROW);
+ }
+ catch( 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 simple ConfigManager
+ Sequence< Any > aConfArgs(3);
+ aConfArgs[0] <<= PropertyValue( OUString::createFromAscii("servertype"), 0, makeAny( OUString::createFromAscii("local") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
+ aConfArgs[1] <<= PropertyValue( OUString::createFromAscii("sourcepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
+ aConfArgs[2] <<= PropertyValue( OUString::createFromAscii("updatepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
+
+ uno::Reference< XContentProvider > xConfProvider
+ ( xSMgr->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), aConfArgs), UNO_QUERY );
+*/
+
+
+// Create unconfigured Ucb:
+/* Sequence< Any > aArgs(1);
+ aArgs[1] = makeAny ( xConfProvider );*/
+ Sequence< Any > aArgs;
+ ::ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
+ uno::Reference< XContentProviderManager > xUcb =
+ ::ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
+
+ uno::Reference< XContentProvider > xFileProvider
+ ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY );
+ xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True );
+
+
+/* uno::Reference< XContentProvider > xPackageProvider
+ ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.PackageContentProvider" ) ), UNO_QUERY );
+ xUcb->registerContentProvider( xPackageProvider, OUString::createFromAscii( "vnd.sun.star.pkg" ), sal_True );
+ */
+
+ 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 );
+ /*
+ rStr.SearchAndReplaceAllAscii( "%PRODUCTVERSION", rVersion );
+ rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSION", rAboutBoxVersion );
+ rStr.SearchAndReplaceAllAscii( "%PRODUCTEXTENSION", rExtension );
+ rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATNAME", rXMLFileFormatName );
+ rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATVERSION", rXMLFileFormatVersion );
+ */
+ }
+}
+
+void BasicApp::Main( )
+{
+#ifdef DBG_UTIL
+// Install filter for OSLAsserts
+ DbgPrintMsgBox = DbgGetPrintMsgBox();
+ DbgSetPrintTestTool( DBG_TestToolDebugMessageFilter );
+ DBG_INSTOUTERROR( DBG_OUT_TESTTOOL );
+
+ if ( osl_setDebugMessageFunc( osl_TestToolDebugMessageFilter ) )
+ DBG_ERROR("osl_setDebugMessageFunc returns non NULL pointer");
+#endif
+
+ ResMgr::SetReadStringHook( ReplaceStringHookProc );
+
+ try
+ {
+#ifdef _USE_UNO
+ uno::Reference< XContentProviderManager > xUcb = InitializeUCB();
+#endif
+
+ {
+ 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() );
+
+// DirEntry aDefIniPath( Config::GetConfigName( aAppDir, CUniString("testtool") ) );
+// 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, FALSE );
+ }
+ }
+ }
+
+ {
+ LanguageType aRequestedLanguage;
+ Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
+
+ // 1033 = LANGUAGE_ENGLISH_US
+ // 1031 = LANGUAGE_GERMAN
+ aConf.SetGroup("Misc");
+ ByteString aLang = aConf.ReadKey( "Language", ByteString::CreateFromInt32( LANGUAGE_SYSTEM ) );
+ aRequestedLanguage = LanguageType( aLang.ToInt32() );
+
+ AllSettings aSettings = GetSettings();
+ aSettings.SetUILanguage( aRequestedLanguage );
+ aSettings.SetLanguage( aRequestedLanguage );
+// International aInternational;
+// aInternational = GetSettings().GetInternational();
+// aInternational = International( aRequestedLanguage );
+// aSettings.SetInternational( aInternational );
+ SetSettings( aSettings );
+// aInternational = GetSettings().GetInternational();
+ }
+
+// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt ), )
+//const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio )
+
+// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt )
+// ResMgr *pRes = new ResMgr( "testtool.res" );
+// Resource::SetResManager( pRes );
+
+ BasicDLL aBasicDLL;
+ nWait = 0;
+
+ // Hilfe:
+// pHelp = new Help;
+// SetHelp( pHelp );
+// Help::EnableContextHelp();
+// Help::EnableExtHelp();
+// DeactivateExtHelp();
+
+ // Acceleratoren
+ Accelerator aAccel( SttResId( MAIN_ACCEL ) );
+ InsertAccel( &aAccel );
+ 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 pHelp;
+ delete pFrame;
+
+ RemoveAccel( pMainAccel );
+
+ }
+ catch( class Exception & rEx)
+ {
+ printf( "Exception not caught: %s\n", ByteString( String(rEx.Message), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
+ 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;
+ }
+}
+
+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 */
+ USHORT 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( 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 ( ByteString( Application::GetCommandLineParam( i+1 ), osl_getThreadTextEncoding() ).IsNumericAscii() )
+ {
+ MsgEdit::SetMaxLogLen( sal::static_int_cast< USHORT >( 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( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ ToTop( TOTOP_NOGRABFOCUS );
+ aAusblend.Start();
+ aStatus.SetText( aW );
+}
+
+void FloatingExecutionStatus::SetAdditionalInfo( String aF )
+{
+ Show( 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( FALSE )
+, pDisplayHidDlg( NULL )
+, pEditVar ( 0 )
+, bAutoReload( FALSE )
+, bAutoSave( TRUE )
+, pBasic( NULL )
+, pExecutionStatus( NULL )
+, pStatus( NULL )
+, pList( NULL )
+, pWork( NULL )
+, pPrn( NULL )
+{
+
+ Application::SetDefDialogParent( this );
+ AlwaysEnableInput( TRUE );
+ pBasic = TTBasic::CreateMyBasic(); // depending on what was linked to the executable
+ bInBreak = FALSE;
+ bDisas = FALSE;
+ nFlags = 0;
+// Icon aAppIcon;
+
+ if ( pBasic->pTestObject ) // Are we the testtool?
+ {
+// aAppIcon = Icon( ResId( RID_APPICON2 ) );
+ aAppName = String( SttResId( IDS_APPNAME2 ) );
+ }
+ else
+ {
+// aAppIcon = Icon( ResId( RID_APPICON ) );
+ aAppName = String( SttResId( IDS_APPNAME ) );
+ }
+
+ // 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 ) );
+
+#ifndef UNX
+ pPrn = new BasicPrinter;
+#else
+ pPrn = NULL;
+#endif
+ pList = new EditList;
+ pStatus = new StatusLine( this );
+
+ LoadIniFile();
+
+ UpdateTitle();
+// SetIcon( aAppIcon );
+
+ // Size: half width, 0.75 * height - 2 * IconSize
+ {
+ Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
+ aConf.SetGroup("WinGeom");
+ SetWindowState( aConf.ReadKey("WinParams", "") );
+ }
+
+// pWork = new AppEdit( this, NULL );
+// pWork->Show();
+// pWork->Close();
+
+ aLineNum.SetTimeoutHdl( LINK( this, BasicFrame, ShowLineNr ) );
+ aLineNum.SetTimeout(200);
+ aLineNum.Start();
+
+
+ aCheckFiles.SetTimeout( 10000 );
+ aCheckFiles.SetTimeoutHdl( LINK( this, BasicFrame, CheckAllFiles ) );
+ aCheckFiles.Start();
+
+ GetMenuBar()->SetCloserHdl( LINK( this, BasicFrame, CloseButtonClick ) );
+ GetMenuBar()->SetFloatButtonClickHdl( LINK( this, BasicFrame, FloatButtonClick ) );
+ GetMenuBar()->SetHideButtonClickHdl( LINK( this, BasicFrame, HideButtonClick ) );
+}
+
+const ByteString ProfilePrefix("_profile_");
+const USHORT ProfilePrefixLen = ProfilePrefix.Len();
+
+void BasicFrame::LoadIniFile()
+{
+ USHORT 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" ).Len() || aConf.ReadKey( "Alle" ).Len() )
+ &&( !aConf.ReadKey( "Current" ).Len() && !aConf.ReadKey( "All" ).Len() ) )
+ {
+ 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->Count() ; i++ )
+ pList->GetObject( i )->LoadIniFile();
+}
+
+BasicFrame::~BasicFrame()
+{
+ AppWin* p = pList->First();
+ DBG_ASSERT( !p, "Still open FileWindows");
+ if( p )
+ while( (p = pList->Remove() ) != NULL )
+ delete p;
+
+ MenuBar *pBar = GetMenuBar();
+ SetMenuBar( NULL );
+ delete pBar;
+
+ delete pStatus;
+ delete pPrn;
+ delete pList;
+// delete pExecutionStatus;
+// delete pBasic;
+ 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 ( int i = pList->Count()-1 ; i >= 0 ; i-- )
+ pList->GetObject( i )->CheckReload();
+
+ if ( pWork != pStartWin )
+ {
+ pWork = pStartWin;
+ pWork->ToTop();
+ }
+ if ( pFocusWin )
+ pFocusWin->GrabFocus();
+ }
+ pTimer->Start();
+ return 0;
+}
+
+BOOL BasicFrame::IsAutoRun()
+{
+ return bIsAutoRun;
+}
+
+void BasicFrame::SetAutoRun( 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 );
+/* if ( !pExecutionStatus )
+ pExecutionStatus = new FloatingExecutionStatus( this );
+ pExecutionStatus->SetStatus( pStatusHint->GetExecutionStatus() );
+ pExecutionStatus->SetAdditionalInfo( pStatusHint->GetAdditionalExecutionStatus() );*/
+ }
+ break;
+ case TT_EXECUTION_HIDE_ACTION:
+ {
+/* if ( pExecutionStatus )
+ {
+ delete pExecutionStatus;
+ pExecutionStatus = NULL;
+ }*/
+ }
+ break;
+ }
+ }
+
+
+ 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
+ ULONG i;
+ for( i = pList->Count(); i > 0 ; i-- )
+ {
+ if ( pList->GetObject( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
+ pList->GetObject( i-1 )->Maximize();
+ }
+}
+
+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 ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
+ {};
+ if ( p )
+ p->GrabFocus();
+ return Command( RID_FILECLOSE, FALSE );
+}
+
+IMPL_LINK( BasicFrame, FloatButtonClick, void*, EMPTYARG )
+{
+ AppWin* p;
+ for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
+ {};
+ if ( p )
+ p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ return 1;
+}
+
+IMPL_LINK( BasicFrame, HideButtonClick, void*, EMPTYARG )
+{
+ AppWin* p;
+ for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
+ {};
+ if ( p )
+ p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ return 1;
+}
+
+void BasicFrame::WinShow_Hide()
+{
+ if ( !pList->Count() )
+ return;
+
+ AppWin* p;
+ BOOL bWasFullscreen = FALSE;
+ for ( p = pList->Last() ; p ; p = pList->Prev() )
+ {
+ 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( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ }
+ bWasFullscreen |= p->GetWinState() == TT_WIN_STATE_MAX;
+ }
+}
+
+void BasicFrame::WinMax_Restore()
+{
+ // The application buttons
+ AppWin* p;
+ BOOL bHasFullscreenWin = FALSE;
+ for( p = pList->First(); p && !bHasFullscreenWin ; p = pList->Next() )
+ bHasFullscreenWin |= ( p->GetWinState() == TT_WIN_STATE_MAX );
+ GetMenuBar()->ShowButtons( bHasFullscreenWin, FALSE, FALSE );
+ WinShow_Hide();
+}
+
+void BasicFrame::RemoveWindow( AppWin *pWin )
+{
+// delete pIcon;
+ pList->Remove( pWin );
+ pWork = pList->Last();
+
+ WinShow_Hide();
+
+ if ( pWork )
+ pWork->ToTop();
+
+ WinMax_Restore();
+
+ Menu* pMenu = GetMenuBar();
+ if( pList->Count() == 0 ) {
+ pMenu->EnableItem( RID_APPEDIT, FALSE );
+ pMenu->EnableItem( RID_APPRUN, FALSE );
+ pMenu->EnableItem( RID_APPWINDOW, 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->Insert( pWin, LIST_APPEND );
+ pWork = pWin;
+
+ WinMax_Restore();
+
+ // Enable main menu
+ MenuBar* pMenu = GetMenuBar();
+ if( pList->Count() > 0 ) {
+ pMenu->EnableItem( RID_APPEDIT, TRUE );
+ pMenu->EnableItem( RID_APPRUN, TRUE );
+ pMenu->EnableItem( RID_APPWINDOW, TRUE );
+ }
+
+ PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW );
+ USHORT nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 );
+
+ // Separator necessary
+ if ( nLastID < RID_WIN_FILE1 && pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) != MENUITEM_SEPARATOR )
+ pWinMenu->InsertSeparator();
+
+ // Find free ID
+ USHORT nFreeID = RID_WIN_FILE1;
+ 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;
+ pList->Remove( pWin );
+ pList->Insert( pWin, LIST_APPEND );
+ pWin->Minimize( FALSE );
+
+ aAppFile = pWin->GetText();
+ UpdateTitle();
+
+ WinShow_Hide();
+ pStatus->LoadTaskToolBox();
+}
+
+BOOL BasicFrame::Close()
+{
+ if( bInBreak || Basic().IsRunning() )
+ if( RET_NO == QueryBox( this, SttResId( IDS_RUNNING ) ).Execute() )
+ return FALSE;
+
+ StarBASIC::Stop();
+ bInBreak = 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 TRUE;
+ } else return FALSE;
+}
+
+BOOL BasicFrame::CloseAll()
+{
+ while ( pList->Count() )
+ if ( !pList->Last()->Close() )
+ return FALSE;
+ return TRUE;
+}
+
+BOOL BasicFrame::CompileAll()
+{
+ AppWin* p;
+ for( p = pList->First(); p; p = pList->Next() )
+ if( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE;
+ return TRUE;
+}
+
+// Setup menu
+#define MENU2FILENAME( Name ) Name.Copy( Name.SearchAscii(" ") +1).EraseAllChars( '~' )
+#define LRUNr( nNr ) CByteString("LRU").Append( ByteString::CreateFromInt32( nNr ) )
+String FILENAME2MENU( USHORT nNr, String aName )
+{
+ String 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");
+ USHORT nMaxLRU = (USHORT)aConfig.ReadKey("MaxLRU","4").ToInt32();
+ DirEntry aFileEntry( aFile );
+ USHORT i,nLastMove = nMaxLRU;
+
+ for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ )
+ {
+ if ( DirEntry( UniString( 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),"").Len() )
+ {
+ 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), ByteString( 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);
+ BOOL bAddSep = TRUE;
+
+ aConfig.SetGroup("LRU");
+ USHORT nMaxLRU = (USHORT)aConfig.ReadKey("MaxLRU","4").ToInt32();
+
+ if ( pPopup )
+ bAddSep = pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND;
+
+ USHORT i;
+ for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++)
+ {
+ String aFile = UniString( aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8 );
+
+ if (aFile.Len() != 0)
+ {
+ if (bAddSep)
+ {
+ pPopup->InsertSeparator();
+ bAddSep = 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 )
+{
+ BOOL bNormal = BOOL( !bInBreak );
+ pMenu->EnableItem( RID_RUNCOMPILE, bNormal );
+
+ BOOL bHasEdit = BOOL( /*bNormal &&*/ pWork != NULL );
+
+// pMenu->EnableItem( RID_FILENEW, bNormal ); // always possible
+// pMenu->EnableItem( RID_FILEOPEN, bNormal );
+ pMenu->EnableItem( RID_FILECLOSE, bHasEdit );
+ pMenu->EnableItem( RID_FILESAVE, bHasEdit );
+ pMenu->EnableItem( RID_FILESAVEAS, bHasEdit );
+ pMenu->EnableItem( RID_FILEPRINT, bHasEdit );
+ pMenu->EnableItem( RID_FILESETUP, bHasEdit );
+ pMenu->EnableItem( RID_FILELOADLIB, bNormal );
+ pMenu->EnableItem( RID_FILESAVELIB, bHasEdit );
+
+ BOOL bHasErr = BOOL( bNormal && pBasic->GetErrors() != 0 );
+ BOOL bNext = bHasErr & bNormal;
+ BOOL bPrev = bHasErr & bNormal;
+ if( bHasErr )
+ {
+ ULONG n = pBasic->aErrors.GetCurPos();
+ if( n == 0 )
+ bPrev = FALSE;
+ if( USHORT(n+1) == pBasic->GetErrors() )
+ bNext = FALSE;
+ }
+ pMenu->EnableItem( RID_RUNNEXTERR, bNext );
+ pMenu->EnableItem( RID_RUNPREVERR, bPrev );
+ pMenu->CheckItem( RID_RUNDISAS, bDisas );
+ if( pWork )
+ pWork->InitMenu( pMenu );
+
+ return TRUE;
+}
+
+IMPL_LINK_INLINE_START( BasicFrame, DeInitMenu, Menu *, pMenu )
+{
+ (void) pMenu; /* avoid warning about unused parameter */
+/* pMenu->EnableItem( RID_RUNCOMPILE );
+
+ pMenu->EnableItem( RID_FILECLOSE );
+ pMenu->EnableItem( RID_FILESAVE );
+ pMenu->EnableItem( RID_FILESAVEAS );
+ pMenu->EnableItem( RID_FILEPRINT );
+ pMenu->EnableItem( RID_FILESETUP );
+ pMenu->EnableItem( RID_FILELOADLIB );
+ pMenu->EnableItem( RID_FILESAVELIB );
+
+ pMenu->EnableItem( RID_RUNNEXTERR );
+ pMenu->EnableItem( RID_RUNPREVERR );
+ if( pWork ) pWork->DeInitMenu( pMenu );
+*/
+ SetAutoRun( FALSE );
+ 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 )
+{
+ USHORT nId = pMenu->GetCurItemId();
+ BOOL bChecked = pMenu->IsItemChecked( nId );
+ return Command( nId, bChecked );
+}
+IMPL_LINK_INLINE_END( BasicFrame, MenuCommand, Menu *, pMenu )
+
+IMPL_LINK_INLINE_START( BasicFrame, Accel, Accelerator*, pAcc )
+{
+ SetAutoRun( FALSE );
+ 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;
+}
+
+BOOL BasicFrame::LoadFile( String aFilename )
+{
+ BOOL bIsResult = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("RES") == COMPARE_EQUAL;
+ BOOL bIsBasic = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("BAS") == COMPARE_EQUAL;
+ bIsBasic |= DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("INC") == COMPARE_EQUAL;
+
+ AppWin* p;
+ BOOL bSuccess = 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, BOOL bChecked )
+{
+ BasicError* pErr;
+
+ switch( nID ) {
+ case RID_FILENEW: {
+ AppBasEd* p = new AppBasEd( this, NULL );
+ p->Show();
+ p->GrabFocus();
+ // InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+ } break;
+ case RID_FILEOPEN:
+ {
+ String s;
+ if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, FALSE ) ) {
+ AddToLRU( s );
+ LoadFile( s );
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+ }
+ } break;
+ case RID_FILELOADLIB:
+ LoadLibrary();
+ break;
+ case RID_FILESAVELIB:
+ SaveLibrary();
+ break;
+ case RID_FILECLOSE:
+ if( pWork && pWork->Close() ){};
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+ break;
+ case RID_FILEPRINT:
+#ifndef UNX
+ if( pWork )
+ pPrn->Print( pWork->GetText(), pWork->pDataEdit->GetText(), this );
+#else
+ InfoBox( this, SttResId( IDS_NOPRINTERERROR ) ).Execute();
+#endif
+ break;
+ case RID_FILESETUP:
+#ifndef UNX
+ pPrn->Setup();
+#else
+ InfoBox( this, SttResId( IDS_NOPRINTERERROR ) ).Execute();
+#endif
+ 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
+ USHORT x;
+ x = pWork->GetLineNr();
+ x = ((AppBasEd*)pWork)->GetModule()->GetBPCount();
+ if ( !x )
+ x = pModule->SetBP(pWork->GetLineNr());
+ x = pModule->GetBPCount();
+#endif
+
+ for ( USHORT 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: {
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+ if ( !Basic().IsRunning() || bInBreak )
+ {
+ AppBasEd* p = NULL;
+ if( pWork && pWork->ISA(AppBasEd) )
+ {
+ p = ((AppBasEd*)pWork);
+ p->ToTop();
+ }
+ else
+ {
+ AppWin *w = NULL;
+ for ( w = pList->Last() ; w ? !w->ISA(AppBasEd) : FALSE ; w = pList->Prev() ) ;
+ if ( w )
+ {
+ p = ((AppBasEd*)w);
+ p->ToTop();
+ }
+ else
+ if ( IsAutoRun() )
+ printf( "No file loaded to run.\n" );
+ }
+
+ if( bInBreak )
+ // Reset the flag
+ bInBreak = FALSE;
+ else
+ {
+ if( IsAutoSave() && !SaveAll() ) break;
+ if( !CompileAll() ) break;
+ String aString;
+ pStatus->Message( aString );
+ if( p )
+ {
+ BasicDLL::SetDebugMode( TRUE );
+ Basic().ClearGlobalVars();
+ p->Run();
+ BasicDLL::SetDebugMode( FALSE );
+ // If cancelled during Interactive=FALSE
+// BasicDLL::EnableBreak( TRUE );
+ }
+ }}
+ }
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // after run
+ break;
+ case RID_RUNCOMPILE:
+ if( pWork && pWork->ISA(AppBasEd) && SaveAll() )
+ {
+ ((AppBasEd*)pWork)->Compile();
+ pWork->ToTop();
+ pWork->GrabFocus();
+ }
+ break;
+ case RID_RUNDISAS:
+ bDisas = BOOL( !bChecked );
+ break;
+ case RID_RUNBREAK:
+ if ( Basic().IsRunning() && !bInBreak )
+ {
+// pINST->CalcBreakCallLevel(SbDEBUG_STEPINTO);
+ pINST->nBreakCallLvl = pINST->nCallLvl;
+ }
+ break;
+ case RID_RUNSTOP:
+ Basic().Stop();
+ bInBreak = FALSE;
+ break;
+ case RID_RUNNEXTERR:
+ pErr = pBasic->aErrors.Next();
+ if( pErr ) pErr->Show();
+ break;
+ case RID_RUNPREVERR:
+ pErr = pBasic->aErrors.Prev();
+ 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 ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ {
+ aArange.AddWindow( pList->GetObject( i ) );
+ pList->GetObject( 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 ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ {
+ aArange.AddWindow( pList->GetObject( i ) );
+ pList->GetObject( 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:
+//#define WINDOWARRANGE_TILE 1
+//#define WINDOWARRANGE_HORZ 2
+//#define WINDOWARRANGE_VERT 3
+//#define WINDOWARRANGE_CASCADE 4
+ {
+ WindowArrange aArange;
+ for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ {
+ aArange.AddWindow( pList->GetObject( i ) );
+ pList->GetObject( 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 ( USHORT i = 0 ; i < pList->Count() ; i++ )
+ {
+ pList->GetObject( i )->Cascade( i );
+ }
+ }
+ break;
+
+/* case RID_HELPTOPIC:
+ if( pWork ) pWork->Help();
+ break;
+ case RID_HELPKEYS:
+ aBasicApp.pHelp->Start( CUniString( "Keyboard" ) );
+ break;
+ case RID_HELPINDEX:
+ aBasicApp.pHelp->Start( OOO_HELP_INDEX );
+ break;
+ case RID_HELPINTRO:
+ aBasicApp.pHelp->Start( OOO_HELP_HELPONHELP );
+ break;
+*/ case RID_HELPABOUT:
+ {
+ 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 );
+ String aName = pWinMenu->GetItemText( nID );
+ aName.EraseAllChars( L'~' );
+ 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 );
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+ }
+ else
+ {
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
+ if( pWork )
+ pWork->Command( CommandEvent( Point(), nID ) );
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
+ }
+ }
+ return TRUE;
+}
+
+BOOL BasicFrame::SaveAll()
+{
+ AppWin* p, *q = pWork;
+ for( p = pList->First(); p; p = pList->Next() )
+ {
+ USHORT nRes = p->QuerySave( QUERY_DISK_CHANGED );
+ if( (( nRes == SAVE_RES_ERROR ) && QueryBox(this,SttResId(IDS_ASKSAVEERROR)).Execute() == RET_NO )
+ || ( nRes == SAVE_RES_CANCEL ) )
+ return FALSE;
+ }
+ if ( q )
+ q->ToTop();
+ return TRUE;
+}
+
+IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename )
+{
+ return FindModuleWin( *pFilename ) != NULL;
+}
+
+AppBasEd* BasicFrame::FindModuleWin( const String& rName )
+{
+ AppWin* p;
+ for( p = pList->First(); p; p = pList->Next() )
+ {
+ if( p->ISA(AppBasEd) && ((AppBasEd*)p)->GetModName() == rName )
+ return ((AppBasEd*)p);
+ }
+ return NULL;
+}
+
+AppError* BasicFrame::FindErrorWin( const String& rName )
+{
+ AppWin* p;
+ for( p = pList->First(); p; p = pList->Next() )
+ {
+ if( p->ISA(AppError) && ((AppError*)p)->GetText() == rName )
+ return ((AppError*)p);
+ }
+ return NULL;
+}
+
+AppWin* BasicFrame::FindWin( const String& rName )
+{
+ AppWin* p;
+ for( p = pList->First(); p; p = pList->Next() )
+ {
+ if( p->GetText() == rName )
+ return p;
+ }
+ return NULL;
+}
+
+AppWin* BasicFrame::FindWin( USHORT nWinId )
+{
+ AppWin* p;
+ for( p = pList->First(); p; p = pList->Next() )
+ {
+ if( p->GetWinId() == nWinId )
+ return p;
+ }
+ return NULL;
+}
+
+AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
+{
+ AppWin* p;
+ for( p = pList->First(); p; p = pList->Next() )
+ {
+ if( p == pMaybeWin )
+ return p;
+ }
+ return NULL;
+}
+
+IMPL_LINK( BasicFrame, WriteString, String*, pString )
+{
+ if ( pList->Last() )
+ {
+ pList->Last()->pDataEdit->ReplaceSelected( *pString );
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+class NewFileDialog : public FileDialog
+{
+private:
+ String aLastPath;
+public:
+ ByteString 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();
+ USHORT nFilterNr = 0;
+ while ( nFilterNr < GetFilterCount() && aCurFilter != GetFilterName( nFilterNr ) )
+ {
+ nFilterNr++;
+ }
+ aFilterType = ByteString( 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 = UniString( aConf.ReadKey( aFilterType, aConf.ReadKey( "BaseDir" ) ), RTL_TEXTENCODING_UTF8 );
+ SetPath( aLastPath );
+// if ( IsInExecute() )
+// SetPath( "" );
+}
+
+short NewFileDialog::Execute()
+{
+ BOOL bRet = (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, ByteString( DirEntry( GetPath() ).GetPath().GetFull(), RTL_TEXTENCODING_UTF8 ) );
+ aConf.WriteKey( "LastFilterName", ByteString( GetCurFilter(), RTL_TEXTENCODING_UTF8 ) );
+ }
+ return bRet;
+}
+
+BOOL BasicFrame::QueryFileName
+ (String& rName, FileType nFileType, 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 ( bSave )
+ if ( rName.Len() > 0 )
+ aDlg.SetPath( rName );
+
+ if( aDlg.Execute() )
+ {
+ rName = aDlg.GetPath();
+/* rExtension = aDlg.GetCurrentFilter();
+ var i:integer;
+ for ( i = 0 ; i < aDlg.GetFilterCount() ; i++ )
+ if ( rExtension == aDlg.GetFilterName( i ) )
+ rExtension = aDlg.GetFilterType( i );
+*/
+ return TRUE;
+ } else return FALSE;
+}
+
+USHORT BasicFrame::BreakHandler()
+{
+ bInBreak = TRUE;
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+// MenuBar aBar( ResId( RID_APPMENUBAR ) );
+// aBar.EnableItem( RID_APPEDIT, FALSE );
+ SetAppMode( String( SttResId ( IDS_APPMODE_BREAK ) ) );
+ while( bInBreak )
+ GetpApp()->Yield();
+ SetAppMode( String( SttResId ( IDS_APPMODE_RUN ) ) );
+// aBar.EnableItem( RID_APPEDIT, TRUE );
+// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+ return nFlags;
+}
+
+void BasicFrame::LoadLibrary()
+{
+ String s;
+ if( QueryFileName( s, FT_BASIC_LIBRARY, FALSE ) )
+ {
+ 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( USHORT 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, 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;
+ BOOL bFound;
+ bFound = 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();
+ }
+// if ( Resource::GetResManager()->IsAvailable( ResId( aValue ) ) )
+ aString = String( SttResId( (USHORT)(aValue.ToInt32()) ) );
+// else
+ {
+// DBG_ERROR( "Could not load resource!" );
+// return aResString;
+ }
+ nInsertPos = nStart;
+ nStartPos = nStart;
+ aResult.Erase( nStart, nEnd-nStart+1 );
+ bFound = TRUE;
+ }
+ else if ( aType.Search(BaseArgKenn) == 0 ) // Starts with BaseArgKenn
+ {
+ // TODO: What the hell is that for??
+ USHORT nArgNr = USHORT( aType.Copy( BaseArgKenn.Len() ).ToInt32() );
+ 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
+ {
+ DBG_ERROR( CByteString("Unknown replacement in String: ").Append( ByteString( aResult.Copy(nStart,nEnd-nStart), RTL_TEXTENCODING_UTF8 ) ).GetBuffer() );
+ nStartPos = nStartPos + StartKenn.Len();
+ }
+ }
+ if ( bFound )
+ {
+ DBG_ASSERT( aString.SearchAscii( "($Arg" ) == STRING_NOTFOUND, "Argument missing in String");
+ aResult.Insert( aString, nInsertPos );
+ }
+ return aResult;
+}
+
+
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
new file mode 100644
index 000000000000..68b3db186785
--- /dev/null
+++ b/basic/source/app/app.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: app.hxx,v $
+ * $Revision: 1.13 $
+ *
+ * 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>
+#ifndef _HELP_HXX //autogen
+#include <vcl/help.hxx>
+#endif
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#ifndef _WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+#include <vcl/timer.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+
+class BasicFrame;
+#include <basic/mybasic.hxx>
+
+class EditList;
+class AppWin;
+class AppEdit;
+class AppBasEd;
+class MsgEdit;
+class AppError;
+class StatusLine;
+class BasicPrinter;
+struct TTLogMsg;
+
+class BasicApp : public Application {
+ short nWait; // Wait-Zaehler
+public:
+// Help* pHelp; // Hilfesystem
+ BasicFrame* pFrame; // Frame Window
+// MenuBar* pMainMenu; // Hauptmenue
+ Accelerator* pMainAccel; // Acceleratoren
+
+ void Main( );
+
+ void LoadIniFile();
+ void SetFocus();
+ void Wait( BOOL );
+ DECL_LINK( LateInit, void * );
+
+#ifdef DBG_UTIL
+ DbgPrintLine DbgPrintMsgBox;
+#endif
+};
+
+
+typedef USHORT 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 BOOL Close();
+ BOOL CloseAll(); // Close all windows
+ BOOL CompileAll(); // Compile all texts
+ AutoTimer aLineNum; // Show the line numbers
+virtual void Resize();
+virtual void Move();
+virtual void GetFocus();
+ void LoadLibrary();
+ void SaveLibrary();
+ BOOL bIsAutoRun;
+ DisplayHidDlg* pDisplayHidDlg;
+
+// BreakPoint *pRunToCursorBP;
+
+ SbxVariable *pEditVar;
+
+
+
+ Timer aCheckFiles; // Checks the files for changes
+ BOOL bAutoReload;
+ 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:
+ BOOL IsAutoRun();
+ void SetAutoRun( BOOL bAuto );
+ BOOL bInBreak; // TRUE if in Break-Handler
+ StatusLine* pStatus; // Status line
+ EditList* pList; // List of edit windows
+ AppWin* pWork; // Current edit window
+ BasicPrinter* pPrn; // Printer
+ BOOL bDisas; // TRUE: disassemble
+ USHORT nFlags; // Debugging-Flags
+ USHORT 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 * );
+ BOOL LoadFile( String aFilename );
+ long Command( short,BOOL=FALSE ); // Command handler
+ virtual void Command( const CommandEvent& rCEvt ); // Command handler
+ BOOL SaveAll(); // Save all windows
+ BOOL QueryFileName( String& rName, FileType nFileType, 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( USHORT nWinId );
+ AppWin* IsWinValid( AppWin* pMaybeWin );
+ USHORT BreakHandler(); // Break-Handler-Callback
+
+ void SetEditVar( SbxVariable *pVar ){ pEditVar = pVar;}
+ SbxVariable* GetEditVar(){ return pEditVar;}
+ BOOL IsAutoReload() { return bAutoReload; }
+ 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 );
+
+};
+
+extern BasicApp aBasicApp;
+
+#endif
diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx
new file mode 100644
index 000000000000..c81ce03c3b54
--- /dev/null
+++ b/basic/source/app/appbased.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: appbased.cxx,v $
+ * $Revision: 1.13.20.1 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <basic/sbx.hxx>
+#include <svtools/texteng.hxx>
+#include <svtools/textview.hxx>
+#include <basic/sbmeth.hxx>
+#include <svtools/stringtransfer.hxx>
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+#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( TRUE );
+ ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetMaxTextLen( STRING_MAXLEN );
+// ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetWordDelimiters( CUniString(" ,.;:(){}[]\"'+-*/<>^\\") );
+ ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( TRUE );
+ ((TextEdit*)pDataEdit)->SaveAsUTF8( 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 );
+
+ // Define icon:
+// pIcon = new Icon( ResId( RID_WORKICON ) );
+// if( pIcon ) SetIcon( *pIcon );
+
+ 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 )
+ {
+ ULONG 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 = FALSE;
+ return TRUE;
+}
+IMPL_LINK_INLINE_END( AppBasEd, EditChange, void *, p )
+
+// Set up the menu
+long AppBasEd::InitMenu( Menu* pMenu )
+{
+ AppEdit::InitMenu (pMenu );
+ BOOL bRunning = pFrame->Basic().IsRunning();
+ pMenu->EnableItem( RID_RUNCOMPILE, !bCompiled && !bRunning );
+ return TRUE;
+}
+
+long AppBasEd::DeInitMenu( Menu* pMenu )
+{
+ AppEdit::DeInitMenu (pMenu );
+ pMenu->EnableItem( RID_RUNCOMPILE );
+ return 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 = FALSE; // because the code might have changed in the meantime
+ AppEdit::PostLoad();
+
+ pBreakpoints->LoadBreakpoints( GetText() );
+}
+
+USHORT 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()
+{
+ BOOL bErr;
+
+// if( pDataEdit->GetText().Len() != 0 ) return;
+ 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 = FALSE; // because the code might have changed in the meantime
+}
+
+// Save as (new name)
+void AppBasEd::PostSaveAs()
+{
+ pMod->SetName( GetText() );
+ AppEdit::PostSaveAs();
+}
+
+// Compile
+BOOL AppBasEd::Compile()
+{
+ if( !pDataEdit->HasText() || bCompiled )
+ return TRUE;
+ pMod->SetSource( pDataEdit->GetText() );
+ BOOL bRes = FALSE;
+ if( pFrame->Basic().Compile( pMod ) )
+ {
+ bRes = 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().aErrors.First();
+ 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 (USHORT 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().aErrors.First();
+ if( pErr )
+ pErr->Show();
+ aBasicApp.pFrame->SetAppMode( String() );
+ }
+ pMain->SetDebugFlags( 0 );
+ }
+}
+
+
diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx
new file mode 100644
index 000000000000..0977e9bab25e
--- /dev/null
+++ b/basic/source/app/appbased.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: appbased.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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>
+#ifndef _SB_APPEDIT_HXX
+#include "appedit.hxx"
+#endif
+#ifndef _SB_TEXTEDIT_HXX
+#include "textedit.hxx"
+#endif
+
+class BasicFrame;
+class BreakpointWindow;
+
+class AppBasEd : public AppEdit { // Editor-Window:
+using DockingWindow::Notify;
+
+ SbModuleRef pMod; // compile module
+ BOOL bCompiled; // TRUE if compiled
+protected:
+ DECL_LINK( EditChange, void * );
+#define BREAKPOINTSWIDTH 15
+ BreakpointWindow *pBreakpoints;
+ virtual USHORT 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
+ 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
diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx
new file mode 100644
index 000000000000..31e4192e5965
--- /dev/null
+++ b/basic/source/app/appedit.cxx
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: appedit.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#include <tools/config.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svtools/textview.hxx>
+#include <svtools/texteng.hxx>
+#include <svl/undo.hxx>
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+#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();
+ // define Icon:
+// pIcon = new Icon( ResId( RID_WORKICON ) );
+// if( pIcon ) SetIcon( *pIcon );
+
+ 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;
+ BOOL bWasModified = pTextView->GetTextEngine()->IsModified();
+ pTextView->GetTextEngine()->SetModified( FALSE );
+
+ FontList aFontList( pFrame ); // Just some Window is needed
+ Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
+ aConf.SetGroup("Misc");
+ String aFontName = String( aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8 );
+ String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 );
+ String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 );
+ Font aFont = aFontList.Get( aFontName, aFontStyle );
+// ULONG nFontSize = aFontSize.GetValue( FUNIT_POINT );
+ ULONG nFontSize = aFontSize.ToInt32();
+// aFont.SetSize( Size( nFontSize, nFontSize ) );
+ aFont.SetHeight( nFontSize );
+
+#if OSL_DEBUG_LEVEL > 1
+ {
+ Font aFont2( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0, pFrame ));
+ }
+#endif
+ aFont.SetTransparent( FALSE );
+// aFont.SetAlign( ALIGN_BOTTOM );
+// aFont.SetHeight( aFont.GetHeight()+2 );
+ 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() ) );
+}
+
+
+
+USHORT 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 )
+ {
+ USHORT UndoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetUndoActionCount();
+ USHORT RedoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetRedoActionCount();
+
+ pMenu->EnableItem( RID_EDITUNDO, UndoCount > 0 );
+ pMenu->EnableItem( RID_EDITREDO, RedoCount > 0 );
+ }
+
+ return TRUE;
+}
+
+long AppEdit::DeInitMenu( Menu* pMenu )
+{
+ AppWin::DeInitMenu (pMenu );
+
+ pMenu->EnableItem( RID_EDITUNDO );
+ pMenu->EnableItem( RID_EDITREDO );
+
+ return TRUE;
+}
+
+void AppEdit::Resize()
+{
+ if( !pDataEdit )
+ return;
+
+ Point rHStart,rVStart;
+ Size rHSize,rVSize;
+ Size rNewSize( GetOutputSizePixel() );
+
+ if ( pHScroll )
+ {
+ rHSize = pHScroll->GetSizePixel();
+ ULONG nHieght = rHSize.Height();
+ rNewSize.Height() -= nHieght;
+ rHStart.Y() = rNewSize.Height();
+ }
+
+ if ( pVScroll )
+ {
+ rVSize = pVScroll->GetSizePixel();
+ ULONG 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();
+// pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
+ }
+ InitScrollBars();
+ if ( nVisY != pTextView->GetStartDocPos().Y() )
+ pTextView->GetWindow()->Invalidate();
+
+}
+
+void AppEdit::PostLoad()
+{
+}
+
+void AppEdit::PostSaveAs()
+{
+}
+
+void AppEdit::Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 )
+{
+ ((TextEdit*)pDataEdit)->Highlight( nLine, nCol1, nCol2 );
+ ToTop();
+}
+
diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx
new file mode 100644
index 000000000000..8940f7c88fc0
--- /dev/null
+++ b/basic/source/app/appedit.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: appedit.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * 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
+
+#ifndef _SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+
+#include "appwin.hxx"
+#include "textedit.hxx"
+
+class BasicFrame;
+
+class AppEdit : public AppWin { // Editor window
+using Window::Scroll;
+
+public:
+ ScrollBar *pVScroll;
+ ScrollBar *pHScroll;
+ void SetScrollBarRanges();
+ ULONG nCurTextWidth;
+private:
+ void InitScrollBars();
+protected:
+ DECL_LINK( Scroll, ScrollBar* );
+public:
+ TYPEINFO();
+ AppEdit( BasicFrame* );
+ ~AppEdit();
+ USHORT 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( USHORT nLine, USHORT nCol1, USHORT nCol2 );
+ virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); }
+ virtual void LoadIniFile(); // (re)load ini file after change
+};
+
+#endif
diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx
new file mode 100644
index 000000000000..e1a083f3df82
--- /dev/null
+++ b/basic/source/app/apperror.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: apperror.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#include <tools/config.hxx>
+#include <svtools/ctrltool.hxx>
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+#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 );
+ // Define icon
+// pIcon = new Icon( ResId( RID_WORKICON ) );
+// if( pIcon ) SetIcon( *pIcon );
+
+ 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, FALSE );
+ pMenu->EnableItem( RID_EDITREDO, FALSE );
+
+ return TRUE;
+}
+
+long AppError::DeInitMenu( Menu* pMenu )
+{
+ AppWin::DeInitMenu (pMenu );
+
+ pMenu->EnableItem( RID_EDITUNDO );
+ pMenu->EnableItem( RID_EDITREDO );
+
+ return TRUE;
+}
+
+USHORT 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");
+ ByteString 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 = String( aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8 );
+ String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 );
+ String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 );
+ Font aFont = aFontList.Get( aFontName, aFontStyle );
+// ULONG nFontSize = aFontSize.GetValue( FUNIT_POINT );
+ ULONG nFontSize = aFontSize.ToInt32();
+// aFont.SetSize( Size( nFontSize, nFontSize ) );
+ aFont.SetHeight( nFontSize );
+
+ aFont.SetTransparent( FALSE );
+// aFont.SetAlign( ALIGN_BOTTOM );
+// aFont.SetHeight( aFont.GetHeight()+2 );
+ pDataEdit->SetFont( aFont );
+}
diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx
new file mode 100644
index 000000000000..ca50aac4ec6d
--- /dev/null
+++ b/basic/source/app/apperror.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: apperror.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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();
+// long Command( short nID );
+ virtual long InitMenu( Menu* );
+ virtual long DeInitMenu( Menu* );
+ USHORT GetLineNr();
+ FileType GetFileType();
+ MsgEdit* GetMsgTree() { return ((MsgEdit*)pDataEdit); }
+ virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); }
+ virtual void LoadIniFile(); // (re)load ini file after change
+ DirEntry aBaseDir;
+};
+
diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx
new file mode 100644
index 000000000000..099dcda03e37
--- /dev/null
+++ b/basic/source/app/appwin.cxx
@@ -0,0 +1,660 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: appwin.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#include <stdio.h>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#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( FALSE )
+, bReloadAborted( FALSE )
+, pFrame( pParent )
+, bFind( 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
+ USHORT 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( USHORT nButton )
+{
+ if ( TITLE_BUTTON_DOCKING == nButton )
+ if ( TT_WIN_STATE_MAX != nWinState )
+ Maximize();
+ else
+ Restore();
+ else // if ( TITLE_BUTTON_HIDE == nButton )
+ Minimize( TRUE );
+}
+
+void AppWin::Maximize()
+{
+ if ( TT_WIN_STATE_MAX != nWinState )
+ {
+ nNormalPos = GetPosPixel();
+ nNormalSize = GetSizePixel();
+
+ SetFloatingMode( FALSE );
+
+ pFrame->nMaximizedWindows++;
+ nWinState = TT_WIN_STATE_MAX;
+ }
+ sal_Int32 nTitleHeight;
+ {
+ sal_Int32 nDummy1, nDummy2, nDummy3;
+ pFrame->GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 );
+ }
+
+ Size aSize = pFrame->GetOutputSizePixel();
+ aSize.Height() -= nTitleHeight;
+ aSize.Height() -= 2;
+ aSize.Width() -= 2;
+ SetSizePixel( aSize );
+ SetPosPixel( Point( 1,1 ) );
+ pFrame->WinMax_Restore();
+}
+
+void AppWin::Restore()
+{
+ SetFloatingMode( TRUE );
+ SetPosSizePixel( nNormalPos, nNormalSize );
+
+ if ( TT_WIN_STATE_MAX == nWinState )
+ pFrame->nMaximizedWindows--;
+
+ nWinState = TT_WIN_STATE_FLOAT;
+ pFrame->WinMax_Restore();
+}
+
+void AppWin::Minimize( BOOL bMinimize )
+{
+ if ( bMinimize )
+ nWinState |= TT_WIN_STATE_HIDE;
+ else
+ nWinState &= ~TT_WIN_STATE_HIDE;
+ pFrame->WinMax_Restore();
+}
+
+void AppWin::Cascade( USHORT 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 );
+// aBasicApp.pHelp->Start( s );
+ }
+ else
+ {
+// aBasicApp.pHelp->Start( OOO_HELP_INDEX );
+ }
+}
+
+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();
+// InitMenu(GetpApp()->GetAppMenu()->GetPopupMenu( RID_APPEDIT ));
+ }
+}
+
+long AppWin::PreNotify( NotifyEvent& rNEvt )
+{
+
+ if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ Activate();
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ if ( pFrame->pList->Last() != this )
+ Activate();
+ return FALSE; // Der event soll weiter verarbeitet werden
+}
+
+void AppWin::Activate()
+{
+ GrabFocus();
+}
+
+// Set up the menu
+long AppWin::InitMenu( Menu* pMenu )
+{
+
+ ::rtl::OUString aTemp;
+ BOOL bMarked;
+ if( pDataEdit )
+ {
+ TextSelection r = pDataEdit->GetSelection();
+ bMarked = r.HasRange();
+ }
+ else
+ bMarked = 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 );
+// pMenu->EnableItem( RID_HELPTOPIC, bMarked );
+
+ BOOL bHasText;
+ if( pDataEdit )
+ bHasText = pDataEdit->HasText();
+ else
+ bHasText = FALSE;
+ BOOL bRunning = pFrame->Basic().IsRunning();
+ BOOL bCanExecute = 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 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 TRUE;
+}
+
+// Menu Handler
+
+void AppWin::Command( const CommandEvent& rCEvt )
+{
+ TextSelection r = pDataEdit->GetSelection();
+ 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:
+ /*if( bHasMark ) */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 )
+ {
+ USHORT nRes = pKontext->Execute( this, GetPointerPosPixel() );
+ if ( nRes )
+ pFrame->Command( nRes );
+ delete pKontext;
+ }
+ }
+ break;
+ }
+}
+
+
+BOOL AppWin::IsSkipReload()
+{
+ return nSkipReload != 0;
+}
+
+void AppWin::SkipReload( BOOL bSkip )
+{
+ DBG_ASSERT( bSkip || nSkipReload, "SkipReload aufgehoben ohne es zu aktivieren");
+ if ( bSkip )
+ nSkipReload++;
+ else
+ nSkipReload--;
+}
+
+BOOL AppWin::DiskFileChanged( USHORT nWhat )
+{
+ if ( !bHasFile )
+ return FALSE;
+
+ switch ( nWhat )
+ {
+ case SINCE_LAST_LOAD:
+ {
+ if ( bReloadAborted )
+ return TRUE;
+ else
+ return DiskFileChanged( SINCE_LAST_ASK_RELOAD );
+ }
+// uncomment to avoid compiler warning
+// break;
+ 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 );
+ }
+// uncomment to avoid compiler warning
+// break;
+ default:
+ DBG_ERROR("Not Implemented in AppWin::DiskFileChanged");
+ }
+ return TRUE;
+}
+
+void AppWin::UpdateFileInfo( USHORT nWhat )
+{
+ switch ( nWhat )
+ {
+ case HAS_BEEN_LOADED:
+ {
+ bReloadAborted = FALSE;
+ UpdateFileInfo( ASKED_RELOAD );
+
+ }
+ break;
+ case ASKED_RELOAD:
+ {
+ String aFilename( GetText() );
+
+ DirEntry aFile( aFilename );
+ aLastAccess.Update( aFile );
+ }
+ break;
+ default:
+ DBG_ERROR("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;
+
+// FileStat aStat( aFile );
+
+ 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 = TRUE;
+ }
+ }
+}
+
+void AppWin::Reload()
+{
+ SkipReload();
+ TextSelection aSelMemo = pDataEdit->GetSelection();
+ Load( GetText() );
+ pDataEdit->SetSelection( aSelMemo );
+ SkipReload( FALSE );
+}
+
+// Load file
+BOOL AppWin::Load( const String& aName )
+{
+ SkipReload();
+ BOOL bErr;
+
+// if( !QuerySave() )
+// return;
+ 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", ByteString( aMsg, osl_getThreadTextEncoding() ).GetBuffer() );
+ }
+ else
+ {
+ aBox.SetMessText( aMsg );
+ aBox.Execute();
+ }
+ }
+ else
+ {
+ DirEntry aEntry( aName );
+ String aModName = aEntry.GetFull();
+ SetText( aModName );
+ UpdateFileInfo( HAS_BEEN_LOADED );
+ PostLoad();
+ bHasFile = TRUE;
+ }
+ SkipReload( FALSE );
+ return !bErr;
+}
+
+// Save file
+USHORT AppWin::ImplSave()
+{
+ SkipReload();
+ USHORT 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 = TRUE;
+ }
+ else
+ {
+ nResult = SAVE_RES_ERROR;
+ ErrorBox( this, SttResId( IDS_WRITEERROR ) ).Execute();
+ }
+ UpdateFileInfo( HAS_BEEN_LOADED );
+ }
+ SkipReload( FALSE );
+ return nResult;
+}
+
+// Save to new file name
+USHORT 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(), TRUE ) )
+ {
+ SetText( s2 );
+ PostSaveAs();
+ SkipReload( FALSE );
+ return ImplSave();
+ }
+ else
+ {
+ SkipReload( FALSE );
+ return SAVE_RES_CANCEL;
+ }
+}
+
+// Should we save the file?
+USHORT AppWin::QuerySave( QueryBits nBits )
+{
+ BOOL bQueryDirty = ( nBits & QUERY_DIRTY ) != 0;
+ BOOL bQueryDiskChanged = ( nBits & QUERY_DISK_CHANGED ) != 0;
+ BOOL bSaveNotDirty = ( nBits & SAVE_NOT_DIRTY ) != 0;
+
+ SkipReload();
+ short nResult;
+ if ( IsModified() || bSaveNotDirty )
+ nResult = RET_YES;
+ else
+ nResult = RET_NO;
+
+ BOOL bAlwaysEnableInput = pFrame->IsAlwaysEnableInput();
+ pFrame->AlwaysEnableInput( 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 );
+
+ USHORT 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:
+ DBG_ERROR("switch default where no default should be: Internal error");
+ nReturn = SAVE_RES_CANCEL;
+ }
+ SkipReload( FALSE );
+ return nReturn;
+}
+
+BOOL AppWin::Close()
+{
+ switch ( QuerySave( QUERY_DIRTY ) )
+ {
+ case SAVE_RES_NOT_SAVED:
+ case SAVE_RES_SAVED:
+ {
+ DockingWindow::Close();
+ delete this;
+ return TRUE;
+ }
+// uncomment to avoid compiler warning
+// break;
+ case SAVE_RES_ERROR:
+ return FALSE;
+// uncomment to avoid compiler warning
+// break;
+ case SAVE_RES_CANCEL:
+ return FALSE;
+// uncomment to avoid compiler warning
+// break;
+ default:
+ DBG_ERROR("Not Implemented in AppWin::Close");
+ return FALSE;
+ }
+}
+
+// Search and find text
+void AppWin::Find()
+{
+ SttResId aResId( IDD_FIND_DIALOG );
+ FindDialog aDlg( this, aResId, aFind );
+ if( aDlg.Execute() ) {
+ bFind = TRUE;
+ Repeat();
+ }
+}
+
+// Replace text
+void AppWin::Replace()
+{
+ SttResId aResId( IDD_REPLACE_DIALOG );
+ ReplaceDialog* pDlg = new ReplaceDialog
+ (this, aResId, aFind, aReplace );
+ if( pDlg->Execute() ) {
+ bFind = FALSE;
+ Repeat();
+ }
+}
+
+// Repeat search/replace operation
+void AppWin::Repeat()
+{
+ if( (aFind.Len() != 0 ) && ( pDataEdit->Find( aFind ) || (ErrorBox(this,SttResId(IDS_PATTERNNOTFOUND)).Execute() && FALSE) ) && !bFind )
+ pDataEdit->ReplaceSelected( aReplace );
+}
+
diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx
new file mode 100644
index 000000000000..14ca4e6eb448
--- /dev/null
+++ b/basic/source/app/appwin.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: appwin.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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 <sb.hxx>
+#include <vcl/dockwin.hxx>
+#include <tools/fsys.hxx>
+
+#include "app.hxx"
+#include "dataedit.hxx"
+
+typedef USHORT 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 TRUE
+#define SAVE_RES_NOT_SAVED 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
+ USHORT nSkipReload; // Sometimes there must not be a reload
+ BOOL bHasFile; // Otherwise reload does not make sense
+ 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
+// Icon* pIcon; // Document icon
+ String aFind; // Search string
+ String aReplace; // Replace string
+ BOOL bFind; // TRUE if search not replace
+ void RequestHelp( const HelpEvent& ); // Help handler
+ void GetFocus(); // activate
+ virtual USHORT ImplSave(); // Save file
+ USHORT nWinState; // Maximized, Iconized or Normal
+ Point nNormalPos; // Position if normal
+ Size nNormalSize; // Size if Normal
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ USHORT nWinId;
+
+public:
+ TYPEINFO();
+ AppWin( BasicFrame* );
+ ~AppWin();
+ DataEdit* pDataEdit; // Data area
+ virtual USHORT 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 BOOL Load( const String& ); // Load file
+ virtual void PostLoad(){} // Set source at module
+ virtual USHORT SaveAs(); // Save file as
+ virtual void PostSaveAs(){}
+ virtual void Find(); // find text
+ virtual void Replace(); // replace text
+ virtual void Repeat(); // repeat find/replace
+ virtual BOOL Close(); // close window
+ virtual void Activate(); // window was activated
+ virtual FileType GetFileType()=0; // returns the filetype
+ virtual BOOL ReloadAllowed(){ return 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
+ BOOL DiskFileChanged( USHORT nWhat ); // Checks file for changes
+ void UpdateFileInfo( USHORT nWhat ); // Remembers last file state
+ BOOL IsSkipReload(); // Should we test reload?
+ void SkipReload( BOOL bSkip = TRUE );
+ USHORT GetWinState(){ return nWinState; }
+ void Maximize();
+ void Restore();
+ void Minimize( BOOL bMinimize );
+ void Cascade( USHORT nNr );
+
+ USHORT QuerySave( QueryBits nBits = QUERY_ALL );
+ BOOL IsModified() { return pDataEdit->IsModified(); }
+ BasicFrame* GetBasicFrame() { return pFrame; }
+ virtual void TitleButtonClick( USHORT nButton );
+ virtual void SetText( const XubString& rStr );
+
+ USHORT GetWinId() { return nWinId; }
+ void SetWinId( USHORT nWId ) { nWinId = nWId; }
+};
+
+DECLARE_LIST( EditList, AppWin* )
+
+#endif
diff --git a/basic/source/app/basic.hrc b/basic/source/app/basic.hrc
new file mode 100644
index 000000000000..5a030cb36ac2
--- /dev/null
+++ b/basic/source/app/basic.hrc
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basic.hrc,v $
+ * $Revision: 1.8 $
+ *
+ * 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_FILEPRINT 1109
+#define RID_FILESETUP 1110
+#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
new file mode 100644
index 000000000000..1eb8d1b4c880
--- /dev/null
+++ b/basic/source/app/basic.src
@@ -0,0 +1,1475 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basic.src,v $
+ * $Revision: 1.67 $
+ *
+ * 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 {
+ PosSize = MAP_SYSFONT (18,18,142,142);
+ SVLook = TRUE;
+ MOVEABLE = TRUE;
+ CLOSEABLE = TRUE;
+// WinChilds = {
+// FixedText {
+// Text = "Aktuelle Parameter";
+// PosSize = MAP_SYSFONT (10,10,120,8);
+// };
+// };
+ FixedText RID_RETTYPE {
+ PosSize = MAP_SYSFONT (10,70,120,8);
+ };
+ Edit RID_RETVAL {
+ PosSize = MAP_SYSFONT (10,85,120,12);
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+ ListBox 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 {
+ Pos = MAP_APPFONT( 58, 17 );
+ Size = MAP_APPFONT( 155, 106 );
+ SVLook = TRUE;
+/*
+ WINCHILDS = {
+ FixedText {
+ Pos = MAP_APPFONT( 40, 5 );
+ Size = MAP_APPFONT( 110, 10 );
+ TEXT = "Testtool";
+ CENTER = TRUE;
+ };
+ FixedText {
+ Pos = MAP_APPFONT( 40, 20 );
+ Size = MAP_APPFONT( 110, 20 );
+ TEXT = "Ojektorientiertes BASIC-Entwicklungssystem";
+ CENTER = TRUE;
+ };
+ FixedText {
+ Pos = MAP_APPFONT( 40, 45 );
+ Size = MAP_APPFONT( 110, 10 );
+ TEXT = "Version 2.0 May 2002";
+ CENTER = TRUE;
+ };
+ FixedText {
+ Pos = MAP_APPFONT( 40, 60 );
+ Size = MAP_APPFONT( 110, 10 );
+ TEXT = "®1995 Sun Microsystems, Inc.";
+ CENTER = TRUE;
+ };
+ };
+*/
+// FixedIcon RID_ICON {
+// Pos = MAP_APPFONT( 20, 26 );
+// Size = MAP_APPFONT( 20, 20 );
+// FIXED = Icon {
+// FILE = "basic.ico";
+// };
+// };
+ OKButton RID_OK {
+ Pos = MAP_APPFONT( 55, 80 );
+ Size = MAP_APPFONT( 40, 14 );
+ DefButton = TRUE;
+ };
+};
+
+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 );
+ Text = UPDVER;
+ CENTER = TRUE;
+ };
+ FixedText 4 {
+ Pos = MAP_APPFONT( 5, 40 );
+ Size = MAP_APPFONT( 110, 10 );
+ CENTER = TRUE;
+ TEXT[ en-US ] = "©1995-2005 Sun Microsystems, Inc.";
+ };
+ OKButton RID_OK {
+ Pos = MAP_APPFONT( 40, 60 );
+ Size = MAP_APPFONT( 40, 14 );
+ DefButton = TRUE;
+ };
+ TEXT[ en-US ] = "About VCLTestTool";
+};
+
+ModalDialog IDD_FIND_DIALOG {
+ Pos = MAP_APPFONT( 69, 30 );
+ Size = MAP_APPFONT( 185, 70 );
+ SVLook = TRUE;
+ MOVEABLE = TRUE;
+ // CLOSEABLE = TRUE; // Hat cancelbutton
+
+ FixedText RID_FIXEDTEXT1 {
+ Pos = MAP_APPFONT( 5, 10 );
+ Size = MAP_APPFONT( 30, 10 );
+ TEXT[ en-US ] = "~Text";
+ };
+ Edit 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 {
+ Pos = MAP_APPFONT( 69, 30 );
+ Size = MAP_APPFONT( 185, 88 );
+ SVLook = TRUE;
+ MOVEABLE = TRUE;
+ // CLOSEABLE = TRUE; // Hat cancelbutton
+ 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 {
+ BORDER = TRUE;
+ Pos = MAP_APPFONT( 65, 8 );
+ Size = MAP_APPFONT( 110, 12 );
+ TABSTOP = TRUE;
+ };
+ Edit 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";
+};
+//Icon RID_APPICON {
+// FILE = "basic.ico";
+//};
+//Icon RID_APPICON2 {
+// FILE = "testtool.ico";
+//};
+//Icon RID_WORKICON {
+// FILE = "work.ico";
+//};
+
+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_FILEPRINT;
+ TEXT[ en-US ] = "~Print";
+ };
+ MenuItem {
+ Identifier = RID_FILESETUP;
+ TEXT[ en-US ] = "P~rinter Setting...";
+ };
+ 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";
+// AccelKey = KeyCode { Function = KEYFUNC_CUT; };
+ };
+ MenuItem {
+ Identifier = RID_EDITREDO;
+ TEXT[ en-US ] = "~Redo";
+// AccelKey = KeyCode { Function = KEYFUNC_CUT; };
+ };
+ 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; };
+// AccelKey = KeyCode { Function = KEYFUNC_REPEAT; };
+ };
+ };
+};
+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_RUNTOCURSOR;
+// TEXT = "Run to cursor";
+// AccelKey = KeyCode { Code = KEY_F7; };
+// };
+ 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;
+ };
+ };
+};
+// Wird nur beim Test Tool eingef³gt
+
+// unter Folgendem 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 = {
+/* MenuItem {
+ Identifier = RID_WINCASCADE;
+ TEXT[ en-US ] = "~Cascade";
+ };
+ MenuItem {
+ Identifier = RID_WINTILE;
+ TEXT[ en-US ] = "~Tile";
+ };
+ MenuItem {
+ Identifier = RID_WINTILEHORZ;
+ TEXT[ en-US ] = "~Arrange Horizontally";
+ };
+ MenuItem {
+ Identifier = RID_WINTILEVERT;
+ TEXT[ en-US ] = "~Arrange Vertically";
+ };*/
+ };
+};
+Menu RID_HELP {
+ ITEMLIST = {
+/* MenuItem {
+ Identifier = RID_HELPINDEX;
+ TEXT = "~Index";
+ };
+ MenuItem {
+ SEPARATOR = TRUE;
+ };
+ MenuItem {
+ Identifier = RID_HELPKEYS;
+ TEXT = "~Tastaturbelegung";
+ };
+ MenuItem {
+ Identifier = RID_HELPINTRO;
+ TEXT = "~Anleitung";
+ };
+ MenuItem {
+ SEPARATOR = TRUE;
+ };
+ MenuItem {
+ Identifier = RID_HELPTOPIC;
+ TEXT = "~Markierter Text";
+ };
+ MenuItem {
+ SEPARATOR = TRUE;
+ };
+*/ MenuItem {
+ ABOUT = TRUE;
+ Identifier = RID_HELPABOUT;
+ TEXT[ en-US ] = "~About...";
+ };
+ };
+};
+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 {
+ 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 {
+ 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 {
+ Pos = MAP_APPFONT( 144, 12 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "New";
+ };
+ PushButton 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 {
+ 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 {
+ 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 {
+ Pos = MAP_APPFONT( 188, 48 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "New";
+ };
+ PushButton RID_PB_DEL_VALUE {
+ Pos = MAP_APPFONT( 188, 64 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "Delete";
+ };
+};
+
+
+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 {
+ 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 {
+ Pos = MAP_APPFONT( 144, 2 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "New";
+ };
+ PushButton 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 {
+ Pos = MAP_APPFONT( 7, 58 );
+ Size = MAP_APPFONT( 86, 12 );
+ Text[ en-US ] = "Default HID directory";
+ TabStop = TRUE;
+ Hide = FALSE;
+ };
+ Edit LOG_NAME {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 97, 26 );
+ Size = MAP_APPFONT( 116, 12 );
+ TabStop = TRUE;
+ };
+ Edit BASIS_NAME {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 97, 42 );
+ Size = MAP_APPFONT( 116, 12 );
+ TabStop = TRUE;
+ };
+ Edit HID_NAME {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 97, 58 );
+ Size = MAP_APPFONT( 116, 12 );
+ TabStop = TRUE;
+ };
+ PushButton LOG_SET {
+ Pos = MAP_APPFONT( 217, 26 );
+ Size = MAP_APPFONT( 12, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "...";
+ };
+ PushButton BASIS_SET {
+ Pos = MAP_APPFONT( 217, 42 );
+ Size = MAP_APPFONT( 12, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "...";
+ };
+ PushButton HID_SET {
+ Pos = MAP_APPFONT( 217, 58 );
+ Size = MAP_APPFONT( 12, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "...";
+ };
+ CheckBox CB_AUTORELOAD {
+ Pos = MAP_APPFONT( 7, 74 );
+ Size = MAP_APPFONT( 115, 12 );
+ Text[ en-US ] = "AutoReload";
+ };
+ CheckBox CB_AUTOSAVE {
+ Pos = MAP_APPFONT( 7, 87 );
+ Size = MAP_APPFONT( 115, 12 );
+ Text[ en-US ] = "Save before execute";
+ };
+ CheckBox CB_STOPONSYNTAXERRORS {
+ Pos = MAP_APPFONT( 132, 74 );
+ Size = MAP_APPFONT( 115, 12 );
+ Text[ en-US ] = "Stop on Syntax Errors";
+ };
+};
+
+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 {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 43+12, 12+13+16+16+13 );
+ Size = MAP_APPFONT( 80, 12 );
+ TabStop = TRUE;
+ };
+};
+
+
+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 {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 83, 50+15 );
+ Size = MAP_APPFONT( 219-83-4, 12 );
+ TabStop = TRUE;
+ };
+ PushButton PB_PROGDIR {
+ Pos = MAP_APPFONT( 219, 50+15 );
+ Size = MAP_APPFONT( 12, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "...";
+ };
+};
+
+
+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 {
+ 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 {
+ 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 {
+ 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 {
+ 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 );
+/* ItemList = {
+ ToolBoxItem {
+ Text = "erster der Toolbox";
+ };
+ };*/
+// Hide = TRUE;
+ };
+ FixedText RID_FT_CONTROLS {
+ Pos = MAP_APPFONT( 4, 16 );
+ Size = MAP_APPFONT( 128, 10 );
+ Text[ en-US ] = "Controls";
+ };
+ MultiListBox 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 {
+ Border = TRUE;
+ AutoHScroll = TRUE;
+ Pos = MAP_APPFONT( 4, 132 );
+ Size = MAP_APPFONT( 208, 24 );
+ TabStop = TRUE;
+ };
+ PushButton RID_PB_KOPIEREN {
+ Pos = MAP_APPFONT( 216, 28 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "Copy";
+ };
+ PushButton 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 {
+ 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_EDITCUT;
+// Key = KeyCode { Function = KEYFUNC_CUT; };
+// };
+// AcceleratorItem {
+// Identifier = RID_EDITCOPY;
+// Key = KeyCode { Function = KEYFUNC_COPY; };
+// };
+// AcceleratorItem {
+// Identifier = RID_EDITPASTE;
+// Key = KeyCode { Function = KEYFUNC_PASTE; };
+// };
+// AcceleratorItem {
+// Identifier = RID_EDITDEL;
+// Key = KeyCode { Function = KEYFUNC_DELETE; };
+// };
+ AcceleratorItem {
+ Identifier = RID_EDITSEARCH;
+ Key = KeyCode { Function = KEYFUNC_FIND; };
+ };
+ AcceleratorItem {
+ Identifier = RID_EDITREPEAT;
+ Key = KeyCode { Code = KEY_F3; };
+// Key = KeyCode { Function = KEYFUNC_REPEAT; };
+ };
+ 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 {
+ 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 {
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 53, 37 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ Text[ en-US ] = "True";
+ };
+ RadioButton 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 {
+ 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 {
+ 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 {
+ 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 {
+ 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
new file mode 100644
index 000000000000..cd975b76de07
--- /dev/null
+++ b/basic/source/app/basicrt.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basicrt.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+
+#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;
+}
+
+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;
+}
+
+USHORT BasicRuntimeAccess::GetStackEntryCount()
+{
+ return GetSbData()->pErrStack->Count();
+}
+
+BasicErrorStackEntry BasicRuntimeAccess::GetStackEntry( USHORT nIndex )
+{
+ return BasicErrorStackEntry( GetSbData()->pErrStack->GetObject( nIndex ) );
+}
+
+BOOL BasicRuntimeAccess::HasStack()
+{
+ return GetSbData()->pErrStack != NULL;
+}
+
+void BasicRuntimeAccess::DeleteStack()
+{
+ delete GetSbData()->pErrStack;
+ GetSbData()->pErrStack = NULL;
+}
+
+BOOL BasicRuntimeAccess::IsRunInit()
+{
+ return GetSbData()->bRunInit;
+}
diff --git a/basic/source/app/basmsg.hrc b/basic/source/app/basmsg.hrc
new file mode 100644
index 000000000000..73c458059d3d
--- /dev/null
+++ b/basic/source/app/basmsg.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basmsg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * 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"
+
+
+// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+
+
+///////////////////////////////
+// Fehlermeldungen, die in das Resultfile gelangen.
+// *********************
+// *** !!ACHTUNG!! ***
+// *********************
+// Die Nummern dürfen sich NIE! ändern,
+// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
+// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+///////////////////////////////
+
+#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
new file mode 100644
index 000000000000..6a44ad78d1ff
--- /dev/null
+++ b/basic/source/app/basmsg.src
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: basmsg.src,v $
+ * $Revision: 1.26 $
+ *
+ * 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"
+
+
+// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+
+
+///////////////////////////////
+// Fehlermeldungen, die in das Resultfile gelangen.
+// *********************
+// *** !!ACHTUNG!! ***
+// *********************
+// Die Nummern dürfen sich NIE! ändern,
+// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
+// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+///////////////////////////////
+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
new file mode 100644
index 000000000000..115233439f5c
--- /dev/null
+++ b/basic/source/app/brkpnts.cxx
@@ -0,0 +1,389 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: brkpnts.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#include <tools/list.hxx>
+#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>
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+#include "brkpnts.hxx"
+#include "basic.hrc"
+#include "resids.hrc"
+#include "basrid.hxx"
+
+struct Breakpoint
+{
+ USHORT nLine;
+
+ Breakpoint( USHORT nL ) { nLine = nL; }
+};
+
+
+ImageList* BreakpointWindow::pImages = NULL;
+
+
+BreakpointWindow::BreakpointWindow( Window *pParent )
+: Window( pParent )
+, nCurYOffset( 0 )
+, nMarkerPos( MARKER_NOMARKER )
+, pModule( NULL )
+, bErrorMarker( 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::Reset()
+{
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ delete pBrk;
+ pBrk = Next();
+ }
+ Clear();
+
+ pModule->ClearAllBP();
+}
+
+void BreakpointWindow::SetModule( SbModule *pMod )
+{
+ pModule = pMod;
+ USHORT i;
+ for ( i=0 ; i < pModule->GetBPCount() ; i++ )
+ {
+ InsertBreakpoint( pModule->GetBP( i ) );
+ }
+ SetBPsInModule();
+}
+
+
+void BreakpointWindow::SetBPsInModule()
+{
+ pModule->ClearAllBP();
+
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ pModule->SetBP( (USHORT)pBrk->nLine );
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (USHORT)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
+#endif
+ pBrk = Next();
+ }
+ for ( USHORT 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( USHORT nLine )
+{
+ Breakpoint* pNewBrk = new Breakpoint( nLine );
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ if ( nLine <= pBrk->nLine )
+ {
+ if ( pBrk->nLine != nLine )
+ Insert( pNewBrk );
+ else
+ delete pNewBrk;
+ pNewBrk = NULL;
+ pBrk = NULL;
+ }
+ else
+ pBrk = Next();
+ }
+ // No insert position found => LIST_APPEND
+ if ( pNewBrk )
+ Insert( pNewBrk, LIST_APPEND );
+
+ 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 ( USHORT 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
+}
+
+
+Breakpoint* BreakpointWindow::FindBreakpoint( ULONG nLine )
+{
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ if ( pBrk->nLine == nLine )
+ return pBrk;
+
+ pBrk = Next();
+ }
+
+ return (Breakpoint*)0;
+}
+
+
+void BreakpointWindow::AdjustBreakpoints( ULONG nLine, BOOL bInserted )
+{
+ if ( nLine == 0 ) //TODO: nLine == TEXT_PARA_ALL+1
+ return;
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ 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 )
+ {
+ ULONG n = GetCurPos();
+ delete Remove( pBrk );
+ pBrk = Seek( n );
+ }
+ else
+ {
+ pBrk = Next();
+ }
+ }
+ Invalidate();
+}
+
+
+void BreakpointWindow::LoadBreakpoints( String aFilename )
+{
+ Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
+
+ aConfig.SetGroup("Breakpoints");
+
+ ByteString aBreakpoints;
+ aBreakpoints = aConfig.ReadKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ) );
+
+ xub_StrLen i;
+
+ for ( i = 0 ; i < aBreakpoints.GetTokenCount( ';' ) ; i++ )
+ {
+ InsertBreakpoint( (USHORT)aBreakpoints.GetToken( i, ';' ).ToInt32() );
+ }
+}
+
+
+void BreakpointWindow::SaveBreakpoints( String aFilename )
+{
+ ByteString aBreakpoints;
+
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ if ( aBreakpoints.Len() )
+ aBreakpoints += ';';
+
+ aBreakpoints += ByteString::CreateFromInt32( pBrk->nLine );
+ pBrk = Next();
+ }
+
+ Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
+
+ aConfig.SetGroup("Breakpoints");
+
+ if ( aBreakpoints.Len() )
+ aConfig.WriteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ), aBreakpoints );
+ else
+ aConfig.DeleteKey( ByteString( 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;
+
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
+#endif
+ ULONG nLine = pBrk->nLine-1;
+ ULONG nY = nLine*nLineHeight - nCurYOffset;
+ DrawImage( Point( 0, nY ) + aBmpOff, aBrk );
+ pBrk = Next();
+ }
+ ShowMarker( TRUE );
+}
+
+
+Breakpoint* BreakpointWindow::FindBreakpoint( const Point& rMousePos )
+{
+ long nLineHeight = GetTextHeight();
+ long nYPos = rMousePos.Y() + nCurYOffset;
+
+ Breakpoint* pBrk = First();
+ while ( pBrk )
+ {
+ ULONG nLine = pBrk->nLine-1;
+ long nY = nLine*nLineHeight;
+ if ( ( nYPos > nY ) && ( nYPos < ( nY + nLineHeight ) ) )
+ return pBrk;
+ pBrk = Next();
+ }
+ return 0;
+}
+
+
+void BreakpointWindow::ToggleBreakpoint( USHORT nLine )
+{
+ Breakpoint* pBrk = FindBreakpoint( nLine );
+ if ( pBrk ) // remove
+ {
+ pModule->ClearBP( nLine );
+ delete Remove( pBrk );
+ }
+ else // 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;
+
+ ULONG 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< USHORT >(nLine) );
+ Invalidate();
+ }
+}
+
+
+void BreakpointWindow::SetMarkerPos( USHORT nLine, BOOL bError )
+{
+ ShowMarker( FALSE ); // Remove old one
+ nMarkerPos = nLine;
+ bErrorMarker = bError;
+ ShowMarker( TRUE ); // Draw new one
+ Update();
+}
+
+
+void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags )
+{
+ (void) nFlags; /* avoid warning about unused parameter */
+ nCurYOffset -= nVertScroll;
+ Window::Scroll( nHorzScroll, nVertScroll );
+}
+
diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx
new file mode 100644
index 000000000000..4a9d5868f738
--- /dev/null
+++ b/basic/source/app/brkpnts.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: brkpnts.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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>
+
+#define MARKER_NOMARKER 0xFFFF
+
+
+class SbModule;
+class BreakpointListe;
+struct Breakpoint;
+class ImageList;
+
+DECLARE_LIST( BreakpointList, Breakpoint* )
+
+class BreakpointWindow : public Window, public BreakpointList
+{
+using Window::Scroll;
+
+public:
+ BreakpointWindow( Window *pParent );
+// ~BreakpointWindow();
+
+ void Reset();
+
+ void SetModule( SbModule *pMod );
+ void SetBPsInModule();
+
+ void InsertBreakpoint( USHORT nLine );
+ void ToggleBreakpoint( USHORT nLine );
+ void AdjustBreakpoints( ULONG nLine, BOOL bInserted );
+
+ void LoadBreakpoints( String aFilename );
+ void SaveBreakpoints( String aFilename );
+
+protected:
+ Breakpoint* FindBreakpoint( ULONG nLine );
+
+private:
+ long nCurYOffset;
+ USHORT nMarkerPos;
+ SbModule* pModule;
+ BOOL bErrorMarker;
+ static ImageList *pImages;
+
+protected:
+ virtual void Paint( const Rectangle& );
+ Breakpoint* FindBreakpoint( const Point& rMousePos );
+ void ShowMarker( BOOL bShow );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+public:
+
+// void SetModulWindow( ModulWindow* pWin )
+// { pModulWindow = pWin; }
+
+ void SetMarkerPos( USHORT nLine, BOOL bErrorMarker = FALSE );
+
+ virtual void Scroll( long nHorzScroll, long nVertScroll,
+ USHORT nFlags = 0 );
+ long& GetCurYOffset() { return nCurYOffset; }
+};
+
+
+
+
+
+
+
+
diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx
new file mode 100644
index 000000000000..dd06d9d8d456
--- /dev/null
+++ b/basic/source/app/dataedit.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dataedit.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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; \
+ BOOL Find( const String& rStr ); \
+ BOOL Load( const String& rStr ); \
+ 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 ); \
+ BOOL HasText() const; \
+ String GetSelected(); \
+ TextSelection GetSelection() const; \
+ void SetSelection( const TextSelection& rSelection ); \
+ USHORT GetLineNr() const; \
+ void ReplaceSelected( const String& rStr ); \
+ 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 BOOL Find( const String& )=0; // Find and select text
+ virtual BOOL Load( const String& )=0; // Load text from file
+ virtual 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 USHORT GetLineNr() const=0;
+ virtual String GetText() const=0;
+ virtual void SetText( const String& rStr )=0;
+ virtual BOOL HasText() const=0; // to avoid GetText.Len()
+ virtual void ReplaceSelected( const String& rStr )=0;
+ virtual 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
diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx
new file mode 100644
index 000000000000..00eba2fbac6c
--- /dev/null
+++ b/basic/source/app/dialogs.cxx
@@ -0,0 +1,1510 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dialogs.cxx,v $
+ * $Revision: 1.37 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#include <tools/solar.h>
+
+#include <algorithm>
+#include <tools/rc.hxx>
+#include <vcl/metric.hxx>
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <tools/config.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <tools/debug.hxx>
+#ifndef _SV_FILEDLG_HXX //autogen
+#include <svtools/filedlg.hxx>
+#endif
+#include <tools/stream.hxx>
+#include <tools/fsys.hxx>
+#include <svtools/stringtransfer.hxx>
+#include <vcl/splitwin.hxx>
+#ifndef _ZFORLIST_HXX //autogen
+#include <svl/zformat.hxx>
+#endif
+#include <svtools/ctrltool.hxx>
+
+// Ohne Includeschutz
+#include <svtools/svtdata.hxx>
+#include <svl/solar.hrc>
+
+
+#include <basic/dispdefs.hxx>
+#include <basic/testtool.hxx>
+#include "dialogs.hxx"
+#include "resids.hrc"
+#include "basic.hrc"
+
+#include "app.hxx"
+#include "basrid.hxx"
+
+#include "_version.h"
+
+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();
+}
+
+////////////////////////////////////////////////////////////////////
+
+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( TRUE );
+ } else EndDialog( FALSE );
+ return 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( TRUE );
+ } else EndDialog( FALSE );
+ return 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 = UniString( aConf.ReadKey( aKeyName ), RTL_TEXTENCODING_UTF8 );
+ aEdit.SetText( aTemp );
+}
+
+ConfEdit::ConfEdit( Window* pParent, USHORT nResText, USHORT nResEdit, USHORT 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, USHORT nResEdit, USHORT 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, ByteString( aEdit.GetText(), RTL_TEXTENCODING_UTF8 ) );
+}
+
+void ConfEdit::Reload( Config &aConf )
+{
+ aConf.SetGroup("Misc");
+ ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
+ aConf.SetGroup( aCurrentProfile );
+ String aValue = String( 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, USHORT nResCheck, USHORT nResEdit, USHORT 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 ) );
+}
+
+void OptConfEdit::Reload( Config &aConf )
+{
+ ConfEdit::Reload( aConf );
+
+ DirEntry aCalculatedHIDDir( rBase.GetValue() );
+ aCalculatedHIDDir += DirEntry( "global/hid", FSYS_STYLE_FAT );
+
+ 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_FAT );
+ 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( 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 ( USHORT i = 0; i < aTabCtrl.GetPageCount(); i++ )
+ delete aTabCtrl.GetTabPage( aTabCtrl.GetPageId( i ) );
+};
+
+BOOL OptionsDialog::Close()
+{
+ if ( TabDialog::Close() )
+ {
+ delete this;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+
+IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl )
+{
+ USHORT 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: DBG_ERROR( "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 USHORT 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( 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 ( USHORT 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( ByteString( 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( ByteString( 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( ByteString( 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( ByteString( 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( FALSE );
+
+ ByteString aTemp;
+
+ aConfig.SetGroup("Crashreporter");
+
+ aTemp = aConfig.ReadKey( "UseProxy", "false" );
+ if ( aTemp.EqualsIgnoreCaseAscii( "true" ) || aTemp.Equals( "1" ) )
+ aCBUseProxy.Check();
+ else
+ aCBUseProxy.Check( FALSE );
+
+ aCBUseProxy.SetToggleHdl( LINK( this, CrashreportOptions, CheckProxy ) );
+ LINK( this, CrashreportOptions, CheckProxy ).Call( NULL ); // call once to initialize
+
+ aTemp = aConfig.ReadKey( "ProxyServer" );
+ aEDCRHost.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) );
+ aTemp = aConfig.ReadKey( "ProxyPort", "8080" );
+ aNFCRPort.SetValue( aTemp.ToInt32() );
+
+
+ aTemp = aConfig.ReadKey( "AllowContact", "false" );
+ if ( aTemp.EqualsIgnoreCaseAscii( "true" ) || aTemp.Equals( "1" ) )
+ aCBAllowContact.Check();
+ else
+ aCBAllowContact.Check( FALSE );
+
+ aCBAllowContact.SetToggleHdl( LINK( this, CrashreportOptions, CheckResponse ) );
+ LINK( this, CrashreportOptions, CheckResponse ).Call( NULL ); // call once to initialize
+
+ aTemp = aConfig.ReadKey( "ReturnAddress" );
+ aEDEMail.SetText( String( 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", ByteString( aEDCRHost.GetText(), RTL_TEXTENCODING_UTF8 ) );
+ aConfig.WriteKey( "ProxyPort", ByteString::CreateFromInt64( aNFCRPort.GetValue() ) );
+
+ if ( aCBAllowContact.IsChecked() )
+ aConfig.WriteKey( "AllowContact", "true" );
+ else
+ aConfig.WriteKey( "AllowContact", "false" );
+
+ aConfig.WriteKey( "ReturnAddress", ByteString( 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( FALSE );
+ aNFUNOPort.SetUseThousandSep( FALSE );
+ aTFMaxLRU.SetUseThousandSep( FALSE );
+
+ ByteString aTemp;
+
+ aConfig.SetGroup("Communication");
+ aTemp = aConfig.ReadKey( "Host", DEFAULT_HOST );
+ aEDHost.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) );
+ aTemp = aConfig.ReadKey( "TTPort", ByteString::CreateFromInt32( TESTTOOL_DEFAULT_PORT ) );
+ aNFTTPort.SetValue( aTemp.ToInt32() );
+ aTemp = aConfig.ReadKey( "UnoPort", ByteString::CreateFromInt32( 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( String( 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", ByteString( aEDHost.GetText(), RTL_TEXTENCODING_UTF8 ) );
+ aConfig.WriteKey( "TTPort", ByteString::CreateFromInt64( aNFTTPort.GetValue() ) );
+ aConfig.WriteKey( "UnoPort", ByteString::CreateFromInt64( aNFUNOPort.GetValue() ) );
+
+ aConfig.SetGroup("Misc");
+ aConfig.WriteKey( "ServerTimeout", ByteString::CreateFromInt32( aServerTimeout.GetTime().GetTime() ) );
+
+ aConfig.SetGroup("LRU");
+ ByteString aTemp = aConfig.ReadKey( "MaxLRU", "4" );
+ USHORT nOldMaxLRU = (USHORT)aTemp.ToInt32();
+ USHORT n;
+ for ( n = nOldMaxLRU ; n > aTFMaxLRU.GetValue() ; n-- )
+ aConfig.DeleteKey( ByteString("LRU").Append( ByteString::CreateFromInt32( n ) ) );
+ aConfig.WriteKey( "MaxLRU", ByteString::CreateFromInt64( aTFMaxLRU.GetValue() ) );
+
+ aConfig.SetGroup("OOoProgramDir");
+ aConfig.WriteKey( C_KEY_AKTUELL, ByteString( 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();
+
+// aFontSize.SetUnit( FUNIT_POINT );
+// MapMode aMode( MAP_POINT );
+// aFTPreview.SetMapMode( aMode );
+
+ 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() );
+// ULONG nFontSize = aFontSize.GetValue( FUNIT_POINT );
+ ULONG nFontSize = static_cast<ULONG>((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", aFontName.GetText(), RTL_TEXTENCODING_UTF8 );
+ aConfig.WriteKey( "ScriptFontStyle", aFontStyle.GetText(), RTL_TEXTENCODING_UTF8 );
+ aConfig.WriteKey( "ScriptFontSize", 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( FALSE )
+{
+ FreeResource();
+ LoadData();
+
+ aCbArea.EnableAutocomplete( TRUE );
+ aCbValue.EnableAutocomplete( 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 ( USHORT i = 0 ; i < aConf.GetGroupCount() ; i++ )
+ {
+ String *pGroup = new String( aConf.GetGroupName( i ), RTL_TEXTENCODING_UTF8 );
+ pGroups->Insert( pGroup );
+ }
+ return pGroups;
+}
+
+void GenericOptions::LoadData()
+{
+ StringList* pGroups = GetAllGroups();
+ String* pGroup;
+ while ( (pGroup = pGroups->First()) != NULL )
+ {
+ pGroups->Remove( pGroup );
+ aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) );
+ if ( aConf.ReadKey( C_KEY_AKTUELL ).Len() > 0 )
+ {
+ aCbArea.InsertEntry( *pGroup );
+ }
+ delete pGroup;
+ }
+ 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 aType )
+{
+ Point aNPos = aPbNewValue.GetPosPixel();
+ Point aDPos = aPbDelValue.GetPosPixel();
+ long nDelta = aDPos.Y() - aNPos.Y();
+ if ( aType.EqualsIgnoreCaseAscii( "PATH" ) && !bShowSelectPath )
+ { // Show Path button
+ nMoveButtons += nDelta;
+ aMoveTimer.Start();
+ bShowSelectPath = TRUE;
+ aPbSelectPath.Show( TRUE );
+ aPbSelectPath.Enable( TRUE );
+ }
+ else if ( !aType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath )
+ { // Hide Path button
+ nMoveButtons -= nDelta;
+ aMoveTimer.Start();
+ bShowSelectPath = FALSE;
+ aPbSelectPath.Enable( 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 UniString( 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, ByteString( aCurrentValue, RTL_TEXTENCODING_UTF8 ) );
+ USHORT i;
+ for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ )
+ {
+ if ( i > 0 )
+ aAllValues += ';';
+ aAllValues += aCbValue.GetEntry( i );
+ }
+ aConf.WriteKey( C_KEY_ALLE, ByteString( aAllValues, RTL_TEXTENCODING_UTF8 ) );
+ }
+
+ aCbValue.Clear();
+
+ ByteString aGroupName = ByteString( 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 );
+ ByteString aByteGroup( 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
+ BOOL bAlignTop;
+
+public:
+ TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, BOOL bAlignTopP );
+ ~TextAndWin();
+
+ virtual void Resize();
+};
+
+TextAndWin::TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, 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();
+
+/* ResMgr* pRM = CREATERESMGR( svt );
+ ToolBox aOrig( this, ResId( 12345, pRM ) );
+ delete pRM;
+
+ aTbConf.CopyItem( aOrig, 4 );
+ aTbConf.InsertSeparator();
+ aTbConf.CopyItem( aOrig, 5 );
+ aTbConf.CopyItem( aOrig, 6 );
+ aTbConf.CopyItem( aOrig, 7 ); */
+ 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(), TRUE );
+ pSlots = new TextAndWin( pSplit, &aFtSlots, &aMlbSlots, aMlbControls.GetPosPixel().X(), 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;
+ USHORT 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 )
+ {
+ USHORT 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
+// if ( pWinInfo->aUId.GetULONG() & DH_MODE_DATA_VALID ) // kein altes Office
+// nDisplayMode = pWinInfo->aUId.GetULONG(); // Wird im Reset zur �bermittlung des Modus verwendet
+
+ 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
+ {
+// SetUpdateMode( FALSE );
+
+ // 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 );
+
+// SetUpdateMode( TRUE );
+// Invalidate();
+ }
+ 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 SbxCURRENCY:
+// case SbxDATE:
+// 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 SbxOBJECT: // cannot be edited
+// 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 */
+ BOOL bWasError = SbxBase::IsError(); // Probably an error is thrown
+
+
+ SbxDataType eType = pVar->GetType();
+/*
+Boolean
+Currency
+Date
+Double
+Integer
+Long
+Object
+Single
+String
+Variant
+
+
+atof
+
+ ecvt
+ f
+ gcvt
+
+SvNumberformat::
+ static double StringToDouble( const xub_Unicode* pStr,
+ const International& rIntl,
+ int& nErrno,
+ const xub_Unicode** ppEnd = NULL );
+ // Converts just as strtod a decimal string to a double.
+ // Decimal and thousand separators come from International,
+ // leading spaces are omitted.
+ // If ppEnd!=NULL then *ppEnd is set after the parsed data.
+ // If pStr contains only the String to be parsed, then if success:
+ // **ppEnd=='\0' and *ppEnd-pStr==strlen(pStr).
+ // If overflow fVal=+/-HUGE_VAL, if underflow 0,
+ // nErrno is in this cases set to ERANGE otherwise 0.
+ // "+/-1.#INF" are recognized as +/-HUGE_VAL.
+
+ */
+
+
+
+ String aContent( aEditRID_ED_NEW_STRING.GetText() );
+ BOOL bError = FALSE;
+ switch ( eType )
+ {
+ case SbxBOOL:
+ pVar->PutBool( aRadioButtonRID_RB_NEW_BOOL_T.IsChecked() );
+ break;
+// case SbxCURRENCY:
+// pVar->PutCurrency( aContent );
+// break;
+// case SbxDATE:
+// pVar->PutDate( aContent );
+// break;
+ case SbxINTEGER:
+ pVar->PutInteger( (INT16)aNumericFieldRID_NF_NEW_INTEGER.GetValue() );
+ break;
+ case SbxLONG:
+ pVar->PutLong( static_cast<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
+ ;
+ }
+
+
+// pVar->PutStringExt( aEditRID_ED_NEW_STRING.GetText() );
+ if ( !bWasError && SbxBase::IsError() )
+ {
+ bError = TRUE;
+ SbxBase::ResetError();
+ }
+
+ if ( bError )
+ {
+ ErrorBox( this, SttResId( IDS_INVALID_VALUE ) ).Execute();
+ return 1;
+ }
+
+// if ( aEditRID_ED_NEW_STRING.GetText().Compare( pVar->GetString() ) != COMPARE_EQUAL )
+// {
+// aFixedTextRID_FT_CONTENT_VALUE.SetText( pVar->GetString() );
+// aEditRID_ED_NEW_STRING.SetText( pVar->GetString() );
+// return 1;
+// }
+
+ Close();
+ return 0;
+}
+
+
+
diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx
new file mode 100644
index 000000000000..7f31af2ebb47
--- /dev/null
+++ b/basic/source/app/dialogs.hxx
@@ -0,0 +1,374 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dialogs.hxx,v $
+ * $Revision: 1.15 $
+ *
+ * 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
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/tabdlg.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <tools/config.hxx>
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/floatwin.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svtools/ctrlbox.hxx>
+
+class SbxVariable;
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+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, USHORT nResText, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, Config &aConf );
+ ConfEdit( Window* pParent, USHORT nResEdit, USHORT 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, USHORT nResCheck, USHORT nResEdit, USHORT 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 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 );
+};
+
+
+DECLARE_LIST( StringList, String * )
+#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;
+ 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 aType );
+
+ 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;
+
+ ULONG 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 * );
+
+// BOOL bCompare = FALSE;
+// String aCompareString;
+
+public:
+ VarEditDialog( Window * pParent, SbxVariable *pPVar );
+};
+
+
+#endif
diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk
new file mode 100644
index 000000000000..13c3b4a8b507
--- /dev/null
+++ b/basic/source/app/makefile.mk
@@ -0,0 +1,104 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.15 $
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=basic
+TARGET=app
+
+LIBTARGET = NO
+
+# --- Settings ------------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Common ------------------------------------------------------------
+
+OBJFILES = \
+ $(OBJ)$/ttbasic.obj \
+ $(OBJ)$/basicrt.obj \
+ $(OBJ)$/processw.obj \
+ $(OBJ)$/process.obj \
+ $(OBJ)$/brkpnts.obj \
+ $(OBJ)$/mybasic.obj \
+ $(OBJ)$/status.obj \
+ $(OBJ)$/printer.obj \
+ $(OBJ)$/appwin.obj \
+ $(OBJ)$/appedit.obj \
+ $(OBJ)$/appbased.obj \
+ $(OBJ)$/apperror.obj \
+ $(OBJ)$/textedit.obj \
+ $(OBJ)$/msgedit.obj \
+ $(OBJ)$/dialogs.obj \
+
+EXCEPTIONSFILES = \
+ $(OBJ)$/app.obj \
+ $(OBJ)$/process.obj
+
+.IF "$(GUI)" == "WNT"
+EXCEPTIONSFILES += \
+ $(OBJ)$/process.obj
+.ENDIF
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ basic.src \
+ ttmsg.src \
+ basmsg.src \
+ svtmsg.src \
+ testtool.src
+
+LIB1TARGET=$(LB)$/app.lib
+LIB1ARCHIV=$(LB)$/libapp.a
+LIB1OBJFILES = \
+ $(OBJ)$/basicrt.obj \
+ $(OBJ)$/processw.obj \
+ $(OBJ)$/process.obj \
+ $(OBJ)$/brkpnts.obj \
+ $(OBJ)$/app.obj \
+ $(OBJ)$/mybasic.obj \
+ $(OBJ)$/status.obj \
+ $(OBJ)$/printer.obj \
+ $(OBJ)$/appwin.obj \
+ $(OBJ)$/appedit.obj \
+ $(OBJ)$/appbased.obj \
+ $(OBJ)$/apperror.obj \
+ $(OBJ)$/textedit.obj \
+ $(OBJ)$/msgedit.obj \
+ $(OBJ)$/dialogs.obj \
+ $(OBJ)$/sbintern.obj
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(OBJ)$/dialogs.obj : $(INCCOM)$/_version.h
+
diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx
new file mode 100644
index 000000000000..544d7c9f4d4d
--- /dev/null
+++ b/basic/source/app/msgedit.cxx
@@ -0,0 +1,1002 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: msgedit.cxx,v $
+ * $Revision: 1.30 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+/*************************************************************************
+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>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+#include <tools/fsys.hxx>
+#include <svtools/stringtransfer.hxx>
+#include <unotools/syslocale.hxx>
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+#include "basic.hrc"
+#include "msgedit.hxx"
+#include "app.hxx"
+#include "apperror.hxx"
+#include "appbased.hxx"
+#include "basmsg.hrc"
+#include "basrid.hxx"
+
+USHORT MsgEdit::nMaxLogLen = 0;
+BOOL MsgEdit::bLimitLogLen = FALSE;
+BOOL MsgEdit::bPrintLogToStdout = FALSE;
+BOOL MsgEdit::bPrintLogToStdoutSet = 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(FALSE)
+, bFileLoading(FALSE)
+, nVersion(0)
+, pAppError( pParent )
+, aEditTree( pParent, pBF, aBits | WB_HASBUTTONS | WB_HASLINES | WB_HASBUTTONSATROOT )
+{
+// SetFont( aEditTree.GetDefaultFont( DEFAULTFONT_FIXED, aEditTree.GetSettings().GetLanguage(), 0, &aEditTree ) );
+ 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 = TRUE;
+ for ( USHORT 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 = 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);
+
+ if ( LogMsg->aDebugData.aFilename.Len() && LogMsg->aDebugData.aFilename.GetChar(0) != '~' ) // do we want to convert
+ {
+ DirEntry aConvert( LogMsg->aDebugData.aFilename );
+ if ( pAppError->aBaseDir.Contains( aConvert ) )
+ {
+ aConvert.ToRel( pAppError->aBaseDir );
+ LogMsg->aDebugData.aFilename = CUniString("~"); // mark as converted
+ LogMsg->aDebugData.aFilename += aConvert.GetFull( FSYS_STYLE_VFAT );
+ }
+ else if ( !bFileLoading )
+ {
+ LogMsg->aDebugData.aFilename.Insert( CUniString("~-"), 0); // mark as unconvertable
+ }
+ }
+ 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()),
+ aLocale.GetLocaleData().getTime(Time()) );
+ 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:DBG_ERROR("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust");
+ }
+
+ if ( !bFileLoading )
+ { // Comes from Testtool and must be written immediately
+ BOOL bFileWasChanged = pAppError->DiskFileChanged( SINCE_LAST_LOAD );
+
+ DBG_ASSERT( aLogFileName == LogMsg->aLogFileName, "Logging to different logfile as before" );
+ DirEntry aEntry( LogMsg->aLogFileName );
+ 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 << ByteString( aSave, RTL_TEXTENCODING_IBM_850 ).GetBuffer();
+ }
+
+ String aLogMsg = Impl_MakeSaveText( LogMsg->aDebugData ).AppendAscii("\n");
+
+ if( aStrm.IsOpen() )
+ {
+ aLogMsg.ConvertLineEnd(LINEEND_CRLF);
+ aStrm.Seek(STREAM_SEEK_TO_END);
+ aStrm << ByteString( aLogMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer();
+ 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( ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ }
+ }
+ // 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 )
+ {
+ USHORT 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 = 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, FALSE, 0, pTTDebugData );
+ else // First file format
+ pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, 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, 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, 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, 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, FALSE, LIST_APPEND, pTTDebugData );
+ else if ( pCurrentRun )
+ {
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData );
+ aEditTree.ShowEntry( pThisEntry );
+ }
+ else
+ {
+ AddRun( aMsg, aDebugData );
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, 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, FALSE, LIST_APPEND, pTTDebugData );
+ else if ( pCurrentRun )
+ {
+ pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData );
+ aEditTree.ShowEntry( pThisEntry );
+ }
+ else
+ {
+ AddRun( aMsg, aDebugData );
+ pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, 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, FALSE, LIST_APPEND, pTTDebugData );
+ else if ( pCurrentRun )
+ {
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData );
+ aEditTree.ShowEntry( pThisEntry );
+ }
+ else
+ {
+ AddRun( aMsg, aDebugData );
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, 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, FALSE, LIST_APPEND, pTTDebugData );
+ else if ( pCurrentTestCase )
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData );
+ else if ( pCurrentRun )
+ {
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData );
+ aEditTree.ShowEntry( pThisEntry );
+ }
+ else
+ {
+ AddRun( aMsg, aDebugData );
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, 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, FALSE, LIST_APPEND, pTTDebugData );
+ else if ( pCurrentRun )
+ {
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData );
+ aEditTree.ShowEntry( pThisEntry );
+ }
+ else
+ {
+ AddRun( aMsg, aDebugData );
+ pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData );
+ aEditTree.ShowEntry( pThisEntry );
+ }
+
+ while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) != NULL )
+ aEditTree.InvalidateEntry( pThisEntry );
+}
+
+/*
+ SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return SvLBox::GetEntry(pParent,nPos); }
+ SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return SvLBox::GetEntry(nRootPos);}
+
+
+
+ SvLBoxEntry* FirstChild(SvLBoxEntry* pParent ) const { return (SvLBoxEntry*)(pModel->FirstChild(pParent)); }
+ SvLBoxEntry* NextSibling(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->NextSibling( pEntry )); }
+ SvLBoxEntry* PrevSibling(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->PrevSibling( pEntry )); }
+
+ SvLBoxEntry* FirstSelected() const { return (SvLBoxEntry*)SvListView::FirstSelected(); }
+ SvLBoxEntry* NextSelected( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(SvListView::NextSelected(pEntry)); }
+ SvLBoxEntry* PrevSelected( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(SvListView::PrevSelected(pEntry)); }
+ SvLBoxEntry* LastSelected() const { return (SvLBoxEntry*)(SvListView::LastSelected()); }
+
+ SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(pParent,nPos)); }
+ SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(nRootPos)); }
+
+ SvLBoxEntry* GetParent( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->GetParent(pEntry)); }
+ SvLBoxEntry* GetRootLevelParent(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->GetRootLevelParent( pEntry ));}
+
+ BOOL IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const;
+ SvListEntry* GetEntry( SvListEntry* pParent, ULONG nPos ) const;
+ SvListEntry* GetEntry( ULONG nRootPos ) const;
+ SvListEntry* GetEntryAtAbsPos( ULONG nAbsPos ) const;
+ SvListEntry* GetParent( SvListEntry* pEntry ) const;
+ SvListEntry* GetRootLevelParent( SvListEntry* pEntry ) const;
+*/
+
+//#define CHECK( pMemo ) if ( pMemo && !aEditTree.GetViewData( pMemo ) ) pMemo = NULL
+#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 = TRUE;
+ lModify.Call( NULL );
+}
+
+void MsgEdit::Cut(){ Copy(); Delete(); bModified = 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:DBG_ERROR("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
+{
+ ULONG nStart=0,nEnd=0;
+
+ if ( aEditTree.FirstSelected() )
+ {
+ 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 )
+{
+ ULONG nStart,nEnd;
+
+ while ( aEditTree.GetSelectionCount() )
+ aEditTree.Select( aEditTree.FirstSelected(), FALSE );
+
+ if ( rSelection.HasRange() )
+ {
+ nStart = rSelection.GetStart().GetPara();
+ nEnd = rSelection.GetEnd().GetPara();
+
+ for ( ULONG i = nStart ; i <= nEnd ; i++ )
+ aEditTree.Select( aEditTree.GetModel()->GetEntryAtAbsPos( i ), TRUE );
+ }
+}
+
+USHORT MsgEdit::GetLineNr() const
+{
+ if ( aEditTree.GetCurEntry() )
+ return (USHORT)aEditTree.GetModel()->GetAbsPos(aEditTree.GetCurEntry() ) + 1;
+ else
+ return 0;
+}
+
+void MsgEdit::ReplaceSelected( const String& rStr )
+{
+ (void) rStr; /* avoid warning about unused parameter */
+ Sound::Beep();
+ DBG_ERROR("Not Implemented");
+}
+
+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();
+ DBG_ERROR("Not Implemented");
+}
+
+BOOL MsgEdit::HasText() const
+{
+ return aEditTree.First() != NULL;
+}
+
+// Search from the beginning or mark start + 1
+BOOL MsgEdit::Find( const String& s )
+{
+ TextSelection r = GetSelection();
+ USHORT bgn = (USHORT) 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 TRUE;
+ }
+ pEntry = aEditTree.Next( pEntry );
+ }
+ return FALSE;
+}
+
+/******************************************************************
+
+ Fileformat of *.res file:
+ Information are stored as semicolon separated strings
+ Order:
+
+ LogType;Filename;Line;Col1;Col2;Message
+
+******************************************************************/
+
+BOOL MsgEdit::Load( const String& aName )
+{
+ aLogFileName = aName;
+ BOOL bOk = TRUE, bFirstLine = TRUE;
+ BOOL bLoadError = FALSE;
+ SvFileStream aStrm( aName, STREAM_STD_READ );
+ if( aStrm.IsOpen() )
+ {
+ aEditTree.Clear();
+ String aLine;
+ bFileLoading = 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 = 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 = USHORT( TOKEN(2).ToInt32() );
+ aDebugData.nCol1 = USHORT( TOKEN(3).ToInt32() );
+ aDebugData.nCol2 = USHORT( 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 = USHORT( aLine.Copy( VERSION_STRING.Len() ).ToInt32() );
+ else if ( aLine.Len() )
+ bLoadError = TRUE;
+
+ bFirstLine = FALSE;
+ }
+ bFileLoading = FALSE;
+ delete pLogMsg;
+ aStrm.Close();
+ if ( nVersion < 2 && !bLoadError )
+ Save( aName ); // Necessary to avoid mess
+
+ }
+ else
+ bOk = FALSE;
+ return bOk;
+}
+
+BOOL MsgEdit::Save( const String& aName )
+{
+ BOOL bOk = TRUE;
+ BOOL bIsText = DirEntry( aName ).GetExtension().CompareIgnoreCaseToAscii("TXT") == COMPARE_EQUAL;
+ if ( bIsText && !QueryBox( NULL, SttResId( IDS_LOSS_OF_INFORMATION ) ).Execute() )
+ return FALSE;
+ SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC );
+ if( aStrm.IsOpen() )
+ {
+ if ( bIsText )
+ {
+ String aSave = GetText();
+ aSave.ConvertLineEnd(LINEEND_CRLF);
+ aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer();
+ }
+ 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 << ByteString( aSave, RTL_TEXTENCODING_IBM_850 ).GetBuffer();
+
+ 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 << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer();
+ pEntry = aEditTree.Next( pEntry );
+ }
+ pRun = aEditTree.PrevSibling( pRun );
+
+ }
+ }
+ if( aStrm.GetError() != SVSTREAM_OK )
+ bOk = FALSE;
+ else
+ {
+ bModified = FALSE;
+ lModify.Call( NULL );
+ }
+
+ }
+ else
+ bOk = FALSE;
+ return bOk;
+}
+
+
+TTTreeListBox::TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinStyle )
+: SvTreeListBox( pParent, nWinStyle )
+, pBasicFrame(pBF)
+, pAppError( pParent )
+//, nDeselectParent(0)
+{}
+
+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 );
+ DirEntry aConvert( pAppError->aBaseDir );
+ aConvert += DirEntry( aFilename, FSYS_STYLE_VFAT );
+ aFilename = aConvert.GetFull();
+ }
+ }
+
+ 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 FALSE;
+ }
+ return TRUE;
+}
+
+BOOL TTTreeListBox::DoubleClickHdl()
+{
+ return JumpToSourcecode( GetHdlEntry() );
+}
+
+/*ULONG TTTreeListBox::SelectChildren( SvLBoxEntry* pParent, BOOL bSelect )
+{
+ SvLBoxEntry *pEntry = FirstChild( pParent );
+ ULONG nRet = 0;
+ while ( pEntry )
+ {
+ nRet++;
+ Select( pEntry, bSelect );
+ pEntry = NextSibling( pEntry );
+ }
+ return nRet;
+}
+
+
+void TTTreeListBox::SelectHdl()
+{
+ SvLBoxEntry* pHdlEntry = GetHdlEntry();
+
+ SelectChildren( pHdlEntry, TRUE );
+ Select( pHdlEntry, TRUE );
+// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
+}
+
+void TTTreeListBox::DeselectHdl()
+{
+ SvLBoxEntry* pHdlEntry = GetHdlEntry();
+ if ( GetParent( pHdlEntry ) )
+ {
+ nDeselectParent++;
+ Select( GetParent( pHdlEntry ), FALSE );
+ nDeselectParent--;
+ }
+ if ( !nDeselectParent )
+ {
+ SelectChildren( pHdlEntry, FALSE );
+ Select( pHdlEntry, FALSE );
+ }
+ Invalidate();
+} */
+
+
+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:
+ DBG_ERROR("Unknown type in ResultWindow");
+ }
+ return HasNothing;
+}
+
+
+class TTLBoxString : public SvLBoxString
+{
+public:
+
+ TTLBoxString( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+
+void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT 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 ); // Ocker oder 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( 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 )
+{
+ USHORT 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 );
+}
+
diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx
new file mode 100644
index 000000000000..21af563834c0
--- /dev/null
+++ b/basic/source/app/msgedit.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: msgedit.hxx,v $
+ * $Revision: 1.11.40.1 $
+ *
+ * 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 // Sonst wird mir schlecht
+
+typedef USHORT 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:
+// virtual void Command( const CommandEvent& rCEvt );
+// USHORT nDeselectParent;
+ BasicFrame *pBasicFrame;
+ void InitEntry( SvLBoxEntry*, const String&, const Image&,
+ const Image&, SvLBoxButtonKind eButtonKind );
+ AppError *pAppError;
+
+ BOOL JumpToSourcecode( SvLBoxEntry *pThisEntry );
+
+public:
+ TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinStyle=0 );
+ ~TTTreeListBox(){}
+
+// virtual void SelectHdl();
+// virtual void DeselectHdl();
+ virtual BOOL DoubleClickHdl();
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+// ULONG SelectChildren( SvLBoxEntry* pParent, BOOL bSelect );
+ TTFeatures GetFeatures( SvLBoxEntry* );
+};
+
+class MsgEdit : public DataEdit
+{
+ BasicFrame *pBasicFrame;
+
+ SvLBoxEntry *pCurrentRun;
+ SvLBoxEntry *pCurrentTestCase;
+ SvLBoxEntry *pCurrentAssertion;
+ SvLBoxEntry *pCurrentError;
+ BOOL bModified;
+ Link lModify;
+ BOOL bFileLoading; // TRUE while loading a file
+ String Impl_MakeText( SvLBoxEntry *pEntry ) const;
+ String Impl_MakeSaveText( SvLBoxEntry *pEntry ) const;
+ String Impl_MakeSaveText( TTDebugData aData ) const;
+ USHORT nVersion; // Stores file version
+ AppError* pAppError;
+ String aLogFileName;
+
+ static USHORT nMaxLogLen;
+ static BOOL bLimitLogLen;
+ static BOOL bPrintLogToStdout;
+ static 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( USHORT nLen ) { nMaxLogLen = nLen; bLimitLogLen = TRUE; }
+DATA_FUNC_DEF( aEditTree, TTTreeListBox )
+};
+
+#endif
diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx
new file mode 100644
index 000000000000..4ec6cc6b86e6
--- /dev/null
+++ b/basic/source/app/mybasic.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: mybasic.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <basic/sbx.hxx>
+
+// AB-Uno-Test
+//#define unotest
+#ifdef unotest
+#ifndef _USR_UNO_HXX
+#include <usr/uno.hxx>
+#endif
+#include <basic/sbuno.hxx>
+#include <sbunoobj.hxx>
+#endif
+
+#include "sbintern.hxx"
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+#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( UINT16 nSbxId, UINT32 = SBXCR_SBX );
+};
+
+static SampleObjectFac aFac1;
+static MyFactory aFac2;
+static ProcessFactory aProcessFac;
+static short nInst = 0;
+
+SbxBase* MyFactory::Create( UINT16 nSbxId, UINT32 nCr )
+{
+ if( nCr == SBXCR_TEST && nSbxId == SBXID_MYBASIC )
+ return new MyBasic;
+ else
+ return NULL;
+}
+
+MyBasic::MyBasic() : StarBASIC()
+{
+ nError = 0;
+ if( !nInst++ )
+ {
+ AddFactory( &aFac1 );
+ AddFactory( &aFac2 );
+ AddFactory( &aProcessFac );
+ }
+ SbxVariable* p = new SbxCollection( CUniString("MyColl") );
+ p->SetName( CUniString("Objects") );
+ Insert( p );
+
+ // AB-Uno-Test
+#ifdef unotest
+ // Get Uno-Service-Manager and Reflection Service
+ createAndSetDefaultServiceManager(); // done later
+
+ // Get Uno-Test-Object
+ UsrAny aObjAny = getIntrospectionTestObject();
+
+ // Box object into SbUnoObject
+ String aName( "UnoObject" );
+ SbxObjectRef xSbUnoObj = GetSbUnoObject( aName, aObjAny );
+ //SbxObjectRef xSbUnoObj = new SbUnoObject( aName, aObjAny );
+ Insert( (SbxObject*)xSbUnoObj );
+#endif
+
+ 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, 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()
+{
+ aErrors.Clear();
+ if( !--nInst )
+ {
+ RemoveFactory( &aFac1 );
+ RemoveFactory( &aFac2 );
+ RemoveFactory( &aProcessFac );
+ }
+}
+
+void MyBasic::Reset()
+{
+ aErrors.Clear();
+ nError = 0;
+}
+
+BOOL MyBasic::Compile( SbModule* p )
+{
+ Reset();
+ return StarBASIC::Compile( p );
+}
+
+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.Insert(
+ new BasicError
+ ( pWin,
+ 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ),
+ LIST_APPEND );
+ nError++;
+ return BOOL( nError < 20 ); // Cancel after 20 errors
+ }
+ else
+ {
+ ReportRuntimeError( pWin );
+ return FALSE;
+ }
+}
+
+void MyBasic::ReportRuntimeError( AppBasEd *pEditWin )
+{
+ String nErrorText;
+ nErrorText = GetSpechialErrorText();
+
+ if ( pEditWin ) // just in case the focus is not right
+ pEditWin->ToTop();
+
+ BasicError( pEditWin,
+ GetVBErrorCode( GetErrorCode() ), nErrorText, GetLine(),
+ GetCol1(), GetCol2() ).Show();
+}
+
+void MyBasic::DebugFindNoErrors( BOOL bDebugFindNoErrors )
+{
+ (void) bDebugFindNoErrors; /* avoid warning about unused parameter */
+}
+
+const String MyBasic::GetSpechialErrorText()
+{
+ return GetErrorText();
+}
+
+USHORT 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() );
+ }
+
+ if( IsBreak() ) // If Breakpoint (or "Run to Cursor")
+ {
+// if ( GetActiveModule()->IsBP(GetLine()) )
+// GetActiveModule()->ClearBP(GetLine());
+ return aBasicApp.pFrame->BreakHandler();
+ }
+ else
+ {
+ return aBasicApp.pFrame->BreakHandler();
+ }
+}
+
+/***************************************************************************
+|*
+|* class BasicError
+|*
+***************************************************************************/
+
+BasicError::BasicError
+ ( AppBasEd* w, USHORT nE, const String& r, USHORT nL, USHORT nC1, USHORT 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();
+}
+
+
diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx
new file mode 100644
index 000000000000..6f173fd53ffa
--- /dev/null
+++ b/basic/source/app/printer.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: printer.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#ifndef _PRINT_HXX //autogen
+#include <vcl/print.hxx>
+#endif
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+#include <algorithm>
+
+#include "app.hxx"
+#include "printer.hxx"
+#include "basic.hrc"
+#include "resids.hrc"
+#include "basrid.hxx"
+
+class PrintingDialog : public ModelessDialog {
+ String aName;
+ FixedText aText;
+ CancelButton aCancel;
+public:
+ PrintingDialog( Window*, BasicPrinter*, ResId&, String& );
+ void ChangeMessage( short );
+};
+
+BasicPrinter::BasicPrinter() : Printer()
+{
+ nPage = 0; nLine = 9999;
+ SetMapMode( MapMode( MAP_POINT ) );
+ Size s( GetOutputSize() );
+ // Use 10 point font
+ Font aFont( FAMILY_MODERN, Size( 0, 10 ) );
+ aFont.SetPitch( PITCH_FIXED );
+ SetFont( aFont );
+ // Output: 6 Lines/Inch = 12 Point
+ nLines = (short) s.Height() / 12;
+ nYoff = 12;
+ SetStartPrintHdl( LINK( this, BasicPrinter, StartPrintHdl ) );
+ SetEndPrintHdl( LINK( this, BasicPrinter, EndPrintHdl ) );
+ SetPrintPageHdl( LINK( this, BasicPrinter, PrintPageHdl ) );
+}
+
+void BasicPrinter::Header()
+{
+ if( nPage ) EndPage();
+ nPage++;
+ StartPage();
+ String aHdr;
+ String aPage( SttResId( IDS_PAGE ) );
+ aPage.Append( String::CreateFromInt32(nPage) );
+ aHdr = aFile.Copy( 0, 80 - aPage.Len() );
+ aHdr.Expand( 80 - aPage.Len(), ' ' );
+ aHdr += aPage;
+ DrawText( Point( 0, 0 ), aHdr );
+ nLine = 2;
+}
+
+void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame *pFrame )
+{
+ nPage = 0; nLine = 9999;
+ aFile = rFile;
+ // Setup dialog
+ SttResId aResId( IDD_PRINT_DIALOG );
+ pDlg = new PrintingDialog
+ ( aBasicApp.pFrame, this, aResId, aFile );
+ // Set position of dialog
+ Size s1 = aBasicApp.pFrame->GetSizePixel();
+ Size s2 = pDlg->GetSizePixel();
+ pDlg->SetPosPixel( Point( (s1.Width() - s2.Width() ) / 2,
+ (s1.Height()- s2.Height() ) / 2 ) );
+ // Disable PRINT-Menu
+ MenuBar* pBar = pFrame->GetMenuBar();
+ Menu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE );
+ pFileMenu->EnableItem( RID_FILEPRINT, FALSE );
+
+ pDlg->ChangeMessage( 1 );
+ pDlg->Show();
+ StartJob( rFile );
+ StartPage();
+ xub_StrLen nDone=0;
+ while( nDone < rText.Len() )
+ {
+ if( nLine >= nLines ) Header();
+ xub_StrLen nLineEnd = std::min( rText.Search( '\n', nDone ), rText.Search( '\r', nDone ) );
+ DrawText( Point( 0, nLine * nYoff ), rText, nDone, nLineEnd-nDone-1 );
+ nDone = nLineEnd;
+ if( nDone <= rText.Len() && rText.GetChar(nDone) == '\r' ) nDone++;
+ if( nDone <= rText.Len() && rText.GetChar(nDone) == '\n' ) nDone++;
+ nLine++;
+ Application::Reschedule();
+ }
+ EndPage();
+ EndJob();
+ nPage = 1;
+ while( IsPrinting() ) Application::Reschedule();
+ delete pDlg; pDlg = NULL;
+ pFileMenu->EnableItem( RID_FILEPRINT, TRUE );
+}
+
+IMPL_LINK_INLINE_START( BasicPrinter, StartPrintHdl, Printer *, pPrinter )
+{
+ (void) pPrinter; /* avoid warning about unused parameter */
+ if( pDlg != NULL )
+ pDlg->Show();
+ return 0;
+}
+IMPL_LINK_INLINE_END( BasicPrinter, StartPrintHdl, Printer *, pPrinter )
+
+IMPL_LINK_INLINE_START( BasicPrinter, EndPrintHdl, Printer *, pPrinter )
+{
+ (void) pPrinter; /* avoid warning about unused parameter */
+ if( pDlg != NULL)
+ pDlg->Hide();
+ return 0;
+}
+IMPL_LINK_INLINE_END( BasicPrinter, EndPrintHdl, Printer *, pPrinter )
+
+IMPL_LINK_INLINE_START( BasicPrinter, PrintPageHdl, Printer *, pPrinter )
+{
+ (void) pPrinter; /* avoid warning about unused parameter */
+ if( pDlg != NULL)
+ pDlg->ChangeMessage( nPage );
+ return 0;
+}
+IMPL_LINK_INLINE_END( BasicPrinter, PrintPageHdl, Printer *, pPrinter )
+
+IMPL_LINK_INLINE( BasicPrinter, Abort , void *, EMPTYARG,
+{
+ AbortJob();
+ return 0L;
+}
+)
+
+/////////////////////////////////////////////////////////////////////////
+
+PrintingDialog::PrintingDialog
+ ( Window* pParent, BasicPrinter* pPrn, ResId& rId, String& rName )
+: ModelessDialog( pParent, rId )
+, aName ( rName )
+, aText ( this, ResId( RID_TEXT, *rId.GetResMgr() ) )
+, aCancel( this, ResId( RID_CANCEL, *rId.GetResMgr() ) )
+{
+ FreeResource();
+ aCancel.SetClickHdl( LINK( pPrn, BasicPrinter, Abort ) );
+}
+
+void PrintingDialog::ChangeMessage( short nPage )
+{
+ String aMsg( SttResId( IDS_PRINTMSG ) );
+ aMsg += aName;
+ aMsg += CUniString("\n");
+ aMsg += String( SttResId( IDS_PAGE ) );
+ aMsg += String::CreateFromInt32( nPage );
+ aText.SetText( aMsg );
+}
+
diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx
new file mode 100644
index 000000000000..d6db8154c57f
--- /dev/null
+++ b/basic/source/app/printer.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: printer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 _BASICPRN_HXX
+#define _BASICPRN_HXX
+
+#ifndef _PRINT_HXX //autogen
+#include <vcl/print.hxx>
+#endif
+
+class PrintingDialog;
+
+class BasicPrinter : public Printer {
+ short nLine; // aktuelle Zeile
+ short nPage; // aktuelle Seite
+ short nLines; // Zeilen pro Seite
+ short nYoff; // Zeilenabstand in Points
+ String aFile; // Dateiname
+ PrintingDialog* pDlg; // Druck-Dialog
+ void Header(); // Seitenkopf drucken
+public:
+ BasicPrinter();
+ void Print( const String& rFile, const String& rText, BasicFrame *pFrame );
+ DECL_LINK( Abort, void * );
+ DECL_LINK( StartPrintHdl, Printer * );
+ DECL_LINK( EndPrintHdl, Printer * );
+ DECL_LINK( PrintPageHdl, Printer * );
+#if defined( PM20 )
+ // StarView-Bug, bald wieder zu entfernen:
+ virtual void SetPageQueueSize( USHORT ) {}
+#endif
+};
+
+#endif
diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx
new file mode 100644
index 000000000000..aba775778337
--- /dev/null
+++ b/basic/source/app/process.cxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: process.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include "winbase.h"
+#include <tools/postwin.h>
+#endif
+#include <tools/errcode.hxx>
+#include <vos/process.hxx>
+#include <basic/sbxcore.hxx>
+#include <tools/string.hxx>
+#include <osl/file.hxx>
+
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+//#ifndef _BYTE_STRING_LIST
+//DECLARE_LIST( ByteStringList, ByteString * );
+//#define _BYTE_STRING_LIST
+//#endif
+
+#include <basic/process.hxx>
+
+Process::Process()
+: pArgumentList( NULL )
+, pEnvList( NULL )
+, pProcess( NULL )
+, bWasGPF( FALSE )
+, bHasBeenStarted( FALSE )
+{
+}
+
+Process::~Process()
+{
+// delete pArgumentList;
+// delete pEnvList;
+ delete pProcess;
+}
+
+
+BOOL Process::ImplIsRunning()
+{
+ if ( pProcess && bHasBeenStarted )
+ {
+ NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo;
+ pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo );
+ if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) )
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ return FALSE;
+}
+
+long Process::ImplGetExitCode()
+{
+ if ( pProcess )
+ {
+ NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo;
+ pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo );
+ if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_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 ( pProcess && ImplIsRunning() )
+ SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
+ else
+ {
+ delete pArgumentList; pArgumentList = NULL;
+ delete pEnvList; pEnvList = NULL;
+ delete pProcess; 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++;
+ }
+ }
+ pArgumentList = new NAMESPACE_VOS(OArgumentList)( pParamList, nCount );
+
+
+ ::rtl::OUString *pEnvArray = NULL;
+ if ( pEnv )
+ {
+ pEnvArray = new ::rtl::OUString[pEnv->size()];
+
+ xub_StrLen nEnvCount = 0;
+ Environment::const_iterator aIter = pEnv->begin();
+ while ( aIter != pEnv->end() )
+ {
+ ::rtl::OUString aTemp = ::rtl::OUString( (*aIter).first );
+ aTemp += ::rtl::OUString::createFromAscii( "=" );
+ aTemp += ::rtl::OUString( (*aIter).second );
+ pEnvArray[nEnvCount] = aTemp;
+ nEnvCount++;
+ aIter++;
+ }
+ pEnvList = new NAMESPACE_VOS(OEnvironment)( pEnvArray, nEnvCount );
+ }
+
+ ::rtl::OUString aNormalizedAppPath;
+ osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath );
+ pProcess = new NAMESPACE_VOS(OProcess)( aNormalizedAppPath );
+ bHasBeenStarted = FALSE;
+
+ delete [] pParamList;
+ delete [] pEnvArray;
+ }
+}
+
+BOOL Process::Start()
+{ // Start program
+ BOOL bSuccess=FALSE;
+ if ( pProcess && !ImplIsRunning() )
+ {
+ bWasGPF = FALSE;
+#ifdef WNT
+// sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+ sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX);
+ try
+ {
+#endif
+ if ( pEnvList )
+ {
+ bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption)
+ ( NAMESPACE_VOS(OProcess)::TOption_SearchPath
+ /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/
+ /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ),
+ *pArgumentList,
+ *pEnvList ) == NAMESPACE_VOS(OProcess)::E_None;
+ }
+ else
+ {
+ bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption)
+ ( NAMESPACE_VOS(OProcess)::TOption_SearchPath
+ /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/
+ /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ),
+ *pArgumentList ) == NAMESPACE_VOS(OProcess)::E_None;
+ }
+#ifdef WNT
+ }
+ catch( ... )
+ {
+ bWasGPF = TRUE;
+ // TODO: Output debug message !!
+ }
+ nErrorMode = SetErrorMode(nErrorMode);
+#endif
+ bHasBeenStarted = bSuccess;
+ }
+ else
+ SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
+ return bSuccess;
+}
+
+ULONG Process::GetExitCode()
+{ // ExitCode of program after execution
+ return ImplGetExitCode();
+}
+
+BOOL Process::IsRunning()
+{
+ return ImplIsRunning();
+}
+
+BOOL Process::WasGPF()
+{ // Did the process fail?
+#ifdef WNT
+ return ImplGetExitCode() == 3221225477;
+#else
+ return bWasGPF;
+#endif
+}
+
+BOOL Process::Terminate()
+{
+ if ( ImplIsRunning() )
+ return pProcess->terminate() == vos::OProcess::E_None;
+ return TRUE;
+}
+
diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx
new file mode 100644
index 000000000000..8ace95008062
--- /dev/null
+++ b/basic/source/app/processw.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: processw.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+
+#include <tools/errcode.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbx.hxx>
+#ifndef __SBX_SBXVARIABLE_HXX //autogen
+#include <basic/sbxvar.hxx>
+#endif
+
+//#include <osl/thread.h>
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+#include "processw.hxx"
+
+// Process has the following elements:
+// 1) Properties:
+// none
+// 2) Methods:
+// SetImage( Filename )
+// BOOL Start
+// USHORT GetExitCode
+// BOOL IsRunning
+// 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 // 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
+
+#define COLLNAME "Elements" // Name of the collection, hard coded
+
+
+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;
+ BOOL bFound = FALSE;
+ while( p->nArgs != -1 )
+ {
+ if( rName.EqualsIgnoreCaseAscii( p->pName ) )
+ {
+ bFound = 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();
+ USHORT nIndex = (USHORT) pVar->GetUserData();
+ // No index: put through
+ if( nIndex )
+ {
+ ULONG t = pHint->GetId();
+ if( t == SBX_HINT_INFOWANTED )
+ pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) );
+ else
+ {
+ BOOL bWrite = FALSE;
+ if( t == SBX_HINT_DATACHANGED )
+ bWrite = TRUE;
+ if( t == SBX_HINT_DATAWANTED || bWrite )
+ {
+ // Parameter-Test for methods:
+ USHORT 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 ];
+ // Wenn mal eine Hilfedatei zur Verfuegung steht:
+ // SbxInfo* pResultInfo = new SbxInfo( Hilfedateiname, p->nHelpId );
+ 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 );
+ USHORT 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 = FALSE)
+// and store the value from argv[0] (Put, bPut = TRUE)
+
+void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, 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, 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, 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, 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, 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;
+}
+
diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx
new file mode 100644
index 000000000000..0b46ecd2cf0f
--- /dev/null
+++ b/basic/source/app/processw.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: processw.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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>
+#ifndef __SBX_SBXVARIABLE_HXX //autogen
+#include <basic/sbxvar.hxx>
+#endif
+#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 ( HPUX ) || defined ( C50 ) || defined ( C52 )
+public:
+#endif
+ typedef void( ProcessWrapper::*pMeth )
+ ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite );
+#if defined ( ICC ) || defined ( HPUX )
+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, BOOL bWrite );
+ void PStart( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite );
+ void PGetExitCode( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite );
+ void PIsRunning( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite );
+ void PWasGPF( SbxVariable* pVar, SbxArray* pPar, 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
diff --git a/basic/source/app/resids.hrc b/basic/source/app/resids.hrc
new file mode 100644
index 000000000000..b0e48dc15b88
--- /dev/null
+++ b/basic/source/app/resids.hrc
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: resids.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * 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
new file mode 100644
index 000000000000..c4d71c905d59
--- /dev/null
+++ b/basic/source/app/status.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: status.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#include "app.hxx"
+#include "basic.hrc"
+#include "appwin.hxx"
+#include "status.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 )
+{
+ USHORT 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;
+
+ USHORT x;
+ x = pTTB->GetItemPos( pTTB->GetCurItemId() );
+ x = pWinMenu->GetItemId( nFirstWinPos );
+ x = pWinMenu->GetItemCount();
+ AppWin* pWin = pFrame->FindWin( pWinMenu->GetItemText( pWinMenu->GetItemId( nFirstWinPos ) ).EraseAllChars( L'~' ) );
+ if ( pWin )
+ {
+ pWin->Minimize( FALSE );
+ pWin->ToTop();
+ }
+ return 0;
+}
+
+void StatusLine::LoadTaskToolBox()
+{
+ USHORT 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->Last() && !( pFrame->pList->Last()->GetWinState() & TT_WIN_STATE_HIDE ) );
+
+ nFirstWinPos++;
+ }
+
+ pTaskToolBox->EndUpdateTask();
+ Resize();
+ Invalidate();
+}
+
+
diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx
new file mode 100644
index 000000000000..689d10d9e731
--- /dev/null
+++ b/basic/source/app/status.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: status.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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
diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src
new file mode 100644
index 000000000000..02c4bfe5e231
--- /dev/null
+++ b/basic/source/app/svtmsg.src
@@ -0,0 +1,342 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svtmsg.src,v $
+ * $Revision: 1.77 $
+ *
+ * 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 "svtmsg.hrc"
+
+
+// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+
+
+///////////////////////////////
+// Fehlermeldungen, die in das Resultfile gelangen.
+// *********************
+// *** !!ACHTUNG!! ***
+// *********************
+// Die Nummern dürfen sich NIE! ändern,
+// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
+// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+///////////////////////////////
+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). Max. allowed is ($Arg3)";
+};
+String S_NUMBER_TOO_SMALL
+{
+ Text[ en-US ] = "The entry number ($Arg2) is too small in ($Arg1). Min 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/testbasi.cxx b/basic/source/app/testbasi.cxx
new file mode 100644
index 000000000000..aca34f9b3ea8
--- /dev/null
+++ b/basic/source/app/testbasi.cxx
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: testbasi.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#define testtool
+#include "mybasic.cxx"
diff --git a/basic/source/app/testtool.idl b/basic/source/app/testtool.idl
new file mode 100644
index 000000000000..f754dfe4966e
--- /dev/null
+++ b/basic/source/app/testtool.idl
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: testtool.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
new file mode 100644
index 000000000000..f273f3ce81c7
--- /dev/null
+++ b/basic/source/app/testtool.src
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: testtool.src,v $
+ * $Revision: 1.28 $
+ *
+ * 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 "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
new file mode 100644
index 000000000000..0bc6e7c16e37
--- /dev/null
+++ b/basic/source/app/textedit.cxx
@@ -0,0 +1,869 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textedit.cxx,v $
+ * $Revision: 1.24 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#include <tools/stream.hxx>
+#include <svtools/texteng.hxx>
+#include <svtools/textview.hxx>
+#include <svtools/txtattr.hxx>
+#include <basic/sbxmeth.hxx>
+#ifndef _BASIC_TTRESHLP_HXX
+#include <basic/ttstrhlp.hxx>
+#endif
+
+#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( FALSE )
+, bDoSyntaxHighlight( FALSE )
+, bDelayHighlight( TRUE )
+, nTipId( 0 )
+, bViewMoved( FALSE )
+{
+ pTextEngine = new TextEngine();
+ pTextEngine->SetMaxTextLen( STRING_MAXLEN );
+ pTextEngine->EnableUndo( TRUE );
+
+ pTextView = new TextView( pTextEngine, this );
+ pTextEngine->InsertView( pTextView );
+ pTextEngine->SetModified( 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;
+}
+
+BOOL TextEditImp::ViewMoved()
+{
+ BOOL bOld = bViewMoved;
+ bViewMoved = 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 = 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 )
+ {
+ ULONG nWidth = pTextEngine->CalcTextWidth();
+ if ( (ULONG)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, TRUE );
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED )
+ {
+ if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() )
+ ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, 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_SPECHIAL 55
+class TextAttribSpechial : public TextAttrib
+{
+private:
+ FontWeight maFontWeight;
+
+public:
+ TextAttribSpechial( const FontWeight& rFontWeight );
+ TextAttribSpechial( const TextAttribSpechial& rAttr );
+ ~TextAttribSpechial() {;}
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+
+TextAttribSpechial::TextAttribSpechial( const FontWeight& rFontWeight )
+ : TextAttrib( TEXTATTR_SPECHIAL ), maFontWeight( rFontWeight )
+{}
+
+TextAttribSpechial::TextAttribSpechial( const TextAttribSpechial& rAttr )
+ : TextAttrib( rAttr ), maFontWeight( rAttr.maFontWeight )
+{}
+
+void TextAttribSpechial::SetFont( Font& rFont ) const
+{
+ rFont.SetWeight( maFontWeight );
+}
+
+TextAttrib* TextAttribSpechial::Clone() const
+{
+ return new TextAttribSpechial( *this );
+}
+
+int TextAttribSpechial::operator==( const TextAttrib& rAttr ) const
+{
+ return ( ( TextAttrib::operator==(rAttr ) ) &&
+ ( maFontWeight == ((const TextAttribSpechial&)rAttr).maFontWeight ) );
+}
+
+void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
+{
+ SbTextPortions aPortionList;
+ pAppEdit->GetBasicFrame()->Basic().Highlight( rSource, aPortionList );
+
+ USHORT nCount = aPortionList.Count();
+ if ( !nCount )
+ return;
+
+ SbTextPortion& rLast = aPortionList[nCount-1];
+ if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoben
+ {
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ERROR( "MD-Bug nicht beseitigt!" );
+#endif
+ nCount--;
+ aPortionList.Remove( nCount);
+ if ( !nCount )
+ return;
+ }
+
+ // here is the postprocessing for types for the TestTool
+ USHORT i;
+ BOOL bWasTTControl = FALSE;
+ for ( i = 0; i < aPortionList.Count(); i++ )
+ {
+ SbTextPortion& r = aPortionList[i];
+// DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" );
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoben
+ 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 = TRUE;
+ else
+ bWasTTControl = FALSE;
+ }
+ break;
+ case SB_PUNCTUATION:
+ {
+ String aPunctuation = rSource.Copy( r.nStart, r.nEnd - r.nStart +1 );
+ if ( aPunctuation.CompareToAscii( "." ) != COMPARE_EQUAL )
+ bWasTTControl = FALSE;
+ }
+ break;
+ default:
+ bWasTTControl = FALSE;
+ }
+ }
+
+ // Es muessen nur die Blanks und Tabs mit attributiert werden.
+ // 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, "doch mehrere Zeilen ?" );
+ DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" );
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoben
+ continue;
+
+ if ( r.nStart > nLastEnd )
+ {
+ // Kann ich mich drauf verlassen, dass alle ausser
+ // Blank und Tab gehighlightet wird ?!
+ r.nStart = nLastEnd;
+ }
+ nLastEnd = r.nEnd+1;
+ if ( ( i == (nCount-1) ) && ( r.nEnd < rSource.Len() ) )
+ r.nEnd = rSource.Len()-1;
+ }
+
+ BOOL bWasModified = pTextEngine->IsModified();
+ for ( i = 0; i < aPortionList.Count(); i++ )
+ {
+ SbTextPortion& r = aPortionList[i];
+// DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" );
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoben
+ continue;
+
+ SbTextType eCol = r.eType;
+ Color aColor;
+ ULONG 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( TextAttribSpechial( WEIGHT_BOLD ), nLine, r.nStart, r.nEnd+1 );
+ }
+ break;
+ default:
+ {
+ aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) );
+ DBG_ERROR( "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( ULONG nPara )
+{
+ // Due to delayed syntax highlight it can happend that the
+ // paragraph does no longer exist
+ if ( nPara < pTextEngine->GetParagraphCount() )
+ {
+ // leider weis ich nicht, ob genau diese Zeile Modified() ...
+// if ( pProgress )
+// pProgress->StepProgress();
+ 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 ( pProgress )
+// pProgress->StepProgress();
+
+ if ( !bHighlightning && bDoSyntaxHighlight )
+ {
+ if ( bDelayHighlight )
+ {
+ aSyntaxLineTable.Insert( nPara, (void*)(ULONG)1 );
+ aSyntaxIdleTimer.Start();
+ }
+ else
+ DoSyntaxHighlight( nPara );
+ }
+}
+
+IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG )
+{
+ DBG_ASSERT( pTextView, "Not yet a View but Syntax-Highlight ?!" );
+ pTextEngine->SetUpdateMode( FALSE );
+
+ bHighlightning = TRUE;
+ USHORT nLine;
+ while ( aSyntaxLineTable.First() && !Application::AnyInput( INPUT_MOUSEANDKEYBOARD ) )
+ {
+ nLine = (USHORT)aSyntaxLineTable.GetCurKey();
+ DoSyntaxHighlight( nLine );
+ aSyntaxLineTable.Remove( nLine );
+/* if ( Application::AnyInput() )
+ {
+ aSyntaxIdleTimer.Start(); // Starten, falls wir in einem Dialog landen
+ pTextView->ShowCursor( TRUE, TRUE );
+ pTextEngine->SetUpdateMode( TRUE );
+ bHighlightning = FALSE;
+ GetpApp()->Reschedule();
+ bHighlightning = TRUE;
+ pTextEngine->SetUpdateMode( FALSE );
+ }*/
+ }
+
+ BOOL bWasModified = pTextEngine->IsModified();
+ if ( aSyntaxLineTable.Count() > 3 ) // Without VDev
+ {
+ pTextEngine->SetUpdateMode( TRUE );
+ pTextView->ShowCursor( TRUE, TRUE );
+ }
+ else
+ pTextEngine->SetUpdateMode( TRUE ); // ! With VDev
+// pTextView->ForceUpdate();
+
+ // SetUpdateMode( TRUE ) soll kein Modify setzen
+ pTextEngine->SetModified( bWasModified );
+
+ // SyntaxTimerHdl wird gerufen, wenn Text-Aenderung
+ // => gute Gelegenheit, Textbreite zu ermitteln!
+// long nPrevTextWidth = nCurTextWidth;
+// nCurTextWidth = pTextEngine->CalcTextWidth();
+// if ( nCurTextWidth != nPrevTextWidth )
+// SetScrollBarRanges();
+ bHighlightning = FALSE;
+
+ if ( aSyntaxLineTable.First() )
+ aImplSyntaxIdleTimer.Start();
+
+// while ( Application::AnyInput() )
+// Application::Reschedule(); // Reschedule, da der UserEvent keine Paints etc. durchlässt
+
+ return 0;
+}
+
+void TextEditImp::InvalidateSyntaxHighlight()
+{
+ for ( xub_StrLen i = 0; i < pTextEngine->GetParagraphCount(); i++ )
+ DoDelayedSyntaxHighlight( i );
+}
+
+void TextEditImp::SyntaxHighlight( BOOL bNew )
+{
+ if ( ( bNew && bDoSyntaxHighlight ) || ( !bNew && !bDoSyntaxHighlight ) )
+ return;
+
+ bDoSyntaxHighlight = bNew;
+ if ( !pTextEngine )
+ return;
+
+
+ if ( bDoSyntaxHighlight )
+ {
+ InvalidateSyntaxHighlight();
+ }
+ else
+ {
+ aSyntaxIdleTimer.Stop();
+ pTextEngine->SetUpdateMode( FALSE );
+ for ( ULONG i = 0; i < pTextEngine->GetParagraphCount(); i++ )
+ pTextEngine->RemoveAttribs( i );
+
+// pTextEngine->QuickFormatDoc();
+ pTextEngine->SetUpdateMode( TRUE );
+ pTextView->ShowCursor(TRUE, TRUE );
+ }
+}
+
+
+void TextEditImp::SetFont( const Font& rNewFont )
+{
+ pTextEngine->SetFont(rNewFont);
+}
+
+BOOL TextEditImp::IsModified()
+{
+ return pTextEngine->IsModified();
+}
+
+void TextEditImp::KeyInput( const KeyEvent& rKeyEvent )
+{
+ BOOL bWasModified = pTextView->GetTextEngine()->IsModified();
+ pTextView->GetTextEngine()->SetModified( 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::MouseButtonDown( const MouseEvent& rMouseEvent ){ pTextView->MouseButtonDown( rMouseEvent );}
+//void TextEditImp::MouseMove( const MouseEvent& rMouseEvent ){ pTextView->MouseMove( rMouseEvent );}
+//void TextEditImp::Command( const CommandEvent& rCEvt ){ pTextView->Command( rCEvt );}
+//BOOL TextEditImp::Drop( const DropEvent& rEvt ){ return FALSE /*pTextView->Drop( rEvt )*/;}
+//BOOL TextEditImp::QueryDrop( DropEvent& rEvt ){ return FALSE /*pTextView->QueryDrop( rEvt )*/;}
+
+
+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() /*&& !Application::GetAppInternational().IsNumeric( aWord )*/ )
+ {
+ 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
+ BOOL bWasError = SbxBase::IsError();
+ pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( TRUE );
+ SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord );
+ pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( 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 SbxCURRENCY:
+// case SbxDATE:
+ case SbxDOUBLE:
+ case SbxINTEGER:
+ case SbxLONG:
+// case SbxOBJECT: // cannot be edited
+ 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( FALSE )
+, bSaveAsUTF8( FALSE )
+, aEdit( pParent, aBits | WB_NOHIDESELECTION )
+{
+DBG_CTOR(TextEdit,0);
+}
+
+TextEdit::~TextEdit()
+{DBG_DTOR(TextEdit,0);}
+
+void TextEdit::Highlight( ULONG 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
+ BOOL bColon = FALSE;
+
+ while ( s.GetChar( nCol2 ) == ' ' && nCol2 > nCol1 && !bColon )
+ {
+ nCol2--;
+ if ( s.GetChar( nCol2 ) == ':' )
+ {
+ nCol2--;
+ bColon = 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)) ); // fix #105169#
+ 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 ); }
+
+USHORT TextEdit::GetLineNr() const
+{
+ return sal::static_int_cast< USHORT >(
+ aEdit.pTextView->GetSelection().GetEnd().GetPara()+1);
+}
+
+void TextEdit::ReplaceSelected( const String& rStr ){ aEdit.pTextView->InsertText(rStr); }
+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( FALSE ); }
+void TextEdit::SetModifyHdl( Link l ){ aEdit.SetModifyHdl(l); }
+BOOL TextEdit::HasText() const { return aEdit.pTextEngine->GetTextLen() > 0; }
+
+// Search from the beginning or at mark + 1
+BOOL TextEdit::Find( const String& s )
+{
+ DBG_CHKTHIS(TextEdit,0);
+
+ TextSelection aSelection = aEdit.pTextView->GetSelection();
+ ULONG 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 TRUE;
+ }
+ nIndex = 0;
+ nPara++;
+ }
+ return FALSE;
+}
+
+BOOL TextEdit::Load( const String& aName )
+{
+DBG_CHKTHIS(TextEdit,0);
+ BOOL bOk = TRUE;
+ SvFileStream aStrm( aName, STREAM_STD_READ );
+ if( aStrm.IsOpen() )
+ {
+ String aText, aLine, aLineBreak;
+ BOOL bIsFirstLine = 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 = TRUE;
+ }
+ else
+ {
+ if ( !bIsFirstLine )
+ aText += aLineBreak;
+ aText += aLine;
+ bIsFirstLine = FALSE;
+ }
+ if( aStrm.GetError() != SVSTREAM_OK )
+ bOk = FALSE;
+ }
+ SetText( aText );
+ }
+ else
+ bOk = FALSE;
+ return bOk;
+}
+
+BOOL TextEdit::Save( const String& aName )
+{
+DBG_CHKTHIS(TextEdit,0);
+ BOOL bOk = 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 << ByteString( aSave, aFileEncoding ).GetBuffer();
+ if( aStrm.GetError() != SVSTREAM_OK )
+ bOk = FALSE;
+ else
+ aEdit.pTextEngine->SetModified(FALSE);
+ } else bOk = FALSE;
+ return bOk;
+}
+
+
+void TextEdit::BuildKontextMenu( PopupMenu *&pMenu )
+{
+ DataEdit::BuildKontextMenu( pMenu );
+ aEdit.BuildKontextMenu( pMenu );
+}
+
+
diff --git a/basic/source/app/textedit.hxx b/basic/source/app/textedit.hxx
new file mode 100644
index 000000000000..5caf90d738d7
--- /dev/null
+++ b/basic/source/app/textedit.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: textedit.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * 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"
+
+//#include <xtextedt.hxx>
+
+class TextEditImp : public Window, public SfxListener
+{
+using Window::Notify;
+
+protected:
+ void DoSyntaxHighlight( ULONG 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, ULONG nLineOff );
+ BOOL bHighlightning;
+ BOOL bDoSyntaxHighlight;
+ BOOL bDelayHighlight;
+
+
+ SbxBase* GetSbxAtMousePos( String &aWord );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ DECL_LINK( HideVarContents, void* );
+ DECL_LINK( ShowVarContents, void* );
+ Point aTipPos;
+ String aTipWord;
+ ULONG nTipId;
+
+ Timer HideTipTimer;
+ Timer ShowTipTimer;
+
+ BOOL bViewMoved;
+
+public:
+ TextEditImp( AppEdit *pParent, const WinBits& aBits );
+ ~TextEditImp();
+
+ TextEngine *pTextEngine;
+ TextView *pTextView;
+
+ void SetFont( const Font& rNewFont );
+ 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 MouseMove( const MouseEvent& rMouseEvent );
+ void Command( const CommandEvent& rCEvt );
+ //BOOL Drop( const DropEvent& rEvt );
+ //BOOL QueryDrop( DropEvent& rEvt );
+
+ BOOL ViewMoved();
+
+ void DoDelayedSyntaxHighlight( xub_StrLen nPara );
+ void InvalidateSyntaxHighlight();
+ void SyntaxHighlight( BOOL bNew );
+ void BuildKontextMenu( PopupMenu *&pMenu );
+};
+
+
+
+DBG_NAMEEX(TextEdit)
+class TextEdit : public DataEdit {
+
+ BreakpointWindow *pBreakpointWindow;
+ BOOL bFileWasUTF8;
+ BOOL bSaveAsUTF8;
+
+public:
+ TextEdit( AppEdit*, const WinBits& );
+ ~TextEdit();
+ void Highlight( ULONG 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( BOOL bUTF8 ) { bSaveAsUTF8 = bUTF8; }
+};
+
+#endif
diff --git a/basic/source/app/ttbasic.cxx b/basic/source/app/ttbasic.cxx
new file mode 100644
index 000000000000..b0e8eb4a8a39
--- /dev/null
+++ b/basic/source/app/ttbasic.cxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ttbasic.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+#include <basic/mybasic.hxx>
+#include "ttbasic.hxx"
+
+MyBasic* TTBasic::CreateMyBasic()
+{
+ return new MyBasic;
+}
diff --git a/basic/source/app/ttbasic.hxx b/basic/source/app/ttbasic.hxx
new file mode 100644
index 000000000000..96a00d791916
--- /dev/null
+++ b/basic/source/app/ttbasic.hxx
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ttbasic.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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();
+};
+
diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src
new file mode 100644
index 000000000000..81d595cee55f
--- /dev/null
+++ b/basic/source/app/ttmsg.src
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ttmsg.src,v $
+ * $Revision: 1.47 $
+ *
+ * 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 "ttmsg.hrc"
+
+
+// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten
+
+
+///////////////////////////////
+// Fehlermeldungen, die in das Resultfile gelangen.
+// *********************
+// *** !!ACHTUNG!! ***
+// *********************
+// Die Nummern dürfen sich NIE! ändern,
+// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
+// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+///////////////////////////////
+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)";
+};
+/*
+String
+{
+ Text[ en-US ] = ;
+};
+String
+{
+ Text[ en-US ] = ;
+};
+String
+{
+ Text[ en-US ] = ;
+};
+String
+{
+ Text[ en-US ] = ;
+};
+*/
+