summaryrefslogtreecommitdiff
path: root/basic/source
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source')
-rwxr-xr-x[-rw-r--r--]basic/source/app/app.cxx353
-rwxr-xr-x[-rw-r--r--]basic/source/app/app.hxx25
-rwxr-xr-x[-rw-r--r--]basic/source/app/appbased.cxx17
-rwxr-xr-x[-rw-r--r--]basic/source/app/appbased.hxx7
-rwxr-xr-x[-rw-r--r--]basic/source/app/appedit.cxx12
-rwxr-xr-x[-rw-r--r--]basic/source/app/appedit.hxx5
-rwxr-xr-x[-rw-r--r--]basic/source/app/apperror.cxx5
-rwxr-xr-x[-rw-r--r--]basic/source/app/apperror.hxx2
-rwxr-xr-x[-rw-r--r--]basic/source/app/appwin.cxx14
-rwxr-xr-x[-rw-r--r--]basic/source/app/appwin.hxx9
-rwxr-xr-x[-rw-r--r--]basic/source/app/basic.hrc0
-rwxr-xr-x[-rw-r--r--]basic/source/app/basic.src10
-rwxr-xr-x[-rw-r--r--]basic/source/app/basicrt.cxx3
-rwxr-xr-x[-rw-r--r--]basic/source/app/basmsg.hrc12
-rwxr-xr-x[-rw-r--r--]basic/source/app/basmsg.src13
-rwxr-xr-x[-rw-r--r--]basic/source/app/brkpnts.cxx150
-rwxr-xr-x[-rw-r--r--]basic/source/app/brkpnts.hxx49
-rwxr-xr-x[-rw-r--r--]basic/source/app/dataedit.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/app/dialogs.cxx40
-rwxr-xr-x[-rw-r--r--]basic/source/app/dialogs.hxx25
-rwxr-xr-x[-rw-r--r--]basic/source/app/makefile.mk54
-rwxr-xr-x[-rw-r--r--]basic/source/app/msgedit.cxx27
-rwxr-xr-x[-rw-r--r--]basic/source/app/msgedit.hxx5
-rwxr-xr-x[-rw-r--r--]basic/source/app/mybasic.cxx52
-rwxr-xr-x[-rw-r--r--]basic/source/app/printer.cxx12
-rwxr-xr-x[-rw-r--r--]basic/source/app/printer.hxx15
-rwxr-xr-x[-rw-r--r--]basic/source/app/process.cxx137
-rwxr-xr-x[-rw-r--r--]basic/source/app/processw.cxx10
-rwxr-xr-x[-rw-r--r--]basic/source/app/processw.hxx9
-rwxr-xr-x[-rw-r--r--]basic/source/app/resids.hrc0
-rwxr-xr-x[-rw-r--r--]basic/source/app/status.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/app/status.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/app/svtmsg.src12
-rwxr-xr-x[-rw-r--r--]basic/source/app/testbasi.cxx3
-rwxr-xr-x[-rw-r--r--]basic/source/app/testtool.idl0
-rwxr-xr-x[-rw-r--r--]basic/source/app/testtool.src0
-rwxr-xr-x[-rw-r--r--]basic/source/app/textedit.cxx69
-rwxr-xr-x[-rw-r--r--]basic/source/app/textedit.hxx4
-rwxr-xr-x[-rw-r--r--]basic/source/app/ttbasic.cxx3
-rwxr-xr-x[-rw-r--r--]basic/source/app/ttbasic.hxx2
-rwxr-xr-x[-rw-r--r--]basic/source/app/ttmsg.src13
-rwxr-xr-x[-rw-r--r--]basic/source/basmgr/basicmanagerrepository.cxx10
-rwxr-xr-x[-rw-r--r--]basic/source/basmgr/basmgr.cxx224
-rwxr-xr-x[-rw-r--r--]basic/source/basmgr/makefile.mk0
-rwxr-xr-x[-rw-r--r--]basic/source/classes/disas.cxx32
-rwxr-xr-x[-rw-r--r--]basic/source/classes/errobject.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/classes/eventatt.cxx105
-rwxr-xr-x[-rw-r--r--]basic/source/classes/image.cxx7
-rwxr-xr-x[-rw-r--r--]basic/source/classes/makefile.mk0
-rwxr-xr-x[-rw-r--r--]basic/source/classes/propacc.cxx10
-rwxr-xr-x[-rw-r--r--]basic/source/classes/sb.cxx110
-rwxr-xr-x[-rw-r--r--]basic/source/classes/sb.src58
-rwxr-xr-x[-rw-r--r--]basic/source/classes/sbintern.cxx2
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx825
-rwxr-xr-xbasic/source/classes/sbxmod.cxx454
-rwxr-xr-x[-rw-r--r--]basic/source/comp/buffer.cxx26
-rwxr-xr-x[-rw-r--r--]basic/source/comp/codegen.cxx51
-rwxr-xr-x[-rw-r--r--]basic/source/comp/dim.cxx171
-rwxr-xr-x[-rw-r--r--]basic/source/comp/exprgen.cxx38
-rwxr-xr-x[-rw-r--r--]basic/source/comp/exprnode.cxx45
-rwxr-xr-x[-rw-r--r--]basic/source/comp/exprtree.cxx100
-rwxr-xr-x[-rw-r--r--]basic/source/comp/io.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/comp/loops.cxx5
-rwxr-xr-x[-rw-r--r--]basic/source/comp/makefile.mk19
-rwxr-xr-x[-rw-r--r--]basic/source/comp/parser.cxx17
-rwxr-xr-xbasic/source/comp/sbcomp.cxx397
-rwxr-xr-x[-rw-r--r--]basic/source/comp/scanner.cxx3
-rwxr-xr-x[-rw-r--r--]basic/source/comp/symtbl.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/comp/token.cxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/buffer.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/codegen.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/collelem.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/disas.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/dlgcont.hxx8
-rwxr-xr-x[-rw-r--r--]basic/source/inc/errobject.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/expr.hxx8
-rwxr-xr-x[-rw-r--r--]basic/source/inc/filefmt.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/image.hxx5
-rwxr-xr-x[-rw-r--r--]basic/source/inc/iosys.hxx4
-rwxr-xr-x[-rw-r--r--]basic/source/inc/namecont.hxx14
-rwxr-xr-x[-rw-r--r--]basic/source/inc/object.hxx9
-rwxr-xr-x[-rw-r--r--]basic/source/inc/opcodes.hxx7
-rwxr-xr-x[-rw-r--r--]basic/source/inc/parser.hxx4
-rwxr-xr-x[-rw-r--r--]basic/source/inc/propacc.hxx12
-rwxr-xr-x[-rw-r--r--]basic/source/inc/runtime.hxx13
-rwxr-xr-x[-rw-r--r--]basic/source/inc/sbcomp.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/sbintern.hxx2
-rwxr-xr-x[-rw-r--r--]basic/source/inc/sbjsmeth.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/sbjsmod.hxx2
-rwxr-xr-xbasic/source/inc/sbtrace.hxx10
-rwxr-xr-x[-rw-r--r--]basic/source/inc/sbunoobj.hxx26
-rwxr-xr-x[-rw-r--r--]basic/source/inc/scanner.hxx5
-rwxr-xr-x[-rw-r--r--]basic/source/inc/scriptcont.hxx8
-rwxr-xr-x[-rw-r--r--]basic/source/inc/stdobj.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/inc/symtbl.hxx2
-rwxr-xr-x[-rw-r--r--]basic/source/inc/token.hxx7
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/basrdll.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/comenumwrapper.cxx0
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/comenumwrapper.hxx0
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/ddectrl.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/ddectrl.hxx5
-rwxr-xr-xbasic/source/runtime/dllmgr-none.cxx64
-rwxr-xr-xbasic/source/runtime/dllmgr-x64.cxx772
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/dllmgr-x86.cxx (renamed from basic/source/runtime/dllmgr.cxx)22
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/dllmgr.hxx3
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/inputbox.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/iosys.cxx59
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/makefile.mk23
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/methods.cxx286
-rwxr-xr-xbasic/source/runtime/methods1.cxx592
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/props.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/rtlproto.hxx17
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/runtime.cxx58
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/stdobj.cxx128
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/stdobj1.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step0.cxx97
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step1.cxx21
-rwxr-xr-xbasic/source/runtime/step2.cxx16
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/wnt-mingw.s0
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/wnt-x86.asm (renamed from basic/source/runtime/wnt.asm)0
-rwxr-xr-x[-rw-r--r--]basic/source/sample/collelem.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/sample/makefile.mk3
-rwxr-xr-x[-rw-r--r--]basic/source/sample/object.cxx6
-rwxr-xr-x[-rw-r--r--]basic/source/sample/sample.bas0
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/format.src0
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/makefile.mk48
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxarray.cxx59
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxbase.cxx28
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxbool.cxx41
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxbyte.cxx45
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxchar.cxx54
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxcoll.cxx12
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxconv.hxx48
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxcurr.cxx529
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxdate.cxx36
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxdbl.cxx25
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxdec.cxx101
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxdec.hxx6
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxexec.cxx74
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxform.cxx6
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxint.cxx169
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxlng.cxx68
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxmstrm.cxx3
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxobj.cxx208
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxres.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxres.hxx9
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxscan.cxx15
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxsng.cxx45
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxstr.cxx44
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxuint.cxx49
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxulng.cxx41
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxvals.cxx0
-rwxr-xr-xbasic/source/sbx/sbxvalue.cxx607
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/sbxvar.cxx83
-rwxr-xr-x[-rw-r--r--]basic/source/uno/dlgcont.cxx113
-rwxr-xr-x[-rw-r--r--]basic/source/uno/makefile.mk0
-rwxr-xr-x[-rw-r--r--]basic/source/uno/modsizeexceeded.cxx5
-rwxr-xr-x[-rw-r--r--]basic/source/uno/namecont.cxx115
-rwxr-xr-x[-rw-r--r--]basic/source/uno/sbmodule.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/uno/sbmodule.hxx2
-rwxr-xr-x[-rw-r--r--]basic/source/uno/sbservices.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/uno/scriptcont.cxx33
162 files changed, 5236 insertions, 3764 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index cd3e1dd0061f..7786914f85df 100644..100755
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,20 +29,14 @@
// 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>
@@ -60,9 +55,7 @@
#include <basic/basrdll.hxx>
#include "basrid.hxx"
-#ifndef _RUNTIME_HXX
#include "runtime.hxx"
-#endif
#include "sbintern.hxx"
#ifdef _USE_UNO
@@ -81,13 +74,15 @@
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;
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+
#endif /* _USE_UNO */
IMPL_GEN_RES_STR;
@@ -161,20 +156,20 @@ void TestToolDebugMessageFilter( const sal_Char *pString, sal_Bool bIsOsl )
printf("DbgPrintMsgBox failed: %s\n", pString );
}
}
-/* DBG_INSTOUTERROR( DBG_OUT_MSGBOX )
- DBG_ERROR( pString );
- DBG_INSTOUTERROR( DBG_OUT_TESTTOOL )*/
static_bInsideFilter = sal_False;
}
+
void SAL_CALL DBG_TestToolDebugMessageFilter( const sal_Char *pString )
{
TestToolDebugMessageFilter( pString, sal_False );
}
+
extern "C" void SAL_CALL osl_TestToolDebugMessageFilter( const sal_Char *pString )
{
if ( !getenv( "DISABLE_SAL_DBGBOX" ) )
TestToolDebugMessageFilter( pString, sal_True );
}
+
#endif
// #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors
@@ -209,38 +204,18 @@ uno::Reference< XContentProviderManager > InitializeUCB( void )
}
- //////////////////////////////////////////////////////////////////////
// set global factory
setProcessServiceFactory( xSMgr );
-/* // Create simple ConfigManager
- Sequence< Any > aConfArgs(3);
- aConfArgs[0] <<= PropertyValue( OUString::createFromAscii("servertype"), 0, makeAny( OUString::createFromAscii("local") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
- aConfArgs[1] <<= PropertyValue( OUString::createFromAscii("sourcepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
- aConfArgs[2] <<= PropertyValue( OUString::createFromAscii("updatepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
-
- uno::Reference< XContentProvider > xConfProvider
- ( xSMgr->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), aConfArgs), UNO_QUERY );
-*/
-
-
// Create unconfigured Ucb:
-/* Sequence< Any > aArgs(1);
- aArgs[1] = makeAny ( xConfProvider );*/
Sequence< Any > aArgs;
::ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
uno::Reference< XContentProviderManager > xUcb =
::ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
uno::Reference< XContentProvider > xFileProvider
- ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY );
- xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True );
-
-
-/* uno::Reference< XContentProvider > xPackageProvider
- ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.PackageContentProvider" ) ), UNO_QUERY );
- xUcb->registerContentProvider( xPackageProvider, OUString::createFromAscii( "vnd.sun.star.pkg" ), sal_True );
- */
+ ( xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.FileContentProvider" )) ), UNO_QUERY );
+ xUcb->registerContentProvider( xFileProvider, OUString(RTL_CONSTASCII_USTRINGPARAM( "file" )), sal_True );
return xUcb;
}
@@ -252,17 +227,10 @@ static void ReplaceStringHookProc( UniString& rStr )
if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND )
{
rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", aTestToolName );
- /*
- rStr.SearchAndReplaceAllAscii( "%PRODUCTVERSION", rVersion );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSION", rAboutBoxVersion );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTEXTENSION", rExtension );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATNAME", rXMLFileFormatName );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATVERSION", rXMLFileFormatVersion );
- */
}
}
-void BasicApp::Main( )
+int BasicApp::Main( )
{
#ifdef DBG_UTIL
// Install filter for OSLAsserts
@@ -271,7 +239,7 @@ void BasicApp::Main( )
DBG_INSTOUTERROR( DBG_OUT_TESTTOOL );
if ( osl_setDebugMessageFunc( osl_TestToolDebugMessageFilter ) )
- DBG_ERROR("osl_setDebugMessageFunc returns non NULL pointer");
+ OSL_FAIL("osl_setDebugMessageFunc returns non NULL pointer");
#endif
ResMgr::SetReadStringHook( ReplaceStringHookProc );
@@ -289,8 +257,8 @@ void BasicApp::Main( )
DirEntry aAppFileName( GetAppFileName() );
String aAppDir ( aAppFileName.GetPath().GetFull() );
-// DirEntry aDefIniPath( Config::GetConfigName( aAppDir, CUniString("testtool") ) );
-// Do not use Config::GetConfigName here because is uses a hidden file for UNIX
+ // Do not use Config::GetConfigName here because is uses a hidden
+ // file for UNIX
DirEntry aDefIniPath( aAppDir );
ByteString aFileName;
@@ -322,31 +290,12 @@ void BasicApp::Main( )
AllSettings aSettings = GetSettings();
aSettings.SetUILanguage( aRequestedLanguage );
aSettings.SetLanguage( aRequestedLanguage );
-// International aInternational;
-// aInternational = GetSettings().GetInternational();
-// aInternational = International( aRequestedLanguage );
-// aSettings.SetInternational( aInternational );
SetSettings( aSettings );
-// aInternational = GetSettings().GetInternational();
}
-// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt ), )
-//const char* ResMgr::GetLang( LanguageType& nType, sal_uInt16 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 );
@@ -370,7 +319,6 @@ void BasicApp::Main( )
PostUserEvent( LINK( this, BasicApp, LateInit ) );
Execute();
-// delete pHelp;
delete pFrame;
RemoveAccel( pMainAccel );
@@ -390,6 +338,7 @@ void BasicApp::Main( )
InfoBox( NULL, String::CreateFromAscii( "unknown Exception not caught" ) ).Execute();
throw;
}
+ return EXIT_SUCCESS;
}
void BasicApp::LoadIniFile()
@@ -547,12 +496,10 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
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 ) );
}
@@ -625,7 +572,6 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
LoadIniFile();
UpdateTitle();
-// SetIcon( aAppIcon );
// Size: half width, 0.75 * height - 2 * IconSize
{
@@ -634,15 +580,10 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
SetWindowState( aConf.ReadKey("WinParams", "") );
}
-// pWork = new AppEdit( this, NULL );
-// pWork->Show();
-// pWork->Close();
-
aLineNum.SetTimeoutHdl( LINK( this, BasicFrame, ShowLineNr ) );
aLineNum.SetTimeout(200);
aLineNum.Start();
-
aCheckFiles.SetTimeout( 10000 );
aCheckFiles.SetTimeoutHdl( LINK( this, BasicFrame, CheckAllFiles ) );
aCheckFiles.Start();
@@ -688,17 +629,15 @@ void BasicFrame::LoadIniFile()
if ( pBasic )
pBasic->LoadIniFile();
- for ( i = 0 ; i < pList->Count() ; i++ )
- pList->GetObject( i )->LoadIniFile();
+ for ( i = 0 ; i < pList->size() ; i++ )
+ pList->at( i )->LoadIniFile();
}
BasicFrame::~BasicFrame()
{
- AppWin* p = pList->First();
- DBG_ASSERT( !p, "Still open FileWindows");
- if( p )
- while( (p = pList->Remove() ) != NULL )
- delete p;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ delete pList->at( i );
+ pList->clear();
MenuBar *pBar = GetMenuBar();
SetMenuBar( NULL );
@@ -707,8 +646,6 @@ BasicFrame::~BasicFrame()
delete pStatus;
delete pPrn;
delete pList;
-// delete pExecutionStatus;
-// delete pBasic;
pBasic.Clear();
}
@@ -762,8 +699,8 @@ IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer )
{
AppWin* pStartWin = pWork;
Window* pFocusWin = Application::GetFocusWindow();
- for ( int i = pList->Count()-1 ; i >= 0 ; i-- )
- pList->GetObject( i )->CheckReload();
+ for ( size_t i = pList->size() ; i > 0 ; )
+ pList->at( --i )->CheckReload();
if ( pWork != pStartWin )
{
@@ -810,19 +747,10 @@ void BasicFrame::Notify( SfxBroadcaster&, const SfxHint& rHint )
aTotalStatus.AppendAscii( " " );
aTotalStatus.Append( pStatusHint->GetAdditionalExecutionStatus() );
pStatus->Message( aTotalStatus );
-/* if ( !pExecutionStatus )
- pExecutionStatus = new FloatingExecutionStatus( this );
- pExecutionStatus->SetStatus( pStatusHint->GetExecutionStatus() );
- pExecutionStatus->SetAdditionalInfo( pStatusHint->GetAdditionalExecutionStatus() );*/
}
break;
case TT_EXECUTION_HIDE_ACTION:
{
-/* if ( pExecutionStatus )
- {
- delete pExecutionStatus;
- pExecutionStatus = NULL;
- }*/
}
break;
}
@@ -849,11 +777,10 @@ void BasicFrame::Resize()
// Resize possibly maximized window
- sal_uIntPtr i;
- for( i = pList->Count(); i > 0 ; i-- )
+ for( size_t i = pList->size(); i > 0 ; i-- )
{
- if ( pList->GetObject( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
- pList->GetObject( i-1 )->Maximize();
+ if ( pList->at( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
+ pList->at( i-1 )->Maximize();
}
}
@@ -873,42 +800,58 @@ void BasicFrame::GetFocus()
IMPL_LINK( BasicFrame, CloseButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->GrabFocus();
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->GrabFocus();
+ break;
+ }
+ }
return Command( RID_FILECLOSE, sal_False );
}
IMPL_LINK( BasicFrame, FloatButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ break;
+ }
+ }
return 1;
}
IMPL_LINK( BasicFrame, HideButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ break;
+ }
+ }
return 1;
}
void BasicFrame::WinShow_Hide()
{
- if ( !pList->Count() )
+ if ( pList->empty() )
return;
AppWin* p;
sal_Bool bWasFullscreen = sal_False;
- for ( p = pList->Last() ; p ; p = pList->Prev() )
+ for ( size_t i = pList->size(); i > 0; --i )
{
+ p = pList->at( i - 1 );
if ( p->pDataEdit )
{
if ( p->GetWinState() & TT_WIN_STATE_HIDE // Hidden
@@ -927,17 +870,26 @@ void BasicFrame::WinMax_Restore()
// The application buttons
AppWin* p;
sal_Bool bHasFullscreenWin = sal_False;
- for( p = pList->First(); p && !bHasFullscreenWin ; p = pList->Next() )
- bHasFullscreenWin |= ( p->GetWinState() == TT_WIN_STATE_MAX );
+ for ( size_t i = 0, n = pList->size(); i < n && !bHasFullscreenWin; ++i )
+ {
+ p = pList->at( i );
+ bHasFullscreenWin = ( p->GetWinState() == TT_WIN_STATE_MAX );
+ }
GetMenuBar()->ShowButtons( bHasFullscreenWin, sal_False, sal_False );
WinShow_Hide();
}
void BasicFrame::RemoveWindow( AppWin *pWin )
{
-// delete pIcon;
- pList->Remove( pWin );
- pWork = pList->Last();
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pWork = ( pList->empty() ) ? NULL : pList->back();
WinShow_Hide();
@@ -947,7 +899,8 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
WinMax_Restore();
Menu* pMenu = GetMenuBar();
- if( pList->Count() == 0 ) {
+ if( pList->empty() )
+ {
pMenu->EnableItem( RID_APPEDIT, sal_False );
pMenu->EnableItem( RID_APPRUN, sal_False );
pMenu->EnableItem( RID_APPWINDOW, sal_False );
@@ -966,14 +919,15 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
void BasicFrame::AddWindow( AppWin *pWin )
{
- pList->Insert( pWin, LIST_APPEND );
+ pList->push_back( pWin );
pWork = pWin;
WinMax_Restore();
// Enable main menu
MenuBar* pMenu = GetMenuBar();
- if( pList->Count() > 0 ) {
+ if( !pList->empty() )
+ {
pMenu->EnableItem( RID_APPEDIT, sal_True );
pMenu->EnableItem( RID_APPRUN, sal_True );
pMenu->EnableItem( RID_APPWINDOW, sal_True );
@@ -1011,8 +965,15 @@ void BasicFrame::WindowRenamed( AppWin *pWin )
void BasicFrame::FocusWindow( AppWin *pWin )
{
pWork = pWin;
- pList->Remove( pWin );
- pList->Insert( pWin, LIST_APPEND );
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pList->push_back( pWin );
pWin->Minimize( sal_False );
aAppFile = pWin->GetText();
@@ -1049,8 +1010,8 @@ sal_Bool BasicFrame::Close()
sal_Bool BasicFrame::CloseAll()
{
- while ( pList->Count() )
- if ( !pList->Last()->Close() )
+ while ( !pList->empty() )
+ if ( !pList->back()->Close() )
return sal_False;
return sal_True;
}
@@ -1058,8 +1019,11 @@ sal_Bool BasicFrame::CloseAll()
sal_Bool BasicFrame::CompileAll()
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
- if( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return sal_False;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ {
+ p = pList->at( i );
+ if ( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return sal_False;
+ }
return sal_True;
}
@@ -1159,10 +1123,8 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
sal_Bool bNormal = sal_Bool( !bInBreak );
pMenu->EnableItem( RID_RUNCOMPILE, bNormal );
- sal_Bool bHasEdit = sal_Bool( /*bNormal &&*/ pWork != NULL );
+ sal_Bool bHasEdit = sal_Bool( pWork != NULL );
-// pMenu->EnableItem( RID_FILENEW, bNormal ); // always possible
-// pMenu->EnableItem( RID_FILEOPEN, bNormal );
pMenu->EnableItem( RID_FILECLOSE, bHasEdit );
pMenu->EnableItem( RID_FILESAVE, bHasEdit );
pMenu->EnableItem( RID_FILESAVEAS, bHasEdit );
@@ -1176,10 +1138,10 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
sal_Bool bPrev = bHasErr & bNormal;
if( bHasErr )
{
- sal_uIntPtr n = pBasic->aErrors.GetCurPos();
+ size_t n = pBasic->GetCurrentError();
if( n == 0 )
bPrev = sal_False;
- if( sal_uInt16(n+1) == pBasic->GetErrors() )
+ if( SbError(n+1) == pBasic->GetErrors() )
bNext = sal_False;
}
pMenu->EnableItem( RID_RUNNEXTERR, bNext );
@@ -1194,20 +1156,7 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
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( sal_False );
String aString;
pStatus->Message( aString );
@@ -1341,7 +1290,6 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
AppBasEd* p = new AppBasEd( this, NULL );
p->Show();
p->GrabFocus();
- // InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
} break;
case RID_FILEOPEN:
{
@@ -1349,7 +1297,6 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, sal_False ) ) {
AddToLRU( s );
LoadFile( s );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
} break;
case RID_FILELOADLIB:
@@ -1360,7 +1307,6 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
break;
case RID_FILECLOSE:
if( pWork && pWork->Close() ){};
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
break;
case RID_FILEPRINT:
if( pWork )
@@ -1405,7 +1351,6 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
nFlags = SbDEBUG_BREAK;
goto start;
start: {
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
if ( !Basic().IsRunning() || bInBreak )
{
AppBasEd* p = NULL;
@@ -1417,7 +1362,14 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
else
{
AppWin *w = NULL;
- for ( w = pList->Last() ; w ? !w->ISA(AppBasEd) : sal_False ; w = pList->Prev() ) ;
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ if ( pList->at( i-1 )->ISA( AppBasEd ) )
+ {
+ w = pList->at( i-1 );
+ break;
+ }
+ }
if ( w )
{
p = ((AppBasEd*)w);
@@ -1444,11 +1396,9 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
p->Run();
BasicDLL::SetDebugMode( sal_False );
// If cancelled during Interactive=FALSE
-// BasicDLL::EnableBreak( sal_True );
}
}}
}
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // after run
break;
case RID_RUNCOMPILE:
if( pWork && pWork->ISA(AppBasEd) && SaveAll() )
@@ -1464,7 +1414,6 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
case RID_RUNBREAK:
if ( Basic().IsRunning() && !bInBreak )
{
-// pINST->CalcBreakCallLevel(SbDEBUG_STEPINTO);
pINST->nBreakCallLvl = pINST->nCallLvl;
}
break;
@@ -1473,11 +1422,11 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
bInBreak = sal_False;
break;
case RID_RUNNEXTERR:
- pErr = pBasic->aErrors.Next();
+ pErr = pBasic->NextError();
if( pErr ) pErr->Show();
break;
case RID_RUNPREVERR:
- pErr = pBasic->aErrors.Prev();
+ pErr = pBasic->PrevError();
if( pErr ) pErr->Show();
break;
@@ -1494,13 +1443,12 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
case RID_WINTILE:
{
WindowArrange aArange;
- for ( sal_uIntPtr i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
-
sal_Int32 nTitleHeight;
{
sal_Int32 nDummy1, nDummy2, nDummy3;
@@ -1518,10 +1466,10 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
case RID_WINTILEHORZ:
{
WindowArrange aArange;
- for ( sal_uIntPtr i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
@@ -1540,16 +1488,12 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
}
break;
case RID_WINTILEVERT:
-//#define WINDOWARRANGE_TILE 1
-//#define WINDOWARRANGE_HORZ 2
-//#define WINDOWARRANGE_VERT 3
-//#define WINDOWARRANGE_CASCADE 4
{
WindowArrange aArange;
- for ( sal_uIntPtr i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
@@ -1569,26 +1513,14 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
break;
case RID_WINCASCADE:
{
- for ( sal_uInt16 i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- pList->GetObject( i )->Cascade( i );
+ pList->at( i )->Cascade( i );
}
}
break;
-/* case RID_HELPTOPIC:
- if( pWork ) pWork->Help();
- break;
- case RID_HELPKEYS:
- aBasicApp.pHelp->Start( CUniString( "Keyboard" ) );
- break;
- case RID_HELPINDEX:
- aBasicApp.pHelp->Start( OOO_HELP_INDEX );
- break;
- case RID_HELPINTRO:
- aBasicApp.pHelp->Start( OOO_HELP_HELPONHELP );
- break;
-*/ case RID_HELPABOUT:
+ case RID_HELPABOUT:
{
SttResId aResId( IDD_ABOUT_DIALOG );
if ( Basic().pTestObject ) // Are we TestTool?
@@ -1621,14 +1553,11 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
AddToLRU( s );
LoadFile( s );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
else
{
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
if( pWork )
pWork->Command( CommandEvent( Point(), nID ) );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
}
}
return sal_True;
@@ -1637,8 +1566,9 @@ long BasicFrame::Command( short nID, sal_Bool bChecked )
sal_Bool BasicFrame::SaveAll()
{
AppWin* p, *q = pWork;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
sal_uInt16 nRes = p->QuerySave( QUERY_DISK_CHANGED );
if( (( nRes == SAVE_RES_ERROR ) && QueryBox(this,SttResId(IDS_ASKSAVEERROR)).Execute() == RET_NO )
|| ( nRes == SAVE_RES_CANCEL ) )
@@ -1657,8 +1587,9 @@ IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename )
AppBasEd* BasicFrame::FindModuleWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->ISA(AppBasEd) && ((AppBasEd*)p)->GetModName() == rName )
return ((AppBasEd*)p);
}
@@ -1668,8 +1599,9 @@ AppBasEd* BasicFrame::FindModuleWin( const String& rName )
AppError* BasicFrame::FindErrorWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->ISA(AppError) && ((AppError*)p)->GetText() == rName )
return ((AppError*)p);
}
@@ -1679,8 +1611,9 @@ AppError* BasicFrame::FindErrorWin( const String& rName )
AppWin* BasicFrame::FindWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->GetText() == rName )
return p;
}
@@ -1690,8 +1623,9 @@ AppWin* BasicFrame::FindWin( const String& rName )
AppWin* BasicFrame::FindWin( sal_uInt16 nWinId )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->GetWinId() == nWinId )
return p;
}
@@ -1701,8 +1635,9 @@ AppWin* BasicFrame::FindWin( sal_uInt16 nWinId )
AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p == pMaybeWin )
return p;
}
@@ -1711,9 +1646,9 @@ AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
IMPL_LINK( BasicFrame, WriteString, String*, pString )
{
- if ( pList->Last() )
+ if ( !pList->empty() )
{
- pList->Last()->pDataEdit->ReplaceSelected( *pString );
+ pList->back()->pDataEdit->ReplaceSelected( *pString );
return sal_True;
}
else
@@ -1753,8 +1688,6 @@ void NewFileDialog::FilterSelect()
aConf.SetGroup( aCurrentProfile );
aLastPath = UniString( aConf.ReadKey( aFilterType, aConf.ReadKey( "BaseDir" ) ), RTL_TEXTENCODING_UTF8 );
SetPath( aLastPath );
-// if ( IsInExecute() )
-// SetPath( "" );
}
short NewFileDialog::Execute()
@@ -1813,19 +1746,12 @@ sal_Bool BasicFrame::QueryFileName
aDlg.SetCurFilter( String( SttResId( IDS_BASFILTER ) ) );
aDlg.FilterSelect(); // Selects the last used path
-// if ( bSave )
if ( rName.Len() > 0 )
aDlg.SetPath( rName );
if( aDlg.Execute() )
{
rName = aDlg.GetPath();
-/* rExtension = aDlg.GetCurrentFilter();
- var i:integer;
- for ( i = 0 ; i < aDlg.GetFilterCount() ; i++ )
- if ( rExtension == aDlg.GetFilterName( i ) )
- rExtension = aDlg.GetFilterType( i );
-*/
return sal_True;
} else return sal_False;
}
@@ -1833,15 +1759,14 @@ sal_Bool BasicFrame::QueryFileName
sal_uInt16 BasicFrame::BreakHandler()
{
bInBreak = sal_True;
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
-// MenuBar aBar( ResId( RID_APPMENUBAR ) );
-// aBar.EnableItem( RID_APPEDIT, sal_False );
SetAppMode( String( SttResId ( IDS_APPMODE_BREAK ) ) );
- while( bInBreak )
+
+ while( bInBreak ) {
GetpApp()->Yield();
+ }
+
SetAppMode( String( SttResId ( IDS_APPMODE_RUN ) ) );
-// aBar.EnableItem( RID_APPEDIT, sal_True );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+
return nFlags;
}
@@ -1910,13 +1835,8 @@ String BasicFrame::GenRealString( const String &aResString )
nEnd = nEnd + aString.Len();
aString.Erase();
}
-// if ( Resource::GetResManager()->IsAvailable( ResId( aValue ) ) )
- aString = String( SttResId( (sal_uInt16)(aValue.ToInt32()) ) );
-// else
- {
-// DBG_ERROR( "Could not load resource!" );
-// return aResString;
- }
+
+ aString = String( SttResId( (sal_uInt16)(aValue.ToInt32()) ) );
nInsertPos = nStart;
nStartPos = nStart;
aResult.Erase( nStart, nEnd-nStart+1 );
@@ -1946,3 +1866,4 @@ String BasicFrame::GenRealString( const String &aResString )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index 5a501ec5efcf..983e979c5021 100644..100755
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,23 +30,17 @@
#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>
+#include <vector>
-class EditList;
class AppWin;
class AppEdit;
class AppBasEd;
@@ -55,15 +50,15 @@ class StatusLine;
class BasicPrinter;
struct TTLogMsg;
+typedef ::std::vector< AppWin* > EditList;
+
class BasicApp : public Application {
short nWait; // Wait-Zaehler
public:
-// Help* pHelp; // Hilfesystem
BasicFrame* pFrame; // Frame Window
-// MenuBar* pMainMenu; // Hauptmenue
Accelerator* pMainAccel; // Acceleratoren
- void Main( );
+ int Main( );
void LoadIniFile();
void SetFocus();
@@ -95,13 +90,13 @@ class BasicFrame : public WorkWindow, public SfxBroadcaster, public SfxListener
using SystemWindow::Notify;
using Window::Command;
-virtual sal_Bool Close();
+ virtual sal_Bool Close();
sal_Bool CloseAll(); // Close all windows
sal_Bool CompileAll(); // Compile all texts
AutoTimer aLineNum; // Show the line numbers
-virtual void Resize();
-virtual void Move();
-virtual void GetFocus();
+ virtual void Resize();
+ virtual void Move();
+ virtual void GetFocus();
void LoadLibrary();
void SaveLibrary();
sal_Bool bIsAutoRun;
@@ -194,3 +189,5 @@ public:
extern BasicApp aBasicApp;
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx
index fd7637fe26bf..4a3b94d057ec 100644..100755
--- a/basic/source/app/appbased.cxx
+++ b/basic/source/app/appbased.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,18 +29,14 @@
// 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"
@@ -59,10 +56,8 @@ AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p )
pBreakpoints->Show();
-
((TextEdit*)pDataEdit)->GetTextEditImp().pTextView->SetAutoIndentMode( sal_True );
((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetMaxTextLen( STRING_MAXLEN );
-// ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetWordDelimiters( CUniString(" ,.;:(){}[]\"'+-*/<>^\\") );
((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( sal_True );
((TextEdit*)pDataEdit)->SaveAsUTF8( sal_True );
@@ -79,10 +74,6 @@ AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p )
pBreakpoints->SetModule( pMod );
- // Define icon:
-// pIcon = new Icon( ResId( RID_WORKICON ) );
-// if( pIcon ) SetIcon( *pIcon );
-
SetText( pMod->GetName() );
pDataEdit->SetText( pMod->GetSource() );
@@ -210,7 +201,6 @@ void AppBasEd::LoadSource()
{
sal_Bool bErr;
-// if( pDataEdit->GetText().Len() != 0 ) return;
String aName = pMod->GetName();
bErr = !pDataEdit->Load( aName );
pBreakpoints->LoadBreakpoints( GetText() );
@@ -250,7 +240,7 @@ sal_Bool AppBasEd::Compile()
}
else
{
- BasicError* pErr = pFrame->Basic().aErrors.First();
+ BasicError* pErr = pFrame->Basic().FirstError();
if( pErr ) pErr->Show();
}
return bCompiled = bRes;
@@ -287,7 +277,7 @@ void AppBasEd::Run()
pMain->Run();
if (aBasicApp.pFrame)
{
- BasicError* pErr = aBasicApp.pFrame->Basic().aErrors.First();
+ BasicError* pErr = aBasicApp.pFrame->Basic().FirstError();
if( pErr )
pErr->Show();
aBasicApp.pFrame->SetAppMode( String() );
@@ -297,3 +287,4 @@ void AppBasEd::Run()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx
index ccda8ce68c69..22e9afa37bc1 100644..100755
--- a/basic/source/app/appbased.hxx
+++ b/basic/source/app/appbased.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,12 +30,8 @@
#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;
@@ -72,3 +69,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx
index 9aa06ffad38e..1cf75d13c58a 100644..100755
--- a/basic/source/app/appedit.cxx
+++ b/basic/source/app/appedit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,9 +34,7 @@
#include <svtools/texteng.hxx>
#include <svl/undo.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "basic.hrc"
#include "appedit.hxx"
@@ -53,9 +52,6 @@ AppEdit::AppEdit( BasicFrame* pParent )
pDataEdit = new TextEdit( this, WB_LEFT );
LoadIniFile();
- // define Icon:
-// pIcon = new Icon( ResId( RID_WORKICON ) );
-// if( pIcon ) SetIcon( *pIcon );
pDataEdit->SetText( aEmpty );
@@ -93,9 +89,7 @@ void AppEdit::LoadIniFile()
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 );
-// sal_uIntPtr nFontSize = aFontSize.GetValue( FUNIT_POINT );
sal_uIntPtr nFontSize = aFontSize.ToInt32();
-// aFont.SetSize( Size( nFontSize, nFontSize ) );
aFont.SetHeight( nFontSize );
#if OSL_DEBUG_LEVEL > 1
@@ -104,8 +98,6 @@ void AppEdit::LoadIniFile()
}
#endif
aFont.SetTransparent( sal_False );
-// aFont.SetAlign( ALIGN_BOTTOM );
-// aFont.SetHeight( aFont.GetHeight()+2 );
pDataEdit->SetFont( aFont );
if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() )
@@ -277,7 +269,6 @@ void AppEdit::Resize()
aStartDocPos.Y() = nMaxVisAreaStart;
pTextView->SetStartDocPos( aStartDocPos );
pTextView->ShowCursor();
-// pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
}
InitScrollBars();
if ( nVisY != pTextView->GetStartDocPos().Y() )
@@ -299,3 +290,4 @@ void AppEdit::Highlight( sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 )
ToTop();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx
index b2c71c09c454..67cb4337c6b0 100644..100755
--- a/basic/source/app/appedit.hxx
+++ b/basic/source/app/appedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
#ifndef _APPEDIT_HXX
#define _APPEDIT_HXX
-#ifndef _SCRBAR_HXX //autogen
#include <vcl/scrbar.hxx>
-#endif
#include "appwin.hxx"
#include "textedit.hxx"
@@ -68,3 +67,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx
index 03c8aebd0bbe..48781eab1767 100644..100755
--- a/basic/source/app/apperror.cxx
+++ b/basic/source/app/apperror.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#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"
@@ -113,3 +112,5 @@ void AppError::LoadIniFile()
// aFont.SetHeight( aFont.GetHeight()+2 );
pDataEdit->SetFont( aFont );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx
index 3a7028aeae4b..c55015a1964d 100644..100755
--- a/basic/source/app/apperror.hxx
+++ b/basic/source/app/apperror.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,3 +48,4 @@ public:
DirEntry aBaseDir;
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx
index 4d0a5f95fca4..984637af5178 100644..100755
--- a/basic/source/app/appwin.cxx
+++ b/basic/source/app/appwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#include "precompiled_basic.hxx"
#include <stdio.h>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <tools/fsys.hxx>
#include <svtools/stringtransfer.hxx>
@@ -227,7 +226,7 @@ long AppWin::PreNotify( NotifyEvent& rNEvt )
if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
Activate();
if ( rNEvt.GetType() == EVENT_GETFOCUS )
- if ( pFrame->pList->Last() != this )
+ if ( pFrame->pList->back() != this )
Activate();
return sal_False; // Der event soll weiter verarbeitet werden
}
@@ -391,7 +390,7 @@ sal_Bool AppWin::DiskFileChanged( sal_uInt16 nWhat )
// uncomment to avoid compiler warning
// break;
default:
- DBG_ERROR("Not Implemented in AppWin::DiskFileChanged");
+ OSL_FAIL("Not Implemented in AppWin::DiskFileChanged");
}
return sal_True;
}
@@ -416,7 +415,7 @@ void AppWin::UpdateFileInfo( sal_uInt16 nWhat )
}
break;
default:
- DBG_ERROR("Not Implemented in AppWin::UpdateFileInfo");
+ OSL_FAIL("Not Implemented in AppWin::UpdateFileInfo");
}
}
@@ -591,7 +590,7 @@ sal_uInt16 AppWin::QuerySave( QueryBits nBits )
nReturn = SAVE_RES_CANCEL;
break;
default:
- DBG_ERROR("switch default where no default should be: Internal error");
+ OSL_FAIL("switch default where no default should be: Internal error");
nReturn = SAVE_RES_CANCEL;
}
SkipReload( sal_False );
@@ -620,7 +619,7 @@ sal_Bool AppWin::Close()
// uncomment to avoid compiler warning
// break;
default:
- DBG_ERROR("Not Implemented in AppWin::Close");
+ OSL_FAIL("Not Implemented in AppWin::Close");
return sal_False;
}
}
@@ -655,3 +654,4 @@ void AppWin::Repeat()
pDataEdit->ReplaceSelected( aReplace );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx
index 928380d50df8..e5a79e042d8b 100644..100755
--- a/basic/source/app/appwin.hxx
+++ b/basic/source/app/appwin.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,14 +29,15 @@
#ifndef _APPWIN_HXX
#define _APPWIN_HXX
-//#include <sb.hxx>
#include <vcl/dockwin.hxx>
#include <tools/fsys.hxx>
#include "app.hxx"
#include "dataedit.hxx"
+#include <vector>
typedef sal_uInt16 QueryBits;
+
#define QUERY_NONE ( QueryBits ( 0x00 ) )
#define QUERY_DIRTY ( QueryBits ( 0x01 ) )
#define QUERY_DISK_CHANGED ( QueryBits ( 0x02 ) )
@@ -75,7 +77,6 @@ protected:
short nId; // ID-Nummer( "Unnamed n" )
BasicFrame* pFrame; // Parent-Window
-// Icon* pIcon; // Document icon
String aFind; // Search string
String aReplace; // Replace string
sal_Bool bFind; // sal_True if search not replace
@@ -133,6 +134,8 @@ public:
void SetWinId( sal_uInt16 nWId ) { nWinId = nWId; }
};
-DECLARE_LIST( EditList, AppWin* )
+typedef ::std::vector< AppWin* > EditList;
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/basic.hrc b/basic/source/app/basic.hrc
index e4a69d9d2942..e4a69d9d2942 100644..100755
--- a/basic/source/app/basic.hrc
+++ b/basic/source/app/basic.hrc
diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src
index 7f83ba8db2ba..28cffcbae5b7 100644..100755
--- a/basic/source/app/basic.src
+++ b/basic/source/app/basic.src
@@ -91,7 +91,7 @@ ModalDialog IDD_ABOUT_DIALOG {
FixedText {
Pos = MAP_APPFONT( 40, 60 );
Size = MAP_APPFONT( 110, 10 );
- TEXT = "®1995-2010 Oracle";
+ TEXT = "�1995-2010 Oracle";
CENTER = TRUE;
};
};
@@ -148,7 +148,7 @@ ModalDialog IDD_FIND_DIALOG {
Size = MAP_APPFONT( 185, 70 );
SVLook = TRUE;
MOVEABLE = TRUE;
- // CLOSEABLE = TRUE; // Hat cancelbutton
+ // CLOSEABLE = TRUE; // It has a cancelbutton
FixedText RID_FIXEDTEXT1 {
Pos = MAP_APPFONT( 5, 10 );
@@ -184,7 +184,7 @@ ModalDialog IDD_REPLACE_DIALOG {
Size = MAP_APPFONT( 185, 88 );
SVLook = TRUE;
MOVEABLE = TRUE;
- // CLOSEABLE = TRUE; // Hat cancelbutton
+ // CLOSEABLE = TRUE; // It has a cancelbutton
FixedText RID_FIXEDTEXT1 {
Pos = MAP_APPFONT( 5, 10 );
Size = MAP_APPFONT( 55, 10 );
@@ -652,9 +652,9 @@ Menu RID_RUN {
};
};
};
-// Wird nur beim Test Tool eingef³gt
+// This will be inserted from the Test Tool
-// unter Folgendem Name
+// under the following name
String RID_TT_EXTRAS_NAME
{
Text[ en-US ] = "E~xtra";
diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx
index 2df8df0d53fe..bd1638587c13 100644..100755
--- a/basic/source/app/basicrt.cxx
+++ b/basic/source/app/basicrt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -142,3 +143,5 @@ sal_Bool BasicRuntimeAccess::IsRunInit()
{
return GetSbData()->bRunInit;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/basmsg.hrc b/basic/source/app/basmsg.hrc
index 5f66605dc725..bfabe2c9759e 100644..100755
--- a/basic/source/app/basmsg.hrc
+++ b/basic/source/app/basmsg.hrc
@@ -27,17 +27,17 @@
#include "basic/ttglobal.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+// Here are included the messages of the folder /basic/source/app
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// 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.
+// The numbers must NEVER(!) change,
+// because they are saved in the result files and a renewed display
+// would display new strings or no strings.
///////////////////////////////
#define S_PROG_START ( BAS_START + 0 )
diff --git a/basic/source/app/basmsg.src b/basic/source/app/basmsg.src
index 6de25e82a170..e2179afd4c34 100644..100755
--- a/basic/source/app/basmsg.src
+++ b/basic/source/app/basmsg.src
@@ -27,18 +27,19 @@
#include "basmsg.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+// Here are included the messages of the folder /basic/source/app
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// 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.
+// The numbers must NEVER(!) change,
+// because they are saved in the result files and a renewed display
+// would display new strings or no strings.
///////////////////////////////
+
String S_PROG_START
{
Text[ en-US ] = "Program start: ($Arg1); ($Arg2)";
diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx
index e7687222d5da..134c5194b7aa 100644..100755
--- a/basic/source/app/brkpnts.cxx
+++ b/basic/source/app/brkpnts.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +28,6 @@
// 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>
@@ -37,9 +37,7 @@
#include <tools/config.hxx>
#include <vcl/gradient.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "brkpnts.hxx"
#include "basic.hrc"
@@ -48,15 +46,12 @@
struct Breakpoint
{
- sal_uInt16 nLine;
-
- Breakpoint( sal_uInt16 nL ) { nLine = nL; }
+ sal_uInt32 nLine;
+ Breakpoint( sal_uInt32 nL ) { nLine = nL; }
};
-
ImageList* BreakpointWindow::pImages = NULL;
-
BreakpointWindow::BreakpointWindow( Window *pParent )
: Window( pParent )
, nCurYOffset( 0 )
@@ -76,13 +71,9 @@ BreakpointWindow::BreakpointWindow( Window *pParent )
void BreakpointWindow::Reset()
{
- Breakpoint* pBrk = First();
- while ( pBrk )
- {
- delete pBrk;
- pBrk = Next();
- }
- Clear();
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
+ delete BreakpointList[ i ];
+ BreakpointList.clear();
pModule->ClearAllBP();
}
@@ -103,14 +94,13 @@ void BreakpointWindow::SetBPsInModule()
{
pModule->ClearAllBP();
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
+ Breakpoint* pBrk = BreakpointList[ i ];
pModule->SetBP( (sal_uInt16)pBrk->nLine );
#if OSL_DEBUG_LEVEL > 1
- DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (USHORT)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
+ DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (sal_uInt16)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
#endif
- pBrk = Next();
}
for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ )
{
@@ -121,27 +111,30 @@ void BreakpointWindow::SetBPsInModule()
}
-void BreakpointWindow::InsertBreakpoint( sal_uInt16 nLine )
+void BreakpointWindow::InsertBreakpoint( sal_uInt32 nLine )
{
Breakpoint* pNewBrk = new Breakpoint( nLine );
- Breakpoint* pBrk = First();
- while ( pBrk )
+
+ for ( ::std::vector< Breakpoint* >::iterator i = BreakpointList.begin();
+ i < BreakpointList.end();
+ ++ i
+ )
{
+ Breakpoint* pBrk = *i;
if ( nLine <= pBrk->nLine )
{
- if ( pBrk->nLine != nLine )
- Insert( pNewBrk );
+ if ( nLine != pBrk->nLine )
+ BreakpointList.insert( i, pNewBrk );
else
delete pNewBrk;
pNewBrk = NULL;
- pBrk = NULL;
+ break;
}
- else
- pBrk = Next();
}
+
// No insert position found => LIST_APPEND
if ( pNewBrk )
- Insert( pNewBrk, LIST_APPEND );
+ BreakpointList.push_back( pNewBrk );
Invalidate();
@@ -166,35 +159,34 @@ void BreakpointWindow::InsertBreakpoint( sal_uInt16 nLine )
}
-Breakpoint* BreakpointWindow::FindBreakpoint( sal_uIntPtr nLine )
+Breakpoint* BreakpointWindow::FindBreakpoint( sal_uInt32 nLine )
{
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- if ( pBrk->nLine == nLine )
- return pBrk;
-
- pBrk = Next();
+ Breakpoint* pBP = BreakpointList[ i ];
+ if ( pBP->nLine == nLine )
+ return pBP;
}
-
- return (Breakpoint*)0;
+ return NULL;
}
-void BreakpointWindow::AdjustBreakpoints( sal_uIntPtr nLine, sal_Bool bInserted )
+void BreakpointWindow::AdjustBreakpoints( sal_uInt32 nLine, bool bInserted )
{
if ( nLine == 0 ) //TODO: nLine == TEXT_PARA_ALL+1
return;
- Breakpoint* pBrk = First();
- while ( pBrk )
+
+ for ( size_t i = 0; i < BreakpointList.size(); )
{
- sal_Bool bDelBrk = sal_False;
+ Breakpoint* pBrk = BreakpointList[ i ];
+ bool bDelBrk = false;
+
if ( pBrk->nLine == nLine )
{
if ( bInserted )
pBrk->nLine++;
else
- bDelBrk = sal_True;
+ bDelBrk = true;
}
else if ( pBrk->nLine > nLine )
{
@@ -203,18 +195,19 @@ void BreakpointWindow::AdjustBreakpoints( sal_uIntPtr nLine, sal_Bool bInserted
else
pBrk->nLine--;
}
-
if ( bDelBrk )
{
- sal_uIntPtr n = GetCurPos();
- delete Remove( pBrk );
- pBrk = Seek( n );
+ delete pBrk;
+ ::std::vector< Breakpoint* >::iterator it = BreakpointList.begin();
+ ::std::advance( it, i );
+ BreakpointList.erase( it );
}
else
{
- pBrk = Next();
+ ++i;
}
}
+
Invalidate();
}
@@ -241,14 +234,12 @@ void BreakpointWindow::SaveBreakpoints( String aFilename )
{
ByteString aBreakpoints;
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
+ Breakpoint* pBrk = BreakpointList[ i ];
if ( aBreakpoints.Len() )
aBreakpoints += ';';
-
aBreakpoints += ByteString::CreateFromInt32( pBrk->nLine );
- pBrk = Next();
}
Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
@@ -274,16 +265,15 @@ void BreakpointWindow::Paint( const Rectangle& )
aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2;
aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2;
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
+ Breakpoint* pBrk = BreakpointList[ i ];
#if OSL_DEBUG_LEVEL > 1
DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
#endif
- sal_uIntPtr nLine = pBrk->nLine-1;
- sal_uIntPtr nY = nLine*nLineHeight - nCurYOffset;
+ sal_Int32 nLine = pBrk->nLine-1;
+ sal_Int32 nY = nLine*nLineHeight - nCurYOffset;
DrawImage( Point( 0, nY ) + aBmpOff, aBrk );
- pBrk = Next();
}
ShowMarker( sal_True );
}
@@ -291,39 +281,46 @@ void BreakpointWindow::Paint( const Rectangle& )
Breakpoint* BreakpointWindow::FindBreakpoint( const Point& rMousePos )
{
- long nLineHeight = GetTextHeight();
- long nYPos = rMousePos.Y() + nCurYOffset;
+ sal_Int32 nLineHeight = GetTextHeight();
+ sal_Int32 nYPos = rMousePos.Y() + nCurYOffset;
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- sal_uIntPtr nLine = pBrk->nLine-1;
- long nY = nLine*nLineHeight;
+ Breakpoint* pBrk = BreakpointList[ i ];
+ sal_Int32 nLine = pBrk->nLine-1;
+ sal_Int32 nY = nLine * nLineHeight;
if ( ( nYPos > nY ) && ( nYPos < ( nY + nLineHeight ) ) )
return pBrk;
- pBrk = Next();
}
- return 0;
+ return NULL;
}
-void BreakpointWindow::ToggleBreakpoint( sal_uInt16 nLine )
+void BreakpointWindow::ToggleBreakpoint( sal_uInt32 nLine )
{
- Breakpoint* pBrk = FindBreakpoint( nLine );
- if ( pBrk ) // remove
+ bool Removed = false;
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- pModule->ClearBP( nLine );
- delete Remove( pBrk );
+ Breakpoint* pBP = BreakpointList[ i ];
+ if ( pBP->nLine == nLine ) // remove
+ {
+ pModule->ClearBP( nLine );
+ delete pBP;
+ ::std::vector< Breakpoint* >::iterator it = BreakpointList.begin();
+ ::std::advance( it, i );
+ BreakpointList.erase( it );
+ Removed = true;
+ break;
+ }
}
- else // create one
- {
+
+ if ( !Removed ) // create one
InsertBreakpoint( nLine );
- }
Invalidate();
}
-void BreakpointWindow::ShowMarker( sal_Bool bShow )
+void BreakpointWindow::ShowMarker( bool bShow )
{
if ( nMarkerPos == MARKER_NOMARKER )
return;
@@ -367,12 +364,12 @@ void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt )
}
-void BreakpointWindow::SetMarkerPos( sal_uInt16 nLine, sal_Bool bError )
+void BreakpointWindow::SetMarkerPos( sal_uInt32 nLine, bool bError )
{
- ShowMarker( sal_False ); // Remove old one
+ ShowMarker( false ); // Remove old one
nMarkerPos = nLine;
bErrorMarker = bError;
- ShowMarker( sal_True ); // Draw new one
+ ShowMarker( true ); // Draw new one
Update();
}
@@ -384,3 +381,4 @@ void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nF
Window::Scroll( nHorzScroll, nVertScroll );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx
index 64d5c0a9d0d7..0ea0fc9b45ad 100644..100755
--- a/basic/source/app/brkpnts.hxx
+++ b/basic/source/app/brkpnts.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,18 +27,15 @@
************************************************************************/
#include <vcl/window.hxx>
+#include <vector>
#define MARKER_NOMARKER 0xFFFF
-
class SbModule;
-class BreakpointListe;
struct Breakpoint;
class ImageList;
-DECLARE_LIST( BreakpointList, Breakpoint* )
-
-class BreakpointWindow : public Window, public BreakpointList
+class BreakpointWindow : public Window
{
using Window::Scroll;
@@ -50,45 +48,32 @@ public:
void SetModule( SbModule *pMod );
void SetBPsInModule();
- void InsertBreakpoint( sal_uInt16 nLine );
- void ToggleBreakpoint( sal_uInt16 nLine );
- void AdjustBreakpoints( sal_uIntPtr nLine, sal_Bool bInserted );
+ void InsertBreakpoint( sal_uInt32 nLine );
+ void ToggleBreakpoint( sal_uInt32 nLine );
+ void AdjustBreakpoints( sal_uInt32 nLine, bool bInserted );
void LoadBreakpoints( String aFilename );
void SaveBreakpoints( String aFilename );
-protected:
- Breakpoint* FindBreakpoint( sal_uIntPtr nLine );
-
private:
- long nCurYOffset;
- sal_uInt16 nMarkerPos;
- SbModule* pModule;
- sal_Bool bErrorMarker;
- static ImageList *pImages;
+ ::std::vector< Breakpoint* > BreakpointList;
+ long nCurYOffset;
+ sal_uInt32 nMarkerPos;
+ SbModule* pModule;
+ bool bErrorMarker;
+ static ImageList* pImages;
protected:
virtual void Paint( const Rectangle& );
Breakpoint* FindBreakpoint( const Point& rMousePos );
- void ShowMarker( sal_Bool bShow );
+ Breakpoint* FindBreakpoint( sal_uInt32 nLine );
+ void ShowMarker( bool bShow );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
public:
-
-// void SetModulWindow( ModulWindow* pWin )
-// { pModulWindow = pWin; }
-
- void SetMarkerPos( sal_uInt16 nLine, sal_Bool bErrorMarker = sal_False );
-
- virtual void Scroll( long nHorzScroll, long nVertScroll,
- sal_uInt16 nFlags = 0 );
+ void SetMarkerPos( sal_uInt32 nLine, bool bErrorMarker = false );
+ virtual void Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags = 0 );
long& GetCurYOffset() { return nCurYOffset; }
};
-
-
-
-
-
-
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx
index 29148bc79919..60ab6626a85f 100644..100755
--- a/basic/source/app/dataedit.hxx
+++ b/basic/source/app/dataedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -114,3 +115,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx
index 85f09b6b6cd0..dc8a57516b20 100644..100755
--- a/basic/source/app/dialogs.cxx
+++ b/basic/source/app/dialogs.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,36 +33,22 @@
#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>
@@ -314,7 +301,7 @@ IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl )
case RID_TP_FON:
pNewTabPage = new FontOptions( pTabCtrl, aConfig );
break;
- default: DBG_ERROR( "PageHdl: Unbekannte ID!" );
+ default: OSL_FAIL( "PageHdl: Unbekannte ID!" );
}
DBG_ASSERT( pNewTabPage, "Keine Page!" );
pTabCtrl->SetTabPage( nId, pNewTabPage );
@@ -805,7 +792,7 @@ StringList* GenericOptions::GetAllGroups()
for ( sal_uInt16 i = 0 ; i < aConf.GetGroupCount() ; i++ )
{
String *pGroup = new String( aConf.GetGroupName( i ), RTL_TEXTENCODING_UTF8 );
- pGroups->Insert( pGroup );
+ pGroups->push_back( pGroup );
}
return pGroups;
}
@@ -813,31 +800,29 @@ StringList* GenericOptions::GetAllGroups()
void GenericOptions::LoadData()
{
StringList* pGroups = GetAllGroups();
- String* pGroup;
- while ( (pGroup = pGroups->First()) != NULL )
+ for ( size_t i = 0, n = pGroups->size(); i < n; ++i )
{
- pGroups->Remove( pGroup );
+ String* pGroup = pGroups->at( i );
aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) );
if ( aConf.ReadKey( C_KEY_AKTUELL ).Len() > 0 )
- {
aCbArea.InsertEntry( *pGroup );
- }
delete pGroup;
}
+ pGroups->clear();
delete pGroups;
- aCbArea.SetText( aCbArea.GetEntry( 0 ) );
+ 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 )
+void GenericOptions::ShowSelectPath( const String &rType )
{
Point aNPos = aPbNewValue.GetPosPixel();
Point aDPos = aPbDelValue.GetPosPixel();
long nDelta = aDPos.Y() - aNPos.Y();
- if ( aType.EqualsIgnoreCaseAscii( "PATH" ) && !bShowSelectPath )
+ if ( rType.EqualsIgnoreCaseAscii( "PATH" ) && !bShowSelectPath )
{ // Show Path button
nMoveButtons += nDelta;
aMoveTimer.Start();
@@ -845,7 +830,7 @@ void GenericOptions::ShowSelectPath( const String aType )
aPbSelectPath.Show( sal_True );
aPbSelectPath.Enable( sal_True );
}
- else if ( !aType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath )
+ else if ( !rType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath )
{ // Hide Path button
nMoveButtons -= nDelta;
aMoveTimer.Start();
@@ -1199,8 +1184,6 @@ void DisplayHidDlg::AddData( WinInfoRec* pWinInfo )
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;
}
@@ -1505,3 +1488,4 @@ SvNumberformat::
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx
index e0a2409ad937..108aaa5de062 100644..100755
--- a/basic/source/app/dialogs.hxx
+++ b/basic/source/app/dialogs.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,37 +29,25 @@
#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>
+#include <vector>
class SbxVariable;
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
class AboutDialog : public ModalDialog {
FixedText a1,a4,aVersionString;
@@ -250,8 +239,7 @@ public:
void Save( Config &aConfig );
};
-
-DECLARE_LIST( StringList, String * )
+typedef ::std::vector< String* > StringList;
#define C_KEY_ALLE CByteString("All")
#define C_KEY_AKTUELL CByteString("Current")
#define C_KEY_TYPE CByteString("Type")
@@ -284,7 +272,7 @@ class GenericOptions : public TabPage
StringList* GetAllGroups();
void LoadData();
- void ShowSelectPath( const String aType );
+ void ShowSelectPath( const String& rType );
DECL_LINK( LoadGroup, ComboBox* );
DECL_LINK( DelGroup, Button* );
@@ -360,12 +348,11 @@ protected:
DECL_LINK( OKClick, Button * );
-// sal_Bool bCompare = sal_False;
-// String aCompareString;
-
public:
VarEditDialog( Window * pParent, SbxVariable *pPVar );
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk
index 07ceed6e5116..e62b11c0beb4 100644..100755
--- a/basic/source/app/makefile.mk
+++ b/basic/source/app/makefile.mk
@@ -38,32 +38,21 @@ LIBTARGET = NO
# --- 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)$/printer.obj \
- $(OBJ)$/process.obj
-
-.IF "$(GUI)" == "WNT"
-EXCEPTIONSFILES += \
- $(OBJ)$/process.obj
-.ENDIF
+ $(OBJ)$/app.obj \
+ $(OBJ)$/appbased.obj \
+ $(OBJ)$/appedit.obj \
+ $(OBJ)$/apperror.obj \
+ $(OBJ)$/appwin.obj \
+ $(OBJ)$/basicrt.obj \
+ $(OBJ)$/brkpnts.obj \
+ $(OBJ)$/dialogs.obj \
+ $(OBJ)$/msgedit.obj \
+ $(OBJ)$/mybasic.obj \
+ $(OBJ)$/printer.obj \
+ $(OBJ)$/process.obj \
+ $(OBJ)$/status.obj \
+ $(OBJ)$/textedit.obj
SRS1NAME=$(TARGET)
SRC1FILES = \
@@ -76,21 +65,8 @@ SRC1FILES = \
LIB1TARGET=$(LB)$/app.lib
LIB1ARCHIV=$(LB)$/libapp.a
LIB1OBJFILES = \
- $(OBJ)$/basicrt.obj \
+ $(EXCEPTIONSFILES) \
$(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 ------------------------------------------------------------
diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx
index 21febe8b3393..1ebc24d560a0 100644..100755
--- a/basic/source/app/msgedit.cxx
+++ b/basic/source/app/msgedit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,18 +38,12 @@ 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"
@@ -172,7 +167,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg )
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");
+ default:OSL_FAIL("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust");
}
if ( !bFileLoading )
@@ -217,7 +212,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg )
// restore Original Msg
LogMsg->aDebugData.aMsg = aOriginalMsg;
- printf( ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ printf( "%s", ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
}
}
}
@@ -491,7 +486,7 @@ String MsgEdit::Impl_MakeText( SvLBoxEntry *pEntry ) const
case LOG_ASSERTION: break;
case LOG_ASSERTION_STACK:aRet.AppendAscii("--> "); break;
case LOG_QA_ERROR: break;
- default:DBG_ERROR("Unknown type in ResultWindow!");
+ default:OSL_FAIL("Unknown type in ResultWindow!");
}
aRet += aEditTree.GetEntryText( pEntry );
return aRet;
@@ -548,10 +543,9 @@ String MsgEdit::GetSelected()
TextSelection MsgEdit::GetSelection() const
{
- sal_uIntPtr nStart=0,nEnd=0;
-
if ( aEditTree.FirstSelected() )
{
+ sal_uIntPtr nStart=0,nEnd=0;
nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() );
if ( aEditTree.LastSelected() )
nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() );
@@ -590,7 +584,7 @@ void MsgEdit::ReplaceSelected( const String& rStr )
{
(void) rStr; /* avoid warning about unused parameter */
Sound::Beep();
- DBG_ERROR("Not Implemented");
+ OSL_FAIL("Not Implemented");
}
sal_Bool MsgEdit::IsModified(){ return bModified; }
@@ -614,7 +608,7 @@ void MsgEdit::SetText( const String& rStr )
{
(void) rStr; /* avoid warning about unused parameter */
Sound::Beep();
- DBG_ERROR("Not Implemented");
+ OSL_FAIL("Not Implemented");
}
sal_Bool MsgEdit::HasText() const
@@ -846,7 +840,7 @@ void TTTreeListBox::SelectHdl()
SelectChildren( pHdlEntry, sal_True );
Select( pHdlEntry, sal_True );
-// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
+// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // so that delete works correct
}
void TTTreeListBox::DeselectHdl()
@@ -922,7 +916,7 @@ TTFeatures TTTreeListBox::GetFeatures( SvLBoxEntry* pEntry )
case LOG_QA_ERROR:
return HasQAError;
default:
- DBG_ERROR("Unknown type in ResultWindow");
+ OSL_FAIL("Unknown type in ResultWindow");
}
return HasNothing;
}
@@ -953,7 +947,7 @@ void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
if ( ( aFeatures & HasError ) == HasError )
aCol = Color( 255, 130, 130 ); // Red
else if ( ( aFeatures & HasWarning ) == HasWarning )
- aCol = Color( 255, 200, 120 ); // Ocker oder so
+ aCol = Color( 255, 200, 120 ); // Ochre or so
else if ( ( aFeatures & HasAssertion ) == HasAssertion )
aCol = Color( 0xd0, 0xd0, 0xff ); // blueish
else
@@ -997,3 +991,4 @@ void TTTreeListBox::InitEntry(SvLBoxEntry* pEntry,
pEntry->ReplaceItem( pStr, nColToHilite );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx
index c3e4d6413db4..442ff3034c19 100644..100755
--- a/basic/source/app/msgedit.hxx
+++ b/basic/source/app/msgedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,7 +36,7 @@
class BasicFrame;
class AppError;
-#define SelectChildren SelectChilds // Sonst wird mir schlecht
+#define SelectChildren SelectChilds
typedef sal_uInt16 TTFeatures; // Bitfield for features of the entries
#define HasNothing TTFeatures(0x00)
@@ -112,3 +113,5 @@ DATA_FUNC_DEF( aEditTree, TTTreeListBox )
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx
index 791c267cda44..9e2a32fe751f 100644..100755
--- a/basic/source/app/mybasic.cxx
+++ b/basic/source/app/mybasic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,26 +29,20 @@
// 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"
@@ -84,6 +79,7 @@ SbxBase* MyFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCr )
MyBasic::MyBasic() : StarBASIC()
{
nError = 0;
+ CurrentError = 0;
if( !nInst++ )
{
AddFactory( &aFac1 );
@@ -166,7 +162,7 @@ SbTextType MyBasic::GetSymbolType( const String &rSymbol, sal_Bool bWasTTControl
MyBasic::~MyBasic()
{
- aErrors.Clear();
+ Reset();
if( !--nInst )
{
RemoveFactory( &aFac1 );
@@ -177,8 +173,10 @@ MyBasic::~MyBasic()
void MyBasic::Reset()
{
- aErrors.Clear();
+ for ( size_t i = 0, n = aErrors.size(); i < n; ++i ) delete aErrors[ i ];
+ aErrors.clear();
nError = 0;
+ CurrentError = 0;
}
sal_Bool MyBasic::Compile( SbModule* p )
@@ -187,6 +185,36 @@ sal_Bool MyBasic::Compile( SbModule* p )
return StarBASIC::Compile( p );
}
+BasicError* MyBasic::NextError()
+{
+ if ( CurrentError < ( aErrors.size() - 1 ) )
+ {
+ ++CurrentError;
+ return aErrors[ CurrentError ];
+ }
+ return NULL;
+}
+
+BasicError* MyBasic::PrevError()
+{
+ if ( !aErrors.empty() && CurrentError > 0 )
+ {
+ --CurrentError;
+ return aErrors[ CurrentError ];
+ }
+ return NULL;
+}
+
+BasicError* MyBasic::FirstError()
+{
+ if ( !aErrors.empty() )
+ {
+ CurrentError = 0;
+ return aErrors[ CurrentError ];
+ }
+ return NULL;
+}
+
sal_Bool MyBasic::ErrorHdl()
{
AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() );
@@ -198,12 +226,13 @@ sal_Bool MyBasic::ErrorHdl()
pWin->ToTop();
if( IsCompilerError() )
{
- aErrors.Insert(
+ aErrors.push_back(
new BasicError
( pWin,
- 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ),
- LIST_APPEND );
+ 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() )
+ );
nError++;
+ CurrentError = aErrors.size() - 1;
return sal_Bool( nError < 20 ); // Cancel after 20 errors
}
else
@@ -302,3 +331,4 @@ void BasicError::Show()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx
index 8e89f5d90c03..675aeed2c7e0 100644..100755
--- a/basic/source/app/printer.cxx
+++ b/basic/source/app/printer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,21 +29,11 @@
// 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>
@@ -120,3 +111,4 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame *
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx
index 505835278234..b884a642e76f 100644..100755
--- a/basic/source/app/printer.hxx
+++ b/basic/source/app/printer.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,13 +37,13 @@ class BasicPrinter
boost::shared_ptr<Printer> mpPrinter;
boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
- short nLine; // aktuelle Zeile
- short nPage; // aktuelle Seite
- short nLines; // Zeilen pro Seite
- short nYoff; // Zeilenabstand in Points
- String aFile; // Dateiname
+ short nLine; // current row
+ short nPage; // current page
+ short nLines; // lines per page
+ short nYoff; // line spacing in points
+ String aFile; // file name
- void Header(); // Seitenkopf drucken
+ void Header(); // print page header
void StartPage();
public:
BasicPrinter();
@@ -50,3 +51,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx
index 703f684b38de..02d27e3a7ba6 100644..100755
--- a/basic/source/app/process.cxx
+++ b/basic/source/app/process.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,51 +31,60 @@
#ifdef WNT
-#include <tools/prewin.h>
-#include "winbase.h"
-#include <tools/postwin.h>
+#include <prewin.h>
+#include <postwin.h>
#endif
#include <tools/errcode.hxx>
-#include <vos/process.hxx>
#include <basic/sbxcore.hxx>
#include <tools/string.hxx>
#include <osl/file.hxx>
+#include <osl/process.h>
-#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 )
+: m_nArgumentCount( 0 )
+, m_pArgumentList( NULL )
+, m_nEnvCount( 0 )
+, m_pEnvList( NULL )
+, m_aProcessName()
, bWasGPF( sal_False )
, bHasBeenStarted( sal_False )
+, m_pProcess( NULL )
{
}
+#define FREE_USTRING_LIST( count, list ) \
+ if ( count && list ) \
+ { \
+ for ( unsigned int i = 0; i < count; ++i ) \
+ { \
+ rtl_uString_release( list[i] ); \
+ list[i] = NULL; \
+ } \
+ delete[] list; \
+ } \
+ count = 0; \
+ list = NULL;
+
Process::~Process()
{
-// delete pArgumentList;
-// delete pEnvList;
- delete pProcess;
+ FREE_USTRING_LIST( m_nArgumentCount, m_pArgumentList );
+ FREE_USTRING_LIST( m_nEnvCount, m_pEnvList );
+ if ( m_pProcess )
+ osl_freeProcessHandle( m_pProcess );
}
sal_Bool Process::ImplIsRunning()
{
- if ( pProcess && bHasBeenStarted )
+ if ( m_pProcess && bHasBeenStarted )
{
- vos::OProcess::TProcessInfo aProcessInfo;
- pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
- if ( !(aProcessInfo.Fields & vos::OProcess::TData_ExitCode) )
+ oslProcessInfo aProcessInfo;
+ aProcessInfo.Size = sizeof(oslProcessInfo);
+ osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo );
+ if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) )
return sal_True;
else
return sal_False;
@@ -85,11 +95,12 @@ sal_Bool Process::ImplIsRunning()
long Process::ImplGetExitCode()
{
- if ( pProcess )
+ if ( m_pProcess )
{
- vos::OProcess::TProcessInfo aProcessInfo;
- pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
- if ( !(aProcessInfo.Fields & vos::OProcess::TData_ExitCode) )
+ oslProcessInfo aProcessInfo;
+ aProcessInfo.Size = sizeof(oslProcessInfo);
+ osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo );
+ if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) )
SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
return aProcessInfo.Code;
}
@@ -103,13 +114,14 @@ long Process::ImplGetExitCode()
void Process::SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv )
{ // Set image file of executable
- if ( pProcess && ImplIsRunning() )
+ if ( m_pProcess && ImplIsRunning() )
SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
else
{
- delete pArgumentList; pArgumentList = NULL;
- delete pEnvList; pEnvList = NULL;
- delete pProcess; pProcess = NULL;
+ FREE_USTRING_LIST( m_nArgumentCount, m_pArgumentList );
+ FREE_USTRING_LIST( m_nEnvCount, m_pEnvList );
+ osl_freeProcessHandle( m_pProcess );
+ m_pProcess = NULL;
xub_StrLen i, nCount = aAppParams.GetQuotedTokenCount( CUniString("\"\"" ), ' ' );
::rtl::OUString *pParamList = new ::rtl::OUString[nCount];
@@ -124,67 +136,65 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
nParamCount++;
}
}
- pArgumentList = new vos::OArgumentList( pParamList, nCount );
-
+ m_nArgumentCount = nParamCount;
+ m_pArgumentList = new rtl_uString*[m_nArgumentCount];
+ for ( i = 0 ; i < m_nArgumentCount ; i++ )
+ {
+ m_pArgumentList[i] = NULL;
+ rtl_uString_assign( &(m_pArgumentList[i]), pParamList[i].pData );
+ }
+ delete [] pParamList;
- ::rtl::OUString *pEnvArray = NULL;
if ( pEnv )
{
- pEnvArray = new ::rtl::OUString[pEnv->size()];
+ m_pEnvList = new rtl_uString*[pEnv->size()];
- xub_StrLen nEnvCount = 0;
+ m_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(RTL_CONSTASCII_USTRINGPARAM( "=" ));
aTemp += ::rtl::OUString( (*aIter).second );
- pEnvArray[nEnvCount] = aTemp;
- nEnvCount++;
- aIter++;
+ m_pEnvList[m_nEnvCount] = NULL;
+ rtl_uString_assign( &(m_pEnvList[m_nEnvCount]), aTemp.pData );
+ ++m_nEnvCount;
+ ++aIter;
}
- pEnvList = new vos::OEnvironment( pEnvArray, nEnvCount );
}
::rtl::OUString aNormalizedAppPath;
osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath );
- pProcess = new vos::OProcess( aNormalizedAppPath );
+ m_aProcessName = aNormalizedAppPath;;
bHasBeenStarted = sal_False;
- delete [] pParamList;
- delete [] pEnvArray;
}
}
sal_Bool Process::Start()
{ // Start program
sal_Bool bSuccess=sal_False;
- if ( pProcess && !ImplIsRunning() )
+ if ( m_aProcessName.getLength() && !ImplIsRunning() )
{
bWasGPF = sal_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( (vos::OProcess::TProcessOption)
- ( vos::OProcess::TOption_SearchPath
- /*| vos::OProcess::TOption_Detached*/
- /*| vos::OProcess::TOption_Wait*/ ),
- *pArgumentList,
- *pEnvList ) == vos::OProcess::E_None;
- }
- else
- {
- bSuccess = pProcess->execute( (vos::OProcess::TProcessOption)
- ( vos::OProcess::TOption_SearchPath
- /*| vos::OProcess::TOption_Detached*/
- /*| vos::OProcess::TOption_Wait*/ ),
- *pArgumentList ) == vos::OProcess::E_None;
- }
+ bSuccess = osl_executeProcess(
+ m_aProcessName.pData,
+ m_pArgumentList,
+ m_nArgumentCount,
+ osl_Process_SEARCHPATH
+ /*| osl_Process_DETACHED*/
+ /*| osl_Process_WAIT*/,
+ NULL,
+ NULL,
+ m_pEnvList,
+ m_nEnvCount,
+ &m_pProcess ) == osl_Process_E_None;
+
#ifdef WNT
}
catch( ... )
@@ -223,7 +233,8 @@ sal_Bool Process::WasGPF()
sal_Bool Process::Terminate()
{
if ( ImplIsRunning() )
- return pProcess->terminate() == vos::OProcess::E_None;
+ return osl_terminateProcess(m_pProcess) == osl_Process_E_None;
return sal_True;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx
index 0abf5afc0d57..4bf428b6a0ac 100644..100755
--- a/basic/source/app/processw.cxx
+++ b/basic/source/app/processw.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,14 +33,9 @@
#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"
@@ -204,8 +200,7 @@ void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
SbxInfo* ProcessWrapper::GetInfo( short nIdx )
{
Methods* p = &pMethods[ nIdx ];
- // Wenn mal eine Hilfedatei zur Verfuegung steht:
- // SbxInfo* pResultInfo = new SbxInfo( Hilfedateiname, p->nHelpId );
+ // In case there is a help file available:
SbxInfo* pResultInfo = new SbxInfo;
short nPar = p->nArgs & _ARGSMASK;
for( short i = 0; i < nPar; i++ )
@@ -280,3 +275,4 @@ SbxObject* ProcessFactory::CreateObject( const String& rClass )
return NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx
index 69f6eb73a793..f5d60b8d783c 100644..100755
--- a/basic/source/app/processw.hxx
+++ b/basic/source/app/processw.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#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>
@@ -40,12 +39,12 @@ 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 )
+#if defined ( ICC ) || defined ( C50 ) || defined ( C52 )
public:
#endif
typedef void( ProcessWrapper::*pMeth )
( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite );
-#if defined ( ICC ) || defined ( HPUX )
+#if defined ( ICC )
private:
#endif
@@ -88,3 +87,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/resids.hrc b/basic/source/app/resids.hrc
index 5d3fbb098dde..5d3fbb098dde 100644..100755
--- a/basic/source/app/resids.hrc
+++ b/basic/source/app/resids.hrc
diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx
index beb43ec1de18..f545538a84bd 100644..100755
--- a/basic/source/app/status.cxx
+++ b/basic/source/app/status.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -112,7 +113,7 @@ void StatusLine::LoadTaskToolBox()
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 ) );
+ pTaskToolBox->UpdateTask( Image(), pWin->GetText(), pWin == pFrame->pList->back() && !( pFrame->pList->back()->GetWinState() & TT_WIN_STATE_HIDE ) );
nFirstWinPos++;
}
@@ -123,3 +124,4 @@ void StatusLine::LoadTaskToolBox()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx
index fd9ab033009e..7c3b04bed8cc 100644..100755
--- a/basic/source/app/status.hxx
+++ b/basic/source/app/status.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,3 +53,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src
index 748256bb5564..365f5f3d4ee6 100644..100755
--- a/basic/source/app/svtmsg.src
+++ b/basic/source/app/svtmsg.src
@@ -27,17 +27,17 @@
#include "basic/svtmsg.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+// Here are included the messages of the folder /basic/source/app
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// 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.
+// The numbers must NEVER(!) change,
+// because they are saved in the result files and a renewed display
+// would display new strings or no strings.
///////////////////////////////
String S_GPF_ABORT
{
diff --git a/basic/source/app/testbasi.cxx b/basic/source/app/testbasi.cxx
index b63986b63b2d..05818806c8a8 100644..100755
--- a/basic/source/app/testbasi.cxx
+++ b/basic/source/app/testbasi.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,3 +30,5 @@
#include "precompiled_basic.hxx"
#define testtool
#include "mybasic.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/testtool.idl b/basic/source/app/testtool.idl
index acda657881c7..acda657881c7 100644..100755
--- a/basic/source/app/testtool.idl
+++ b/basic/source/app/testtool.idl
diff --git a/basic/source/app/testtool.src b/basic/source/app/testtool.src
index 090cb735c139..090cb735c139 100644..100755
--- a/basic/source/app/testtool.src
+++ b/basic/source/app/testtool.src
diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx
index 55e91ea879b5..4ffbef7121f8 100644..100755
--- a/basic/source/app/textedit.cxx
+++ b/basic/source/app/textedit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,9 +33,7 @@
#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"
@@ -199,10 +198,10 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
return;
SbTextPortion& rLast = aPortionList[nCount-1];
- if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoben
+ if ( rLast.nStart > rLast.nEnd ) // Only up to the bug of MD repaired
{
#if OSL_DEBUG_LEVEL > 1
- DBG_ERROR( "MD-Bug nicht beseitigt!" );
+ OSL_FAIL( "MD-Bug is not repaired!" );
#endif
nCount--;
aPortionList.Remove( nCount);
@@ -216,8 +215,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
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
+ if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired
continue;
SbTextType eType = r.eType;
@@ -247,7 +245,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
}
}
- // Es muessen nur die Blanks und Tabs mit attributiert werden.
+ // Only the blanks and tabs had to be attributed.
// If there are two equal attributes one after another,
// they are optimized by the EditEngine.
xub_StrLen nLastEnd = 0;
@@ -264,8 +262,8 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
if ( r.nStart > nLastEnd )
{
- // Kann ich mich drauf verlassen, dass alle ausser
- // Blank und Tab gehighlightet wird ?!
+ // can I trust that all of them except
+ // blank und tab will be highlighted?!
r.nStart = nLastEnd;
}
nLastEnd = r.nEnd+1;
@@ -277,8 +275,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
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
+ if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired
continue;
SbTextType eCol = r.eType;
@@ -327,7 +324,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
default:
{
aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) );
- DBG_ERROR( "Unknown syntax color" );
+ OSL_FAIL( "Unknown syntax color" );
}
}
pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 );
@@ -338,13 +335,11 @@ void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff )
void TextEditImp::DoSyntaxHighlight( sal_uIntPtr nPara )
{
- // Due to delayed syntax highlight it can happend that the
- // paragraph does no longer exist
+ // Due to delayed syntax highlight it can happen that the
+ // paragraph does no longer exist
if ( nPara < pTextEngine->GetParagraphCount() )
{
- // leider weis ich nicht, ob genau diese Zeile Modified() ...
-// if ( pProgress )
-// pProgress->StepProgress();
+ // unfortunatly I don't know if exact this line Modified() ...
pTextEngine->RemoveAttribs( nPara );
String aSource( pTextEngine->GetText( nPara ) );
ImpDoHighlight( aSource, nPara );
@@ -355,8 +350,6 @@ 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 )
{
@@ -382,16 +375,6 @@ IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG )
nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey();
DoSyntaxHighlight( nLine );
aSyntaxLineTable.Remove( nLine );
-/* if ( Application::AnyInput() )
- {
- aSyntaxIdleTimer.Start(); // Starten, falls wir in einem Dialog landen
- pTextView->ShowCursor( sal_True, sal_True );
- pTextEngine->SetUpdateMode( sal_True );
- bHighlightning = sal_False;
- GetpApp()->Reschedule();
- bHighlightning = sal_True;
- pTextEngine->SetUpdateMode( sal_False );
- }*/
}
sal_Bool bWasModified = pTextEngine->IsModified();
@@ -402,25 +385,17 @@ IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG )
}
else
pTextEngine->SetUpdateMode( sal_True ); // ! With VDev
-// pTextView->ForceUpdate();
// SetUpdateMode( sal_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 = sal_False;
if ( aSyntaxLineTable.First() )
aImplSyntaxIdleTimer.Start();
-// while ( Application::AnyInput() )
-// Application::Reschedule(); // Reschedule, da der UserEvent keine Paints etc. durchlässt
-
return 0;
}
@@ -451,7 +426,6 @@ void TextEditImp::SyntaxHighlight( sal_Bool bNew )
for ( sal_uIntPtr i = 0; i < pTextEngine->GetParagraphCount(); i++ )
pTextEngine->RemoveAttribs( i );
-// pTextEngine->QuickFormatDoc();
pTextEngine->SetUpdateMode( sal_True );
pTextView->ShowCursor(sal_True, sal_True );
}
@@ -482,13 +456,15 @@ void TextEditImp::KeyInput( const KeyEvent& rKeyEvent )
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 );}
-//sal_Bool TextEditImp::Drop( const DropEvent& rEvt ){ return sal_False /*pTextView->Drop( rEvt )*/;}
-//sal_Bool TextEditImp::QueryDrop( DropEvent& rEvt ){ return sal_False /*pTextView->QueryDrop( rEvt )*/;}
+void TextEditImp::Paint( const Rectangle& rRect )
+{
+ pTextView->Paint( rRect );
+}
+
+void TextEditImp::MouseButtonUp( const MouseEvent& rMouseEvent )
+{
+ pTextView->MouseButtonUp( rMouseEvent );
+}
void TextEditImp::Command( const CommandEvent& rCEvt )
@@ -543,7 +519,7 @@ SbxBase* TextEditImp::GetSbxAtMousePos( String &aWord )
Point aDocPos = pTextView->GetDocPos( aPos );
aWord = pTextEngine->GetWord( pTextEngine->GetPaM( aDocPos ) );
- if ( aWord.Len() /*&& !Application::GetAppInternational().IsNumeric( aWord )*/ )
+ if ( aWord.Len() )
{
xub_StrLen nLastChar = aWord.Len()-1;
String aSuffixes = CUniString( cSuffixes );
@@ -864,3 +840,4 @@ void TextEdit::BuildKontextMenu( PopupMenu *&pMenu )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/textedit.hxx b/basic/source/app/textedit.hxx
index 404dc4acb2bd..21044c75e4bf 100644..100755
--- a/basic/source/app/textedit.hxx
+++ b/basic/source/app/textedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,7 +43,6 @@ class BreakpointWindow;
#include "dataedit.hxx"
-//#include <xtextedt.hxx>
class TextEditImp : public Window, public SfxListener
{
@@ -136,3 +136,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/ttbasic.cxx b/basic/source/app/ttbasic.cxx
index 98ffc1e4c08d..cfc12a85dcc4 100644..100755
--- a/basic/source/app/ttbasic.cxx
+++ b/basic/source/app/ttbasic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,3 +35,5 @@ MyBasic* TTBasic::CreateMyBasic()
{
return new MyBasic;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/ttbasic.hxx b/basic/source/app/ttbasic.hxx
index 04d74daa1bb7..8810da66b5e9 100644..100755
--- a/basic/source/app/ttbasic.hxx
+++ b/basic/source/app/ttbasic.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,3 +31,4 @@ public:
static MyBasic* CreateMyBasic();
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src
index 076ee83fd879..c2c017b167ca 100644..100755
--- a/basic/source/app/ttmsg.src
+++ b/basic/source/app/ttmsg.src
@@ -27,18 +27,19 @@
#include "basic/ttmsg.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten
+// Here are included the messages of the folder /basic/source/testtool
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// 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.
+// The numbers must NEVER(!) change,
+// because they are saved in the result files and a renewed display
+// would display new strings or no strings.
///////////////////////////////
+
String S_NAME_NOT_THERE
{
Text[ en-US ] = "Name doesn't exist: #($Arg1)";
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index e8fe55c2f920..f94155d67808 100644..100755
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,9 +53,7 @@
#include <comphelper/documentinfo.hxx>
#include <unotools/eventlisteneradapter.hxx>
-#ifndef INCLUDED_OSL_DOUBLECHECKEDLOCKING_H
#include <rtl/instance.hxx>
-#endif
#include <map>
@@ -313,7 +312,7 @@ namespace basic
BasicManager* pBasicManager = new BasicManager( new StarBASIC, &aAppBasicDir );
setApplicationBasicManager( pBasicManager );
- // Als Destination das erste Dir im Pfad:
+ // The first dir in the path as destination:
String aFileName( aAppBasic.getName() );
aAppBasic = INetURLObject( aAppBasicDir.GetToken(1) );
DBG_ASSERT( aAppBasic.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
@@ -365,7 +364,7 @@ namespace basic
if ( pos != m_aCreationListeners.end() )
m_aCreationListeners.erase( pos );
else {
- DBG_ERROR( "ImplRepository::revokeCreationListener: listener is not registered!" );
+ OSL_FAIL( "ImplRepository::revokeCreationListener: listener is not registered!" );
}
}
@@ -491,7 +490,7 @@ namespace basic
// initialize the containers
impl_initDocLibraryContainers_nothrow( xBasicLibs, xDialogLibs );
- // damit auch Dialoge etc. 'qualifiziert' angesprochen werden k"onnen
+ // so that also dialogs etc. could be 'qualified' addressed
_out_rpBasicManager->GetLib(0)->SetParent( pAppBasic );
// global properties in the document's Basic
@@ -660,3 +659,4 @@ namespace basic
} // namespace basic
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index bb686c765f4c..a2aa4b53207c 100644..100755
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,6 +53,7 @@
#include "sbintern.hxx"
#include <sb.hrc>
+#include <vector>
#define LIB_SEP 0x01
#define LIBINFO_SEP 0x02
@@ -75,6 +77,8 @@
#include <cppuhelper/implbase1.hxx>
using com::sun::star::uno::Reference;
+using ::std::vector;
+using ::std::advance;
using namespace com::sun::star::container;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -86,7 +90,7 @@ typedef WeakImplHelper1< XStarBasicModuleInfo > ModuleInfoHelper;
typedef WeakImplHelper1< XStarBasicDialogInfo > DialogInfoHelper;
typedef WeakImplHelper1< XStarBasicLibraryInfo > LibraryInfoHelper;
typedef WeakImplHelper1< XStarBasicAccess > StarBasicAccessHelper;
-
+typedef vector< BasicError* > BasErrorLst;
#define CURR_VER 2
@@ -116,8 +120,6 @@ DBG_NAME( BasicManager );
StreamMode eStreamReadMode = STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL;
StreamMode eStorageReadMode = STREAM_READ | STREAM_SHARE_DENYWRITE;
-DECLARE_LIST( BasErrorLst, BasicError* )
-
//----------------------------------------------------------------------------
// BasicManager impl data
struct BasicManagerImpl
@@ -389,18 +391,24 @@ class BasicErrorManager
{
private:
BasErrorLst aErrorList;
+ size_t CurrentError;
public:
+ BasicErrorManager();
~BasicErrorManager();
void Reset();
void InsertError( const BasicError& rError );
- sal_Bool HasErrors() { return (sal_Bool)aErrorList.Count(); }
- BasicError* GetFirstError() { return aErrorList.First(); }
- BasicError* GetNextError() { return aErrorList.Next(); }
+ bool HasErrors() { return !aErrorList.empty(); }
+ BasicError* GetFirstError();
+ BasicError* GetNextError();
};
+BasicErrorManager::BasicErrorManager()
+ : CurrentError( 0 )
+{
+}
BasicErrorManager::~BasicErrorManager()
{
@@ -409,20 +417,36 @@ BasicErrorManager::~BasicErrorManager()
void BasicErrorManager::Reset()
{
- BasicError* pError = (BasicError*)aErrorList.First();
- while ( pError )
- {
- delete pError;
- pError = (BasicError*)aErrorList.Next();
- }
- aErrorList.Clear();
+ for ( size_t i = 0, n = aErrorList.size(); i < n; ++i )
+ delete aErrorList[ i ];
+ aErrorList.clear();
}
void BasicErrorManager::InsertError( const BasicError& rError )
{
- aErrorList.Insert( new BasicError( rError ), LIST_APPEND );
+ aErrorList.push_back( new BasicError( rError ) );
}
+BasicError* BasicErrorManager::GetFirstError()
+{
+ CurrentError = 0;
+ return aErrorList.empty() ? NULL : aErrorList[ CurrentError ];
+}
+
+BasicError* BasicErrorManager::GetNextError()
+{
+ if ( !aErrorList.empty()
+ && CurrentError < ( aErrorList.size() - 1)
+ )
+ {
+ ++CurrentError;
+ return aErrorList[ CurrentError ];
+ }
+ return NULL;
+}
+
+
+//=====================================================================
BasicError::BasicError()
{
@@ -445,6 +469,8 @@ BasicError::BasicError( const BasicError& rErr ) :
}
+//=====================================================================
+
class BasicLibInfo
{
private:
@@ -513,14 +539,111 @@ public:
{ mxScriptCont = xScriptCont; }
};
-DECLARE_LIST( BasicLibsBase, BasicLibInfo* )
-class BasicLibs : public BasicLibsBase
+//=====================================================================
+
+class BasicLibs
{
+private:
+ vector< BasicLibInfo* > aList;
+ size_t CurrentLib;
+
public:
- String aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
+ ~BasicLibs();
+ String aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
+ BasicLibInfo* GetObject( size_t i );
+ BasicLibInfo* First();
+ BasicLibInfo* Last();
+ BasicLibInfo* Prev();
+ BasicLibInfo* Next();
+ size_t GetPos( BasicLibInfo* LibInfo );
+ size_t Count() const { return aList.size(); };
+ size_t GetCurPos() const { return CurrentLib; };
+ void Insert( BasicLibInfo* LibInfo );
+ BasicLibInfo* Remove( BasicLibInfo* LibInfo );
};
+BasicLibs::~BasicLibs() {
+ for ( size_t i = 0, n = aList.size(); i < n; ++i )
+ delete aList[ i ];
+ aList.clear();
+}
+
+BasicLibInfo* BasicLibs::GetObject( size_t i )
+{
+ if ( aList.empty()
+ || aList.size() <= i
+ )
+ return NULL;
+ CurrentLib = i;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::First()
+{
+ if ( aList.empty() )
+ return NULL;
+ CurrentLib = 0;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::Last()
+{
+ if ( aList.empty() )
+ return NULL;
+ CurrentLib = aList.size() - 1;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::Prev()
+{
+ if ( aList.empty()
+ || CurrentLib == 0
+ )
+ return NULL;
+ --CurrentLib;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::Next()
+{
+ if ( aList.empty()
+ || CurrentLib >= ( aList.size() - 1 )
+ )
+ return NULL;
+ ++CurrentLib;
+ return aList[ CurrentLib ];
+}
+
+size_t BasicLibs::GetPos( BasicLibInfo* LibInfo )
+{
+ for ( size_t i = 0, n = aList.size(); i < n; ++i )
+ if ( aList[ i ] == LibInfo )
+ return i;
+ return size_t( -1 );
+}
+
+void BasicLibs::Insert( BasicLibInfo* LibInfo )
+{
+ aList.push_back( LibInfo );
+ CurrentLib = aList.size() - 1;
+}
+
+BasicLibInfo* BasicLibs::Remove( BasicLibInfo* LibInfo )
+{
+ size_t i = GetPos( LibInfo );
+ if ( i < aList.size() )
+ {
+ vector< BasicLibInfo* >::iterator it = aList.begin();
+ advance( it , i );
+ it = aList.erase( it );
+ }
+ return LibInfo;
+}
+
+
+//=====================================================================
+
BasicLibInfo::BasicLibInfo()
{
bReference = sal_False;
@@ -832,7 +955,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
{
Any aLibAny = xScriptCont->getByName( *pScriptLibName );
- if ( pScriptLibName->equalsAscii( "Standard" ) )
+ if ( pScriptLibName->equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Standard")) )
xScriptCont->loadLibrary( *pScriptLibName );
BasMgrContainerListenerImpl::insertLibraryImpl
@@ -976,7 +1099,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
sal_uInt16 nLibs;
*xManagerStream >> nLibs;
- // Plausi!
+ // Plausibility!
if( nLibs & 0xF000 )
{
DBG_ASSERT( !this, "BasicManager-Stream defect!" );
@@ -1013,7 +1136,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
}
}
- pLibs->Insert( pInfo, LIST_APPEND );
+ pLibs->Insert( pInfo );
// Libs from external files should be loaded only when necessary.
// But references are loaded at once, otherwise some big customers get into trouble
if ( bLoadLibs && pInfo->DoLoad() &&
@@ -1057,11 +1180,9 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
xManagerStream->Seek( nBasicStartOff );
if( !ImplLoadBasic( *xManagerStream, pLibs->GetObject(0)->GetLibRef() ) )
{
-// String aErrorText( BasicResId( IDS_SBERR_MGROPEN ) );
-// aErrorText.SearchAndReplace( "XX", aStorName );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, aStorName, ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_OPENMGRSTREAM, aStorName ) );
- // und es geht weiter...
+ // and it proceeds ...
}
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
String aLibs;
@@ -1105,8 +1226,6 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
AddLib( *xStorageRef, aLibName, sal_False );
else
{
-// String aErrorText( BasicResId( IDS_SBERR_LIBLOAD ) );
-// aErrorText.SearchAndReplace( "XX", aLibName );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_STORAGENOTFOUND, aStorName ) );
}
@@ -1123,13 +1242,6 @@ BasicManager::~BasicManager()
// Destroy Basic-Infos...
// In reverse order
- BasicLibInfo* pInf = pLibs->Last();
- while ( pInf )
- {
- delete pInf;
- pInf = pLibs->Prev();
- }
- pLibs->Clear();
delete pLibs;
delete pErrorMgr;
delete mpImpl;
@@ -1141,6 +1253,25 @@ void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
_rpManager = NULL;
}
+
+bool BasicManager::HasExeCode( const String& sLib )
+{
+ StarBASIC* pLib = GetLib(sLib);
+ if ( pLib )
+ {
+ SbxArray* pMods = pLib->GetModules();
+ sal_uInt16 nMods = pMods ? pMods->Count() : 0;
+ for( sal_uInt16 i = 0; i < nMods; i++ )
+ {
+ SbModule* p = (SbModule*) pMods->Get( i );
+ if ( p )
+ if ( p->HasExeCode() )
+ return true;
+ }
+ }
+ return false;
+}
+
void BasicManager::Init()
{
DBG_CHKTHIS( BasicManager, 0 );
@@ -1156,7 +1287,7 @@ BasicLibInfo* BasicManager::CreateLibInfo()
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = new BasicLibInfo;
- pLibs->Insert( pInf, LIST_APPEND );
+ pLibs->Insert( pInf );
return pInf;
}
@@ -1303,13 +1434,6 @@ sal_Bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic )
// Fill new libray container (5.2 -> 6.0)
copyToLibraryContainer( pNew, mpImpl->maContainerInfo );
-/*
- if( rOldBasic->GetParent() )
- {
- rOldBasic->GetParent()->Insert( rOldBasic );
- rOldBasic->SetFlag( SBX_EXTSEARCH );
- }
-*/
pNew->SetModified( sal_False );
bLoaded = sal_True;
}
@@ -1338,7 +1462,7 @@ void BasicManager::CheckModules( StarBASIC* pLib, sal_Bool bReference ) const
// cause modified
if( !bModified && bReference )
{
- DBG_ERROR( "Per Reference eingebundene Basic-Library ist nicht compiliert!" );
+ OSL_FAIL( "Per Reference eingebundene Basic-Library ist nicht compiliert!" );
pLib->SetModified( sal_False );
}
}
@@ -1361,7 +1485,6 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, s
// Use original name otherwise ImpLoadLibary failes...
pLibInfo->SetLibName( rLibName );
// Funktioniert so aber nicht, wenn Name doppelt
-// sal_uInt16 nLibId = GetLibId( rLibName );
sal_uInt16 nLibId = (sal_uInt16) pLibs->GetPos( pLibInfo );
// Set StorageName before load because it is compared with pCurStorage
@@ -1377,7 +1500,6 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, s
{
pLibInfo->GetLib()->SetModified( sal_False ); // Don't save in this case
pLibInfo->SetRelStorageName( String() );
-// pLibInfo->CalcRelStorageName( GetStorageName() );
pLibInfo->IsReference() = sal_True;
}
else
@@ -1451,7 +1573,6 @@ sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage
if ( !xBasicStorage.Is() || xBasicStorage->GetError() )
{
-// String aErrorText( BasicResId( IDS_SBERR_REMOVELIB ) );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, String(), ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_OPENLIBSTORAGE, pLibInfo->GetLibName() ) );
}
@@ -1614,7 +1735,6 @@ sal_Bool BasicManager::LoadLib( sal_uInt16 nLib )
StarBASIC* pLib = GetLib( nLib );
if ( pLib )
{
- // pLib->SetParent( GetStdLib() );
GetStdLib()->Insert( pLib );
pLib->SetFlag( SBX_EXTSEARCH );
}
@@ -1622,8 +1742,6 @@ sal_Bool BasicManager::LoadLib( sal_uInt16 nLib )
}
else
{
-// String aErrorText( BasicResId( IDS_SBERR_LIBLOAD ) );
-// aErrorText.SearchAndReplace( "XX", "" );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, String(), ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_LIBNOTFOUND, String::CreateFromInt32(nLib) ) );
}
@@ -1660,16 +1778,7 @@ StarBASIC* BasicManager::CreateLib
if( !xStorage->GetError() )
{
pLib = AddLib( *xStorage, rLibName, sal_True );
-
- //if( !pLibInfo )
- //pLibInfo = FindLibInfo( pLib );
- //pLibInfo->SetStorageName( LinkTargetURL );
- //pLibInfo->GetLib()->SetModified( sal_False ); // Dann nicht speichern
- //pLibInfo->SetRelStorageName( String() );
- //pLibInfo->IsReference() = sal_True;
}
- //else
- //Message?
DBG_ASSERT( pLib, "XML Import: Linked basic library could not be loaded");
}
@@ -1832,7 +1941,7 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequen
const ::rtl::OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
for ( ; pNames != pNamesEnd; ++pNames )
{
- if( /*pLib->mbSharedIndexFile ||*/ !xPassword->isLibraryPasswordProtected( *pNames ) )
+ if( !xPassword->isLibraryPasswordProtected( *pNames ) )
continue;
StarBASIC* pBasicLib = GetLib( *pNames );
@@ -2600,3 +2709,4 @@ Reference< XStarBasicAccess > getStarBasicAccess( BasicManager* pMgr )
return xRet;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/basmgr/makefile.mk b/basic/source/basmgr/makefile.mk
index 615a8e8465ef..615a8e8465ef 100644..100755
--- a/basic/source/basmgr/makefile.mk
+++ b/basic/source/basmgr/makefile.mk
diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx
index 37d777cb8da8..a06c0d05ed18 100644..100755
--- a/basic/source/classes/disas.cxx
+++ b/basic/source/classes/disas.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,7 +36,6 @@
#include "sb.hxx"
#include "iosys.hxx"
#include "disas.hxx"
-#include "sbtrace.hxx"
static const char* pOp1[] = {
@@ -363,10 +363,6 @@ sal_Bool SbiDisas::DisasLine( String& rText )
if( !Fetch() )
return sal_False;
-#ifdef DBG_TRACE_BASIC
- String aTraceStr_STMNT;
-#endif
-
// New line?
if( eOp == _STMNT && nOp1 != nLine )
{
@@ -399,10 +395,6 @@ sal_Bool SbiDisas::DisasLine( String& rText )
rText.AppendAscii( "; " );
rText += s;
rText.AppendAscii( _crlf() );
-
-#ifdef DBG_TRACE_BASIC
- aTraceStr_STMNT = s;
-#endif
}
}
@@ -462,10 +454,6 @@ sal_Bool SbiDisas::DisasLine( String& rText )
rText += aPCodeStr;
-#ifdef DBG_TRACE_BASIC
- dbg_RegisterTraceTextForPC( pMod, nPC, aTraceStr_STMNT, aPCodeStr );
-#endif
-
return sal_True;
}
@@ -610,29 +598,21 @@ void SbiDisas::OffOp( String& rText )
}
// Data type
-#ifdef HP9000 // TODO: remove this!
-static char* SbiDisas_TypeOp_pTypes[13] = {
- "Empty","Null","Integer","Long","Single","Double",
- "Currency","Date","String","Object","Error","Boolean",
- "Variant" };
-#define pTypes SbiDisas_TypeOp_pTypes
-#endif
void SbiDisas::TypeOp( String& rText )
{
- // AB 19.1.96: Typ kann Flag für BYVAL enthalten (StepARGTYP)
+ // From 1996-01-19: type can contain flag for BYVAL (StepARGTYP)
if( nOp1 & 0x8000 )
{
- nOp1 &= 0x7FFF; // Flag wegfiltern
+ nOp1 &= 0x7FFF; // filter away the flag
rText.AppendAscii( "BYVAL " );
}
if( nOp1 < 13 )
{
-#ifndef HP9000
static char pTypes[][13] = {
"Empty","Null","Integer","Long","Single","Double",
"Currency","Date","String","Object","Error","Boolean",
"Variant" };
-#endif
+
rText.AppendAscii( pTypes[ nOp1 ] );
}
else
@@ -641,9 +621,6 @@ void SbiDisas::TypeOp( String& rText )
rText += (sal_uInt16)nOp1;
}
}
-#ifdef HP9000
-#undef pTypes
-#endif
// sal_True-Label, condition Opcode
void SbiDisas::CaseOp( String& rText )
@@ -685,3 +662,4 @@ void SbiDisas::StrmOp( String& rText )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
index 0ec0454e2bb5..44f55aa65f7a 100644..100755
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -174,7 +175,7 @@ void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const u
throw (uno::RuntimeException)
{
if ( !Number.hasValue() )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Missing Required Paramater")), uno::Reference< uno::XInterface >() );
Number >>= m_nNumber;
Description >>= m_sDescription;
Source >>= m_sSource;
@@ -223,3 +224,4 @@ void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OU
m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 8d9f30e4982f..bb26b99129dd 100644..100755
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-//#include <stl_queue.h>
#include <osl/mutex.hxx>
#include <comphelper/processfactory.hxx>
@@ -108,18 +108,18 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere
Reference< XComponentContext > xContext;
Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "DefaultContext" ) ) >>= xContext );
+ OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
if ( xContext.is() )
{
Reference< provider::XScriptProviderFactory > xFactory(
xContext->getValueByName(
- ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory" ) ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ),
UNO_QUERY );
OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
if ( xFactory.is() )
{
Any aCtx;
- aCtx <<= ::rtl::OUString::createFromAscii( "user" );
+ aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
}
}
@@ -207,7 +207,7 @@ Any BasicScriptListener_Impl::approveFiring( const ScriptEvent& aScriptEvent )
void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeException )
{
// TODO: ???
- //vos::OGuard guard( Application::GetSolarMutex() );
+ //SolarMutexGuard aGuard;
//xSbxObj.Clear();
}
@@ -438,15 +438,8 @@ Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, Star
return aDlgLibAny;
}
-static ::rtl::OUString aDecorationPropName =
- ::rtl::OUString::createFromAscii( "Decoration" );
-static ::rtl::OUString aTitlePropName =
- ::rtl::OUString::createFromAscii( "Title" );
-
void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
{
- static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
-
(void)pBasic;
(void)bWrite;
@@ -505,11 +498,14 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
bool bDecoration = true;
try
{
+ ::rtl::OUString aDecorationPropName(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName );
aDecorationAny >>= bDecoration;
if( !bDecoration )
{
xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) );
+
+ ::rtl::OUString aTitlePropName(RTL_CONSTASCII_USTRINGPARAM("Title"));
xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) );
}
}
@@ -522,43 +518,43 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
StarBASIC* pFoundBasic = NULL;
OSL_TRACE("About to try get a hold of ThisComponent");
Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ;
- aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
- // If we found the dialog then it belongs to the Search basic
- if ( !pFoundBasic )
- {
- Reference< frame::XDesktop > xDesktop( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
- UNO_QUERY );
- Reference< container::XEnumeration > xModels;
- if ( xDesktop.is() )
+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
+ // If we found the dialog then it belongs to the Search basic
+ if ( !pFoundBasic )
{
- Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
- if ( xComponents.is() )
- xModels.set( xComponents->createEnumeration(), UNO_QUERY );
- if ( xModels.is() )
+ Reference< frame::XDesktop > xDesktop( xMSF->createInstance
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
+ UNO_QUERY );
+ Reference< container::XEnumeration > xModels;
+ if ( xDesktop.is() )
+ {
+ Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
+ if ( xComponents.is() )
+ xModels.set( xComponents->createEnumeration(), UNO_QUERY );
+ if ( xModels.is() )
+ {
+ while ( xModels->hasMoreElements() )
{
- while ( xModels->hasMoreElements() )
+ Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
+ if ( xNextModel.is() )
{
- Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
- if ( xNextModel.is() )
+ BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
+ if ( pMgr )
+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
+ if ( aDlgLibAny.hasValue() )
{
- BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
- if ( pMgr )
- aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
- if ( aDlgLibAny.hasValue() )
- {
- bDocDialog = true;
- xModel = xNextModel;
- break;
- }
+ bDocDialog = true;
+ xModel = xNextModel;
+ break;
}
}
}
}
}
+ }
if ( pFoundBasic )
bDocDialog = pFoundBasic->IsDocBasic();
- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
+ Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
Sequence< Any > aArgs( 4 );
if( bDocDialog )
@@ -569,23 +565,23 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
aArgs[ 2 ] = aDlgLibAny;
aArgs[ 3 ] <<= xScriptListener;
// Create a "living" Dialog
- Reference< XControl > xCntrl;
- try
- {
+ Reference< XControl > xCntrl;
+ try
+ {
Reference< XDialogProvider > xDlgProv( xMSF->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.DialogProvider" ) ), aArgs ), UNO_QUERY );
- xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
- // Add dialog model to dispose vector
- Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
- pINST->getComponentVector().push_back( xDlgComponent );
- // need ThisCompoent from calling script
- }
- // preserve existing bad behaviour, it's possible... but probably
- // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
- // create dialog fails. So, in this case let's not throw, just leave basic
- // detect the unset object.
- catch( uno::Exception& )
- {
- }
+ xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
+ // Add dialog model to dispose vector
+ Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
+ pINST->getComponentVector().push_back( xDlgComponent );
+ // need ThisCompoent from calling script
+ }
+ // preserve existing bad behaviour, it's possible... but probably
+ // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
+ // create dialog fails. So, in this case let's not throw, just leave basic
+ // detect the unset object.
+ catch( uno::Exception& )
+ {
+ }
// Return dialog
Any aRetVal;
@@ -597,3 +593,4 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
//===================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index fc6228d1aee9..d9e7bc521af1 100644..100755
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -148,7 +149,6 @@ sal_Bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
sal_uIntPtr nNext;
while( ( nNext = r.Tell() ) < nLast )
{
- short i;
r >> nSign >> nLen >> nCount;
nNext += nLen + 8;
@@ -216,6 +216,7 @@ sal_Bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
case B_STRINGPOOL:
if( bBadVer ) break;
MakeStrings( nCount );
+ short i;
for( i = 0; i < nStrings && SbiGood( r ); i++ )
{
r >> nOff;
@@ -407,8 +408,6 @@ void SbiImage::MakeStrings( short nSize )
bError = sal_True;
}
-// Hinzufuegen eines Strings an den StringPool. Der String-Puffer
-// waechst dynamisch in 1K-Schritten
// Add a string to StringPool. The String buffer is dynamically
// growing in 1K-Steps
void SbiImage::AddString( const String& r )
@@ -542,3 +541,5 @@ sal_Bool SbiImage::ExceedsLegacyLimits()
return sal_True;
return sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/makefile.mk b/basic/source/classes/makefile.mk
index e00ed4674cc1..e00ed4674cc1 100644..100755
--- a/basic/source/classes/makefile.mk
+++ b/basic/source/classes/makefile.mk
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 9168ef915770..2f20c0e016fe 100644..100755
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -391,15 +392,7 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr
// Get class names of struct
String aServiceName( RTL_CONSTASCII_USTRINGPARAM("stardiv.uno.beans.PropertySet") );
-#if 0
- // Service suchen und instanzieren
- Reference< XMultiServiceFactory > xServiceManager = getProcessServiceFactory();
- Reference< XInterface > xInterface;
- if( xProv.is() )
- xInterface = xProv->newInstance();
-#else
Reference< XInterface > xInterface = (OWeakObject*) new SbPropertyValues();
-#endif
SbxVariableRef refVar = rPar.Get(0);
if( xInterface.is() )
@@ -428,3 +421,4 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr
refVar->PutObject( NULL );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index f8ffa46d48a5..bb65b0c8b82b 100644..100755
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,11 +35,8 @@
#include <tools/rcid.h>
#include <tools/config.hxx>
#include <tools/stream.hxx>
-#ifndef __RSC //autogen
#include <tools/errinf.hxx>
-#endif
#include <basic/sbx.hxx>
-#include <tools/list.hxx>
#include <tools/shl.hxx>
#include <tools/rc.hxx>
#include <vcl/svapp.hxx>
@@ -54,21 +52,18 @@
#include "filefmt.hxx"
#include "sb.hrc"
#include <basrid.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
#include "errobject.hxx"
-#include <map>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
using namespace ::com::sun::star::script;
-// #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
-
SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
TYPEINIT1(StarBASIC,SbxObject)
@@ -81,9 +76,6 @@ using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::lang::XMultiServiceFactory;
-const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
-const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
-
// ============================================================================
class DocBasicItem : public ::cppu::WeakImplHelper1< util::XCloseListener >
@@ -171,7 +163,9 @@ void SAL_CALL DocBasicItem::disposing( const lang::EventObject& /*rEvent*/ ) thr
namespace {
typedef ::rtl::Reference< DocBasicItem > DocBasicItemRef;
-typedef std::map< const StarBASIC*, DocBasicItemRef > DocBasicItemMap;
+typedef boost::unordered_map< const StarBASIC *, DocBasicItemRef > DocBasicItemMap;
+ // ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap;
+
static DocBasicItemMap GaDocBasicItems;
const DocBasicItem* lclFindDocBasicItem( const StarBASIC* pDocBasic )
@@ -241,6 +235,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
}
}
}
+ const String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE );
}
return pVBAGlobals;
@@ -249,6 +244,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
// i#i68894#
SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t )
{
+ const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
if( rName == aThisComponent )
return NULL;
// rename to init globals
@@ -264,7 +260,7 @@ struct SFX_VB_ErrorItem
SbError nErrorSFX;
};
-const SFX_VB_ErrorItem __FAR_DATA SFX_VB_ErrorTab[] =
+const SFX_VB_ErrorItem SFX_VB_ErrorTab[] =
{
{ 1, SbERR_BASIC_EXCEPTION }, // #87844 Map exception to error code 1
{ 2, SbERR_SYNTAX },
@@ -532,12 +528,12 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
SbxBase* pParObj = pVar->GetObject();
SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
- sal_Int32 lb = 0;
- sal_Int32 ub = 0;
pDest->setHasFixedSize( pSource->hasFixedSize() );
if ( pSource->GetDims() && pSource->hasFixedSize() )
{
+ sal_Int32 lb = 0;
+ sal_Int32 ub = 0;
for ( sal_Int32 j = 1 ; j <= pSource->GetDims(); ++j )
{
pSource->GetDim32( (sal_Int32)j, lb, ub );
@@ -660,7 +656,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbMethod* pImplMethod = pIfaceMethod->getImplMethod();
if( !pImplMethod )
{
- DBG_ERROR( "No ImplMethod" );
+ OSL_FAIL( "No ImplMethod" );
continue;
}
@@ -670,7 +666,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbMethod* pImplMethodCopy = p ? PTR_CAST(SbMethod,p) : NULL;
if( !pImplMethodCopy )
{
- DBG_ERROR( "Found no ImplMethod copy" );
+ OSL_FAIL( "Found no ImplMethod copy" );
continue;
}
SbIfaceMapperMethod* pNewIfaceMethod =
@@ -1159,11 +1155,11 @@ struct ClassModuleRunInitItem
{}
};
-// Derive from has_map type instead of typedef
+// Derive from unordered_map type instead of typedef
// to allow forward declaration in sbmod.hxx
class ModuleInitDependencyMap : public
- std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
- ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
+ boost::unordered_map< ::rtl::OUString, ClassModuleRunInitItem,
+ ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
{};
void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem )
@@ -1189,7 +1185,7 @@ void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassMod
if( rParentItem.m_bProcessing )
{
// TODO: raise error?
- DBG_ERROR( "Cyclic module dependency detected" );
+ OSL_FAIL( "Cyclic module dependency detected" );
continue;
}
@@ -1208,7 +1204,7 @@ void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassMod
// Run Init-Code of all modules (including inserted libraries)
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
- ::vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
// Init own modules
for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ )
@@ -1340,7 +1336,6 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t )
sal_Int32 nType = p->GetModuleType();
if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
continue;
-
// otherwise check if the element is available
// unset GBLSEARCH-Flag (due to Rekursion)
sal_uInt16 nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
@@ -1496,7 +1491,7 @@ sal_uInt16 StarBASIC::StepPoint( sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
return BreakHdl();
}
-sal_uInt16 __EXPORT StarBASIC::BreakHdl()
+sal_uInt16 StarBASIC::BreakHdl()
{
return (sal_uInt16) ( aBreakHdl.IsSet()
? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE );
@@ -1529,14 +1524,14 @@ SbLanguageMode StarBASIC::GetLanguageMode()
return eLanguageMode;
}
-// AB: 29.3.96
-// Das Mapping zwischen alten und neuen Fehlercodes erfolgt, indem die Tabelle
-// SFX_VB_ErrorTab[] durchsucht wird. Dies ist zwar nicht besonders performant,
-// verbraucht aber viel weniger Speicher als entsprechende switch-Bloecke.
-// Die Umrechnung von Fehlercodes muss nicht schnell sein, daher auch keine
-// binaere Suche bei VB-Error -> SFX-Error.
+// From 1996-03-29:
+// The mapping between the old and the new error codes take place by searching
+// through the table SFX_VB_ErrorTab[]. This is indeed not with good performance,
+// but it consumes much less memory than corresponding switch blocs.
+// Because the conversion of error codes has not to be fast. there is no
+// binaere search by VB-Error -> SFX-Error.
-// Neue Fehler-Codes auf alte, Sbx-Kompatible zurueckmappen
+// Map back new error codes to old, Sbx-compatible
sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError )
{
sal_uInt16 nRet = 0;
@@ -1562,7 +1557,7 @@ sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError )
}
}
- // Suchschleife
+ // search loop
const SFX_VB_ErrorItem* pErrItem;
sal_uInt16 nIndex = 0;
do
@@ -1575,7 +1570,7 @@ sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError )
}
nIndex++;
}
- while( pErrItem->nErrorVB != 0xFFFF ); // bis End-Marke
+ while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
return nRet;
}
@@ -1621,15 +1616,15 @@ SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
break;
}
else if( pErrItem->nErrorVB > nError )
- break; // kann nicht mehr gefunden werden
+ break; // couldn't found anymore
nIndex++;
}
- while( pErrItem->nErrorVB != 0xFFFF ); // bis End-Marke
+ while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
return nRet;
}
-// Error- / Break-Daten setzen
+// set Error- / Break-data
void StarBASIC::SetErrorData
( SbError nCode, sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 )
{
@@ -1641,8 +1636,8 @@ void StarBASIC::SetErrorData
}
//----------------------------------------------------------------
-// Hilfsklasse zum Zugriff auf String SubResourcen einer Resource.
-// Quelle: sfx2\source\doc\docfile.cxx (TLX)
+// help class for access to string SubResource of a Resource.
+// Source: sfx2\source\doc\docfile.cxx (TLX)
struct BasicStringList_Impl : private Resource
{
ResId aResId;
@@ -1657,7 +1652,7 @@ struct BasicStringList_Impl : private Resource
};
//----------------------------------------------------------------
-// #60175 Flag, das bei Basic-Fehlern das Anziehen der SFX-Resourcen verhindert
+// Flag, that prevent the activation of the SFX-Resources at a Basic error
static sal_Bool bStaticSuppressSfxResource = sal_False;
void StarBASIC::StaticSuppressSfxResource( sal_Bool bSuppress )
@@ -1674,7 +1669,7 @@ sal_Bool runsInSetup( void )
void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
if( bStaticSuppressSfxResource )
{
@@ -1684,15 +1679,15 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
sal_uInt16 nOldID = GetVBErrorCode( nId );
- // Hilfsklasse instanzieren
+ // intantiate the help class
BasResId aId( RID_BASIC_START );
BasicStringList_Impl aMyStringList( aId, sal_uInt16(nId & ERRCODE_RES_MASK) );
if( aMyStringList.IsErrorTextAvailable() )
{
- // Merge Message mit Zusatztext
+ // merge message with additional text
String aMsg1 = aMyStringList.GetString();
- // Argument-Platzhalter durch %s ersetzen
+ // replace argument placeholder with %s
String aSrgStr( RTL_CONSTASCII_USTRINGPARAM("$(ARG1)") );
sal_uInt16 nResult = aMsg1.Search( aSrgStr );
@@ -1718,9 +1713,9 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
sal_Bool StarBASIC::CError
( SbError code, const String& rMsg, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
- // Compiler-Fehler waehrend der Laufzeit -> Programm anhalten
+ // compiler error during runtime -> stop programm
if( IsRunning() )
{
// #109018 Check if running Basic is affected
@@ -1731,13 +1726,13 @@ sal_Bool StarBASIC::CError
Stop();
}
- // Flag setzen, damit GlobalRunInit den Fehler mitbekommt
+ // set flag, so that GlobalRunInit notice the error
GetSbData()->bGlobalInitErr = sal_True;
- // Fehlertext basteln
+ // tinker the error message
MakeErrorText( code, rMsg );
- // Umsetzung des Codes fuer String-Transport in SFX-Error
+ // Implementation of the code for the string transport to SFX-Error
if( rMsg.Len() )
code = (sal_uIntPtr)*new StringErrorInfo( code, String(rMsg) );
@@ -1748,7 +1743,7 @@ sal_Bool StarBASIC::CError
bRet = (sal_Bool) GetSbData()->aErrHdl.Call( this );
else
bRet = ErrorHdl();
- GetSbData()->bCompiler = sal_False; // nur sal_True fuer Error-Handler
+ GetSbData()->bCompiler = sal_False; // only true for error handler
return bRet;
}
@@ -1760,14 +1755,14 @@ sal_Bool StarBASIC::RTError
sal_Bool StarBASIC::RTError( SbError code, const String& rMsg, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
SbError c = code;
if( (c & ERRCODE_CLASS_MASK) == ERRCODE_CLASS_COMPILER )
c = 0;
MakeErrorText( c, rMsg );
- // Umsetzung des Codes fuer String-Transport in SFX-Error
+ // Implementation of the code for the string transport to SFX-Error
if( rMsg.Len() )
{
// very confusing, even though MakeErrorText sets up the error text
@@ -1824,7 +1819,7 @@ SbError StarBASIC::GetErrBasic()
return 0;
}
-// #66536 Zusatz-Message fuer RTL-Funktion Error zugreifbar machen
+// make the additional message for the RTL function error accessible
String StarBASIC::GetErrorMsg()
{
if( pINST )
@@ -1841,7 +1836,7 @@ sal_uInt16 StarBASIC::GetErl()
return 0;
}
-sal_Bool __EXPORT StarBASIC::ErrorHdl()
+sal_Bool StarBASIC::ErrorHdl()
{
return (sal_Bool) ( aErrorHdl.IsSet()
? aErrorHdl.Call( this ) : sal_False );
@@ -1917,7 +1912,7 @@ sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
return sal_False;
else if( pMod->ISA(SbJScriptModule) )
{
- // Ref zuweisen, damit pMod deleted wird
+ // assign Ref, so that pMod will be deleted
SbModuleRef xRef = pMod;
}
else
@@ -1926,15 +1921,15 @@ sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
pModules->Put( pMod, i );
}
}
- // HACK fuer SFX-Mist!
+ // HACK for SFX-Bullshit!
SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("FALSE") ), SbxCLASS_PROPERTY );
if( p )
Remove( p );
p = Find( String( RTL_CONSTASCII_USTRINGPARAM("TRUE") ), SbxCLASS_PROPERTY );
if( p )
Remove( p );
- // Ende des Hacks!
- // Suche ueber StarBASIC ist immer global
+ // End of the hacks!
+ // Search via StarBASIC is at all times global
DBG_ASSERT( IsSet( SBX_GBLSEARCH ), "Basic ohne GBLSEARCH geladen" );
SetFlag( SBX_GBLSEARCH );
return sal_True;
@@ -2278,3 +2273,4 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
SetError( SbERR_BAD_ARGUMENT );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src
index 73cc1c3a0b2c..df916c64b031 100644..100755
--- a/basic/source/classes/sb.src
+++ b/basic/source/classes/sb.src
@@ -47,17 +47,14 @@ Resource RID_BASIC_START
};
String SbERR_BAD_ARGUMENT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Prozeduraufruf : Ungltiger Prozeduraufruf */
Text [ en-US ] = "Invalid procedure call." ;
};
String SbERR_MATH_OVERFLOW & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? šberlauf : Überlauf */
Text [ en-US ] = "Overflow." ;
};
String SbERR_NO_MEMORY & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Nicht gen³gend Speicher : Nicht gengend Speicher */
Text [ en-US ] = "Not enough memory." ;
};
String SbERR_ALREADY_DIM & ERRCODE_RES_MASK
@@ -66,7 +63,6 @@ Resource RID_BASIC_START
};
String SbERR_OUT_OF_RANGE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Index au˜erhalb des definierten Bereichs : Index auÿerhalb des definierten Bereichs */
Text [ en-US ] = "Index out of defined range." ;
};
String SbERR_DUPLICATE_DEF & ERRCODE_RES_MASK
@@ -83,12 +79,10 @@ Resource RID_BASIC_START
};
String SbERR_CONVERSION & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Datentypen unvertrõglich : Datentypen unvertr§glich */
Text [ en-US ] = "Data type mismatch." ;
};
String SbERR_BAD_PARAMETER & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Parameter : Ungltiger Parameter */
Text [ en-US ] = "Invalid parameter." ;
};
String SbERR_USER_ABORT & ERRCODE_RES_MASK
@@ -101,7 +95,6 @@ Resource RID_BASIC_START
};
String SbERR_STACK_OVERFLOW & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Nicht gen³gend Stapelspeicher : Nicht gengend Stapelspeicher */
Text [ en-US ] = "Not enough stack memory." ;
};
String SbERR_PROC_UNDEFINED & ERRCODE_RES_MASK
@@ -134,12 +127,10 @@ Resource RID_BASIC_START
};
String SbERR_FILE_ALREADY_OPEN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Datei bereits ge÷ffnet : Datei bereits ge”ffnet */
Text [ en-US ] = "File already open." ;
};
String SbERR_IO_ERROR & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Gerõte-E/A-Fehler : Ger§te-E/A-Fehler */
Text [ en-US ] = "Device I/O error." ;
};
String SbERR_FILE_EXISTS & ERRCODE_RES_MASK
@@ -148,7 +139,6 @@ Resource RID_BASIC_START
};
String SbERR_BAD_RECORD_LENGTH & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Falsche Datensatzlõnge : Falsche Datensatzl§nge */
Text [ en-US ] = "Incorrect record length." ;
};
String SbERR_DISK_FULL & ERRCODE_RES_MASK
@@ -157,7 +147,6 @@ Resource RID_BASIC_START
};
String SbERR_READ_PAST_EOF & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Lesen ³ber das Ende der Datei hinaus : Lesen ber das Ende der Datei hinaus */
Text [ en-US ] = "Reading exceeds EOF." ;
};
String SbERR_BAD_RECORD_NUMBER & ERRCODE_RES_MASK
@@ -170,7 +159,6 @@ Resource RID_BASIC_START
};
String SbERR_NO_DEVICE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Gerõt nicht verf³gbar : Ger§t nicht verfgbar */
Text [ en-US ] = "Device not available." ;
};
String SbERR_ACCESS_DENIED & ERRCODE_RES_MASK
@@ -187,7 +175,6 @@ Resource RID_BASIC_START
};
String SbERR_DIFFERENT_DRIVE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Umbenennen auf verschiedenen Laufwerken nicht m÷glich : Umbenennen auf verschiedenen Laufwerken nicht m”glich */
Text [ en-US ] = "Renaming on different drives impossible." ;
};
String SbERR_ACCESS_ERROR & ERRCODE_RES_MASK
@@ -204,12 +191,10 @@ Resource RID_BASIC_START
};
String SbERR_BAD_PATTERN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Zeichenfolgenmuster unzulõssig : Zeichenfolgenmuster unzul§ssig */
Text [ en-US ] = "Invalid string pattern." ;
};
String SBERR_IS_NULL & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Verwendung von Null unzulõssig : Verwendung von Null unzul§ssig */
Text [ en-US ] = "Use of zero not permitted." ;
};
String SbERR_DDE_ERROR & ERRCODE_RES_MASK
@@ -222,7 +207,6 @@ Resource RID_BASIC_START
};
String SbERR_DDE_OUTOFCHANNELS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Keine freien DDE-Kanõle : Keine freien DDE-Kan§le */
Text [ en-US ] = "No DDE channels available." ;
};
String SbERR_DDE_NO_RESPONSE & ERRCODE_RES_MASK
@@ -239,17 +223,14 @@ Resource RID_BASIC_START
};
String SbERR_DDE_NOTPROCESSED & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fremdapplikation kann DDE-Operation nicht ausf³hren : Fremdapplikation kann DDE-Operation nicht ausfhren */
Text [ en-US ] = "External application cannot execute DDE operation." ;
};
String SbERR_DDE_TIMEOUT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Zeit³berschreitung wõhrend des Wartens auf DDE-Antwort : Zeitberschreitung w§hrend des Wartens auf DDE-Antwort */
Text [ en-US ] = "Timeout while waiting for DDE response." ;
};
String SbERR_DDE_USER_INTERRUPT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Benutzer dr³ckte ESCAPE wõhrend der DDE-Operation : Benutzer drckte ESCAPE w§hrend der DDE-Operation */
Text [ en-US ] = "User pressed ESCAPE during DDE operation." ;
};
String SbERR_DDE_BUSY & ERRCODE_RES_MASK
@@ -270,7 +251,6 @@ Resource RID_BASIC_START
};
String SbERR_DDE_CONV_CLOSED & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? DDE-Verbindung ist unterbrochen oder geõndert worden : DDE-Verbindung ist unterbrochen oder ge§ndert worden */
Text [ en-US ] = "DDE connection interrupted or modified." ;
};
String SbERR_DDE_NO_CHANNEL & ERRCODE_RES_MASK
@@ -279,7 +259,6 @@ Resource RID_BASIC_START
};
String SbERR_DDE_INVALID_LINK & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges DDE-Linkformat : Ungltiges DDE-Linkformat */
Text [ en-US ] = "Invalid DDE link format." ;
};
String SbERR_DDE_QUEUE_OVERFLOW & ERRCODE_RES_MASK
@@ -288,52 +267,42 @@ Resource RID_BASIC_START
};
String SbERR_DDE_LINK_ALREADY_EST & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Paste Link bereits durchgef³hrt : Paste Link bereits durchgefhrt */
Text [ en-US ] = "Paste link already performed." ;
};
String SbERR_DDE_LINK_INV_TOPIC & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? LinkMode kann wegen ung³ltigen Link-Topics nicht gesetzt werden : LinkMode kann wegen ungltigen Link-Topics nicht gesetzt werden */
Text [ en-US ] = "Link mode cannot be set due to invalid link topic." ;
};
String SbERR_DDE_DLL_NOT_FOUND & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? F³r DDE wird DDEML.DLL ben÷tigt : Fr DDE wird DDEML.DLL ben”tigt */
Text [ en-US ] = "DDE requires the DDEML.DLL file." ;
};
String SbERR_CANNOT_LOAD & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Das Modul kann nicht geladen werden, ung³ltiges Format : Das Modul kann nicht geladen werden, ungltiges Format */
Text [ en-US ] = "Module cannot be loaded; invalid format." ;
};
String SbERR_BAD_INDEX & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Objektindex : Ungltiger Objektindex */
Text [ en-US ] = "Invalid object index." ;
};
String SbERR_NO_ACTIVE_OBJECT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Objekt ist nicht verf³gbar : Objekt ist nicht verfgbar */
Text [ en-US ] = "Object is not available." ;
};
String SbERR_BAD_PROP_VALUE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Falscher Wert f³r Eigenschaft : Falscher Wert fr Eigenschaft */
Text [ en-US ] = "Incorrect property value." ;
};
String SbERR_PROP_READONLY & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist schreibgesch³tzt : Eigenschaft ist schreibgeschtzt */
Text [ en-US ] = "This property is read-only." ;
};
String SbERR_PROP_WRITEONLY & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist lesegesch³tzt : Eigenschaft ist lesegeschtzt */
Text [ en-US ] = "This property is write only." ;
};
String SbERR_INVALID_OBJECT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltige Objektreferenz : Ungltige Objektreferenz */
Text [ en-US ] = "Invalid object reference." ;
};
String SbERR_NO_METHOD & ERRCODE_RES_MASK
@@ -350,12 +319,10 @@ Resource RID_BASIC_START
};
String SbERR_NO_OLE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? OLE-Automatisierung wird von diesem Objekt nicht unterst³tzt : OLE-Automatisierung wird von diesem Objekt nicht untersttzt */
Text [ en-US ] = "OLE Automation is not supported by this object." ;
};
String SbERR_BAD_METHOD & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Objekt unterst³tzt diese Eigenschaft oder Methode nicht : Objekt untersttzt diese Eigenschaft oder Methode nicht */
Text [ en-US ] = "This property or method is not supported by the object." ;
};
String SbERR_OLE_ERROR & ERRCODE_RES_MASK
@@ -364,17 +331,14 @@ Resource RID_BASIC_START
};
String SbERR_BAD_ACTION & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Diese Aktion wird vom angegebenen Objekt nicht unterst³tzt : Diese Aktion wird vom angegebenen Objekt nicht untersttzt */
Text [ en-US ] = "This action is not supported by given object." ;
};
String SbERR_NO_NAMED_ARGS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Benannte Argumente werden vom angegebenen Objekt nicht unterst³tzt : Benannte Argumente werden vom angegebenen Objekt nicht untersttzt */
Text [ en-US ] = "Named arguments are not supported by given object." ;
};
String SbERR_BAD_LOCALE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht unterst³tzt : Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht untersttzt */
Text [ en-US ] = "The current locale setting is not supported by the given object." ;
};
String SbERR_NAMED_NOT_FOUND & ERRCODE_RES_MASK
@@ -395,7 +359,6 @@ Resource RID_BASIC_START
};
String SbERR_BAD_ORDINAL & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ordnungszahl ung³ltig : Ordnungszahl ungltig */
Text [ en-US ] = "Invalid ordinal number." ;
};
String SbERR_DLLPROC_NOT_FOUND & ERRCODE_RES_MASK
@@ -404,7 +367,6 @@ Resource RID_BASIC_START
};
String SbERR_BAD_CLIPBD_FORMAT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges Clipboard-Format : Ungltiges Clipboard-Format */
Text [ en-US ] = "Invalid clipboard format." ;
};
String SbERR_PROPERTY_NOT_FOUND & ERRCODE_RES_MASK
@@ -421,12 +383,10 @@ Resource RID_BASIC_START
};
String SbERR_BAD_NUMBER_OF_ARGS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltige Anzahl von Argumenten : Ungltige Anzahl von Argumenten */
Text [ en-US ] = "Invalid number of arguments." ;
};
String SbERR_METHOD_FAILED & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fehler in Ausf³hrung einer Methode : Fehler in Ausfhrung einer Methode */
Text [ en-US ] = "Error executing a method." ;
};
String SbERR_SETPROP_FAILED & ERRCODE_RES_MASK
@@ -516,12 +476,10 @@ Resource RID_BASIC_START
};
String SbERR_BAD_CHAR_IN_NUMBER & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges Zeichen in Zahl : Ungltiges Zeichen in Zahl */
Text [ en-US ] = "Invalid character in number." ;
};
String SbERR_MUST_HAVE_DIMS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Array mu˜ dimensioniert werden : Array muÿ dimensioniert werden */
Text [ en-US ] = "Array must be dimensioned." ;
};
String SbERR_NO_IF & ERRCODE_RES_MASK
@@ -530,12 +488,10 @@ Resource RID_BASIC_START
};
String SbERR_NOT_IN_SUBR & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) innerhalb einer Prozedur unzulõssig : $(ARG1) innerhalb einer Prozedur unzul§ssig */
Text [ en-US ] = "$(ARG1) not allowed within a procedure." ;
};
String SbERR_NOT_IN_MAIN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) au˜erhalb einer Prozedur unzulõssig : $(ARG1) auÿerhalb einer Prozedur unzul§ssig */
Text [ en-US ] = "$(ARG1) not allowed outside a procedure." ;
};
String SbERR_WRONG_DIMS & ERRCODE_RES_MASK
@@ -552,12 +508,10 @@ Resource RID_BASIC_START
};
String SbERR_PROG_TOO_LARGE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Programm ist zu gro˜ : Programm ist zu groÿ */
Text [ en-US ] = "Program too large." ;
};
String SbERR_NO_STRINGS_ARRAYS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Strings oder Arrays unzulõssig : Strings oder Arrays unzul§ssig */
Text [ en-US ] = "Strings or arrays not permitted." ;
};
String ERRCODE_BASIC_EXCEPTION & ERRCODE_RES_MASK
@@ -604,26 +558,14 @@ String IDS_SBERR_STOREREF
};
String ERRCODE_BASMGR_LIBLOAD & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */
Text [ en-US ] = "Error loading library '$(ARG1)'." ;
};
String ERRCODE_BASMGR_LIBSAVE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */
Text [ en-US ] = "Error saving library: '$(ARG1)'." ;
};
String ERRCODE_BASMGR_MGROPEN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
Text [ en-US ] = "The BASIC from the file '$(ARG1)' could not be initialized." ;
};
String ERRCODE_BASMGR_MGRSAVE & ERRCODE_RES_MASK
diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx
index 2b1f32e474d5..2f0a9fe93fee 100644..100755
--- a/basic/source/classes/sbintern.cxx
+++ b/basic/source/classes/sbintern.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,3 +81,4 @@ SbiGlobals::~SbiGlobals()
delete pTransliterationWrapper;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 13ae406cb305..28765880c6e4 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-//#include <stl_queue.h>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
-#ifndef _TOOLERR_HXX //autogen
#include <tools/errcode.hxx>
-#endif
#include <svl/hint.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -64,6 +62,7 @@
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
+#include <com/sun/star/script/XDefaultMethod.hpp>
#include <com/sun/star/script/XDirectInvocation.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
@@ -76,7 +75,7 @@
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
-
+#include <com/sun/star/script/XAutomationInvocation.hpp>
using com::sun::star::uno::Reference;
using namespace com::sun::star::uno;
@@ -99,7 +98,7 @@ using namespace cppu;
#include<runtime.hxx>
#include<math.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
#include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
@@ -113,7 +112,7 @@ TYPEINIT1(SbUnoSingleton,SbxObject)
typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper;
-// Flag, um immer ueber Invocation zu gehen
+// Flag to go via invocation
//#define INVOCATION_ONLY
@@ -162,11 +161,26 @@ SbxVariable* getDefaultProp( SbxVariable* pRef )
return pDefaultProp;
}
+void SetSbUnoObjectDfltPropName( SbxObject* pObj )
+{
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
+ if ( pUnoObj )
+ {
+ String sDfltPropName;
+
+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
+ {
+ OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
+ pUnoObj->SetDfltProperty( sDfltPropName );
+ }
+ }
+}
+
Reference< XComponentContext > getComponentContext_Impl( void )
{
static Reference< XComponentContext > xContext;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xContext.is() )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
@@ -182,12 +196,12 @@ Reference< XComponentContext > getComponentContext_Impl( void )
return xContext;
}
-// CoreReflection statisch speichern
+// save CoreReflection statically
Reference< XIdlReflection > getCoreReflection_Impl( void )
{
static Reference< XIdlReflection > xCoreReflection;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xCoreReflection.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
@@ -208,7 +222,7 @@ Reference< XIdlReflection > getCoreReflection_Impl( void )
return xCoreReflection;
}
-// CoreReflection statisch speichern
+// save CoreReflection statically
Reference< XHierarchicalNameAccess > getCoreReflection_HierarchicalNameAccess_Impl( void )
{
static Reference< XHierarchicalNameAccess > xCoreReflection_HierarchicalNameAccess;
@@ -230,7 +244,7 @@ Reference< XHierarchicalNameAccess > getTypeProvider_Impl( void )
{
static Reference< XHierarchicalNameAccess > xAccess;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xAccess.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
@@ -257,7 +271,7 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
{
static Reference< XTypeConverter > xTypeConverter;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xTypeConverter.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
@@ -349,7 +363,7 @@ void implAppendExceptionMsg( ::rtl::OUStringBuffer& _inout_rBuffer, const Except
}
-// Fehlermeldungs-Message bei Exception zusammenbauen
+// construct an error message for the exception
::rtl::OUString implGetExceptionMsg( const Exception& e, const ::rtl::OUString& aExceptionType_ )
{
::rtl::OUStringBuffer aMessageBuf;
@@ -396,10 +410,10 @@ Any convertAny( const Any& rVal, const Type& aDestType )
TYPEINIT1(SbUnoAnyObject,SbxObject)
-// TODO: Spaeter auslagern
+// TODO: source out later
Reference<XIdlClass> TypeToIdlClass( const Type& rType )
{
- // void als Default-Klasse eintragen
+ // register void as default class
Reference<XIdlClass> xRetClass;
typelib_TypeDescription * pTD = 0;
rType.getDescription( &pTD );
@@ -463,6 +477,32 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
SbError nError( ERRCODE_BASIC_EXCEPTION );
::rtl::OUStringBuffer aMessageBuf;
+ // Add for VBA, to get the correct error code and message.
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ if ( aExamine >>= aBasicError )
+ {
+ if ( aBasicError.ErrorCode != 0 )
+ {
+ nError = StarBASIC::GetSfxFromVBError( (sal_uInt16) aBasicError.ErrorCode );
+ if ( nError == 0 )
+ {
+ nError = (SbError) aBasicError.ErrorCode;
+ }
+ aMessageBuf.append( aBasicError.ErrorMessageArgument );
+ aExamine.clear();
+ }
+ }
+
+ IndexOutOfBoundsException aIdxOutBndsExp;
+ if ( aExamine >>= aIdxOutBndsExp )
+ {
+ nError = SbERR_OUT_OF_RANGE;
+ aExamine.clear();
+ }
+ }
+ // End add
+
// strip any other WrappedTargetException instances, but this time preserve the error messages.
WrappedTargetException aWrapped;
sal_Int32 nLevel = 0;
@@ -516,7 +556,6 @@ static void implHandleAnyException( const Any& _rCaughtException )
}
}
-
// NativeObjectWrapper handling
struct ObjectItem
{
@@ -554,7 +593,7 @@ SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
}
-// Von Uno nach Sbx wandeln
+// convert from Uno to Sbx
SbxDataType unoToSbxType( TypeClass eType )
{
SbxDataType eRetType = SbxVOID;
@@ -566,7 +605,7 @@ SbxDataType unoToSbxType( TypeClass eType )
case TypeClass_STRUCT:
case TypeClass_EXCEPTION: eRetType = SbxOBJECT; break;
- /* folgende Typen lassen wir erstmal weg
+ /* first we leave the following types out
case TypeClass_SERVICE: break;
case TypeClass_CLASS: break;
case TypeClass_TYPEDEF: break;
@@ -622,7 +661,6 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
Type aType = aValue.getValueType();
TypeClass eTypeClass = aType.getTypeClass();
- sal_Int32 indicesIndex = indices.getLength() -1;
sal_Int32 dimCopy = dimension;
if ( eTypeClass == TypeClass_SEQUENCE )
@@ -647,7 +685,6 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
sizes.realloc( sizes.getLength() + 1 );
sizes[ sizes.getLength() - 1 ] = nLen;
indices.realloc( indices.getLength() + 1 );
- indicesIndex = indices.getLength() - 1;
}
}
@@ -716,12 +753,12 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
Any aClassAny;
aClassAny <<= xClass;
- // SbUnoObject instanzieren
+ // instantiate SbUnoObject
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aClassAny );
SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject;
- // #51475 Wenn das Objekt ungueltig ist null liefern
+ // If the object is invalid deliver zero
if( pSbUnoObject->getUnoAny().getValueType().getTypeClass() == TypeClass_VOID )
{
pVar->PutObject( NULL );
@@ -732,7 +769,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
}
break;
- // Interfaces und Structs muessen in ein SbUnoObject gewrappt werden
+ // Interfaces and Structs must be wrapped in a SbUnoObject
case TypeClass_INTERFACE:
case TypeClass_STRUCT:
case TypeClass_EXCEPTION:
@@ -796,13 +833,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
oleautomation::Currency aCurrency;
if( (aValue >>= aCurrency) )
{
- sal_Int64 nValue64 = aCurrency.Value;
- SbxINT64 aInt64;
- aInt64.nHigh =
- sal::static_int_cast< sal_Int32 >(
- nValue64 >> 32);
- aInt64.nLow = (sal_uInt32)( nValue64 & 0xffffffff );
- pVar->PutCurrency( aInt64 );
+ pVar->PutCurrency( aCurrency.Value );
break;
}
}
@@ -810,7 +841,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
}
}
- // SbUnoObject instanzieren
+ // instantiate a SbUnoObject
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
//If this is called externally e.g. from the scripting
@@ -826,7 +857,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject;
- // #51475 Wenn das Objekt ungueltig ist null liefern
+ // If the object is invalid deliver zero
if( pSbUnoObject->getUnoAny().getValueType().getTypeClass() == TypeClass_VOID )
{
pVar->PutObject( NULL );
@@ -867,7 +898,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
Type aElementType( ((typelib_IndirectTypeDescription *)pTD)->pType );
::typelib_typedescription_release( pTD );
- // In Basic Array anlegen
+ // build an Array in Basic
SbxDimArrayRef xArray;
SbxDataType eSbxElementType = unoToSbxType( aElementType.getTypeClass() );
xArray = new SbxDimArray( eSbxElementType );
@@ -875,15 +906,15 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
{
xArray->unoAddDim32( 0, nLen - 1 );
- // Elemente als Variablen eintragen
+ // register the elements as variables
for( i = 0 ; i < nLen ; i++ )
{
- // Elemente wandeln
+ // convert elements
Any aElementAny = xIdlArray->get( aValue, (sal_uInt32)i );
SbxVariableRef xVar = new SbxVariable( eSbxElementType );
unoToSbxValue( (SbxVariable*)xVar, aElementAny );
- // Ins Array braten
+ // put into the Array
xArray->Put32( (SbxVariable*)xVar, &i );
}
}
@@ -892,13 +923,13 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
xArray->unoAddDim( 0, -1 );
}
- // Array zurueckliefern
+ // return the Array
sal_uInt16 nFlags = pVar->GetFlags();
pVar->ResetFlag( SBX_FIXED );
pVar->PutObject( (SbxDimArray*)xArray );
pVar->SetFlags( nFlags );
- // #54548, Die Parameter duerfen hier nicht weggehauen werden
+ // The parameter mustn't deleted here
//pVar->SetParameters( NULL );
}
break;
@@ -909,7 +940,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
case TypeClass_ANY:
{
- // Any rausholen und konvertieren
+ // get Any and convert it
//Any* pAny = (Any*)aValue.get();
//if( pAny )
//unoToSbxValue( pVar, *pAny );
@@ -942,7 +973,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
}
-// Reflection fuer Sbx-Typen liefern
+// Deliver the reflection for Sbx types
Type getUnoTypeForSbxBaseType( SbxDataType eType )
{
Type aRetType = getCppuVoidType();
@@ -975,9 +1006,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break;
case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break;
case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
- //case SbxLONG64: break;
- //case SbxULONG64: break;
- // Maschinenabhaengige zur Sicherheit auf Hyper abbilden
+ // map machine-dependent ones on hyper for secureness
case SbxINT: aRetType = ::getCppuType( (sal_Int32*)0 ); break;
case SbxUINT: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
//case SbxVOID: break;
@@ -994,14 +1023,14 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
return aRetType;
}
-// Konvertierung von Sbx nach Uno ohne bekannte Zielklasse fuer TypeClass_ANY
+// Converting of Sbx to Uno without a know target class for TypeClass_ANY
Type getUnoTypeForSbxValue( SbxValue* pVal )
{
Type aRetType = getCppuVoidType();
if( !pVal )
return aRetType;
- // SbxType nach Uno wandeln
+ // convert SbxType to Uno
SbxDataType eBaseType = pVal->SbxValue::GetType();
if( eBaseType == SbxOBJECT )
{
@@ -1029,8 +1058,8 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
{
if( eElementTypeClass == TypeClass_VOID || eElementTypeClass == TypeClass_ANY )
{
- // Wenn alle Elemente des Arrays vom gleichen Typ sind, wird
- // der genommen, sonst wird das ganze als Any-Sequence betrachtet
+ // If all elements of the arrays are from the same type, take
+ // this one - otherwise the whole will be considered as Any-Sequence
sal_Bool bNeedsInit = sal_True;
sal_Int32 nSize = nUpper - nLower + 1;
@@ -1054,7 +1083,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
else if( aElementType != aType )
{
- // Verschiedene Typen -> AnySequence
+ // different types -> AnySequence
aElementType = getCppuType( (Any*)0 );
break;
}
@@ -1092,7 +1121,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
else if( aElementType != aType )
{
- // Verschiedene Typen -> AnySequence
+ // different types -> AnySequence
aElementType = getCppuType( (Any*)0 );
break;
}
@@ -1106,7 +1135,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
aRetType = Type( TypeClass_SEQUENCE, aSeqTypeName );
}
}
- // Kein Array, sondern...
+ // No array, but ...
else if( xObj->ISA(SbUnoObject) )
{
aRetType = ((SbUnoObject*)(SbxBase*)xObj)->getUnoAny().getValueType();
@@ -1116,9 +1145,9 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
{
aRetType = ((SbUnoAnyObject*)(SbxBase*)xObj)->getValue().getValueType();
}
- // Sonst ist es ein Nicht-Uno-Basic-Objekt -> default==void liefern
+ // Otherwise it is a No-Uno-Basic-Object -> default==deliver void
}
- // Kein Objekt, Basistyp konvertieren
+ // No object, convert basic type
else
{
aRetType = getUnoTypeForSbxBaseType( eBaseType );
@@ -1126,10 +1155,10 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
return aRetType;
}
-// Deklaration Konvertierung von Sbx nach Uno mit bekannter Zielklasse
+// Declaration converting of Sbx to Uno with known target class
Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL );
-// Konvertierung von Sbx nach Uno ohne bekannte Zielklasse fuer TypeClass_ANY
+// converting of Sbx to Uno without known target class for TypeClass_ANY
Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType = false )
{
SbxDataType eBaseType = pVar->SbxValue::GetType();
@@ -1221,6 +1250,7 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
aType = ::getCppuType( (sal_uInt16*)0 );
break;
}
+ // TODO: need to add hyper types ?
default: break;
}
}
@@ -1275,7 +1305,7 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
try
{
- // In die Sequence uebernehmen
+ // transfer to the sequence
xArray->set( aRetVal, i, aElementVal );
}
catch( const IllegalArgumentException& )
@@ -1297,7 +1327,6 @@ Any sbxToUnoValue( SbxVariable* pVar )
return sbxToUnoValueImpl( pVar );
}
-
// Funktion, um einen globalen Bezeichner im
// UnoScope zu suchen und fuer Sbx zu wrappen
static bool implGetTypeByName( const String& rName, Type& rRetType )
@@ -1321,7 +1350,7 @@ static bool implGetTypeByName( const String& rName, Type& rRetType )
}
-// Konvertierung von Sbx nach Uno mit bekannter Zielklasse
+// converting of Sbx to Uno with known target class
Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty )
{
Any aRetVal;
@@ -1352,7 +1381,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
{
Reference< XIdlClass > xIdlTargetClass = TypeToIdlClass( rType );
- // Null-Referenz?
+ // zero referenz?
if( pVar->IsNull() && eType == TypeClass_INTERFACE )
{
Reference< XInterface > xRef;
@@ -1377,13 +1406,8 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
else if( rType == ::getCppuType( (oleautomation::Currency*)0 ) )
{
- SbxINT64 aInt64 = pVar->GetCurrency();
- oleautomation::Currency aCurrency;
- sal_Int64& rnValue64 = aCurrency.Value;
- rnValue64 = aInt64.nHigh;
- rnValue64 <<= 32;
- rnValue64 |= aInt64.nLow;
- aRetVal <<= aCurrency;
+ // assumes per previous code that ole Currency is Int64
+ aRetVal <<= (sal_Int64)( pVar->GetInt64() );
break;
}
else if( rType == ::getCppuType( (oleautomation::Date*)0 ) )
@@ -1403,7 +1427,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
else
{
- // #109936 NULL object -> NULL XInterface
+ // zero object -> zero XInterface
Reference<XInterface> xInt;
aRetVal <<= xInt;
}
@@ -1444,16 +1468,14 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
break;
- /* folgende Typen lassen wir erstmal weg
+ /* we leave out the following types
case TypeClass_SERVICE: break;
case TypeClass_CLASS: break;
case TypeClass_TYPEDEF: break;
case TypeClass_UNION: break;
- case TypeClass_ENUM: break;
case TypeClass_ARRAY: break;
*/
- // Array -> Sequence
case TypeClass_ENUM:
{
aRetVal = int2enum( pVar->GetLong(), rType );
@@ -1476,7 +1498,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
{
sal_Int32 nSeqSize = nUpper - nLower + 1;
- // Instanz der geforderten Sequence erzeugen
+ // create the instanz of the required sequence
Reference< XIdlClass > xIdlTargetClass = TypeToIdlClass( rType );
xIdlTargetClass->createObject( aRetVal );
Reference< XIdlArray > xArray = xIdlTargetClass->getArray();
@@ -1490,18 +1512,18 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
Type aElemType( ((typelib_IndirectTypeDescription *)pSeqTD)->pType );
// Reference< XIdlClass > xElementClass = TypeToIdlClass( aElemType );
- // Alle Array-Member umwandeln und eintragen
+ // convert all array member and register them
sal_Int32 nIdx = nLower;
for( sal_Int32 i = 0 ; i < nSeqSize ; i++,nIdx++ )
{
SbxVariableRef xVar = pArray->Get32( &nIdx );
- // Wert von Sbx nach Uno wandeln
+ // Convert the value of Sbx to Uno
Any aAnyValue = sbxToUnoValue( (SbxVariable*)xVar, aElemType );
try
{
- // In die Sequence uebernehmen
+ // take over to the sequence
xArray->set( aRetVal, i, aAnyValue );
}
catch( const IllegalArgumentException& )
@@ -1573,7 +1595,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
case TypeClass_UNKNOWN: break;
*/
- // Bei Any die Klassen-unabhaengige Konvertierungs-Routine nutzen
+ // Use for Any the class indipendent converting routine
case TypeClass_ANY:
{
aRetVal = sbxToUnoValueImpl( pVar );
@@ -1634,7 +1656,102 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
return aRetVal;
}
-// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, sal_uInt32 nParamCount )
+{
+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
+ if( bOLEAutomation )
+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
+
+ args.realloc( nParamCount );
+ Any* pAnyArgs = args.getArray();
+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
+ sal_uInt32 i = 0;
+ if( pArgNamesArray )
+ {
+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
+ ::rtl::OUString* pNames = rNameSeq.getArray();
+ Any aValAny;
+ for( i = 0 ; i < nParamCount ; i++ )
+ {
+ sal_uInt16 iSbx = (sal_uInt16)(i+1);
+
+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
+ bBlockConversionToSmallestType );
+
+ ::rtl::OUString aParamName = pNames[iSbx];
+ if( aParamName.getLength() )
+ {
+ oleautomation::NamedArgument aNamedArgument;
+ aNamedArgument.Name = aParamName;
+ aNamedArgument.Value = aValAny;
+ pAnyArgs[i] <<= aNamedArgument;
+ }
+ else
+ {
+ pAnyArgs[i] = aValAny;
+ }
+ }
+ }
+ else
+ {
+ for( i = 0 ; i < nParamCount ; i++ )
+ {
+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (sal_uInt16)(i+1) ),
+ bBlockConversionToSmallestType );
+ }
+ }
+
+}
+enum INVOKETYPE
+{
+ GetProp = 0,
+ SetProp,
+ Func
+};
+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, sal_uInt32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
+{
+ Sequence< sal_Int16 > OutParamIndex;
+ Sequence< Any > OutParam;
+
+ Any aRetAny;
+ switch( invokeType )
+ {
+ case Func:
+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
+ break;
+ case GetProp:
+ {
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY );
+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
+ break;
+ }
+ case SetProp:
+ {
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
+ break;
+ }
+ default:
+ break; // should introduce an error here
+
+ }
+ const sal_Int16* pIndices = OutParamIndex.getConstArray();
+ sal_uInt32 nLen = OutParamIndex.getLength();
+ if( nLen )
+ {
+ const Any* pNewValues = OutParam.getConstArray();
+ for( sal_uInt32 j = 0 ; j < nLen ; j++ )
+ {
+ sal_Int16 iTarget = pIndices[ j ];
+ if( iTarget >= (sal_Int16)nParamCount )
+ break;
+ unoToSbxValue( (SbxVariable*)pParams->Get( (sal_uInt16)(j+1) ), pNewValues[ j ] );
+ }
+ }
+ return aRetAny;
+}
+
+// Debugging help method to readout the imlemented interfaces of an object
String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, sal_uInt16 nRekLevel )
{
Type aIfaceType = ::getCppuType( (const Reference< XInterface > *)0 );
@@ -1647,17 +1764,17 @@ String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference<
::rtl::OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
- // Pruefen, ob das Interface wirklich unterstuetzt wird
+ // checking if the interface is realy supported
if( !x->queryInterface( aClassType ).hasValue() )
{
aRetStr.AppendAscii( " (ERROR: Not really supported!)\n" );
}
- // Gibt es Super-Interfaces
+ // Are there super interfaces?
else
{
aRetStr.AppendAscii( "\n" );
- // Super-Interfaces holen
+ // get the super interfaces
Sequence< Reference< XIdlClass > > aSuperClassSeq = xClass->getSuperclasses();
const Reference< XIdlClass >* pClasses = aSuperClassSeq.getConstArray();
sal_uInt32 nSuperIfaceCount = aSuperClassSeq.getLength();
@@ -1750,7 +1867,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
Reference<XIdlClass> xClass = TypeToIdlClass( rType );
if( !xClass.is() )
{
- DBG_ERROR("failed to get XIdlClass for type");
+ OSL_FAIL("failed to get XIdlClass for type");
break;
}
::rtl::OUString sClassName = xClass->getName();
@@ -1790,12 +1907,12 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
return result;
}
-// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
+// Debugging help method to readout the imlemented interfaces of an object
String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
{
Any aToInspectObj = pUnoObj->getUnoAny();
- // #54898: Nur TypeClass Interface zulasssen
+ // allow only TypeClass interface
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
String aRet;
if( eType != TypeClass_INTERFACE )
@@ -1805,10 +1922,10 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
}
else
{
- // Interface aus dem Any besorgen
+ // get the interface from the Any
const Reference< XInterface > x = *(Reference< XInterface >*)aToInspectObj.getValue();
- // XIdlClassProvider-Interface ansprechen
+ // address the XIdlClassProvider-Interface
Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY );
Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
@@ -1818,7 +1935,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
aRet.AppendAscii( "\n" );
if( xTypeProvider.is() )
{
- // Interfaces der Implementation holen
+ // get the interfaces of the implementation
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
const Type* pTypeArray = aTypeSeq.getConstArray();
sal_uInt32 nIfaceCount = aTypeSeq.getLength();
@@ -1846,7 +1963,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
else if( xClassProvider.is() )
{
- DBG_ERROR( "XClassProvider not supported in UNO3" );
+ OSL_FAIL( "XClassProvider not supported in UNO3" );
}
}
return aRet;
@@ -1854,7 +1971,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
-// Dbg-Hilfsmethode SbxDataType -> String
+// Debugging help method SbxDataType -> String
String Dbg_SbxDataType2String( SbxDataType eType )
{
String aRet( RTL_CONSTASCII_USTRINGPARAM("Unknown Sbx-Type!") );
@@ -1879,8 +1996,6 @@ String Dbg_SbxDataType2String( SbxDataType eType )
case SbxBYTE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxBYTE") ); break;
case SbxUSHORT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUSHORT") ); break;
case SbxULONG: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxULONG") ); break;
- case SbxLONG64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLONG64") ); break;
- case SbxULONG64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxULONG64") ); break;
case SbxSALINT64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINT64") ); break;
case SbxSALUINT64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUINT64") ); break;
case SbxINT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINT") ); break;
@@ -1900,14 +2015,14 @@ String Dbg_SbxDataType2String( SbxDataType eType )
return aRet;
}
-// Dbg-Hilfsmethode zum Anzeigen der Properties eines SbUnoObjects
+// Debugging help method to display the properties of a SbUnoObjects
String Impl_DumpProperties( SbUnoObject* pUnoObj )
{
String aRet( RTL_CONSTASCII_USTRINGPARAM("Properties of object ") );
String aObjName = getDbgObjectName( pUnoObj );
aRet += aObjName;
- // Uno-Infos auswerten, um Arrays zu erkennen
+ // analyse the Uno-Infos to recognise the arrays
Reference< XIntrospectionAccess > xAccess = pUnoObj->getIntrospectionAccess();
if( !xAccess.is() )
{
@@ -1937,8 +2052,8 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
if( (i % nPropsPerLine) == 0 )
aPropStr.AppendAscii( "\n" );
- // Typ und Namen ausgeben
- // Ist es in Uno eine Sequence?
+ // output the type and name
+ // Is it in Uno a sequence?
SbxDataType eType = pVar->GetFullType();
sal_Bool bMaybeVoid = sal_False;
@@ -1946,8 +2061,8 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
{
const Property& rProp = pUnoProps[ i ];
- // #63133: Bei MAYBEVOID Typ aus Uno neu konvertieren,
- // damit nicht immer nur SbxEMPTY ausgegben wird.
+ // By MAYBEVOID convert the type out of Uno newly,
+ // so that not only SbxEMPTY were outputed.
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
{
eType = unoToSbxType( rProp.Type.getTypeClass() );
@@ -1977,14 +2092,14 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
return aRet;
}
-// Dbg-Hilfsmethode zum Anzeigen der Methoden eines SbUnoObjects
+// Debugging help method to display the methods of an SbUnoObjects
String Impl_DumpMethods( SbUnoObject* pUnoObj )
{
String aRet( RTL_CONSTASCII_USTRINGPARAM("Methods of object ") );
String aObjName = getDbgObjectName( pUnoObj );
aRet += aObjName;
- // XIntrospectionAccess, um die Typen der Parameter auch ausgeben zu koennen
+ // XIntrospectionAccess, so that the types of the parameter could be outputed
Reference< XIntrospectionAccess > xAccess = pUnoObj->getIntrospectionAccess();
if( !xAccess.is() )
{
@@ -2018,10 +2133,10 @@ String Impl_DumpMethods( SbUnoObject* pUnoObj )
if( (i % nPropsPerLine) == 0 )
aPropStr.AppendAscii( "\n" );
- // Methode ansprechen
+ // address the method
const Reference< XIdlMethod >& rxMethod = pUnoMethods[i];
- // Ist es in Uno eine Sequence?
+ // Is it in Uno a sequence?
SbxDataType eType = pVar->GetFullType();
if( eType == SbxOBJECT )
{
@@ -2029,13 +2144,13 @@ String Impl_DumpMethods( SbUnoObject* pUnoObj )
if( xClass.is() && xClass->getTypeClass() == TypeClass_SEQUENCE )
eType = (SbxDataType) ( SbxOBJECT | SbxARRAY );
}
- // Name und Typ ausgeben
+ // output the name and the type
aPropStr += Dbg_SbxDataType2String( eType );
aPropStr.AppendAscii( " " );
aPropStr += pVar->GetName();
aPropStr.AppendAscii( " ( " );
- // get-Methode darf keinen Parameter haben
+ // the get-method mustn't have a parameter
Sequence< Reference< XIdlClass > > aParamsSeq = rxMethod->getParameterTypes();
sal_uInt32 nParamCount = aParamsSeq.getLength();
const Reference< XIdlClass >* pParams = aParamsSeq.getConstArray();
@@ -2092,24 +2207,24 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
sal_Int32 nId = pProp->nId;
if( nId < 0 )
{
- // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen
+ // Id == -1: Display implemented interfaces according the ClassProvider
if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES"
{
String aRetStr = Impl_GetSupportedInterfaces( this );
pVar->PutString( aRetStr );
}
- // Id == -2: Properties ausgeben
+ // Id == -2: output properties
else if( nId == -2 ) // Property ID_DBG_PROPERTIES
{
- // Jetzt muessen alle Properties angelegt werden
+ // by now all properties must be established
implCreateAll();
String aRetStr = Impl_DumpProperties( this );
pVar->PutString( aRetStr );
}
- // Id == -3: Methoden ausgeben
+ // Id == -3: output the methods
else if( nId == -3 ) // Property ID_DBG_METHODS
{
- // Jetzt muessen alle Properties angelegt werden
+ // y now all properties must be established
implCreateAll();
String aRetStr = Impl_DumpMethods( this );
pVar->PutString( aRetStr );
@@ -2121,14 +2236,14 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
try
{
- // Wert holen
+ // get the value
Reference< XPropertySet > xPropSet( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY );
Any aRetAny = xPropSet->getPropertyValue( pProp->GetName() );
- // Die Nutzung von getPropertyValue (statt ueber den Index zu gehen) ist
- // nicht optimal, aber die Umstellung auf XInvocation steht ja ohnehin an
- // Ansonsten kann auch FastPropertySet genutzt werden
+ // The use of getPropertyValue (instead of using the index) is
+ // suboptimal, but the refactoring to XInvocation is already pending
+ // Otherwise it is posible to use FastPropertySet
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
}
catch( const Exception& )
@@ -2140,11 +2255,24 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
try
{
- // Wert holen
- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
-
- // Wert von Uno nach Sbx uebernehmen
+ sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
+ Any aRetAny;
+ if ( bCanBeConsideredAMethod && nParamCount )
+ {
+ // Automation properties have methods, so.. we need to invoke this through
+ // XInvocation
+ Sequence<Any> args;
+ processAutomationParams( pParams, args, true, nParamCount );
+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
+ }
+ else
+ aRetAny = mxInvocation->getValue( pProp->GetName() );
+ // take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
+ if( pParams && bCanBeConsideredAMethod )
+ pVar->SetParameters( NULL );
+
}
catch( const Exception& )
{
@@ -2162,16 +2290,16 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
return;
}
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
Any aAnyValue = sbxToUnoValue( pVar, pProp->aUnoProp.Type, &pProp->aUnoProp );
try
{
- // Wert setzen
+ // set the value
Reference< XPropertySet > xPropSet( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY );
xPropSet->setPropertyValue( pProp->GetName(), aAnyValue );
- // Die Nutzung von getPropertyValue (statt ueber den Index zu gehen) ist
- // nicht optimal, aber die Umstellung auf XInvocation steht ja ohnehin an
- // Ansonsten kann auch FastPropertySet genutzt werden
+ // The use of getPropertyValue (instead of using the index) is
+ // suboptimal, but the refactoring to XInvocation is already pending
+ // Otherwise it is posible to use FastPropertySet
}
catch( const Exception& )
{
@@ -2180,11 +2308,11 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
else if( bInvocation && mxInvocation.is() )
{
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
Any aAnyValue = sbxToUnoValueImpl( pVar );
try
{
- // Wert setzen
+ // set the value
mxInvocation->setValue( pProp->GetName(), aAnyValue );
}
catch( const Exception& )
@@ -2199,7 +2327,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
bool bInvocation = pMeth->isInvocationBased();
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
- // Anzahl Parameter -1 wegen Param0 == this
+ // number of Parameter -1 because of Param0 == this
sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
Sequence<Any> args;
sal_Bool bOutParams = sal_False;
@@ -2207,13 +2335,13 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( !bInvocation && mxUnoAccess.is() )
{
- // Infos holen
+ // get info
const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos();
const ParamInfo* pParamInfos = rInfoSeq.getConstArray();
sal_uInt32 nUnoParamCount = rInfoSeq.getLength();
sal_uInt32 nAllocParamCount = nParamCount;
- // Ueberschuessige Parameter ignorieren, Alternative: Error schmeissen
+ // ignore surplus parameter; alternative: throw an error
if( nParamCount > nUnoParamCount )
{
nParamCount = nUnoParamCount;
@@ -2253,10 +2381,10 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
com::sun::star::uno::Type aType( rxClass->getTypeClass(), rxClass->getName() );
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
+ // ATTENTION: Don't forget for Sbx-Parameter the offset!
pAnyArgs[i] = sbxToUnoValue( pParams->Get( (sal_uInt16)(i+1) ), aType );
- // Wenn es nicht schon feststeht pruefen, ob Out-Parameter vorliegen
+ // If it is not certain check whether the out-parameter are available.
if( !bOutParams )
{
ParamMode aParamMode = rInfo.aMode;
@@ -2269,55 +2397,10 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
else if( bInvocation && pParams && mxInvocation.is() )
{
bool bOLEAutomation = true;
- // TODO: bOLEAutomation = xOLEAutomation.is()
-
- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
- if( bOLEAutomation )
- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-
- args.realloc( nParamCount );
- Any* pAnyArgs = args.getArray();
- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
- if( pArgNamesArray )
- {
- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
- ::rtl::OUString* pNames = rNameSeq.getArray();
-
- Any aValAny;
- for( i = 0 ; i < nParamCount ; i++ )
- {
- sal_uInt16 iSbx = (sal_uInt16)(i+1);
-
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
- bBlockConversionToSmallestType );
-
- ::rtl::OUString aParamName = pNames[iSbx];
- if( aParamName.getLength() )
- {
- oleautomation::NamedArgument aNamedArgument;
- aNamedArgument.Name = aParamName;
- aNamedArgument.Value = aValAny;
- pAnyArgs[i] <<= aNamedArgument;
- }
- else
- {
- pAnyArgs[i] = aValAny;
- }
- }
- }
- else
- {
- for( i = 0 ; i < nParamCount ; i++ )
- {
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (sal_uInt16)(i+1) ),
- bBlockConversionToSmallestType );
- }
- }
+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
}
- // Methode callen
+ // call the method
GetSbData()->bBlockCompilerError = sal_True; // #106433 Block compiler errors for API calls
try
{
@@ -2325,15 +2408,15 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
Any aRetAny = pMeth->m_xUnoMethod->invoke( getUnoAny(), args );
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
- // Muessen wir Out-Parameter zurueckkopieren?
+ // Did we to copy back the Out-Parameter?
if( bOutParams )
{
const Any* pAnyArgs = args.getConstArray();
- // Infos holen
+ // get info
const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos();
const ParamInfo* pParamInfos = rInfoSeq.getConstArray();
@@ -2349,40 +2432,12 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
else if( bInvocation && mxInvocation.is() )
{
- Reference< XDirectInvocation > xDirectInvoke;
- if ( pMeth->needsDirectInvocation() )
- xDirectInvoke.set( mxInvocation, UNO_QUERY );
-
- Any aRetAny;
- if ( xDirectInvoke.is() )
- aRetAny = xDirectInvoke->directInvoke( pMeth->GetName(), args );
- else
- {
- Sequence< sal_Int16 > OutParamIndex;
- Sequence< Any > OutParam;
- aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
-
- const sal_Int16* pIndices = OutParamIndex.getConstArray();
- sal_uInt32 nLen = OutParamIndex.getLength();
- if( nLen )
- {
- const Any* pNewValues = OutParam.getConstArray();
- for( sal_uInt32 j = 0 ; j < nLen ; j++ )
- {
- sal_Int16 iTarget = pIndices[ j ];
- if( iTarget >= (sal_Int16)nParamCount )
- break;
- unoToSbxValue( (SbxVariable*)pParams->Get( (sal_uInt16)(j+1) ), pNewValues[ j ] );
- }
- }
- }
-
- // Wert von Uno nach Sbx uebernehmen
+ Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
unoToSbxValue( pVar, aRetAny );
- }
+ }
- // #55460, Parameter hier weghauen, da das in unoToSbxValue()
- // bei Arrays wegen #54548 nicht mehr gemacht wird
+ // remove parameter here, because this was not done anymore in unoToSbxValue()
+ // for arrays
if( pParams )
pVar->SetParameters( NULL );
}
@@ -2400,7 +2455,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
#ifdef INVOCATION_ONLY
-// Aus USR
+// From USR
Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
#endif
@@ -2411,16 +2466,16 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
{
static Reference< XIntrospection > xIntrospection;
- // Default-Properties von Sbx wieder rauspruegeln
+ // beat out again the default properties of Sbx
Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE );
Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Parent") ), SbxCLASS_DONTCARE );
- // Typ des Objekts pruefen
+ // check the type of the ojekts
TypeClass eType = aUnoObj_.getValueType().getTypeClass();
Reference< XInterface > x;
if( eType == TypeClass_INTERFACE )
{
- // Interface aus dem Any besorgen
+ // get the interface from the Any
x = *(Reference< XInterface >*)aUnoObj_.getValue();
if( !x.is() )
return;
@@ -2428,10 +2483,10 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
Reference< XTypeProvider > xTypeProvider;
#ifdef INVOCATION_ONLY
- // Invocation besorgen
+ // get the invocation
mxInvocation = createDynamicInvocationFor( aUnoObj_ );
#else
- // Hat das Object selbst eine Invocation?
+ // Did the object have an invocation itself?
mxInvocation = Reference< XInvocation >( x, UNO_QUERY );
xTypeProvider = Reference< XTypeProvider >( x, UNO_QUERY );
@@ -2444,10 +2499,10 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
// the invocation service!!!
// mxMaterialHolder = Reference< XMaterialHolder >::query( mxInvocation );
- // ExactName holen
+ // get the ExactName
mxExactNameInvocation = Reference< XExactName >::query( mxInvocation );
- // Rest bezieht sich nur auf Introspection
+ // The remainder refers only to the introspection
if( !xTypeProvider.is() )
{
bNeedIntrospection = sal_False;
@@ -2464,18 +2519,18 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
maTmpUnoObj = aUnoObj_;
- //*** Namen bestimmen ***
+ //*** Define the name ***
sal_Bool bFatalError = sal_True;
- // Ist es ein Interface oder eine struct?
+ // Is it an interface or a struct?
sal_Bool bSetClassName = sal_False;
String aClassName_;
if( eType == TypeClass_STRUCT || eType == TypeClass_EXCEPTION )
{
- // Struct ist Ok
+ // Struct is Ok
bFatalError = sal_False;
- // #67173 Echten Klassen-Namen eintragen
+ // insert the real name of the class
if( aName_.Len() == 0 )
{
aClassName_ = String( aUnoObj_.getValueType().getTypeName() );
@@ -2484,14 +2539,14 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
}
else if( eType == TypeClass_INTERFACE )
{
- // #70197 Interface geht immer durch Typ im Any
+ // Interface works always through the type in the Any
bFatalError = sal_False;
- // Nach XIdlClassProvider-Interface fragen
+ // Ask for the XIdlClassProvider-Interface
Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY );
if( xClassProvider.is() )
{
- // #67173 Echten Klassen-Namen eintragen
+ // Insert the real name of the class
if( aName_.Len() == 0 )
{
Sequence< Reference< XIdlClass > > szClasses = xClassProvider->getIdlClasses();
@@ -2511,14 +2566,14 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
if( bSetClassName )
SetClassName( aClassName_ );
- // Weder Interface noch Struct -> FatalError
+ // Neither interface nor Struct -> FatalError
if( bFatalError )
{
StarBASIC::FatalError( ERRCODE_BASIC_EXCEPTION );
return;
}
- // #67781 Introspection erst on demand durchfuehren
+ // pass the introspection primal on demand
}
SbUnoObject::~SbUnoObject()
@@ -2526,7 +2581,7 @@ SbUnoObject::~SbUnoObject()
}
-// #76470 Introspection on Demand durchfuehren
+// pass the introspection on Demand
void SbUnoObject::doIntrospection( void )
{
static Reference< XIntrospection > xIntrospection;
@@ -2537,11 +2592,11 @@ void SbUnoObject::doIntrospection( void )
if( !xIntrospection.is() )
{
- // Introspection-Service holen
+ // get the introspection service
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
if ( xFactory.is() )
{
- Reference< XInterface > xI = xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") );
+ Reference< XInterface > xI = xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) );
if (xI.is())
xIntrospection = Reference< XIntrospection >::query( xI );
//xI->queryInterface( ::getCppuType( (const Reference< XIntrospection > *)0 ), xIntrospection );
@@ -2553,7 +2608,7 @@ void SbUnoObject::doIntrospection( void )
return;
}
- // Introspection durchfuehren
+ // pass the introspection
try
{
mxUnoAccess = xIntrospection->inspect( maTmpUnoObj );
@@ -2565,21 +2620,21 @@ void SbUnoObject::doIntrospection( void )
if( !mxUnoAccess.is() )
{
- // #51475 Ungueltiges Objekt kennzeichnen (kein mxMaterialHolder)
+ // #51475 mark an invalid objekt kennzeichnen (no mxMaterialHolder)
return;
}
- // MaterialHolder vom Access holen
+ // get MaterialHolder from access
mxMaterialHolder = Reference< XMaterialHolder >::query( mxUnoAccess );
- // ExactName vom Access holen
+ // get ExactName from access
mxExactName = Reference< XExactName >::query( mxUnoAccess );
}
-// #67781 Start einer Liste aller SbUnoMethod-Instanzen
+// Start of a list of all SbUnoMethod-Instances
static SbUnoMethod* pFirst = NULL;
void clearUnoMethodsForBasic( StarBASIC* pBasic )
@@ -2649,7 +2704,7 @@ SbUnoMethod::SbUnoMethod
m_xUnoMethod = xUnoMethod_;
pParamInfoSeq = NULL;
- // #67781 Methode in Liste eintragen
+ // enregister the method in a list
pNext = pFirst;
pPrev = NULL;
pFirst = this;
@@ -2720,7 +2775,7 @@ SbUnoProperty::SbUnoProperty
, nId( nId_ )
, mbInvocation( bInvocation )
{
- // #54548, bei bedarf Dummy-Array einsetzen, damit SbiRuntime::CheckArray() geht
+ // as needed establish an dummy array so that SbiRuntime::CheckArray() works
static SbxArrayRef xDummyArray = new SbxArray( SbxVARIANT );
if( eSbxType & SbxARRAY )
PutObject( xDummyArray );
@@ -2740,8 +2795,8 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
if( bNeedIntrospection )
doIntrospection();
- // Neu 4.3.1999: Properties on Demand anlegen, daher jetzt perIntrospectionAccess
- // suchen, ob doch eine Property oder Methode des geforderten Namens existiert
+ // New 1999-03-04: Create properties on demand. Therefore search now perIntrospectionAccess,
+ // if a property or a method of the required name exist
if( !pRes )
{
::rtl::OUString aUName( rName );
@@ -2758,14 +2813,14 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
const Property& rProp = mxUnoAccess->
getProperty( aUName, PropertyConcept::ALL - PropertyConcept::DANGEROUS );
- // #58455 Wenn die Property void sein kann, muss als Typ Variant gesetzt werden
+ // If the property could be void the type had to be set to Variant
SbxDataType eSbxType;
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
eSbxType = SbxVARIANT;
else
eSbxType = unoToSbxType( rProp.Type.getTypeClass() );
- // Property anlegen und reinbraten
+ // create the property and superimpose it
SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, 0, false );
QuickInsert( (SbxVariable*)xVarRef );
pRes = xVarRef;
@@ -2773,18 +2828,18 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
else if( mxUnoAccess->hasMethod( aUName,
MethodConcept::ALL - MethodConcept::DANGEROUS ) )
{
- // Methode ansprechen
+ // address the method
const Reference< XIdlMethod >& rxMethod = mxUnoAccess->
getMethod( aUName, MethodConcept::ALL - MethodConcept::DANGEROUS );
- // SbUnoMethode anlegen und reinbraten
+ // create SbUnoMethod and superimpose it
SbxVariableRef xMethRef = new SbUnoMethod( rxMethod->getName(),
unoToSbxType( rxMethod->getReturnType() ), rxMethod, false );
QuickInsert( (SbxVariable*)xMethRef );
pRes = xMethRef;
}
- // Wenn immer noch nichts gefunden wurde, muss geprueft werden, ob NameAccess vorliegt
+ // Elsewise nothing would be found it had to be checked, if NameAccess is existent
if( !pRes )
{
try
@@ -2796,13 +2851,13 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
{
Any aAny = xNameAccess->getByName( aUName2 );
- // ACHTUNG: Die hier erzeugte Variable darf wegen bei XNameAccess
+ // ATTENTION: Die hier erzeugte Variable darf wegen bei XNameAccess
// nicht als feste Property in das Object aufgenommen werden und
// wird daher nirgendwo gehalten.
- // Wenn das Probleme gibt, muss das kuenstlich gemacht werden oder
- // es muss eine Klasse SbUnoNameAccessProperty geschaffen werden,
- // bei der die Existenz staendig neu ueberprueft und die ggf. weg-
- // geworfen wird, wenn der Name nicht mehr gefunden wird.
+ // If this leads to problems, it has to be created synthetically or
+ // a class SbUnoNameAccessProperty, whose existence had to be checked
+ // constantly and which were if necessary thrown away
+ // if the name was not found anymore.
pRes = new SbxVariable( SbxVARIANT );
unoToSbxValue( pRes, aAny );
}
@@ -2813,7 +2868,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
catch( const Exception& )
{
- // Anlegen, damit der Exception-Fehler nicht ueberschrieben wird
+ // Establish so that the exeption error will not be overwriten
if( !pRes )
pRes = new SbxVariable( SbxVARIANT );
@@ -2834,14 +2889,14 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
{
if( mxInvocation->hasProperty( aUName ) )
{
- // Property anlegen und reinbraten
+ // create a property and superimpose it
SbxVariableRef xVarRef = new SbUnoProperty( aUName, SbxVARIANT, aDummyProp, 0, true );
QuickInsert( (SbxVariable*)xVarRef );
pRes = xVarRef;
}
else if( mxInvocation->hasMethod( aUName ) )
{
- // SbUnoMethode anlegen und reinbraten
+ // create SbUnoMethode and superimpose it
SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod, true );
QuickInsert( (SbxVariable*)xMethRef );
pRes = xMethRef;
@@ -2860,7 +2915,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
catch( RuntimeException& e )
{
- // Anlegen, damit der Exception-Fehler nicht ueberschrieben wird
+ // Establish so that the exeption error will not be overwriten
if( !pRes )
pRes = new SbxVariable( SbxVARIANT );
@@ -2869,7 +2924,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
}
- // Ganz am Schluss noch pruefen, ob die Dbg_-Properties gemeint sind
+ // At the very end checking if the Dbg_-Properties are meant
if( !pRes )
{
@@ -2877,10 +2932,10 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
rName.EqualsIgnoreCaseAscii( ID_DBG_PROPERTIES ) ||
rName.EqualsIgnoreCaseAscii( ID_DBG_METHODS ) )
{
- // Anlegen
+ // Create
implCreateDbgProperties();
- // Jetzt muessen sie regulaer gefunden werden
+ // Now they have to be found regular
pRes = SbxObject::Find( rName, SbxCLASS_DONTCARE );
}
}
@@ -2888,33 +2943,33 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
-// Hilfs-Methode zum Anlegen der dbg_-Properties
+// help method to create the dbg_-Properties
void SbUnoObject::implCreateDbgProperties( void )
{
Property aProp;
- // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen
+ // Id == -1: display the implemented interfaces corresponding the ClassProvider
SbxVariableRef xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_SUPPORTEDINTERFACES)), SbxSTRING, aProp, -1, false );
QuickInsert( (SbxVariable*)xVarRef );
- // Id == -2: Properties ausgeben
+ // Id == -2: output the properties
xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_PROPERTIES)), SbxSTRING, aProp, -2, false );
QuickInsert( (SbxVariable*)xVarRef );
- // Id == -3: Methoden ausgeben
+ // Id == -3: output the Methods
xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_METHODS)), SbxSTRING, aProp, -3, false );
QuickInsert( (SbxVariable*)xVarRef );
}
void SbUnoObject::implCreateAll( void )
{
- // Bestehende Methoden und Properties alle wieder wegwerfen
+ // throw away all existing methods and properties
pMethods = new SbxArray;
pProps = new SbxArray;
if( bNeedIntrospection ) doIntrospection();
- // Instrospection besorgen
+ // get instrospection
Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
if( !xAccess.is() || bNativeCOMObject )
{
@@ -2926,7 +2981,7 @@ void SbUnoObject::implCreateAll( void )
if( !xAccess.is() )
return;
- // Properties anlegen
+ // Establish properties
Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS );
sal_uInt32 nPropCount = props.getLength();
const Property* pProps_ = props.getConstArray();
@@ -2936,32 +2991,32 @@ void SbUnoObject::implCreateAll( void )
{
const Property& rProp = pProps_[ i ];
- // #58455 Wenn die Property void sein kann, muss als Typ Variant gesetzt werden
+ // If the property could be void the type had to be set to Variant
SbxDataType eSbxType;
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
eSbxType = SbxVARIANT;
else
eSbxType = unoToSbxType( rProp.Type.getTypeClass() );
- // Property anlegen und reinbraten
+ // Create property and superimpose it
SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, i, false );
QuickInsert( (SbxVariable*)xVarRef );
}
- // Dbg_-Properties anlegen
+ // Create Dbg_-Properties
implCreateDbgProperties();
- // Methoden anlegen
+ // Create methods
Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods
( MethodConcept::ALL - MethodConcept::DANGEROUS );
sal_uInt32 nMethCount = aMethodSeq.getLength();
const Reference< XIdlMethod >* pMethods_ = aMethodSeq.getConstArray();
for( i = 0 ; i < nMethCount ; i++ )
{
- // Methode ansprechen
+ // address method
const Reference< XIdlMethod >& rxMethod = pMethods_[i];
- // SbUnoMethode anlegen und reinbraten
+ // Create SbUnoMethod and superimpose it
SbxVariableRef xMethRef = new SbUnoMethod
( rxMethod->getName(), unoToSbxType( rxMethod->getReturnType() ), rxMethod, false );
QuickInsert( (SbxVariable*)xMethRef );
@@ -2969,7 +3024,7 @@ void SbUnoObject::implCreateAll( void )
}
-// Wert rausgeben
+// output the value
Any SbUnoObject::getUnoAny( void )
{
Any aRetAny;
@@ -2981,15 +3036,15 @@ Any SbUnoObject::getUnoAny( void )
return aRetAny;
}
-// Hilfsmethode zum Anlegen einer Uno-Struct per CoreReflection
+// help method to create an Uno-Struct per CoreReflection
SbUnoObject* Impl_CreateUnoStruct( const String& aClassName )
{
- // CoreReflection holen
+ // get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
return NULL;
- // Klasse suchen
+ // search for the class
Reference< XIdlClass > xClass;
Reference< XHierarchicalNameAccess > xHarryName =
getCoreReflection_HierarchicalNameAccess_Impl();
@@ -2998,25 +3053,25 @@ SbUnoObject* Impl_CreateUnoStruct( const String& aClassName )
if( !xClass.is() )
return NULL;
- // Ist es ueberhaupt ein struct?
+ // Is it realy a struct?
TypeClass eType = xClass->getTypeClass();
if ( ( eType != TypeClass_STRUCT ) && ( eType != TypeClass_EXCEPTION ) )
return NULL;
- // Instanz erzeugen
+ // create an instance
Any aNewAny;
xClass->createObject( aNewAny );
- // SbUnoObject daraus basteln
+ // make a SbUnoObject out of it
SbUnoObject* pUnoObj = new SbUnoObject( aClassName, aNewAny );
return pUnoObj;
}
-// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW
+// Factory-Class to create Uno-Structs per DIM AS NEW
SbxBase* SbUnoFactory::Create( sal_uInt16, sal_uInt32 )
{
- // Ueber SbxId laeuft in Uno nix
+ // Via SbxId nothing works in Uno
return NULL;
}
@@ -3026,8 +3081,8 @@ SbxObject* SbUnoFactory::CreateObject( const String& rClassName )
}
-// Provisorische Schnittstelle fuer UNO-Anbindung
-// Liefert ein SbxObject, das ein Uno-Interface wrappt
+// Provisional interface for the UNO-Connection
+// Deliver a SbxObject, that wrap an Uno-Interface
SbxObjectRef GetSbUnoObject( const String& aName, const Any& aUnoObj_ )
{
return new SbUnoObject( aName, aUnoObj_ );
@@ -3052,22 +3107,22 @@ void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 1 Parameter
+ // We need 1 parameter minimum
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aClassName = rPar.Get(1)->GetString();
- // Versuchen, gleichnamige Struct zu erzeugen
+ // try to create Struct with the same name
SbUnoObjectRef xUnoObj = Impl_CreateUnoStruct( aClassName );
if( !xUnoObj )
return;
- // Objekt zurueckliefern
+ // return the objekt
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
@@ -3077,17 +3132,17 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWri
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 1 Parameter
+ // We need 1 Parameter minimum
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aServiceName = rPar.Get(1)->GetString();
- // Service suchen und instanzieren
+ // search for the service and instatiate it
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
Reference< XInterface > xInterface;
if ( xFactory.is() )
@@ -3108,11 +3163,11 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWri
Any aAny;
aAny <<= xInterface;
- // SbUnoObject daraus basteln und zurueckliefern
+ // Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny );
if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID )
{
- // Objekt zurueckliefern
+ // return the object
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
else
@@ -3131,21 +3186,21 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 2 Parameter
+ // We need 2 parameter minimum
if ( rPar.Count() < 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aServiceName = rPar.Get(1)->GetString();
Any aArgAsAny = sbxToUnoValue( rPar.Get(2),
getCppuType( (Sequence<Any>*)0 ) );
Sequence< Any > aArgs;
aArgAsAny >>= aArgs;
- // Service suchen und instanzieren
+ // search for the service and instatiate it
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
Reference< XInterface > xInterface;
if ( xFactory.is() )
@@ -3166,11 +3221,11 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
Any aAny;
aAny <<= xInterface;
- // SbUnoObject daraus basteln und zurueckliefern
+ // Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny );
if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID )
{
- // Objekt zurueckliefern
+ // return the object
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
else
@@ -3191,14 +3246,14 @@ void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, sal_B
SbxVariableRef refVar = rPar.Get(0);
- // Globalen Service-Manager holen
+ // get the global service manager
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
if( xFactory.is() )
{
Any aAny;
aAny <<= xFactory;
- // SbUnoObject daraus basteln und zurueckliefern
+ // Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( String( RTL_CONSTASCII_USTRINGPARAM("ProcessServiceManager") ), aAny );
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
@@ -3213,7 +3268,7 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 2 Parameter
+ // We need 2 parameter minimum
sal_uInt16 nParCount = rPar.Count();
if( nParCount < 3 )
{
@@ -3221,11 +3276,11 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
return;
}
- // Variable fuer Rueckgabewert
+ // variable for the return value
SbxVariableRef refVar = rPar.Get(0);
refVar->PutBool( sal_False );
- // Uno-Objekt holen
+ // get the Uno-Object
SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject();
if( !(pObj && pObj->ISA(SbUnoObject)) )
return;
@@ -3234,32 +3289,32 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
if( eType != TypeClass_INTERFACE )
return;
- // Interface aus dem Any besorgen
+ // get the interface out of the Any
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
- // CoreReflection holen
+ // get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
return;
for( sal_uInt16 i = 2 ; i < nParCount ; i++ )
{
- // Interface-Name der struct holen
+ // get the name of the interface of the struct
String aIfaceName = rPar.Get( i )->GetString();
- // Klasse suchen
+ // search for the class
Reference< XIdlClass > xClass = xCoreReflection->forName( aIfaceName );
if( !xClass.is() )
return;
- // Pruefen, ob das Interface unterstuetzt wird
+ // check if the interface will be supported
::rtl::OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
if( !x->queryInterface( aClassType ).hasValue() )
return;
}
- // Alles hat geklappt, dann sal_True liefern
+ // Every thing works; then return TRUE
refVar->PutBool( sal_True );
}
@@ -3268,18 +3323,18 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 1 Parameter
+ // We need 1 parameter minimum
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Variable fuer Rueckgabewert
+ // variable for the return value
SbxVariableRef refVar = rPar.Get(0);
refVar->PutBool( sal_False );
- // Uno-Objekt holen
+ // get the Uno-Object
SbxVariableRef xParam = rPar.Get( 1 );
if( !xParam->IsObject() )
return;
@@ -3304,11 +3359,11 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
return;
}
- // Variable fuer Rueckgabewert
+ // variable for the return value
SbxVariableRef refVar = rPar.Get(0);
refVar->PutBool( sal_False );
- // Uno-Objekte holen
+ // get the Uno-Objects
SbxVariableRef xParam1 = rPar.Get( 1 );
if( !xParam1->IsObject() )
return;
@@ -3341,7 +3396,7 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
refVar->PutBool( sal_True );
}
-typedef std::hash_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash;
+typedef boost::unordered_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash;
// helper wrapper function to interact with TypeProvider and
@@ -3368,13 +3423,18 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
return xEnum;
}
-typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+typedef boost::unordered_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-SbxVariable* getVBAConstant( const String& rName )
+VBAConstantHelper&
+VBAConstantHelper::instance()
+{
+ static VBAConstantHelper aHelper;
+ return aHelper;
+}
+
+void
+VBAConstantHelper::init()
{
- SbxVariable* pConst = NULL;
- static VBAConstantsHash aConstCache;
- static bool isInited = false;
if ( !isInited )
{
Sequence< TypeClass > types(1);
@@ -3382,44 +3442,82 @@ SbxVariable* getVBAConstant( const String& rName )
Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE );
if ( !xEnum.is() )
- return NULL;
+ return; //NULL;
while ( xEnum->hasMoreElements() )
{
Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
if ( xConstants.is() )
{
+ // store constant group name
+ ::rtl::OUString sFullName = xConstants->getName();
+ sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
+ ::rtl::OUString sLeafName( sFullName );
+ if ( indexLastDot > -1 )
+ sLeafName = sFullName.copy( indexLastDot + 1);
+ aConstCache.push_back( sLeafName ); // assume constant group names are unique
Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
sal_Int32 nLen = aConsts.getLength();
for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
{
+ // store constant member name
Reference< XConstantTypeDescription >& rXConst =
*pSrc;
- ::rtl::OUString sFullName = rXConst->getName();
- sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
- ::rtl::OUString sLeafName;
+ sFullName = rXConst->getName();
+ indexLastDot = sFullName.lastIndexOf('.');
+ sLeafName = sFullName;
if ( indexLastDot > -1 )
sLeafName = sFullName.copy( indexLastDot + 1);
- aConstCache[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
+ aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
}
}
}
isInited = true;
}
+}
+
+bool
+VBAConstantHelper::isVBAConstantType( const String& rName )
+{
+ init();
+ bool bConstant = false;
::rtl::OUString sKey( rName );
- VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() );
- if ( it != aConstCache.end() )
+ VBAConstantsVector::const_iterator it = aConstCache.begin();
+
+ for( ; it != aConstCache.end(); ++it )
+ {
+ if( sKey.equalsIgnoreAsciiCase( *it ) )
+ {
+ bConstant = true;
+ break;
+ }
+ }
+ return bConstant;
+}
+
+SbxVariable*
+VBAConstantHelper::getVBAConstant( const String& rName )
+{
+ SbxVariable* pConst = NULL;
+ init();
+
+ ::rtl::OUString sKey( rName );
+
+ VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
+
+ if ( it != aConstHash.end() )
{
pConst = new SbxVariable( SbxVARIANT );
pConst->SetName( rName );
unoToSbxValue( pConst, it->second );
}
+
return pConst;
}
-// Funktion, um einen globalen Bezeichner im
-// UnoScope zu suchen und fuer Sbx zu wrappen
+// Function to search for a global identifier in the
+// UnoScope and to wrap it for Sbx
SbUnoClass* findUnoClass( const String& rName )
{
// #105550 Check if module exists
@@ -3448,13 +3546,13 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_VARIABLE );
- // Wenn nichts gefunden wird, ist das Sub-Modul noch nicht bekannt
+ // If nothing were located the submodule isn't known yet
if( !pRes )
{
- // Wenn es schon eine Klasse ist, nach einen Feld fragen
+ // If it is already a class, ask for the field
if( m_xClass.is() )
{
- // Ist es ein Field
+ // Is it a field(?)
::rtl::OUString aUStr( rName );
Reference< XIdlField > xField = m_xClass->getField( aUStr );
Reference< XIdlClass > xClass;
@@ -3465,7 +3563,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
Any aAny;
aAny = xField->get( aAny );
- // Nach Sbx wandeln
+ // Convert to Sbx
pRes = new SbxVariable( SbxVARIANT );
pRes->SetName( rName );
unoToSbxValue( pRes, aAny );
@@ -3478,16 +3576,16 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
}
else
{
- // Vollqualifizierten Namen erweitern
+ // expand fully qualified name
String aNewName = GetName();
aNewName.AppendAscii( "." );
aNewName += rName;
- // CoreReflection holen
+ // get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( xCoreReflection.is() )
{
- // Ist es eine Konstante?
+ // Is it a constant?
Reference< XHierarchicalNameAccess > xHarryName( xCoreReflection, UNO_QUERY );
if( xHarryName.is() )
{
@@ -3496,7 +3594,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
Any aValue = xHarryName->getByHierarchicalName( aNewName );
TypeClass eType = aValue.getValueType().getTypeClass();
- // Interface gefunden? Dann ist es eine Klasse
+ // Interface located? Then it is a class
if( eType == TypeClass_INTERFACE )
{
Reference< XInterface > xIface = *(Reference< XInterface >*)aValue.getValue();
@@ -3520,7 +3618,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
}
}
- // Sonst wieder als Klasse annehmen
+ // Otherwise take it again as class
if( !pRes )
{
SbUnoClass* pNewClass = findUnoClass( aNewName );
@@ -3562,11 +3660,11 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
{
pRes->SetName( rName );
- // Variable einfuegen, damit sie spaeter im Find gefunden wird
+ // Insert variable, so that it could be found later
QuickInsert( pRes );
- // Uns selbst gleich wieder als Listener rausnehmen,
- // die Werte sind alle konstant
+ // Take us out as listener at once,
+ // the values are all constant
if( pRes->IsBroadcaster() )
EndListening( pRes->GetBroadcaster(), sal_True );
}
@@ -3606,7 +3704,7 @@ SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
if( !pRes )
{
- // Wenn es schon eine Klasse ist, nach einen Feld fragen
+ // If it is already a class ask for a field
if( m_bNeedsInit && m_xServiceTypeDesc.is() )
{
m_bNeedsInit = false;
@@ -3924,8 +4022,8 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
//========================================================================
//========================================================================
-// Implementation eines EventAttacher-bezogenen AllListeners, der
-// nur einzelne Events an einen allgemeinen AllListener weiterleitet
+// Implementation of an EventAttacher-drawn AllListener, which
+// solely transmits several events to an general AllListener
class BasicAllListener_Impl : public BasicAllListenerHelper
{
virtual void firing_impl(const AllEventObject& Event, Any* pRet);
@@ -3937,14 +4035,14 @@ public:
BasicAllListener_Impl( const ::rtl::OUString& aPrefixName );
~BasicAllListener_Impl();
- // Methoden von XInterface
+ // Methods of XInterface
//virtual sal_Bool queryInterface( Uik aUik, Reference< XInterface > & rOut );
- // Methoden von XAllListener
+ // Methods of XAllListener
virtual void SAL_CALL firing(const AllEventObject& Event) throw ( RuntimeException );
virtual Any SAL_CALL approveFiring(const AllEventObject& Event) throw ( RuntimeException );
- // Methoden von XEventListener
+ // Methods of XEventListener
virtual void SAL_CALL disposing(const EventObject& Source) throw ( RuntimeException );
};
@@ -3967,7 +4065,7 @@ BasicAllListener_Impl::~BasicAllListener_Impl()
void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet )
{
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
if( xSbxObj.Is() )
{
@@ -3981,13 +4079,13 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
StarBASIC * pLib = PTR_CAST(StarBASIC,pP);
if( pLib )
{
- // In Basic Array anlegen
+ // Create in a Basic Array
SbxArrayRef xSbxArray = new SbxArray( SbxVARIANT );
const Any * pArgs = Event.Arguments.getConstArray();
sal_Int32 nCount = Event.Arguments.getLength();
for( sal_Int32 i = 0; i < nCount; i++ )
{
- // Elemente wandeln
+ // Convert elements
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
unoToSbxValue( (SbxVariable*)xVar, pArgs[i] );
xSbxArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) );
@@ -3995,7 +4093,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
pLib->Call( aMethodName, xSbxArray );
- // Return-Wert aus dem Param-Array holen, wenn verlangt
+ // get the return value from the Param-Array, if requestet
if( pRet )
{
SbxVariable* pVar = xSbxArray->Get( 0 );
@@ -4015,7 +4113,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
}
-// Methoden von XAllListener
+// Methods of Listener
void BasicAllListener_Impl::firing( const AllEventObject& Event ) throw ( RuntimeException )
{
firing_impl( Event, NULL );
@@ -4029,10 +4127,10 @@ Any BasicAllListener_Impl::approveFiring( const AllEventObject& Event ) throw (
}
//========================================================================
-// Methoden von XEventListener
+// Methods of XEventListener
void BasicAllListener_Impl ::disposing(const EventObject& ) throw ( RuntimeException )
{
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
xSbxObj.Clear();
}
@@ -4195,42 +4293,42 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const ::rtl::OUStri
//========================================================================
// Uno-Service erzeugen
-// 1. Parameter == Prefix-Name der Makros
-// 2. Parameter == voll qualifizierter Name des Listeners
+// 1. Parameter == Prefix-Name of the macro
+// 2. Parameter == fully qualified name of the listener
void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
//RTLFUNC(CreateUnoListener)
{
(void)bWrite;
- // Wir brauchen 2 Parameter
+ // We need 2 parameters
if ( rPar.Count() != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aPrefixName = rPar.Get(1)->GetString();
String aListenerClassName = rPar.Get(2)->GetString();
- // CoreReflection holen
+ // get the CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
return;
- // AllListenerAdapterService holen
+ // get the AllListenerAdapterService
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
if( !xFactory.is() )
return;
- // Klasse suchen
+ // search the class
Reference< XIdlClass > xClass = xCoreReflection->forName( aListenerClassName );
if( !xClass.is() )
return;
- // AB, 30.11.1999 InvocationAdapterFactory holen
+ // From 1999-11-30: get the InvocationAdapterFactory
Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = Reference< XInvocationAdapterFactory >(
- xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY );
+ xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.InvocationAdapterFactory")) ), UNO_QUERY );
BasicAllListener_Impl * p;
Reference< XAllListener > xAllLst = p = new BasicAllListener_Impl( aPrefixName );
@@ -4253,7 +4351,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
SbxArrayRef xBasicUnoListeners = pBasic->getUnoListeners();
xBasicUnoListeners->Insert( pUnoObj, xBasicUnoListeners->Count() );
- // Objekt zurueckliefern
+ // return the object
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( p->xSbxObj );
}
@@ -4303,7 +4401,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aTypeName = rPar.Get(1)->GetString();
SbxVariable* pVal = rPar.Get(2);
@@ -4461,7 +4559,7 @@ void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty,
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Set ") );
aPropertyFunctionName += m_aPrefix;
@@ -4502,7 +4600,7 @@ Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty )
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Get ") );
aPropertyFunctionName += m_aPrefix;
@@ -4540,7 +4638,7 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
Sequence< Any >& )
throw( CannotConvertException, InvocationTargetException )
{
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
Any aRet;
SbxObjectRef xScopeObj = m_xScopeObj;
@@ -4853,3 +4951,4 @@ bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal )
return bSuccess;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 592d69c514a0..55c3d9037ef9 100755
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <list>
-#include <vos/macros.hxx>
#include <vcl/svapp.hxx>
#include <tools/stream.hxx>
#include <svl/brdcst.hxx>
@@ -45,14 +45,11 @@
#include "runtime.hxx"
#include "token.hxx"
#include "sbunoobj.hxx"
-#include "sbtrace.hxx"
-
-//#include <basic/hilight.hxx>
#include <svtools/syntaxhighlight.hxx>
#include <basic/basrdll.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <basic/sbobjmod.hxx>
#include <basic/vbahelper.hxx>
#include <cppuhelper/implbase3.hxx>
@@ -60,6 +57,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <com/sun/star/document/XVbaMethodParameter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
#include <com/sun/star/document/XEventListener.hpp>
@@ -305,9 +303,8 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
// call method
SbxVariableRef xReturn = new SbxVariable;
- ErrCode nErr = SbxERR_OK;
- nErr = pMethod->Call( xReturn );
+ pMethod->Call( xReturn );
Any aReturn;
// get output parameters
if ( xSbxParams.Is() )
@@ -516,8 +513,8 @@ void VBAUnlockDocuments( StarBASIC* pBasic )
/////////////////////////////////////////////////////////////////////////////
-// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
-// Elemente von anderen Modulen aus gefunden werden koennen.
+// A Basic module has set EXTSEARCH, so that the elements, that the modul contains,
+// could be found from other module.
SbModule::SbModule( const String& rName, sal_Bool bVBACompat )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
@@ -566,7 +563,7 @@ const SbxObject* SbModule::FindType( String aTypeName ) const
}
-// Aus dem Codegenerator: Loeschen des Images und Invalidieren der Entries
+// From the code generator: deletion of images and the oposite of validation for entries
void SbModule::StartDefinitions()
{
@@ -574,8 +571,8 @@ void SbModule::StartDefinitions()
if( pClassData )
pClassData->clear();
- // Methoden und Properties bleiben erhalten, sind jedoch ungueltig
- // schliesslich sind ja u.U. die Infos belegt
+ // methods and properties persist, but they are invalid;
+ // at least are the information under certain conditions clogged
sal_uInt16 i;
for( i = 0; i < pMethods->Count(); i++ )
{
@@ -593,7 +590,7 @@ void SbModule::StartDefinitions()
}
}
-// Methode anfordern/anlegen
+// request/create method
SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
{
@@ -609,8 +606,8 @@ SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
pMethods->Put( pMeth, pMethods->Count() );
StartListening( pMeth->GetBroadcaster(), sal_True );
}
- // Per Default ist die Methode GUELTIG, da sie auch vom Compiler
- // (Codegenerator) erzeugt werden kann
+ // The method is per default valid, because it could be
+ // created from the compiler (code generator) as well.
pMeth->bInvalid = sal_False;
pMeth->ResetFlag( SBX_FIXED );
pMeth->SetFlag( SBX_WRITE );
@@ -621,7 +618,7 @@ SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
return pMeth;
}
-// Property anfordern/anlegen
+// request/create property
SbProperty* SbModule::GetProperty( const String& rName, SbxDataType t )
{
@@ -683,7 +680,7 @@ SbIfaceMapperMethod::~SbIfaceMapperMethod()
TYPEINIT1(SbIfaceMapperMethod,SbMethod)
-// Aus dem Codegenerator: Ungueltige Eintraege entfernen
+// From the code generator: remove invalid entries
void SbModule::EndDefinitions( sal_Bool bNewState )
{
@@ -764,12 +761,12 @@ const String& SbModule::GetSource() const
return aRetStr;
}
-// Parent und BASIC sind eins!
+// Parent and BASIC are one!
void SbModule::SetParent( SbxObject* p )
{
// #118083: Assertion is not valid any more
- // DBG_ASSERT( !p || p->IsA( TYPE(StarBASIC) ), "SbModules nur in BASIC eintragen" );
+ // DBG_ASSERT( !p || p->IsA( TYPE(StarBASIC) ), "Register SbModules only in BASIC" );
pParent = p;
}
@@ -782,6 +779,82 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxVariable* pVar = pHint->GetVar();
SbProperty* pProp = PTR_CAST(SbProperty,pVar);
SbMethod* pMeth = PTR_CAST(SbMethod,pVar);
+ SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
+ if( pProcProperty )
+ {
+
+ if( pHint->GetId() == SBX_HINT_DATAWANTED )
+ {
+ String aProcName;
+ aProcName.AppendAscii( "Property Get " );
+ aProcName += pProcProperty->GetName();
+
+ SbxVariable* pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ if( pMethVar )
+ {
+ SbxValues aVals;
+ aVals.eType = SbxVARIANT;
+
+ SbxArray* pArg = pVar->GetParameters();
+ sal_uInt16 nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
+ if( nVarParCount > 1 )
+ {
+ SbxArrayRef xMethParameters = new SbxArray;
+ xMethParameters->Put( pMethVar, 0 ); // Method as parameter 0
+ for( sal_uInt16 i = 1 ; i < nVarParCount ; ++i )
+ {
+ SbxVariable* pPar = pArg->Get( i );
+ xMethParameters->Put( pPar, i );
+ }
+
+ pMethVar->SetParameters( xMethParameters );
+ pMethVar->Get( aVals );
+ pMethVar->SetParameters( NULL );
+ }
+ else
+ {
+ pMethVar->Get( aVals );
+ }
+
+ pVar->Put( aVals );
+ }
+ }
+ else if( pHint->GetId() == SBX_HINT_DATACHANGED )
+ {
+ SbxVariable* pMethVar = NULL;
+
+ bool bSet = pProcProperty->isSet();
+ if( bSet )
+ {
+ pProcProperty->setSet( false );
+
+ String aProcName;
+ aProcName.AppendAscii( "Property Set " );
+ aProcName += pProcProperty->GetName();
+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ }
+ if( !pMethVar ) // Let
+ {
+ String aProcName;
+ aProcName.AppendAscii( "Property Let " );
+ aProcName += pProcProperty->GetName();
+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ }
+
+ if( pMethVar )
+ {
+ // Setup parameters
+ SbxArrayRef xArray = new SbxArray;
+ xArray->Put( pMethVar, 0 ); // Method as parameter 0
+ xArray->Put( pVar, 1 );
+ pMethVar->SetParameters( xArray );
+
+ SbxValues aVals;
+ pMethVar->Get( aVals );
+ pMethVar->SetParameters( NULL );
+ }
+ }
+ }
if( pProp )
{
if( pProp->GetModule() != this )
@@ -792,11 +865,11 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
if( pMeth->bInvalid && !Compile() )
- // Auto-Compile hat nicht geklappt!
+ // auto compile has not worked!
StarBASIC::Error( SbERR_BAD_PROP_VALUE );
else
{
- // Aufruf eines Unterprogramms
+ // Call of a subprogram
SbModule* pOld = pMOD;
pMOD = this;
Run( (SbMethod*) pVar );
@@ -821,8 +894,8 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
-// Das Setzen der Source macht das Image ungueltig
-// und scant die Methoden-Definitionen neu ein
+// The setting of the source makes the image invalid
+// and scans the method definitions newly in
void SbModule::SetSource( const String& r )
{
@@ -836,15 +909,16 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
+ aTok.SetCompatible( IsVBACompat() );
while( !aTok.IsEof() )
{
SbiToken eEndTok = NIL;
- // Suchen nach SUB oder FUNCTION
+ // Searching for SUB or FUNCTION
SbiToken eLastTok = NIL;
while( !aTok.IsEof() )
{
- // #32385: Nicht bei declare
+ // #32385: not by declare
SbiToken eCurTok = aTok.Next();
if( eLastTok != DECLARE )
{
@@ -875,7 +949,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
}
eLastTok = eCurTok;
}
- // Definition der Methode
+ // Definition of the method
SbMethod* pMeth = NULL;
if( eEndTok != NIL )
{
@@ -888,13 +962,13 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
t = SbxVOID;
pMeth = GetMethod( aName_, t );
pMeth->nLine1 = pMeth->nLine2 = nLine1;
- // Die Methode ist erst mal GUELTIG
+ // The method is for a start VALID
pMeth->bInvalid = sal_False;
}
else
eEndTok = NIL;
}
- // Skip bis END SUB/END FUNCTION
+ // Skip up to END SUB/END FUNCTION
if( eEndTok != NIL )
{
while( !aTok.IsEof() )
@@ -932,14 +1006,14 @@ SbMethod* SbModule::GetFunctionForLine( sal_uInt16 nLine )
return NULL;
}
-// Ausstrahlen eines Hints an alle Basics
+// Broadcast of a hint to all Basics
static void _SendHint( SbxObject* pObj, sal_uIntPtr nId, SbMethod* p )
{
- // Selbst ein BASIC?
+ // Self a BASIC?
if( pObj->IsA( TYPE(StarBASIC) ) && pObj->IsBroadcaster() )
pObj->GetBroadcaster().Broadcast( SbxHint( nId, p ) );
- // Dann die Unterobjekte fragen
+ // Then ask for the subobjects
SbxArray* pObjs = pObj->GetObjects();
for( sal_uInt16 i = 0; i < pObjs->Count(); i++ )
{
@@ -956,35 +1030,35 @@ static void SendHint( SbxObject* pObj, sal_uIntPtr nId, SbMethod* p )
_SendHint( pObj, nId, p );
}
-// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
-// beim Programm-Ende freigeben, damit nichts gehalten wird.
+// #57841 Clear Uno-Objects, which were helt in RTL functions,
+// at the end of the program, so that nothing were helt.
void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
{
- // return-Wert von CreateUnoService loeschen
+ // delete the return value of CreateUnoService
static String aName( RTL_CONSTASCII_USTRINGPARAM("CreateUnoService") );
SbxVariable* pVar = pBasic->GetRtl()->Find( aName, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // return-Wert von CreateUnoDialog loeschen
+ // delete the return value of CreateUnoDialog
static String aName2( RTL_CONSTASCII_USTRINGPARAM("CreateUnoDialog") );
pVar = pBasic->GetRtl()->Find( aName2, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // return-Wert von CDec loeschen
+ // delete the return value of CDec
static String aName3( RTL_CONSTASCII_USTRINGPARAM("CDec") );
pVar = pBasic->GetRtl()->Find( aName3, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // return-Wert von CreateObject loeschen
+ // delete return value of CreateObject
static String aName4( RTL_CONSTASCII_USTRINGPARAM("CreateObject") );
pVar = pBasic->GetRtl()->Find( aName4, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // Ueber alle Sub-Basics gehen
+ // Go over all Sub-Basics
SbxArray* pObjs = pBasic->GetObjects();
sal_uInt16 nCount = pObjs->Count();
for( sal_uInt16 i = 0 ; i < nCount ; i++ )
@@ -998,13 +1072,13 @@ void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
{
- // #67781 Rueckgabewerte der Uno-Methoden loeschen
+ // #67781 Delete return values of the Uno-methods
clearUnoMethods();
clearUnoServiceCtors();
ClearUnoObjectsInRTL_Impl_Rek( pBasic );
- // Oberstes Basic suchen
+ // Search for the topmost Basic
SbxObject* p = pBasic;
while( p->GetParent() )
p = p->GetParent();
@@ -1020,50 +1094,26 @@ void SbModule::SetVBACompat( sal_Bool bCompat )
{
mbVBACompat = bCompat;
}
-// Ausfuehren eines BASIC-Unterprogramms
+// Run a Basic-subprogram
sal_uInt16 SbModule::Run( SbMethod* pMeth )
{
+ OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
static sal_uInt16 nMaxCallLevel = 0;
static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
sal_uInt16 nRes = 0;
sal_Bool bDelInst = sal_Bool( pINST == NULL );
+ bool bQuit = false;
StarBASICRef xBasic;
if( bDelInst )
{
-#ifdef DBG_TRACE_BASIC
- dbg_InitTrace();
-#endif
- // #32779: Basic waehrend der Ausfuehrung festhalten
+ // #32779: Hold Basic during the execution
xBasic = (StarBASIC*) GetParent();
pINST = new SbiInstance( (StarBASIC*) GetParent() );
- // Launcher problem
- // i80726 The Find below will genarate an error in Testtool so we reset it unless there was one before already
- sal_Bool bWasError = SbxBase::GetError() != 0;
- SbxVariable* pMSOMacroRuntimeLibVar = Find( aMSOMacroRuntimeLibName, SbxCLASS_OBJECT );
- if ( !bWasError && (SbxBase::GetError() == SbxERR_PROC_UNDEFINED) )
- SbxBase::ResetError();
- if( pMSOMacroRuntimeLibVar )
- {
- StarBASIC* pMSOMacroRuntimeLib = PTR_CAST(StarBASIC,pMSOMacroRuntimeLibVar);
- if( pMSOMacroRuntimeLib )
- {
- sal_uInt16 nGblFlag = pMSOMacroRuntimeLib->GetFlags() & SBX_GBLSEARCH;
- pMSOMacroRuntimeLib->ResetFlag( SBX_GBLSEARCH );
- SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( aMSOMacroRuntimeAppSymbol, SbxCLASS_METHOD );
- pMSOMacroRuntimeLib->SetFlag( nGblFlag );
- if( pAppSymbol )
- {
- pMSOMacroRuntimeLib->SetFlag( SBX_EXTSEARCH ); // Could have been disabled before
- GetSbData()->pMSOMacroRuntimLib = pMSOMacroRuntimeLib;
- }
- }
- }
-
- // Error-Stack loeschen
+ // Delete the Error-Stack
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
delete rErrStack;
rErrStack = NULL;
@@ -1091,22 +1141,22 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
}
}
- // Rekursion zu tief?
+ // Recursion to deep?
if( ++pINST->nCallLvl <= nMaxCallLevel )
{
- // Globale Variable in allen Mods definieren
+ // Define a globale variable in all Mods
GlobalRunInit( /* bBasicStart = */ bDelInst );
- // Trat ein Compiler-Fehler auf? Dann starten wir nicht
+ // Appeared a compiler error? Then we don't launch
if( GetSbData()->bGlobalInitErr == sal_False )
{
if( bDelInst )
{
SendHint( GetParent(), SBX_HINT_BASICSTART, pMeth );
- // 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
- // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel()
- // BreakCallLevel ermitteln
+ // 1996-10-16: #31460 New concept for StepInto/Over/Out
+ // For an explanation see runtime.cxx at SbiInstance::CalcBreakCallLevel()
+ // Identify the BreakCallLevel
pINST->CalcBreakCallLevel( pMeth->GetDebugFlags() );
}
@@ -1114,10 +1164,6 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
pMOD = this;
SbiRuntime* pRt = new SbiRuntime( this, pMeth, pMeth->nStart );
-#ifdef DBG_TRACE_BASIC
- dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl );
-#endif
-
pRt->pNext = pINST->pRun;
if( pRt->pNext )
pRt->pNext->block();
@@ -1130,31 +1176,26 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
if( pRt->pNext )
pRt->pNext->unblock();
-#ifdef DBG_TRACE_BASIC
- bool bLeave = true;
- dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl, bLeave );
-#endif
-
- // #63710 Durch ein anderes Thread-Handling bei Events kann es passieren,
- // dass show-Aufruf an einem Dialog zurueckkehrt (durch schliessen des
- // Dialogs per UI), BEVOR ein per Event ausgeloester weitergehender Call,
- // der in Basic weiter oben im Stack steht und auf einen Basic-Breakpoint
- // gelaufen ist, zurueckkehrt. Dann wird unten die Instanz zerstoert und
- // wenn das noch im Call stehende Basic weiterlaeuft, gibt es einen GPF.
- // Daher muss hier gewartet werden, bis andere Call zurueckkehrt.
+ // #63710 It can happen by an another thread handling at events,
+ // that the show call returns to an dialog (by closing the
+ // dialog per UI), before a by an event triggered further call returned,
+ // which stands in Basic more top in the stack and that had been run on
+ // a Basic-Breakpoint. Then would the instance below destroyed. And if the Basic,
+ // that stand still in the call, further runs, there is a GPF.
+ // Thus here had to be wait until the other call comes back.
if( bDelInst )
{
- // Hier mit 1 statt 0 vergleichen, da vor nCallLvl--
+ // Compare here with 1 instead of 0, because before nCallLvl--
while( pINST->nCallLvl != 1 )
GetpApp()->Yield();
}
nRes = sal_True;
pINST->pRun = pRt->pNext;
- pINST->nCallLvl--; // Call-Level wieder runter
+ pINST->nCallLvl--; // Call-Level down again
- // Gibt es eine uebergeordnete Runtime-Instanz?
- // Dann SbDEBUG_BREAK uebernehmen, wenn gesetzt
+ // Exist an higher-ranking runtime instance?
+ // Then take over SbDEBUG_BREAK, if set
SbiRuntime* pRtNext = pRt->pNext;
if( pRtNext && (pRt->GetDebugFlags() & SbDEBUG_BREAK) )
pRtNext->SetDebugFlags( SbDEBUG_BREAK );
@@ -1163,8 +1204,8 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
pMOD = pOldMod;
if( bDelInst )
{
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
- // beim Programm-Ende freigeben, damit nichts gehalten wird.
+ // #57841 Clear Uno-Objects, which were helt in RTL functions,
+ // at the end of the program, so that nothing were helt.
ClearUnoObjectsInRTL_Impl( xBasic );
clearNativeObjectWrapperVector();
@@ -1173,7 +1214,7 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
delete pINST, pINST = NULL, bDelInst = sal_False;
// #i30690
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth );
GlobalRunDeInit();
@@ -1188,25 +1229,27 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
}
}
else
- pINST->nCallLvl--; // Call-Level wieder runter
+ pINST->nCallLvl--; // Call-Level down again
}
else
{
- pINST->nCallLvl--; // Call-Level wieder runter
+ pINST->nCallLvl--; // Call-Level down again
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
}
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
if( bDelInst )
{
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
- // beim Programm-Ende freigeben, damit nichts gehalten wird.
+ // #57841 Clear Uno-Objects, which were helt in RTL functions,
+ // the end of the program, so that nothing were helt.
ClearUnoObjectsInRTL_Impl( xBasic );
delete pINST;
pINST = NULL;
}
if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST )
+ bQuit = true;
+ if ( bQuit )
{
Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL );
}
@@ -1214,8 +1257,8 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
return nRes;
}
-// Ausfuehren der Init-Methode eines Moduls nach dem Laden
-// oder der Compilation
+// Execute of the init method of a module after the loading
+// or the compilation
void SbModule::RunInit()
{
@@ -1223,7 +1266,7 @@ void SbModule::RunInit()
&& !pImage->bInit
&& pImage->GetFlag( SBIMG_INITCODE ) )
{
- // Flag setzen, dass RunInit aktiv ist (Testtool)
+ // Set flag, so that RunInit get activ (Testtool)
GetSbData()->bRunInit = sal_True;
// sal_Bool bDelInst = sal_Bool( pINST == NULL );
@@ -1231,22 +1274,13 @@ void SbModule::RunInit()
// pINST = new SbiInstance( (StarBASIC*) GetParent() );
SbModule* pOldMod = pMOD;
pMOD = this;
- // Der Init-Code beginnt immer hier
+ // The init code starts always here
SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 );
-#ifdef DBG_TRACE_BASIC
- dbg_traceNotifyCall( this, NULL, 0 );
-#endif
-
pRt->pNext = pINST->pRun;
pINST->pRun = pRt;
while( pRt->Step() ) {}
-#ifdef DBG_TRACE_BASIC
- bool bLeave = true;
- dbg_traceNotifyCall( this, NULL, 0, bLeave );
-#endif
-
pINST->pRun = pRt->pNext;
delete pRt;
pMOD = pOldMod;
@@ -1255,12 +1289,12 @@ void SbModule::RunInit()
pImage->bInit = sal_True;
pImage->bFirstInit = sal_False;
- // RunInit ist nicht mehr aktiv
+ // RunInit is not activ anymore
GetSbData()->bRunInit = sal_False;
}
}
-// Mit private/dim deklarierte Variablen loeschen
+// Delete with private/dim declared variables
void SbModule::AddVarName( const String& aName )
{
@@ -1295,7 +1329,7 @@ void SbModule::ClearPrivateVars()
SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) );
if( p )
{
- // Arrays nicht loeschen, sondern nur deren Inhalt
+ // Delete not the arrays, only their content
if( p->GetType() & SbxARRAY )
{
SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject());
@@ -1383,47 +1417,34 @@ void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
}
}
-// Zunaechst in dieses Modul, um 358-faehig zu bleiben
-// (Branch in sb.cxx vermeiden)
void StarBASIC::ClearAllModuleVars( void )
{
- // Eigene Module initialisieren
+ // Initialise the own module
for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
- // Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde
+ // Initialise only, if the startcode was already executed
if( pModule->pImage && pModule->pImage->bInit && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
pModule->ClearPrivateVars();
}
- /* #88042 This code can delete already used public vars during runtime!
- // Alle Objekte ueberpruefen, ob es sich um ein Basic handelt
- // Wenn ja, auch dort initialisieren
- for ( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ )
- {
- SbxVariable* pVar = pObjs->Get( nObj );
- StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
- if( pBasic )
- pBasic->ClearAllModuleVars();
- }
- */
}
-// Ausfuehren des Init-Codes aller Module
+// Execution of the init-code of all module
void SbModule::GlobalRunInit( sal_Bool bBasicStart )
{
- // Wenn kein Basic-Start, nur initialisieren, wenn Modul uninitialisiert
+ // If no Basic-Start, only initialise, if the module is not initialised
if( !bBasicStart )
if( !(pImage && !pImage->bInit) )
return;
- // GlobalInitErr-Flag fuer Compiler-Error initialisieren
- // Anhand dieses Flags kann in SbModule::Run() nach dem Aufruf
- // von GlobalRunInit festgestellt werden, ob beim initialisieren
- // der Module ein Fehler auftrat. Dann wird nicht gestartet.
+ // Initialise GlobalInitErr-Flag for Compiler-Error
+ // With the help of this flags could be located in SbModule::Run() after the call of
+ // GlobalRunInit, if at the intialising of the module
+ // an error occurred. Then it will not be launched.
GetSbData()->bGlobalInitErr = sal_False;
- // Parent vom Modul ist ein Basic
+ // Parent of the module is a Basic
StarBASIC *pBasic = PTR_CAST(StarBASIC,GetParent());
if( pBasic )
{
@@ -1465,8 +1486,8 @@ void SbModule::GlobalRunDeInit( void )
}
}
-// Suche nach dem naechsten STMNT-Befehl im Code. Wird vom STMNT-
-// Opcode verwendet, um die Endspalte zu setzen.
+// Search for the next STMNT-Command in the code. This was used from the STMNT-
+// Opcode to set the endcolumn.
const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, sal_uInt16& nCol ) const
{
@@ -1511,7 +1532,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine,
return NULL;
}
-// Testen, ob eine Zeile STMNT-Opcodes enthaelt
+// Test, if a line contains STMNT-Opcodes
sal_Bool SbModule::IsBreakable( sal_uInt16 nLine ) const
{
@@ -1571,7 +1592,7 @@ sal_Bool SbModule::SetBP( sal_uInt16 nLine )
}
pBreaks->insert( pBreaks->begin() + i, nLine );
- // #38568: Zur Laufzeit auch hier SbDEBUG_BREAK setzen
+ // #38568: Set during runtime as well here SbDEBUG_BREAK
if( pINST && pINST->pRun )
pINST->pRun->SetDebugFlags( SbDEBUG_BREAK );
@@ -1632,7 +1653,7 @@ sal_Bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
Clear();
if( !SbxObject::LoadData( rStrm, 1 ) )
return sal_False;
- // Precaution...
+ // As a precaution...
SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
sal_uInt8 bImage;
rStrm >> bImage;
@@ -1657,7 +1678,7 @@ sal_Bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
if( p->GetCodeSize() )
{
aOUSource = p->aOUSource;
- // Alte Version: Image weg
+ // Old version: image away
if( nVer == 1 )
{
SetSource32( p->aOUSource );
@@ -1720,6 +1741,52 @@ sal_Bool SbModule::ExceedsLegacyModuleSize()
return false;
}
+class ErrorHdlResetter
+{
+ Link mErrHandler;
+ bool mbError;
+ public:
+ ErrorHdlResetter() : mbError( false )
+ {
+ // save error handler
+ mErrHandler = StarBASIC::GetGlobalErrorHdl();
+ // set new error handler
+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
+ }
+ ~ErrorHdlResetter()
+ {
+ // restore error handler
+ StarBASIC::SetGlobalErrorHdl(mErrHandler);
+ }
+ DECL_LINK( BasicErrorHdl, StarBASIC * );
+ bool HasError() { return mbError; }
+};
+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
+{
+ mbError = true;
+ return 0;
+}
+
+bool SbModule::HasExeCode()
+{
+ // And empty Image always has the Global Chain set up
+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
+ // lets be stricter for the moment than VBA
+
+ if (!IsCompiled())
+ {
+ ErrorHdlResetter aGblErrHdl;
+ Compile();
+ if (aGblErrHdl.HasError()) //assume unsafe on compile error
+ return true;
+ }
+
+ bool bRes = false;
+ if (pImage && !(pImage->GetCodeSize() == 5 && (memcmp(pImage->GetCode(), pEmptyImage, pImage->GetCodeSize()) == 0 )))
+ bRes = true;
+
+ return bRes;
+}
// Store only image, no source
sal_Bool SbModule::StoreBinaryData( SvStream& rStrm )
@@ -1769,7 +1836,6 @@ sal_Bool SbModule::LoadBinaryData( SvStream& rStrm )
return bRet;
}
-
sal_Bool SbModule::LoadCompleted()
{
SbxArray* p = GetMethods();
@@ -1897,7 +1963,7 @@ sal_Bool SbJScriptModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
if( !SbxObject::LoadData( rStrm, 1 ) )
return sal_False;
- // Source-String holen
+ // Get the source string
String aTmp;
rStrm.ReadByteString( aTmp, gsl_getSystemTextEncoding() );
aOUSource = aTmp;
@@ -1910,7 +1976,7 @@ sal_Bool SbJScriptModule::StoreData( SvStream& rStrm ) const
if( !SbxObject::StoreData( rStrm ) )
return sal_False;
- // Source-String schreiben
+ // Write the source string
String aTmp = aOUSource;
rStrm.WriteByteString( aTmp, gsl_getSystemTextEncoding() );
//rStrm << aSource;
@@ -1929,7 +1995,8 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
nLine1 =
nLine2 = 0;
refStatics = new SbxArray;
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ mCaller = 0;
+ // From: 1996-07.02: HACK due to 'Referenz could not be saved'
SetFlag( SBX_NO_MODIFY );
}
@@ -1943,6 +2010,7 @@ SbMethod::SbMethod( const SbMethod& r )
nLine1 = r.nLine1;
nLine2 = r.nLine2;
refStatics = r.refStatics;
+ mCaller = r.mCaller;
SetFlag( SBX_NO_MODIFY );
}
@@ -1975,10 +2043,10 @@ sal_Bool SbMethod::LoadData( SvStream& rStrm, sal_uInt16 nVer )
sal_Int16 n;
rStrm >> n;
sal_Int16 nTempStart = (sal_Int16)nStart;
- // nDebugFlags = n; // AB 16.1.96: Nicht mehr uebernehmen
+ // nDebugFlags = n; // From 1996-01-16: no longer take over
if( nVer == 2 )
rStrm >> nLine1 >> nLine2 >> nTempStart >> bInvalid;
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ // From: 1996-07-02: HACK ue to 'Referenz could not be saved'
SetFlag( SBX_NO_MODIFY );
nStart = nTempStart;
return sal_True;
@@ -2001,27 +2069,32 @@ void SbMethod::GetLineRange( sal_uInt16& l1, sal_uInt16& l2 )
l1 = nLine1; l2 = nLine2;
}
-// Kann spaeter mal weg
+// Could later be deleted
SbxInfo* SbMethod::GetInfo()
{
return pInfo;
}
-// Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
-// #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
-// abgeschossen werden kann. Rueckgabewert wird als String geliefert.
-ErrCode SbMethod::Call( SbxValue* pRet )
+// Interface to execute a method of the applications
+// #34191# With special RefCounting, damit so that the Basic was not fired of by CloseDocument()
+// The return value will be delivered as string.
+ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
{
+ if ( pCaller )
+ {
+ OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
+ mCaller = pCaller;
+ }
// RefCount vom Modul hochzaehlen
SbModule* pMod_ = (SbModule*)GetParent();
pMod_->AddRef();
- // RefCount vom Basic hochzaehlen
+ // Increment the RefCount of the Basic
StarBASIC* pBasic = (StarBASIC*)pMod_->GetParent();
pBasic->AddRef();
- // Values anlegen, um Return-Wert zu erhalten
+ // Establish the values to get the return value
SbxValues aVals;
aVals.eType = SbxVARIANT;
@@ -2033,14 +2106,14 @@ ErrCode SbMethod::Call( SbxValue* pRet )
if ( pRet )
pRet->Put( aVals );
- // Gab es einen Error
+ // Was there an error
ErrCode nErr = SbxBase::GetError();
SbxBase::ResetError();
- // Objekte freigeben
+ // Release objects
pMod_->ReleaseRef();
pBasic->ReleaseRef();
-
+ mCaller = 0;
return nErr;
}
@@ -2050,8 +2123,8 @@ void SbMethod::Broadcast( sal_uIntPtr nHintId )
{
if( pCst && !IsSet( SBX_NO_BROADCAST ) && StaticIsEnabledBroadcasting() )
{
- // Da die Methode von aussen aufrufbar ist, hier noch einmal
- // die Berechtigung testen
+ // Because the method could be called from outside, test here once again
+ // the authorisation
if( nHintId & SBX_HINT_DATAWANTED )
if( !CanRead() )
return;
@@ -2069,7 +2142,7 @@ void SbMethod::Broadcast( sal_uIntPtr nHintId )
SbMethodRef xHolder = pThisCopy;
if( mpPar.Is() )
{
- // this, als Element 0 eintragen, aber den Parent nicht umsetzen!
+ // Enrigister this as element 0, but don't reset the parent!
if( GetType() != SbxVOID )
mpPar->PutDirect( pThisCopy, 0 );
SetParameters( NULL );
@@ -2089,7 +2162,7 @@ void SbMethod::Broadcast( sal_uIntPtr nHintId )
/////////////////////////////////////////////////////////////////////////
-// Implementation SbJScriptMethod (Method-Klasse als Wrapper fuer JavaScript-Funktionen)
+// Implementation of SbJScriptMethod (method class as a wrapper for JavaScript-functions)
SbJScriptMethod::SbJScriptMethod( const String& r, SbxDataType t, SbModule* p )
: SbMethod( r, t, p )
@@ -2107,7 +2180,7 @@ SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::Mod
SetModuleType( mInfo.ModuleType );
if ( mInfo.ModuleType == script::ModuleType::FORM )
{
- SetClassName( rtl::OUString::createFromAscii( "Form" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Form" )) );
}
else if ( mInfo.ModuleObject.is() )
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
@@ -2126,13 +2199,13 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException
pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
+ if( xServiceInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Worksheet" )) ) )
{
- SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Worksheet" )) );
}
- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Workbook" ) ) )
+ else if( xServiceInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Workbook" )) ) )
{
- SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Workbook" )) );
}
}
@@ -2258,10 +2331,9 @@ public:
}
}
- //liuchen 2009-7-21, support Excel VBA Form_QueryClose event
- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+
+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
{
-#if IN_THE_FUTURE
uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
if ( xDialog.is() )
{
@@ -2289,9 +2361,8 @@ public:
}
mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
-#endif
}
- //liuchen 2009-7-21
+
virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
@@ -2398,15 +2469,14 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
Sequence< Any > aArguments;
triggerMethod( aMethodToRun, aArguments );
}
-void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& /*aArguments*/)
+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
{
OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
// Search method
SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
if( pMeth )
{
-#if IN_THE_FUTURE
- //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
+
if ( aArguments.getLength() > 0 ) // Setup parameters
{
SbxArrayRef xArray = new SbxArray;
@@ -2434,8 +2504,7 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
pMeth->SetParameters( NULL );
}
else
-//liuchen 2009-7-21
-#endif
+
{
SbxValues aVals;
pMeth->Get( aVals );
@@ -2521,7 +2590,7 @@ void SbUserFormModule::Load()
InitObject();
}
-//liuchen 2009-7-21 change to accmordate VBA's beheavior
+
void SbUserFormModule::Unload()
{
OSL_TRACE("** Unload() ");
@@ -2537,7 +2606,10 @@ void SbUserFormModule::Unload()
triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams);
aParams[0] >>= nCancel;
- if (nCancel == 1)
+ // basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 )
+ // test agains 0 ( false ) and assume anything else is true
+ // ( Note: ) this used to work ( something changes somewhere )
+ if (nCancel != 0)
{
return;
}
@@ -2568,7 +2640,7 @@ void SbUserFormModule::Unload()
OSL_TRACE("UnloadObject completed ( we hope )");
}
}
-//liuchen
+
void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic );
@@ -2587,8 +2659,15 @@ void SbUserFormModule::InitObject()
aArgs[ 0 ] <<= m_xModel;
rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
- if ( this->GetParent()->GetName().Len() )
- sProjectName = this->GetParent()->GetName();
+
+ try
+ {
+ Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
+ sProjectName = xVBAMode->getProjectName();
+ }
+ catch( Exception& /*e*/) {}
+
sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
@@ -2599,7 +2678,7 @@ void SbUserFormModule::InitObject()
aArgs[ 0 ] = uno::Any();
aArgs[ 1 ] <<= m_xDialog;
aArgs[ 2 ] <<= m_xModel;
- aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
+ aArgs[ 3 ] <<= sProjectName;
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW );
@@ -2655,3 +2734,4 @@ SbProperty::~SbProperty()
SbProcedureProperty::~SbProcedureProperty()
{}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx
index 46df47cbd665..2e0fb542d3c2 100644..100755
--- a/basic/source/comp/buffer.cxx
+++ b/basic/source/comp/buffer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,9 +35,9 @@
const static sal_uInt32 UP_LIMIT=0xFFFFFF00L;
-// Der SbiBuffer wird in Inkrements von mindestens 16 Bytes erweitert.
-// Dies ist notwendig, da viele Klassen von einer Pufferlaenge
-// von x*16 Bytes ausgehen.
+// The SbiBuffer will be expanded in increments of at least 16 Bytes.
+// This is necessary, because many classes emanate from a buffer length
+// of x*16 Bytes.
SbiBuffer::SbiBuffer( SbiParser* p, short n )
{
@@ -55,8 +56,8 @@ SbiBuffer::~SbiBuffer()
delete[] pBuf;
}
-// Rausreichen des Puffers
-// Dies fuehrt zur Loeschung des Puffers!
+// Reach out the buffer
+// This lead to the deletion of the buffer!
char* SbiBuffer::GetBuffer()
{
@@ -66,8 +67,8 @@ char* SbiBuffer::GetBuffer()
return p;
}
-// Test, ob der Puffer n Bytes aufnehmen kann.
-// Im Zweifelsfall wird er vergroessert
+// Test, if the buffer can contain n Bytes.
+// In case of doubt it will be enlarged
sal_Bool SbiBuffer::Check( sal_uInt16 n )
{
@@ -100,7 +101,7 @@ sal_Bool SbiBuffer::Check( sal_uInt16 n )
return sal_True;
}
-// Angleich des Puffers auf die uebergebene Byte-Grenze
+// Conditioning of the buffer onto the passed Byte limit
void SbiBuffer::Align( sal_Int32 n )
{
@@ -119,7 +120,7 @@ void SbiBuffer::Align( sal_Int32 n )
}
}
-// Patch einer Location
+// Patch of a Location
void SbiBuffer::Patch( sal_uInt32 off, sal_uInt32 val )
{
@@ -135,9 +136,9 @@ void SbiBuffer::Patch( sal_uInt32 off, sal_uInt32 val )
}
}
-// Forward References auf Labels und Prozeduren
-// bauen eine Kette auf. Der Anfang der Kette ist beim uebergebenen
-// Parameter, das Ende der Kette ist 0.
+// Forward References upon label und procedures
+// establish a linkage. The beginning of the linkage is at the passed parameter,
+// the end of the linkage is 0.
void SbiBuffer::Chain( sal_uInt32 off )
{
@@ -248,3 +249,4 @@ sal_Bool SbiBuffer::Add( const void* p, sal_uInt16 len )
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index a8c7e3f5330f..83d1a1965840 100644..100755
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,9 +33,10 @@
#include "sbcomp.hxx"
#include "image.hxx"
#include <limits>
+#include <algorithm>
#include <com/sun/star/script/ModuleType.hpp>
-// nInc ist die Inkrementgroesse der Puffer
+// nInc is the increment size of the buffers
SbiCodeGen::SbiCodeGen( SbModule& r, SbiParser* p, short nInc )
: rMod( r ), aCode( p, nInc )
@@ -51,7 +53,7 @@ sal_uInt32 SbiCodeGen::GetPC()
return aCode.GetSize();
}
-// Statement merken
+// memorize the statement
void SbiCodeGen::Statement()
{
@@ -60,12 +62,12 @@ void SbiCodeGen::Statement()
nLine = pParser->GetLine();
nCol = pParser->GetCol1();
- // #29955 Information der for-Schleifen-Ebene
- // in oberen Byte der Spalte speichern
+ // #29955 Store the information of the for-loop-layer
+ // in the uppper Byte of the column
nCol = (nCol & 0xff) + 0x100 * nForLevel;
}
-// Anfang eines Statements markieren
+// Mark the beginning of a statement
void SbiCodeGen::GenStmnt()
{
@@ -76,8 +78,8 @@ void SbiCodeGen::GenStmnt()
}
}
-// Die Gen-Routinen returnen den Offset des 1. Operanden,
-// damit Jumps dort ihr Backchain versenken koennen
+// The Gen-Routines return the offset of the 1. operand,
+// so that jumps can sink their backchain there.
sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode )
{
@@ -117,15 +119,15 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd1, sal_uInt32 nOp
return n;
}
-// Abspeichern des erzeugten Images im Modul
+// Storing of the created image in the module
void SbiCodeGen::Save()
{
SbiImage* p = new SbiImage;
rMod.StartDefinitions();
- // OPTION BASE-Wert:
+ // OPTION BASE-Value:
p->nDimBase = pParser->nBase;
- // OPTION EXPLICIT-Flag uebernehmen
+ // OPTION take over the EXPLICIT-Flag
if( pParser->bExplicit )
p->SetFlag( SBIMG_EXPLICIT );
@@ -163,8 +165,6 @@ void SbiCodeGen::Save()
rMod.bIsProxyModule = false;
}
- if( pParser->bText )
- p->SetFlag( SBIMG_COMPARETEXT );
// GlobalCode-Flag
if( pParser->HasGlobalCode() )
p->SetFlag( SBIMG_INITCODE );
@@ -237,13 +237,15 @@ void SbiCodeGen::Save()
ePropType = SbxOBJECT;
break;
case PROPERTY_MODE_NONE:
- DBG_ERROR( "Illegal PropertyMode PROPERTY_MODE_NONE" );
+ OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
break;
}
String aPropName = pProc->GetPropName();
if( nPass == 1 )
aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
SbProcedureProperty* pProcedureProperty = NULL;
+ OSL_TRACE("*** getProcedureProperty for thing %s",
+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
}
if( nPass == 1 )
@@ -266,22 +268,22 @@ void SbiCodeGen::Save()
pMeth->nStart = pProc->GetAddr();
pMeth->nLine1 = pProc->GetLine1();
pMeth->nLine2 = pProc->GetLine2();
- // Die Parameter:
+ // The parameter:
SbxInfo* pInfo = pMeth->GetInfo();
String aHelpFile, aComment;
sal_uIntPtr nHelpId = 0;
if( pInfo )
{
- // Die Zusatzdaten retten
+ // Rescue the additional data
aHelpFile = pInfo->GetHelpFile();
aComment = pInfo->GetComment();
nHelpId = pInfo->GetHelpId();
}
- // Und die Parameterliste neu aufbauen
+ // And reestablish the parameter list
pInfo = new SbxInfo( aHelpFile, nHelpId );
pInfo->SetComment( aComment );
SbiSymPool* pPool = &pProc->GetParams();
- // Das erste Element ist immer der Funktionswert!
+ // The first element is always the value of the function!
for( sal_uInt16 i = 1; i < pPool->GetSize(); i++ )
{
SbiSymDef* pPar = pPool->Get( i );
@@ -290,7 +292,7 @@ void SbiCodeGen::Save()
t = (SbxDataType) ( t | SbxBYREF );
if( pPar->GetDims() )
t = (SbxDataType) ( t | SbxARRAY );
- // #33677 Optional-Info durchreichen
+ // #33677 hand-over an Optional-Info
sal_uInt16 nFlags = SBX_READ;
if( pPar->IsOptional() )
nFlags |= SBX_OPTIONAL;
@@ -315,10 +317,10 @@ void SbiCodeGen::Save()
} // for( iPass...
}
}
- // Der Code
+ // The code
p->AddCode( aCode.GetBuffer(), aCode.GetSize() );
- // Der globale StringPool. 0 ist nicht belegt.
+ // The global StringPool. 0 is not occupied.
SbiStringPool* pPool = &pParser->aGblStrings;
sal_uInt16 nSize = pPool->GetSize();
p->MakeStrings( nSize );
@@ -326,7 +328,7 @@ void SbiCodeGen::Save()
for( i = 1; i <= nSize; i++ )
p->AddString( pPool->Find( i ) );
- // Typen einfuegen
+ // Insert types
sal_uInt16 nCount = pParser->rTypeArray->Count();
for (i = 0; i < nCount; i++)
p->AddType((SbxObject *)pParser->rTypeArray->Get(i));
@@ -436,10 +438,7 @@ public:
T result = 0 ;
static const S max = std::numeric_limits< S >::max();
result = m_nNumOp0 + ( ( sizeof(S) + 1 ) * m_nNumSingleParams ) + ( (( sizeof(S) * 2 )+ 1 ) * m_nNumDoubleParams );
- if ( result > max )
- return max;
-
- return static_cast<S>(result);
+ return std::min(static_cast<T>(max), result);
}
virtual bool processParams(){ return false; }
};
@@ -537,3 +536,5 @@ PCodeBuffConvertor<T,S>::convert()
template class PCodeBuffConvertor< sal_uInt16, sal_uInt32 >;
template class PCodeBuffConvertor< sal_uInt32, sal_uInt16 >;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 1ba8982404e4..a24f4ea9e7e3 100644..100755
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,13 +30,15 @@
#include "precompiled_basic.hxx"
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
+#include "sbunoobj.hxx"
+
SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
-// Deklaration einer Variablen
-// Bei Fehlern wird bis zum Komma oder Newline geparst.
-// Returnwert: eine neue Instanz, die eingefuegt und dann geloescht wird.
-// Array-Indexe werden als SbiDimList zurueckgegeben
+// Declaration of a variable
+// If there are errors it will be parsed up to the comma or the newline.
+// Return-value: a new instance, which were inserted and then deleted.
+// Array-Indexex were returned as SbiDimList
SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, sal_Bool bStatic, sal_Bool bConst )
{
@@ -49,7 +52,7 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, sal_Bool bStatic, sal_Bool bC
SbxDataType t = eScanType;
SbiSymDef* pDef = bConst ? new SbiConstDef( aSym ) : new SbiSymDef( aSym );
SbiDimList* pDim = NULL;
- // Klammern?
+ // Brackets?
if( Peek() == LPAREN )
pDim = new SbiDimList( this );
pDef->SetType( t );
@@ -69,15 +72,15 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, sal_Bool bStatic, sal_Bool bC
return pDef;
}
-// Aufloesen einer AS-Typdeklaration
-// Der Datentyp wird in die uebergebene Variable eingetragen
+// Resolving of a AS-Type-Declaration
+// The data type were inserted into the handed over variable
void SbiParser::TypeDecl( SbiSymDef& rDef, sal_Bool bAsNewAlreadyParsed )
{
SbxDataType eType = rDef.GetType();
- short nSize = 0;
if( bAsNewAlreadyParsed || Peek() == AS )
{
+ short nSize = 0;
if( !bAsNewAlreadyParsed )
Next();
rDef.SetDefinedAs();
@@ -124,14 +127,14 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, sal_Bool bAsNewAlreadyParsed )
}
}
break;
- case SYMBOL: // kann nur ein TYPE oder eine Objektklasse sein!
+ case SYMBOL: // can only be a TYPE or a object class!
if( eScanType != SbxVARIANT )
Error( SbERR_SYNTAX );
else
{
String aCompleteName = aSym;
- // #52709 DIM AS NEW fuer Uno mit voll-qualifizierten Namen
+ // #52709 DIM AS NEW for Uno with full-qualified name
if( Peek() == DOT )
{
String aDotStr( '.' );
@@ -153,13 +156,13 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, sal_Bool bAsNewAlreadyParsed )
}
}
}
- else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
+ else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && VBAConstantHelper::instance().isVBAConstantType( aCompleteName ) ) )
{
eType = SbxLONG;
break;
}
- // In den String-Pool uebernehmen
+ // Take over in the String pool
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
if( rDef.IsNew() && pProc == NULL )
@@ -175,7 +178,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, sal_Bool bAsNewAlreadyParsed )
Error( SbERR_UNEXPECTED, eTok );
Next();
}
- // Die Variable koennte mit Suffix deklariert sein
+ // The variable could have been declared with a suffix
if( rDef.GetType() != SbxVARIANT )
{
if( rDef.GetType() != eType )
@@ -188,7 +191,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, sal_Bool bAsNewAlreadyParsed )
}
}
-// Hier werden Variable, Arrays und Strukturen definiert.
+// Here variables, arrays and structures were definied.
// DIM/PRIVATE/PUBLIC/GLOBAL
void SbiParser::Dim()
@@ -206,7 +209,7 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
Error( SbERR_NOT_IN_SUBR, eCurTok );
if( eCurTok == PUBLIC || eCurTok == GLOBAL )
{
- bSwitchPool = sal_True; // im richtigen Moment auf globalen Pool schalten
+ bSwitchPool = sal_True; // at the right moment switch to the global pool
if( eCurTok == GLOBAL )
bPersistantGlobal = sal_True;
}
@@ -214,7 +217,7 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
// tied to the document. e.g. a module scope variable is global
if( GetBasic()->IsDocBasic() && bVBASupportOn && !pProc )
bPersistantGlobal = sal_True;
- // PRIVATE ist Synonym fuer DIM
+ // PRIVATE is a synonymous for DIM
// _CONST_?
sal_Bool bConst = sal_False;
if( eCurTok == _CONST_ )
@@ -272,13 +275,13 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
#define tmpSHARED
#undef SHARED
#endif
- // SHARED wird ignoriert
+ // SHARED were ignored
if( Peek() == SHARED ) Next();
#ifdef tmpSHARED
#define SHARED
#undef tmpSHARED
#endif
- // PRESERVE nur bei REDIM
+ // PRESERVE only at REDIM
if( Peek() == PRESERVE )
{
Next();
@@ -290,23 +293,23 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
SbiSymDef* pDef;
SbiDimList* pDim;
- // AB 9.7.97, #40689, Statics -> Modul-Initialisierung, in Sub ueberspringen
+ // From 1997-07-09, #40689, Statics -> Modul-Initialising, skip in Sub
sal_uInt32 nEndOfStaticLbl = 0;
if( !bVBASupportOn && bStatic )
{
nEndOfStaticLbl = aGen.Gen( _JUMP, 0 );
- aGen.Statement(); // bei static hier nachholen
+ aGen.Statement(); // catch up on static here
}
sal_Bool bDefined = sal_False;
while( ( pDef = VarDecl( &pDim, bStatic, bConst ) ) != NULL )
{
EnableErrors();
- // Variable suchen:
+ // search variable:
if( bSwitchPool )
pPool = &aGlobals;
SbiSymDef* pOld = pPool->Find( pDef->GetName() );
- // AB 31.3.1996, #25651#, auch in Runtime-Library suchen
+ // From 1996-03-31, #25651#, search also in the Runtime-Library
sal_Bool bRtlSym = sal_False;
if( !pOld )
{
@@ -322,10 +325,10 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
if( pOld )
{
bDefined = sal_True;
- // Bei RTL-Symbol immer Fehler
+ // always an error at a RTL-S
if( !bRtlSym && (eOp == _REDIM || eOp == _REDIMP) )
{
- // Bei REDIM die Attribute vergleichen
+ // compare the attributes at a REDIM
SbxDataType eDefType;
bool bError_ = false;
if( pOld->IsStatic() )
@@ -347,19 +350,19 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
else
pPool->Add( pDef );
- // #36374: Variable vor Unterscheidung IsNew() anlegen
- // Sonst Error bei Dim Identifier As New Type und option explicit
+ // #36374: Create the variable in front of the distinction IsNew()
+ // Otherwise error at Dim Identifier As New Type and option explicit
if( !bDefined && !(eOp == _REDIM || eOp == _REDIMP)
&& ( !bConst || pDef->GetScope() == SbGLOBAL ) )
{
- // Variable oder globale Konstante deklarieren
+ // Declare variable or global constant
SbiOpcode eOp2;
switch ( pDef->GetScope() )
{
case SbGLOBAL: eOp2 = bPersistantGlobal ? _GLOBAL_P : _GLOBAL;
goto global;
case SbPUBLIC: eOp2 = bPersistantGlobal ? _PUBLIC_P : _PUBLIC;
- // AB 9.7.97, #40689, kein eigener Opcode mehr
+ // From 1997-07-09, #40689, no own Opcode anymore
if( bVBASupportOn && bStatic )
{
eOp2 = _STATIC;
@@ -385,8 +388,8 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
aGen.Gen( eOp2, pDef->GetId(), nOpnd2 );
}
- // Initialisierung fuer selbstdefinierte Datentypen
- // und per NEW angelegte Variable
+ // Initialising for self-defined daty types
+ // and per NEW created variable
if( pDef->GetType() == SbxOBJECT
&& pDef->GetTypeId() )
{
@@ -429,14 +432,17 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
aExpr.Gen();
SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
- aGen.Gen( _SET );
+ if ( bVBASupportOn )
+ aGen.Gen( _VBASET );
+ else
+ aGen.Gen( _SET );
}
}
else
{
if( bConst )
{
- // Konstanten-Definition
+ // Definition of the constants
if( pDim )
{
Error( SbERR_SYNTAX );
@@ -444,13 +450,13 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
}
SbiExpression aVar( this, *pDef );
if( !TestToken( EQ ) )
- goto MyBreak; // AB 24.6.1996 (s.u.)
+ goto MyBreak; // From 1996-06-24 (see below)
SbiConstExpression aExpr( this );
if( !bDefined && aExpr.IsValid() )
{
if( pDef->GetScope() == SbGLOBAL )
{
- // Nur Code fuer globale Konstante erzeugen!
+ // Create code only for the global constant!
aVar.Gen();
aExpr.Gen();
aGen.Gen( _PUTC );
@@ -464,8 +470,8 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
}
else if( pDim )
{
- // Die Variable dimensionieren
- // Bei REDIM die Var vorher loeschen
+ // Dimension the variable
+ // Delete the var at REDIM beforehand
if( eOp == _REDIM )
{
SbiExpression aExpr( this, *pDef, NULL );
@@ -495,36 +501,36 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
}
}
if( !TestComma() )
- goto MyBreak; // AB 24.6.1996 (s.u.)
-
- // #27963# AB, 24.6.1996
- // Einfuehrung bSwitchPool (s.o.): pPool darf beim VarDecl-Aufruf
- // noch nicht auf &aGlobals gesetzt sein.
- // Ansonsten soll das Verhalten aber absolut identisch bleiben,
- // d.h. pPool muss immer am Schleifen-Ende zurueckgesetzt werden.
- // auch bei break
+ goto MyBreak; // From 1996-06-24 (see below)
+
+ // #27963# From 1996-06-24
+ // Implementation of bSwitchPool (see above): pPool must not be set to &aGlobals
+ // at the VarDecl-Call.
+ // Apart from that the behavior should be absolutely identical,
+ // i.e., pPool had to be reset always at the end of the loop.
+ // also at a break
pPool = pOldPool;
- continue; // MyBreak überspingen
+ continue; // Skip MyBreak
MyBreak:
pPool = pOldPool;
break;
}
- // AB 9.7.97, #40689, Sprung ueber Statics-Deklaration abschliessen
+ // From 1997-07-09, #40689, finalize the jump over statics declarations
if( !bVBASupportOn && bStatic )
{
- // globalen Chain pflegen
+ // maintain the global chain
nGblChain = aGen.Gen( _JUMP, 0 );
bGblDefs = bNewGblDefs = sal_True;
- // fuer Sub Sprung auf Ende der statics eintragen
+ // Register for Sub a jump to the end of statics
aGen.BackChain( nEndOfStaticLbl );
}
//pPool = pOldPool;
}
-// Hier werden Arrays redimensioniert.
+// Here were Arrays redimensioned.
void SbiParser::ReDim()
{
@@ -544,7 +550,7 @@ void SbiParser::Erase()
}
}
-// Deklaration eines Datentyps
+// Declaration of a data type
void SbiParser::Type()
{
@@ -556,7 +562,7 @@ void SbiParser::DefType( sal_Bool bPrivate )
// TODO: Use bPrivate
(void)bPrivate;
- // Neues Token lesen, es muss ein Symbol sein
+ // Read the new Token lesen. It had to be a symbol
if (!TestSymbol())
return;
@@ -592,7 +598,7 @@ void SbiParser::DefType( sal_Bool bPrivate )
pDim = NULL;
pElem = VarDecl(&pDim,sal_False,sal_False);
if( !pElem )
- bDone = sal_True; // Error occured
+ bDone = sal_True; // Error occurred
}
if( pElem )
{
@@ -678,7 +684,7 @@ void SbiParser::Enum()
void SbiParser::DefEnum( sal_Bool bPrivate )
{
- // Neues Token lesen, es muss ein Symbol sein
+ // Read a the new Token. It had to be a symbol
if (!TestSymbol())
return;
@@ -724,14 +730,14 @@ void SbiParser::DefEnum( sal_Bool bPrivate )
pElem = VarDecl( &pDim, sal_False, sal_True );
if( !pElem )
{
- bDone = sal_True; // Error occured
+ bDone = sal_True; // Error occurred
break;
}
else if( pDim )
{
delete pDim;
Error( SbERR_SYNTAX );
- bDone = sal_True; // Error occured
+ bDone = sal_True; // Error occurred
break;
}
@@ -761,7 +767,7 @@ void SbiParser::DefEnum( sal_Bool bPrivate )
if( pOld )
{
Error( SbERR_VAR_DEFINED, pElem->GetName() );
- bDone = sal_True; // Error occured
+ bDone = sal_True; // Error occurred
break;
}
@@ -805,8 +811,8 @@ void SbiParser::DefEnum( sal_Bool bPrivate )
}
-// Prozedur-Deklaration
-// das erste Token ist bereits eingelesen (SUB/FUNCTION)
+// Procedure-Declaration
+// the first Token is already read in (SUB/FUNCTION)
// xxx Name [LIB "name"[ALIAS "name"]][(Parameter)][AS TYPE]
SbiProcDef* SbiParser::ProcDecl( sal_Bool bDecl )
@@ -840,7 +846,7 @@ SbiProcDef* SbiParser::ProcDecl( sal_Bool bDecl )
}
if( !bDecl )
{
- // CDECL, LIB und ALIAS sind unzulaessig
+ // CDECL, LIB and ALIAS are invalid
if( pDef->GetLib().Len() )
Error( SbERR_UNEXPECTED, LIB );
if( pDef->GetAlias().Len() )
@@ -853,7 +859,7 @@ SbiProcDef* SbiParser::ProcDecl( sal_Bool bDecl )
}
else if( !pDef->GetLib().Len() )
{
- // ALIAS und CDECL nur zusammen mit LIB
+ // ALIAS and CDECL only together with LIB
if( pDef->GetAlias().Len() )
Error( SbERR_UNEXPECTED, ALIAS );
if( pDef->IsCdecl() )
@@ -861,7 +867,7 @@ SbiProcDef* SbiParser::ProcDecl( sal_Bool bDecl )
pDef->SetCdecl( sal_False );
pDef->GetAlias().Erase();
}
- // Klammern?
+ // Brackets?
if( Peek() == LPAREN )
{
Next();
@@ -959,14 +965,14 @@ void SbiParser::DefDeclare( sal_Bool bPrivate )
{
if( !pDef->GetLib().Len() )
Error( SbERR_EXPECTED, LIB );
- // gibts den schon?
+ // Is it already there?
SbiSymDef* pOld = aPublics.Find( pDef->GetName() );
if( pOld )
{
SbiProcDef* p = pOld->GetProcDef();
if( !p )
{
- // Als Variable deklariert
+ // Declared as a variable
Error( SbERR_BAD_DECLARATION, pDef->GetName() );
delete pDef;
pDef = NULL;
@@ -1046,11 +1052,27 @@ void SbiParser::DefDeclare( sal_Bool bPrivate )
}
}
-// Aufruf einer SUB oder FUNCTION
+void SbiParser::Attribute()
+{
+ // TODO: Need to implement the method as an attributed object.
+ while( Next() != EQ )
+ {
+ if( Next() != DOT)
+ break;
+ }
+
+ if( eCurTok != EQ )
+ Error( SbERR_SYNTAX );
+ else
+ SbiExpression aValue( this );
+
+ // Don't generate any code - just discard it.
+}
+
+// Call of a SUB or a FUNCTION
void SbiParser::Call()
{
- String aName( aSym );
SbiExpression aVar( this, SbSYMBOL );
aVar.Gen( FORCE_CALL );
aGen.Gen( _GET );
@@ -1063,7 +1085,7 @@ void SbiParser::SubFunc()
DefProc( sal_False, sal_False );
}
-// Einlesen einer Prozedur
+// Read in of a procedure
sal_Bool runsInSetup( void );
@@ -1092,7 +1114,7 @@ void SbiParser::DefProc( sal_Bool bStatic, sal_Bool bPrivate )
return;
pDef->setPropertyMode( ePropertyMode );
- // Ist die Proc bereits deklariert?
+ // Is the Proc already declared?
SbiSymDef* pOld = aPublics.Find( pDef->GetName() );
if( pOld )
{
@@ -1101,7 +1123,7 @@ void SbiParser::DefProc( sal_Bool bStatic, sal_Bool bPrivate )
pProc = pOld->GetProcDef();
if( !pProc )
{
- // Als Variable deklariert
+ // Declared as a variable
Error( SbERR_BAD_DECLARATION, pDef->GetName() );
delete pDef;
pProc = NULL;
@@ -1134,8 +1156,8 @@ void SbiParser::DefProc( sal_Bool bStatic, sal_Bool bPrivate )
return;
pProc->SetPublic( !bPrivate );
- // Nun setzen wir die Suchhierarchie fuer Symbole sowie die aktuelle
- // Prozedur.
+ // Now we set the search hierarchy for symbols as well as the
+ // current procedure.
aPublics.SetProcId( pProc->GetId() );
pProc->GetParams().SetParent( &aPublics );
if( bStatic )
@@ -1149,7 +1171,7 @@ void SbiParser::DefProc( sal_Bool bStatic, sal_Bool bPrivate )
{
pProc->SetStatic( sal_False );
}
- // Normalfall: Lokale Variable->Parameter->Globale Variable
+ // Normal case: Local variable->parameter->global variable
pProc->GetLocals().SetParent( &pProc->GetParams() );
pPool = &pProc->GetLocals();
@@ -1161,7 +1183,7 @@ void SbiParser::DefProc( sal_Bool bStatic, sal_Bool bPrivate )
pProc->SetLine2( l2 );
pPool = &aPublics;
aPublics.SetProcId( 0 );
- // Offene Labels?
+ // Open labels?
pProc->GetLabels().CheckRefs();
CloseBlock();
aGen.Gen( _LEAVE );
@@ -1195,8 +1217,8 @@ void SbiParser::DefStatic( sal_Bool bPrivate )
default: {
if( !pProc )
Error( SbERR_NOT_IN_SUBR );
- // Pool umsetzen, damit STATIC-Deklarationen im globalen
- // Pool landen
+ // Reset the Pool, so that STATIC-Declarations go into the
+ // global Pool
SbiSymPool* p = pPool; pPool = &aPublics;
DefVar( _STATIC, sal_True );
pPool = p;
@@ -1204,3 +1226,4 @@ void SbiParser::DefStatic( sal_Bool bPrivate )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index c77123493916..1dcd5fc73e59 100644..100755
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,7 @@
#include "sbcomp.hxx"
#include "expr.hxx"
-// Umsetztabelle fuer Token-Operatoren und Opcodes
+// Transform table for token operators and opcodes
typedef struct {
SbiToken eTok; // Token
@@ -64,7 +65,7 @@ static OpTable aOpTable [] = {
{ IS, _IS },
{ NIL, _NOP }};
-// Ausgabe eines Elements
+// Output of an element
void SbiExprNode::Gen( RecursiveMode eRecMode )
{
if( IsConstant() )
@@ -108,10 +109,10 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
eOp = aVar.pDef->IsGlobal() ? _FIND_G : _FIND;
}
}
- // AB: 17.12.1995, Spezialbehandlung fuer WITH
+ // From 1995-12-17, special treatment for WITH
else if( (pWithParent_ = GetWithParent()) != NULL )
{
- eOp = _ELEM; // .-Ausdruck in WITH
+ eOp = _ELEM; // .-Term in in WITH
}
else
{
@@ -162,7 +163,7 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
}
}
-// Ausgabe eines Operanden-Elements
+// Output of an operand element
void SbiExprNode::GenElement( SbiOpcode eOp )
{
@@ -171,11 +172,11 @@ void SbiExprNode::GenElement( SbiOpcode eOp )
pGen->GetParser()->Error( SbERR_INTERNAL_ERROR, "Opcode" );
#endif
SbiSymDef* pDef = aVar.pDef;
- // Das ID ist entweder die Position oder das String-ID
- // Falls das Bit 0x8000 gesetzt ist, hat die Variable
- // eine Parameterliste.
+ // The ID is either the position or the String-ID
+ // If the bit Bit 0x8000 is set, the variable have
+ // a parameter list.
sal_uInt16 nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId();
- // Parameterliste aufbauen
+ // Build a parameter list
if( aVar.pPar && aVar.pPar->GetSize() )
{
nId |= 0x8000;
@@ -197,16 +198,16 @@ void SbiExprNode::GenElement( SbiOpcode eOp )
}
}
-// Erzeugen einer Argv-Tabelle
-// Das erste Element bleibt immer frei fuer Returnwerte etc.
-// Siehe auch SbiProcDef::SbiProcDef() in symtbl.cxx
+// Create an Argv-Table
+// The first element remain available for return value etc.
+// See as well SbiProcDef::SbiProcDef() in symtbl.cxx
void SbiExprList::Gen()
{
if( pFirst )
{
pParser->aGen.Gen( _ARGC );
- // AB 10.1.96: Typ-Anpassung bei DECLARE
+ // From 1996-01-10: Type adjustment at DECLARE
sal_uInt16 nCount = 1 /*, nParAnz = 0*/;
// SbiSymPool* pPool = NULL;
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
@@ -219,13 +220,13 @@ void SbiExprList::Gen()
pParser->aGen.Gen( _ARGN, nSid );
/* TODO: Check after Declare concept change
- // AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
+ // From 1996-01-10: Type adjustment at named -> search suitable parameter
if( pProc )
{
- // Vorerst: Error ausloesen
+ // For the present: trigger an error
pParser->Error( SbERR_NO_NAMED_ARGS );
- // Spaeter, wenn Named Args bei DECLARE moeglich
+ // Later, if Named Args at DECLARE is posible
//for( sal_uInt16 i = 1 ; i < nParAnz ; i++ )
//{
// SbiSymDef* pDef = pPool->Get( i );
@@ -253,8 +254,8 @@ void SbiExprList::Gen()
void SbiExpression::Gen( RecursiveMode eRecMode )
{
- // AB: 17.12.1995, Spezialbehandlung fuer WITH
- // Wenn pExpr == .-Ausdruck in With, zunaechst Gen fuer Basis-Objekt
+ // From 1995-12-17, special treatment for WITH
+ // If pExpr == .-term in With, approximately Gen for Basis-Object
pExpr->Gen( eRecMode );
if( bByVal )
pParser->aGen.Gen( _BYVAL );
@@ -268,3 +269,4 @@ void SbiExpression::Gen( RecursiveMode eRecMode )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index f516513d7589..f454071c0377 100644..100755
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,7 +52,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, SbiToken t, SbiExprNode*
pRight = r;
eTok = t;
nVal = 0;
- eType = SbxVARIANT; // Nodes sind immer Variant
+ eType = SbxVARIANT; // Nodes are always Variant
eNodeType = SbxNODE;
bComposite= sal_True;
}
@@ -85,7 +86,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiEx
aVar.pvMorePar = NULL;
aVar.pNext= NULL;
- // Funktionsergebnisse sind nie starr
+ // Results of functions are at no time fixed
bComposite= sal_Bool( aVar.pDef->GetProcDef() != NULL );
}
@@ -110,7 +111,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, sal_uInt16 nId )
nTypeStrId = nId;
}
-// AB: 17.12.95, Hilfsfunktion fuer Ctor fuer einheitliche Initialisierung
+// From 1995-12-17, auxiliary function for Ctor for the uniform initialisation
void SbiExprNode::BaseInit( SbiParser* p )
{
pGen = &p->aGen;
@@ -158,7 +159,7 @@ SbiSymDef* SbiExprNode::GetRealVar()
return NULL;
}
-// AB: 18.12.95
+// From 1995-12-18
SbiExprNode* SbiExprNode::GetRealNode()
{
if( eNodeType == SbxVARVAL )
@@ -172,7 +173,7 @@ SbiExprNode* SbiExprNode::GetRealNode()
return NULL;
}
-// Diese Methode setzt den Typ um, falls er in den Integer-Bereich hineinpasst
+// This method transform the type, if it fits into the Integer range
sal_Bool SbiExprNode::IsIntConst()
{
@@ -212,7 +213,7 @@ sal_Bool SbiExprNode::IsLvalue()
return IsVariable();
}
-// Ermitteln der Tiefe eines Baumes
+// Identify of the depth of a tree
short SbiExprNode::GetDepth()
{
@@ -226,11 +227,11 @@ short SbiExprNode::GetDepth()
}
-// Abgleich eines Baumes:
+// Adjustment of a tree:
// 1. Constant Folding
-// 2. Typabgleich
-// 3. Umwandlung der Operanden in Strings
-// 4. Hochziehen der Composite- und Error-Bits
+// 2. Type-Adjustment
+// 3. Conversion of the operans into Strings
+// 4. Lifting of the composite- and error-bits
void SbiExprNode::Optimize()
{
@@ -238,7 +239,7 @@ void SbiExprNode::Optimize()
CollectBits();
}
-// Hochziehen der Composite- und Fehlerbits
+// Lifting of the composite- and error-bits
void SbiExprNode::CollectBits()
{
@@ -256,8 +257,8 @@ void SbiExprNode::CollectBits()
}
}
-// Kann ein Zweig umgeformt werden, wird sal_True zurueckgeliefert. In diesem
-// Fall ist das Ergebnis im linken Zweig.
+// If a twig can be converted, True will be returned. In this case
+// the result is in the left twig.
void SbiExprNode::FoldConstants()
{
@@ -272,10 +273,10 @@ void SbiExprNode::FoldConstants()
{
CollectBits();
if( eTok == CAT )
- // CAT verbindet auch zwei Zahlen miteinander!
+ // CAT affiliate also two numbers!
eType = SbxSTRING;
if( pLeft->eType == SbxSTRING )
- // Kein Type Mismatch!
+ // No Type Mismatch!
eType = SbxSTRING;
if( eType == SbxSTRING )
{
@@ -287,7 +288,7 @@ void SbiExprNode::FoldConstants()
if( eTok == PLUS || eTok == CAT )
{
eTok = CAT;
- // Verkettung:
+ // Linking:
aStrVal = rl;
aStrVal += rr;
eType = SbxSTRING;
@@ -333,7 +334,7 @@ void SbiExprNode::FoldConstants()
if( ( eTok >= AND && eTok <= IMP )
|| eTok == IDIV || eTok == MOD )
{
- // Integer-Operationen
+ // Integer operations
sal_Bool err = sal_False;
if( nl > SbxMAXLNG ) err = sal_True, nl = SbxMAXLNG;
else
@@ -427,12 +428,11 @@ void SbiExprNode::FoldConstants()
if( !::rtl::math::isFinite( nVal ) )
pGen->GetParser()->Error( SbERR_MATH_OVERFLOW );
- // Den Datentyp wiederherstellen, um Rundungsfehler
- // zu killen
+ // Recover the data type to kill rounding error
if( bCheckType && bBothInt
&& nVal >= SbxMINLNG && nVal <= SbxMAXLNG )
{
- // NK-Stellen weg
+ // Decimal place away
long n = (long) nVal;
nVal = n;
eType = ( n >= SbxMININT && n <= SbxMAXINT )
@@ -454,7 +454,7 @@ void SbiExprNode::FoldConstants()
case NEG:
nVal = -nVal; break;
case NOT: {
- // Integer-Operation!
+ // Integer operation!
sal_Bool err = sal_False;
if( nVal > SbxMAXLNG ) err = sal_True, nVal = SbxMAXLNG;
else
@@ -472,7 +472,7 @@ void SbiExprNode::FoldConstants()
}
if( eNodeType == SbxNUMVAL )
{
- // Evtl auf INTEGER falten (wg. besserem Opcode)?
+ // Potentially convolve in INTEGER (because of better opcode)?
if( eType == SbxSINGLE || eType == SbxDOUBLE )
{
double x;
@@ -486,3 +486,4 @@ void SbiExprNode::FoldConstants()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 42b4bfa06aaf..cef0542c43bc 100644..100755
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -373,8 +374,12 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// Typ SbxOBJECT sein
if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
{
- pParser->Error( SbERR_BAD_DECLARATION, aSym );
- bError = sal_True;
+ // defer error until runtime if in vba mode
+ if ( !pParser->IsVBASupportOn() )
+ {
+ pParser->Error( SbERR_BAD_DECLARATION, aSym );
+ bError = sal_True;
+ }
}
if( !bError )
pNd->aVar.pNext = ObjTerm( *pDef );
@@ -735,6 +740,7 @@ SbiExprNode* SbiExpression::Comp()
return pNd;
}
+
SbiExprNode* SbiExpression::VBA_Not()
{
SbiExprNode* pNd = NULL;
@@ -752,6 +758,93 @@ SbiExprNode* SbiExpression::VBA_Not()
return pNd;
}
+SbiExprNode* SbiExpression::VBA_And()
+{
+ SbiExprNode* pNd = VBA_Not();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != AND )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Not() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Or()
+{
+ SbiExprNode* pNd = VBA_And();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != OR )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_And() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Xor()
+{
+ SbiExprNode* pNd = VBA_Or();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != XOR )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Or() );
+ }
+ }
+ return pNd;
+
+}
+
+SbiExprNode* SbiExpression::VBA_Eqv()
+{
+ SbiExprNode* pNd = VBA_Xor();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != EQV )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Xor() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Imp()
+{
+ SbiExprNode* pNd = VBA_Eqv();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != IMP )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Eqv() );
+ }
+ }
+ return pNd;
+
+}
+
SbiExprNode* SbiExpression::Like()
{
SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp();
@@ -763,7 +856,7 @@ SbiExprNode* SbiExpression::Like()
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
// Mehrere Operatoren hintereinander gehen nicht
- if( nCount > 1 )
+ if( nCount > 1 && !pParser->IsVBASupportOn() )
{
pParser->Error( SbERR_SYNTAX );
bError = sal_True;
@@ -1161,3 +1254,4 @@ SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
else pParser->Next();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx
index 958b34ee57ff..5c4abc680826 100644..100755
--- a/basic/source/comp/io.cxx
+++ b/basic/source/comp/io.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -356,3 +357,4 @@ void SbiParser::Close()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index 02feb685c11f..f904c9ee51f3 100644..100755
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -316,8 +317,7 @@ void SbiParser::OnGoto()
sal_uInt32 nLbl = 0;
do
{
- SbiToken eTok2 = NIL;
- eTok2 = Next(); // Label holen
+ Next(); // Label holen
if( MayBeLabel() )
{
sal_uInt32 nOff = pProc->GetLabels().Reference( aSym );
@@ -556,3 +556,4 @@ void SbiParser::Resume()
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk
index d65f6a431e43..5fe64ceae091 100644..100755
--- a/basic/source/comp/makefile.mk
+++ b/basic/source/comp/makefile.mk
@@ -35,25 +35,22 @@ TARGET=comp
.INCLUDE : settings.mk
SLOFILES= \
- $(SLO)$/buffer.obj \
- $(SLO)$/codegen.obj \
- $(SLO)$/dim.obj \
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/buffer.obj \
$(SLO)$/exprgen.obj \
$(SLO)$/exprnode.obj \
- $(SLO)$/exprtree.obj \
- $(SLO)$/io.obj \
+ $(SLO)$/io.obj \
$(SLO)$/loops.obj \
- $(SLO)$/parser.obj \
$(SLO)$/sbcomp.obj \
- $(SLO)$/scanner.obj \
$(SLO)$/symtbl.obj \
$(SLO)$/token.obj
EXCEPTIONSFILES= \
- $(SLO)$/codegen.obj \
- $(SLO)$/dim.obj \
- $(SLO)$/exprtree.obj \
- $(SLO)$/parser.obj
+ $(SLO)$/codegen.obj \
+ $(SLO)$/dim.obj \
+ $(SLO)$/exprtree.obj \
+ $(SLO)$/parser.obj \
+ $(SLO)$/scanner.obj
# --- Targets --------------------------------------------------------------
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 670ca7384767..38189bc2025c 100644..100755
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,6 +50,7 @@ struct SbiStatement {
#define N sal_False
static SbiStatement StmntTable [] = {
+{ ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE
{ CALL, &SbiParser::Call, N, Y, }, // CALL
{ CLOSE, &SbiParser::Close, N, Y, }, // CLOSE
{ _CONST_, &SbiParser::Dim, Y, Y, }, // CONST
@@ -387,6 +389,18 @@ sal_Bool SbiParser::Parse()
Next(); return sal_True;
}
+ // In vba it's possible to do Error.foobar ( even if it results in
+ // a runtime error
+ if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
+ {
+ SbiTokenizer tokens( *(SbiTokenizer*)this );
+ tokens.Next();
+ if ( tokens.Peek() == DOT )
+ {
+ eCurTok = SYMBOL;
+ ePush = eCurTok;
+ }
+ }
// Kommt ein Symbol, ist es entweder eine Variable( LET )
// oder eine SUB-Prozedur( CALL ohne Klammern )
// DOT fuer Zuweisungen im WITH-Block: .A=5
@@ -795,7 +809,7 @@ void SbiParser::Option()
bClassModule = sal_True;
aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS );
break;
- case VBASUPPORT:
+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
if( Next() == NUMBER )
{
if ( nVal == 1 || nVal == 0 )
@@ -861,3 +875,4 @@ void SbiParser::ErrorStmnt()
aGen.Gen( _ERROR );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index 12e368d1c7eb..8f5aa58bfe97 100755
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,23 +32,11 @@
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
#include "image.hxx"
-#include "sbtrace.hxx"
#include <basic/sbobjmod.hxx>
-
-//==========================================================================
-// Tracing, for debugging only
-
// To activate tracing enable in sbtrace.hxx
#ifdef DBG_TRACE_BASIC
-#include <hash_map>
-
-// Trace ini file (set NULL to ignore)
-static char GpTraceIniFile[] = "d:\\zBasic.Asm\\BasicTrace.ini";
-//static char* GpTraceIniFile = NULL;
-
-
// Trace Settings, used if no ini file / not found in ini file
static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt";
static char* GpTraceFileName = GpTraceFileNameDefault;
@@ -182,313 +171,7 @@ static void lcl_ReadIniFile( const char* pIniFileName )
}
fclose( pFile );
}
-
-struct TraceTextData
-{
- rtl::OString m_aTraceStr_STMNT;
- rtl::OString m_aTraceStr_PCode;
-};
-typedef std::hash_map< sal_Int32, TraceTextData > PCToTextDataMap;
-typedef std::hash_map< ::rtl::OUString, PCToTextDataMap*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTraceMap;
-
-ModuleTraceMap GaModuleTraceMap;
-ModuleTraceMap& rModuleTraceMap = GaModuleTraceMap;
-
-static void lcl_PrepareTraceForModule( SbModule* pModule )
-{
- String aModuleName = pModule->GetName();
- ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
- if( it != rModuleTraceMap.end() )
- {
- PCToTextDataMap* pInnerMap = it->second;
- delete pInnerMap;
- rModuleTraceMap.erase( it );
- }
-
- String aDisassemblyStr;
- pModule->Disassemble( aDisassemblyStr );
-}
-
-static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL )
-{
- const char* pPrintFirst = (pPreStr != NULL) ? pPreStr : "";
- FILE* pFile = fopen( pFileName, "a+" );
- if( pFile != NULL )
- {
- fprintf( pFile, "%s%s\n", pPrintFirst, pStr );
- fclose( pFile );
- }
-}
-
-const char* lcl_getSpaces( int nSpaceCount )
-{
- static sal_Char Spaces[] = " "
- " "
- " ";
- static int nAvailableSpaceCount = strlen( Spaces );
- static sal_Char* pSpacesEnd = Spaces + nAvailableSpaceCount;
-
- if( nSpaceCount > nAvailableSpaceCount )
- nSpaceCount = nAvailableSpaceCount;
-
- return pSpacesEnd - nSpaceCount;
-}
-
-static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
-{
- static sal_Char Buffer[1000];
-
- rtl::OString aOStr = OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US );
- const sal_Char* pStr = aOStr.getStr();
-
- // Skip whitespace
- sal_Char c = *pStr;
- while( c == ' ' || c == '\t' )
- {
- pStr++;
- c = *pStr;
- }
-
- int nLen = strlen( pStr );
- strncpy( Buffer, pStr, nLen );
- Buffer[nLen] = 0;
-
- rtl::OString aORetStr( Buffer );
- return aORetStr;
-}
-
-String lcl_dumpMethodParameters( SbMethod* pMethod )
-{
- String aStr;
- if( pMethod == NULL )
- return aStr;
-
- SbxError eOld = SbxBase::GetError();
-
- SbxArray* pParams = pMethod->GetParameters();
- SbxInfo* pInfo = pMethod->GetInfo();
- if ( pParams )
- {
- aStr += '(';
- // 0 is sub itself
- for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ )
- {
- SbxVariable* pVar = pParams->Get( nParam );
- DBG_ASSERT( pVar, "Parameter?!" );
- if ( pVar->GetName().Len() )
- aStr += pVar->GetName();
- else if ( pInfo )
- {
- const SbxParamInfo* pParam = pInfo->GetParam( nParam );
- if ( pParam )
- aStr += pParam->aName;
- }
- aStr += '=';
- SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
- else if( eType != SbxOBJECT )
- aStr += pVar->GetString();
- if ( nParam < ( pParams->Count() - 1 ) )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
- }
- aStr += ')';
- }
-
- SbxBase::ResetError();
- if( eOld != SbxERR_OK )
- SbxBase::SetError( eOld );
-
- return aStr;
-}
-
-
-// Public functions
-
-static bool GbSavTraceOn = false;
-void dbg_InitTrace( void )
-{
- if( GpTraceIniFile != NULL )
- lcl_ReadIniFile( GpTraceIniFile );
-
- FILE* pFile = fopen( GpTraceFileName, "w" );
- if( pFile != NULL )
- fclose( pFile );
- GbSavTraceOn = GbTraceOn;
- if( !GbTraceOn )
- lcl_lineOut( GpTraceFileName, "### Program started with trace off ###" );
-}
-
-void dbg_DeInitTrace( void )
-{
- GbTraceOn = GbSavTraceOn;
-}
-
-static sal_Int32 GnLastCallLvl = 0;
-
-void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
-{
- if( !GbTraceOn )
- return;
- GnLastCallLvl = nCallLvl;
-
- SbModule* pTraceMod = pModule;
- if( pTraceMod->ISA(SbClassModuleObject) )
- {
- SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
- pTraceMod = pClassModuleObj->getClassModule();
- }
-
- String aModuleName = pTraceMod->GetName();
- ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
- if( it == rModuleTraceMap.end() )
- {
- const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
- char Buffer[200];
- sprintf( Buffer, "TRACE ERROR: Unknown module \"%s\"", pModuleNameStr );
- lcl_lineOut( GpTraceFileName, Buffer );
- return;
- }
-
- PCToTextDataMap* pInnerMap = it->second;
- if( pInnerMap == NULL )
- {
- lcl_lineOut( GpTraceFileName, "TRACE INTERNAL ERROR: No inner map" );
- return;
- }
-
- PCToTextDataMap::iterator itInner = pInnerMap->find( nPC );
- if( itInner == pInnerMap->end() )
- {
- const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
- char Buffer[200];
- sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", (int)nPC, pModuleNameStr );
- lcl_lineOut( GpTraceFileName, Buffer );
- return;
- }
-
- int nIndent = nCallLvl * GnIndentPerCallLevel;
-
- const TraceTextData& rTraceTextData = itInner->second;
- const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
- if( rStr_STMNT.getLength() )
- lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ) );
-
- if( !GbIncludePCodes )
- return;
-
- nIndent += GnIndentForPCode;
- const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
- if( rStr_PCode.getLength() )
- lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ) );
-}
-
-void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallLvl, bool bLeave )
-{
- static const char* pSeparator = "' ================================================================================";
-
- if( !GbTraceOn )
- return;
- GnLastCallLvl = nCallLvl;
-
- SbModule* pTraceMod = pModule;
- SbClassModuleObject* pClassModuleObj = NULL;
- if( pTraceMod->ISA(SbClassModuleObject) )
- {
- pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
- pTraceMod = pClassModuleObj->getClassModule();
- }
-
- if( nCallLvl > 0 )
- nCallLvl--;
- int nIndent = nCallLvl * GnIndentPerCallLevel;
- if( !bLeave )
- {
- lcl_lineOut( GpTraceFileName, "" );
- lcl_lineOut( GpTraceFileName, pSeparator, lcl_getSpaces( nIndent ) );
- }
-
- String aStr;
- if( bLeave )
- {
- lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) );
- aStr.AppendAscii( "' Leaving " );
- }
- else
- {
- aStr.AppendAscii( "Entering " );
- }
- String aModuleName = pTraceMod->GetName();
- aStr += aModuleName;
- if( pMethod != NULL )
- {
- aStr.AppendAscii( "::" );
- String aMethodName = pMethod->GetName();
- aStr += aMethodName;
- }
- else
- {
- aStr.AppendAscii( "/RunInit" );
- }
-
- if( pClassModuleObj != NULL )
- {
- aStr.AppendAscii( "[this=" );
- aStr += pClassModuleObj->GetName();
- aStr.AppendAscii( "]" );
- }
- if( !bLeave )
- aStr += lcl_dumpMethodParameters( pMethod );
-
- lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
- if( !bLeave )
- lcl_lineOut( GpTraceFileName, "{", lcl_getSpaces( nIndent ) );
-
- if( bLeave )
- lcl_lineOut( GpTraceFileName, "" );
-}
-
-void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, sal_Int32 nCallLvl )
-{
- if( !GbTraceOn )
- return;
- GnLastCallLvl = nCallLvl;
-
- rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
-
- char Buffer[200];
- const char* pHandledStr = bTraceErrHandled ? " / HANDLED" : "";
- sprintf( Buffer, "*** ERROR%s, Id = %d, Msg = \"%s\" ***", pHandledStr, (int)nTraceErr, aOTraceErrMsg.getStr() );
- int nIndent = nCallLvl * GnIndentPerCallLevel;
- lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
-}
-
-void dbg_RegisterTraceTextForPC( SbModule* pModule, sal_uInt32 nPC,
- const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
-{
- String aModuleName = pModule->GetName();
- ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
- PCToTextDataMap* pInnerMap;
- if( it == rModuleTraceMap.end() )
- {
- pInnerMap = new PCToTextDataMap();
- rModuleTraceMap[ aModuleName ] = pInnerMap;
- }
- else
- {
- pInnerMap = it->second;
- }
-
- TraceTextData aData;
-
- rtl::OString aOTraceStr_STMNT = lcl_toOStringSkipLeadingWhites( aTraceStr_STMNT );
- aData.m_aTraceStr_STMNT = aOTraceStr_STMNT;
-
- rtl::OString aOTraceStr_PCode = lcl_toOStringSkipLeadingWhites( aTraceStr_PCode );
- aData.m_aTraceStr_PCode = aOTraceStr_PCode;
-
- (*pInnerMap)[nPC] = aData;
-}
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
{
@@ -549,75 +232,6 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
#endif
-
-//==========================================================================
-// For debugging only
-//#define DBG_SAVE_DISASSEMBLY
-
-#ifdef DBG_SAVE_DISASSEMBLY
-static bool dbg_bDisassemble = true;
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
-#include <com/sun/star/io/XTextOutputStream.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-
-using namespace comphelper;
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::ucb;
-using namespace com::sun::star::io;
-
-void dbg_SaveDisassembly( SbModule* pModule )
-{
- bool bDisassemble = dbg_bDisassemble;
- if( bDisassemble )
- {
- Reference< XSimpleFileAccess3 > xSFI;
- Reference< XTextOutputStream > xTextOut;
- Reference< XOutputStream > xOut;
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( xSMgr.is() )
- {
- Reference< XSimpleFileAccess3 > xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
- if( xSFI.is() )
- {
- String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/zBasic.Asm/Asm_") );
- StarBASIC* pBasic = (StarBASIC*)pModule->GetParent();
- if( pBasic )
- {
- aFile += pBasic->GetName();
- aFile.AppendAscii( "_" );
- }
- aFile += pModule->GetName();
- aFile.AppendAscii( ".txt" );
-
- // String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/BasicAsm.txt") );
- if( xSFI->exists( aFile ) )
- xSFI->kill( aFile );
- xOut = xSFI->openFileWrite( aFile );
- Reference< XInterface > x = xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.io.TextOutputStream" ) );
- Reference< XActiveDataSource > xADS( x, UNO_QUERY );
- xADS->setOutputStream( xOut );
- xTextOut = Reference< XTextOutputStream >( x, UNO_QUERY );
- }
- }
-
- if( xTextOut.is() )
- {
- String aDisassemblyStr;
- pModule->Disassemble( aDisassemblyStr );
- xTextOut->writeString( aDisassemblyStr );
- }
- xOut->closeOutput();
- }
-}
-#endif
-
-
// Diese Routine ist hier definiert, damit der Compiler als eigenes Segment
// geladen werden kann.
@@ -671,14 +285,6 @@ sal_Bool SbModule::Compile()
}
}
-#ifdef DBG_SAVE_DISASSEMBLY
- dbg_SaveDisassembly( this );
-#endif
-
-#ifdef DBG_TRACE_BASIC
- lcl_PrepareTraceForModule( this );
-#endif
-
return bRet;
}
@@ -694,3 +300,4 @@ void StarBASIC::Highlight( const String& rSrc, SbTextPortions& rList )
aTok.Hilite( rList );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index ad94bbe842c8..6e9b80dde9c0 100644..100755
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -618,3 +619,5 @@ bool LetterTable::isLetterUnicode( sal_Unicode c )
bool bRet = pCharClass->isLetter( aStr, 0 );
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 2688b5be28cf..8e5badb5330d 100644..100755
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -500,7 +501,7 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
case PROPERTY_MODE_LET: aCompleteProcName.AppendAscii( "Let " ); break;
case PROPERTY_MODE_SET: aCompleteProcName.AppendAscii( "Set " ); break;
case PROPERTY_MODE_NONE:
- DBG_ERROR( "Illegal PropertyMode PROPERTY_MODE_NONE" );
+ OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
break;
}
aCompleteProcName += aName;
@@ -535,3 +536,4 @@ SbiConstDef* SbiConstDef::GetConstDef()
return this;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 8700ae4129ba..c3a953118878 100644..100755
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,6 +59,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ ANY, "Any" },
{ APPEND, "Append" },
{ AS, "As" },
+ { ATTRIBUTE,"Attribute" },
{ BASE, "Base" },
{ BINARY, "Binary" },
{ TBOOLEAN, "Boolean" },
@@ -712,3 +714,4 @@ void SbiTokenizer::Hilite( SbTextPortions& rList )
bUsedForHilite = sal_False;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx
index 4c14cac05791..24c4bc002f60 100644..100755
--- a/basic/source/inc/buffer.hxx
+++ b/basic/source/inc/buffer.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index a496322bb6d7..21d19312fd17 100644..100755
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -90,3 +91,5 @@ public:
#define PARAM_INFO_PARAMARRAY 0x0010000
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx
index cd1787d6ff01..2c39e711f993 100644..100755
--- a/basic/source/inc/collelem.hxx
+++ b/basic/source/inc/collelem.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,3 +46,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx
index 2d85dc5d1365..1756d36bfacf 100644..100755
--- a/basic/source/inc/disas.hxx
+++ b/basic/source/inc/disas.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -70,3 +71,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index 2c927a8286f4..94c10ca86b2e 100644..100755
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include "namecont.hxx"
-#ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCESUPPLIER_HPP_
#include <com/sun/star/resource/XStringResourceSupplier.hpp>
-#endif
#include "com/sun/star/resource/XStringResourcePersistence.hpp"
#include <cppuhelper/implbase1.hxx>
@@ -96,7 +95,9 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException);
-
+ // XLibraryQueryExecutable
+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
+ throw (::com::sun::star::uno::RuntimeException);
// Service
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
static ::rtl::OUString getImplementationName_static();
@@ -173,3 +174,4 @@ protected:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx
index 39e6e319caae..1e94a3927e93 100644..100755
--- a/basic/source/inc/errobject.hxx
+++ b/basic/source/inc/errobject.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,3 +51,5 @@ public:
throw (com::sun::star::uno::RuntimeException);
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index 28a84094d918..0ae218d14c18 100644..100755
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -189,6 +190,11 @@ protected:
SbiExprNode* Cat();
SbiExprNode* Like();
SbiExprNode* VBA_Not();
+ SbiExprNode* VBA_And();
+ SbiExprNode* VBA_Or();
+ SbiExprNode* VBA_Xor();
+ SbiExprNode* VBA_Eqv();
+ SbiExprNode* VBA_Imp();
SbiExprNode* Comp();
SbiExprNode* Boolean();
public:
@@ -265,3 +271,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx
index 2b3b3eafbf65..087581617297 100644..100755
--- a/basic/source/inc/filefmt.hxx
+++ b/basic/source/inc/filefmt.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -176,3 +177,5 @@ sal_uIntPtr SbOpenRecord( SvStream&, sal_uInt16 nSignature, sal_uInt16 nElem );
void SbCloseRecord( SvStream&, sal_uIntPtr );
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index b2d863acc52b..b852ba1e427f 100644..100755
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#define _SBIMAGE_HXX
#include "sbintern.hxx"
-#ifndef _RTL_USTRING_HXX
#include <rtl/ustring.hxx>
-#endif
#include <filefmt.hxx>
// Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet
@@ -108,3 +107,5 @@ public:
#define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx
index 1308e0289b9f..48d6ce39d506 100644..100755
--- a/basic/source/inc/iosys.hxx
+++ b/basic/source/inc/iosys.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#define _SBIOSYS_HXX
#include <tools/stream.hxx>
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
class SvStream;
@@ -111,3 +110,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 7fd6eb06f607..419230c1c2b6 100644..100755
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,13 +29,14 @@
#ifndef BASIC_NAMECONTAINER_HXX
#define BASIC_NAMECONTAINER_HXX
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/XLibraryContainerExport.hpp>
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
#include <com/sun/star/script/XLibraryContainer3.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -59,6 +61,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/compbase8.hxx>
+#include <cppuhelper/compbase9.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -67,13 +70,14 @@ class BasicManager;
namespace basic
{
-typedef ::cppu::WeakComponentImplHelper8<
+typedef ::cppu::WeakComponentImplHelper9<
::com::sun::star::lang::XInitialization,
::com::sun::star::script::XStorageBasedLibraryContainer,
::com::sun::star::script::XLibraryContainerPassword,
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XLibraryQueryExecutable,
::com::sun::star::script::vba::XVBACompatibility,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
@@ -97,7 +101,7 @@ struct eqName_Impl
}
};
-typedef std::hash_map
+typedef boost::unordered_map
<
::rtl::OUString,
sal_Int32,
@@ -221,6 +225,7 @@ class SfxLibraryContainer :public LibraryContainerHelper
,public ::utl::OEventListenerAdapter
{
sal_Bool mbVBACompat;
+ rtl::OUString msProjectName;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
@@ -510,6 +515,8 @@ public:
// Methods XVBACompatibility
virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
+ virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
@@ -764,3 +771,4 @@ protected:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx
index aa39eba72ef3..1b25ee41a25d 100644..100755
--- a/basic/source/inc/object.hxx
+++ b/basic/source/inc/object.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#define _SAMPLE_OBJECT_HXX
#include <basic/sbxfac.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
#include <basic/sbxobj.hxx>
// 1) Properties:
@@ -56,12 +55,12 @@ using SbxVariable::GetInfo;
// Definition eines Tabelleneintrags. Dies wird hier gemacht,
// da dadurch die Methoden und Properties als private deklariert
// werden koennen.
-#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) || defined ( C52 )
+#if defined ( ICC ) || defined ( C50 ) || defined ( C52 )
public:
#endif
typedef void( SampleObject::*pMeth )
( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite );
-#if defined ( ICC ) || defined ( HPUX )
+#if defined ( ICC )
private:
#endif
@@ -98,3 +97,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx
index ff7eff027f83..cbc98ac22fd4 100644..100755
--- a/basic/source/inc/opcodes.hxx
+++ b/basic/source/inc/opcodes.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,10 +31,6 @@
#include "sbintern.hxx"
-#ifdef MTW
-#undef _NUMBER
-#endif
-
// Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen
// Wert des Opcodes (s.u.).
@@ -170,3 +167,5 @@ enum SbiOpcode {
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 62f7da1b4303..1b58e5d39f0b 100644..100755
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -107,6 +108,7 @@ public:
void BadSyntax(); // Falsches SbiToken
void NoIf(); // ELSE/ELSE IF ohne IF
void Assign(); // LET
+ void Attribute(); // Attribute
void Call(); // CALL
void Close(); // CLOSE
void Declare(); // DECLARE
@@ -151,3 +153,5 @@ public:
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 262a2cf8935d..1497bbc0df9d 100644..100755
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,21 +29,11 @@
#define _SFX_PROPBAG_HXX
#include <svl/svarray.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
#include <com/sun/star/beans/XPropertyAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
#include <com/sun/star/beans/XPropertyContainer.hpp>
-#endif
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -201,3 +192,4 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 46cd9d16521f..df694e548844 100644..100755
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
#ifndef _SBRUNTIME_HXX
#define _SBRUNTIME_HXX
-#ifndef _SBX_HXX
#include <basic/sbx.hxx>
-#endif
#include "sb.hxx"
@@ -59,11 +58,6 @@ using namespace com::sun::star::container;
// #define _OLD_FILE_IMPL
-//#include <sal/types.h>
-//#include <rtl/byteseq.hxx>
-//#include <rtl/ustring>
-
-
namespace basicEncoder
{
@@ -203,7 +197,6 @@ class SbiInstance
sal_Bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
ComponentVector_t ComponentVector;
-
public:
SbiRuntime* pRun; // Call-Stack
SbiInstance* pNext; // Instanzen-Chain
@@ -294,7 +287,9 @@ class SbiRuntime
SbxArrayRef refExprStk; // expression stack
SbxArrayRef refCaseStk; // CASE expression stack
SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
+ SbxVariableRef refRedim; // Array saved to use for REDIM
SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
+ SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
SbiArgvStack* pArgvStk; // ARGV-Stack
SbiGosubStack* pGosubStk; // GOSUB stack
SbiForStack* pForStk; // FOR/NEXT-Stack
@@ -464,6 +459,7 @@ public:
SbMethod* GetCaller();
SbxArray* GetLocals();
SbxArray* GetParams();
+ SbxVariable* GetExternalCaller(){ return mpExtCaller; }
SbxBase* FindElementExtern( const String& rName );
static bool isVBAEnabled();
@@ -530,3 +526,4 @@ bool IsBaseIndexOne();
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx
index 6335a55da62f..2918e67880f0 100644..100755
--- a/basic/source/inc/sbcomp.hxx
+++ b/basic/source/inc/sbcomp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,3 +37,5 @@
#include "codegen.hxx" // Code-Generator
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 41296e865032..34d08f6e8c21 100644..100755
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -148,3 +149,4 @@ SbiGlobals* GetSbData();
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx
index 80c301821884..f2cc8a3d3865 100644..100755
--- a/basic/source/inc/sbjsmeth.hxx
+++ b/basic/source/inc/sbjsmeth.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,3 +52,5 @@ SV_DECL_IMPL_REF(SbJScriptMethod)
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
index b4f680231f93..55091dc681c5 100644..100755
--- a/basic/source/inc/sbjsmod.hxx
+++ b/basic/source/inc/sbjsmod.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -48,3 +49,4 @@ public:
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbtrace.hxx b/basic/source/inc/sbtrace.hxx
index d91c7bdf16e8..50e344fb63d2 100755
--- a/basic/source/inc/sbtrace.hxx
+++ b/basic/source/inc/sbtrace.hxx
@@ -33,12 +33,12 @@
#ifdef DBG_TRACE_BASIC
void dbg_InitTrace( void );
void dbg_DeInitTrace( void );
-void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl );
-void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallLvl, bool bLeave = false );
-void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, sal_Int32 nCallLvl );
-void dbg_RegisterTraceTextForPC( SbModule* pModule, sal_uInt32 nPC,
+void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl );
+void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false );
+void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl );
+void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
const String& aTraceStr_STMNT, const String& aTraceStr_PCode );
-void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
+void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
#endif
#endif
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 5c9d58e8ce55..5905f7f4640f 100644..100755
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,7 @@
#include <basic/sbxmeth.hxx>
#include <basic/sbxprop.hxx>
#include <basic/sbxfac.hxx>
-#ifndef __SBX_SBX_HXX //autogen
#include <basic/sbx.hxx>
-#endif
#include <com/sun/star/beans/XMaterialHolder.hpp>
#include <com/sun/star/beans/XExactName.hpp>
#include <com/sun/star/beans/XIntrospectionAccess.hpp>
@@ -43,6 +42,8 @@
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
#include <rtl/ustring.hxx>
+#include <boost/unordered_map.hpp>
+#include <vector>
class SbUnoObject: public SbxObject
{
@@ -333,6 +334,27 @@ public:
virtual void Clear();
};
+typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+
+typedef std::vector< rtl::OUString > VBAConstantsVector;
+
+class VBAConstantHelper
+{
+private:
+
+ VBAConstantsVector aConstCache;
+ VBAConstantsHash aConstHash;
+ bool isInited;
+ VBAConstantHelper():isInited( false ) {}
+ VBAConstantHelper(const VBAConstantHelper&);
+ void init();
+public:
+ static VBAConstantHelper& instance();
+ SbxVariable* getVBAConstant( const String& rName );
+ bool isVBAConstantType( const String& rName );
+};
+
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index 0c2c27f72b2f..5abfc1efdd3c 100644..100755
--- a/basic/source/inc/scanner.hxx
+++ b/basic/source/inc/scanner.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#define _SCANNER_HXX
#include <tools/string.hxx>
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
// Der Scanner ist stand-alone, d.h. er kann von ueberallher verwendet
// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne
@@ -144,3 +143,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index d788a73da0fc..0966c258380a 100644..100755
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -123,7 +124,9 @@ public:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
-
+ // XLibraryQueryExecutable
+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
+ throw (::com::sun::star::uno::RuntimeException);
// Methods XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( )
throw (::com::sun::star::uno::RuntimeException);
@@ -140,7 +143,7 @@ public:
};
//============================================================================
-typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
+typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo
> SfxScriptLibrary_BASE;
@@ -198,3 +201,4 @@ protected:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx
index cdf3209624fb..7abaf47492f1 100644..100755
--- a/basic/source/inc/stdobj.hxx
+++ b/basic/source/inc/stdobj.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,3 +50,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index c30445d87634..adfee46b4aed 100644..100755
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -248,3 +249,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index 3af2e235c077..deb6764f2e2c 100644..100755
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#define _TOKEN_HXX
#include "scanner.hxx"
-#ifndef _SBDEF_HXX
#include <basic/sbdef.hxx>
-#endif
#if defined( SHARED )
#define SbiTokenSHAREDTMPUNDEF
@@ -72,7 +71,7 @@ enum SbiToken {
IF, _IN_, INPUT,
LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET,
NAME, NEW, NEXT,
- ON, OPEN, OPTION, IMPLEMENTS,
+ ON, OPEN, OPTION, ATTRIBUTE, IMPLEMENTS,
PRINT, PRIVATE, PROPERTY, PUBLIC,
REDIM, REM, RESUME, RETURN, RSET,
SELECT, SET, SHARED, STATIC, STEP, STOP, SUB,
@@ -181,3 +180,5 @@ public:
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index 0cf81e30d9a6..910ecce98f72 100644..100755
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -102,3 +103,4 @@ void BasicDLL::BasicBreak()
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx
index ba3def41838f..ba3def41838f 100644..100755
--- a/basic/source/runtime/comenumwrapper.cxx
+++ b/basic/source/runtime/comenumwrapper.cxx
diff --git a/basic/source/runtime/comenumwrapper.hxx b/basic/source/runtime/comenumwrapper.hxx
index b2464d686f67..b2464d686f67 100644..100755
--- a/basic/source/runtime/comenumwrapper.hxx
+++ b/basic/source/runtime/comenumwrapper.hxx
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 5e8775159c38..83ce5b05adb5 100644..100755
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <tools/errcode.hxx>
#include <svl/svdde.hxx>
#include "ddectrl.hxx"
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
#define DDE_FREECHANNEL ((DdeConnection*)0xffffffff)
@@ -190,3 +189,4 @@ SbError SbiDdeControl::Poke( sal_Int16 nChannel, const String& rItem, const Stri
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx
index a99575308fa8..2f12e8128791 100644..100755
--- a/basic/source/runtime/ddectrl.hxx
+++ b/basic/source/runtime/ddectrl.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#define _DDECTRL_HXX
#include <tools/link.hxx>
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
#include <tools/string.hxx>
class DdeConnection;
@@ -62,3 +61,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx
new file mode 100755
index 000000000000..db32b646b619
--- /dev/null
+++ b/basic/source/runtime/dllmgr-none.cxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_basic.hxx"
+#include "sal/config.h"
+
+#include <algorithm>
+#include <cstddef>
+#include <list>
+#include <map>
+#include <vector>
+
+#include "basic/sbx.hxx"
+#include "basic/sbxvar.hxx"
+#include "osl/thread.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+#include "tools/svwin.h"
+
+#include "dllmgr.hxx"
+
+struct SbiDllMgr::Impl {};
+
+SbError SbiDllMgr::Call(
+ rtl::OUString const &, rtl::OUString const &, SbxArray *, SbxVariable &,
+ bool)
+{
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+}
+
+void SbiDllMgr::FreeDll(rtl::OUString const &) {}
+
+SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
+
+SbiDllMgr::~SbiDllMgr() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
new file mode 100755
index 000000000000..1a5845e10ee2
--- /dev/null
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -0,0 +1,772 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_basic.hxx"
+#include "sal/config.h"
+
+#include <algorithm>
+#include <cstddef>
+#include <list>
+#include <map>
+#include <vector>
+
+#include "basic/sbx.hxx"
+#include "basic/sbxvar.hxx"
+#include "osl/thread.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+#include "tools/svwin.h"
+
+#undef max
+
+#include "dllmgr.hxx"
+
+/* Open issues:
+
+ Missing support for functions returning structs (see TODO in call()).
+
+ Missing support for additional data types (64 bit integers, Any, ...; would
+ trigger OSL_ASSERT(false) in various switches).
+
+ It is assumed that the variables passed into SbiDllMgr::Call to represent
+ the arguments and return value have types that exactly match the Declare
+ statement; it would be better if this code had access to the function
+ signature from the Declare statement, so that it could convert the passed
+ variables accordingly.
+*/
+
+namespace {
+
+char * address(std::vector< char > & blob) {
+ return blob.empty() ? 0 : &blob[0];
+}
+
+SbError convert(rtl::OUString const & source, rtl::OString * target) {
+ return
+ source.convertToString(
+ target, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
+ ? ERRCODE_NONE : ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+}
+
+SbError convert(char const * source, sal_Int32 length, rtl::OUString * target) {
+ return
+ rtl_convertStringToUString(
+ &target->pData, source, length, osl_getThreadTextEncoding(),
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))
+ ? ERRCODE_NONE : ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+}
+
+struct UnmarshalData {
+ UnmarshalData(SbxVariable * theVariable, void * theBuffer):
+ variable(theVariable), buffer(theBuffer) {}
+
+ SbxVariable * variable;
+ void * buffer;
+};
+
+struct StringData: public UnmarshalData {
+ StringData(SbxVariable * theVariable, void * theBuffer, bool theSpecial):
+ UnmarshalData(theVariable, theBuffer), special(theSpecial) {}
+
+ bool special;
+};
+
+class MarshalData: private boost::noncopyable {
+public:
+ std::vector< char > * newBlob() {
+ blobs_.push_front(std::vector< char >());
+ return &blobs_.front();
+ }
+
+ std::vector< UnmarshalData > unmarshal;
+
+ std::vector< StringData > unmarshalStrings;
+
+private:
+ std::list< std::vector< char > > blobs_;
+};
+
+std::size_t align(std::size_t address, std::size_t alignment) {
+ // alignment = 2^k for some k >= 0
+ return (address + (alignment - 1)) & ~(alignment - 1);
+}
+
+char * align(
+ std::vector< char > & blob, std::size_t alignment, std::size_t offset,
+ std::size_t add)
+{
+ std::vector< char >::size_type n = blob.size();
+ n = align(n - offset, alignment) + offset; //TODO: overflow in align()
+ blob.resize(n + add); //TODO: overflow
+ return address(blob) + n;
+}
+
+template< typename T > void add(
+ std::vector< char > & blob, T const & data, std::size_t alignment,
+ std::size_t offset)
+{
+ *reinterpret_cast< T * >(align(blob, alignment, offset, sizeof (T))) = data;
+}
+
+std::size_t alignment(SbxVariable * variable) {
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ return 2;
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxSTRING:
+ return 4;
+ case SbxDOUBLE:
+ return 8;
+ case SbxOBJECT:
+ {
+ std::size_t n = 1;
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
+ n = std::max(n, alignment(props->Get(i)));
+ }
+ return n;
+ }
+ case SbxBOOL:
+ case SbxBYTE:
+ return 1;
+ default:
+ OSL_ASSERT(false);
+ return 1;
+ }
+ } else {
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< sal_Int32 > low(dims);
+ for (int i = 0; i < dims; ++i) {
+ sal_Int32 up;
+ arr->GetDim32(i + 1, low[i], up);
+ }
+ return alignment(arr->Get32(&low[0]));
+ }
+}
+
+SbError marshal(
+ bool outer, SbxVariable * variable, bool special,
+ std::vector< char > & blob, std::size_t offset, MarshalData & data);
+
+SbError marshalString(
+ SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
+{
+ OSL_ASSERT(variable != 0 && buffer != 0);
+ rtl::OString str;
+ SbError e = convert(variable->GetString(), &str);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ std::vector< char > * blob = data.newBlob();
+ blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1);
+ *buffer = address(*blob);
+ data.unmarshalStrings.push_back(StringData(variable, *buffer, special));
+ return ERRCODE_NONE;
+}
+
+SbError marshalStruct(
+ SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
+ MarshalData & data)
+{
+ OSL_ASSERT(variable != 0);
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
+ SbError e = marshal(false, props->Get(i), false, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ return ERRCODE_NONE;
+}
+
+SbError marshalArray(
+ SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
+ MarshalData & data)
+{
+ OSL_ASSERT(variable != 0);
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< sal_Int32 > low(dims);
+ std::vector< sal_Int32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< sal_Int32 > idx = low;;) {
+ SbError e = marshal(
+ false, arr->Get32(&idx[0]), false, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ int i = dims - 1;
+ while (idx[i] == up[i]) {
+ idx[i] = low[i];
+ if (i == 0) {
+ return ERRCODE_NONE;
+ }
+ --i;
+ }
+ ++idx[i];
+ }
+}
+
+// 8-aligned structs are only 4-aligned on stack, so alignment of members in
+// such structs must take that into account via "offset"
+SbError marshal(
+ bool outer, SbxVariable * variable, bool special,
+ std::vector< char > & blob, std::size_t offset, MarshalData & data)
+{
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetFlags() & SBX_REFERENCE) == 0) {
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ add(blob, variable->GetInteger(), outer ? 8 : 2, offset);
+ break;
+ case SbxLONG:
+ add(blob, variable->GetLong(), outer ? 8 : 4, offset);
+ break;
+ case SbxSINGLE:
+ add(blob, variable->GetSingle(), outer ? 8 : 4, offset);
+ break;
+ case SbxDOUBLE:
+ add(blob, variable->GetDouble(), 8, offset);
+ break;
+ case SbxSTRING:
+ {
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(blob, p, 8, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ align(blob, outer ? 8 : alignment(variable), offset, 0);
+ SbError e = marshalStruct(variable, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ break;
+ }
+ case SbxBOOL:
+ add(blob, variable->GetBool(), outer ? 8 : 1, offset);
+ break;
+ case SbxBYTE:
+ add(blob, variable->GetByte(), outer ? 8 : 1, offset);
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ SbError e = marshalArray(variable, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ } else {
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxDOUBLE:
+ case SbxBOOL:
+ case SbxBYTE:
+ add(blob, variable->data(), 8, offset);
+ break;
+ case SbxSTRING:
+ {
+ std::vector< char > * blob2 = data.newBlob();
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(*blob2, p, 8, 0);
+ add(blob, address(*blob2), 8, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ std::vector< char > * blob2 = data.newBlob();
+ SbError e = marshalStruct(variable, *blob2, 0, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ void * p = address(*blob2);
+ if (outer) {
+ data.unmarshal.push_back(UnmarshalData(variable, p));
+ }
+ add(blob, p, 8, offset);
+ break;
+ }
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ std::vector< char > * blob2 = data.newBlob();
+ SbError e = marshalArray(variable, *blob2, 0, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ void * p = address(*blob2);
+ if (outer) {
+ data.unmarshal.push_back(UnmarshalData(variable, p));
+ }
+ add(blob, p, 8, offset);
+ }
+ }
+ return ERRCODE_NONE;
+}
+
+template< typename T > T read(void const ** pointer) {
+ T const * p = static_cast< T const * >(*pointer);
+ *pointer = static_cast< void const * >(p + 1);
+ return *p;
+}
+
+void const * unmarshal(SbxVariable * variable, void const * data) {
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ variable->PutInteger(read< sal_Int16 >(&data));
+ break;
+ case SbxLONG:
+ variable->PutLong(read< sal_Int32 >(&data));
+ break;
+ case SbxSINGLE:
+ variable->PutSingle(read< float >(&data));
+ break;
+ case SbxDOUBLE:
+ variable->PutDouble(read< double >(&data));
+ break;
+ case SbxSTRING:
+ read< char * >(&data); // handled by unmarshalString
+ break;
+ case SbxOBJECT:
+ {
+ data = reinterpret_cast< void const * >(
+ align(
+ reinterpret_cast< sal_uIntPtr >(data),
+ alignment(variable)));
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
+ data = unmarshal(props->Get(i), data);
+ }
+ break;
+ }
+ case SbxBOOL:
+ variable->PutBool(read< sal_Bool >(&data));
+ break;
+ case SbxBYTE:
+ variable->PutByte(read< sal_uInt8 >(&data));
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< sal_Int32 > low(dims);
+ std::vector< sal_Int32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< sal_Int32 > idx = low;;) {
+ data = unmarshal(arr->Get32(&idx[0]), data);
+ int i = dims - 1;
+ while (idx[i] == up[i]) {
+ idx[i] = low[i];
+ if (i == 0) {
+ goto done;
+ }
+ --i;
+ }
+ ++idx[i];
+ }
+ done:;
+ }
+ return data;
+}
+
+SbError unmarshalString(StringData const & data, SbxVariable & result) {
+ rtl::OUString str;
+ if (data.buffer != 0) {
+ char const * p = static_cast< char const * >(data.buffer);
+ sal_Int32 len;
+ if (data.special) {
+ len = static_cast< sal_Int32 >(result.GetULong());
+ if (len < 0) { // i.e., DWORD result >= 2^31
+ return ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+ }
+ } else {
+ len = rtl_str_getLength(p);
+ }
+ SbError e = convert(p, len, &str);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ data.variable->PutString(String(str));
+ return ERRCODE_NONE;
+}
+
+struct ProcData {
+ rtl::OString name;
+ FARPROC proc;
+};
+
+SbError call(
+ rtl::OUString const & dll, ProcData const & proc, SbxArray * arguments,
+ SbxVariable & result)
+{
+ if (arguments->Count() > 20)
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+
+ std::vector< char > stack;
+ MarshalData data;
+
+ // For DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer)
+ // from kernel32, upon return, filled lpBuffer length is result DWORD, which
+ // requires special handling in unmarshalString; other functions might
+ // require similar treatment, too:
+ bool special =
+ dll.equalsIgnoreAsciiCaseAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("KERNEL32.DLL")) &&
+ (proc.name ==
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("GetLogicalDriveStringsA")));
+ for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ SbError e = marshal(
+ true, arguments->Get(i), special && i == 2, stack, stack.size(),
+ data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ align(stack, 8, 0, 0);
+ }
+
+ stack.resize(20*8);
+
+ // We fake all calls as being to a varargs function,
+ // as this means any floating-point argument among the first four
+ // ones will end up in a XMM register where the callee expects it.
+ sal_Int32 (*proc_i)(double d, ...) = (sal_Int32 (*)(double, ...)) proc.proc;
+ double (*proc_d)(double d, ...) = (double (*)(double, ...)) proc.proc;
+
+ sal_Int64 iRetVal;
+ double dRetVal;
+
+ switch (result.GetType()) {
+ case SbxEMPTY:
+ case SbxINTEGER:
+ case SbxLONG:
+ case SbxSTRING:
+ case SbxOBJECT:
+ case SbxBOOL:
+ case SbxBYTE:
+ iRetVal =
+ proc_i(*(double *)&stack[0*8],
+ *(double *)&stack[1*8],
+ *(double *)&stack[2*8],
+ *(double *)&stack[3*8],
+ *(sal_uInt64 *)&stack[4*8],
+ *(sal_uInt64 *)&stack[5*8],
+ *(sal_uInt64 *)&stack[6*8],
+ *(sal_uInt64 *)&stack[7*8],
+ *(sal_uInt64 *)&stack[8*8],
+ *(sal_uInt64 *)&stack[9*8],
+ *(sal_uInt64 *)&stack[10*8],
+ *(sal_uInt64 *)&stack[11*8],
+ *(sal_uInt64 *)&stack[12*8],
+ *(sal_uInt64 *)&stack[13*8],
+ *(sal_uInt64 *)&stack[14*8],
+ *(sal_uInt64 *)&stack[15*8],
+ *(sal_uInt64 *)&stack[16*8],
+ *(sal_uInt64 *)&stack[17*8],
+ *(sal_uInt64 *)&stack[18*8],
+ *(sal_uInt64 *)&stack[19*8]);
+ break;
+ case SbxSINGLE:
+ case SbxDOUBLE:
+ dRetVal =
+ proc_d(*(double *)&stack[0*8],
+ *(double *)&stack[1*8],
+ *(double *)&stack[2*8],
+ *(double *)&stack[3*8],
+ *(sal_uInt64 *)&stack[4*8],
+ *(sal_uInt64 *)&stack[5*8],
+ *(sal_uInt64 *)&stack[6*8],
+ *(sal_uInt64 *)&stack[7*8],
+ *(sal_uInt64 *)&stack[8*8],
+ *(sal_uInt64 *)&stack[9*8],
+ *(sal_uInt64 *)&stack[10*8],
+ *(sal_uInt64 *)&stack[11*8],
+ *(sal_uInt64 *)&stack[12*8],
+ *(sal_uInt64 *)&stack[13*8],
+ *(sal_uInt64 *)&stack[14*8],
+ *(sal_uInt64 *)&stack[15*8],
+ *(sal_uInt64 *)&stack[16*8],
+ *(sal_uInt64 *)&stack[17*8],
+ *(sal_uInt64 *)&stack[18*8],
+ *(sal_uInt64 *)&stack[19*8]);
+ }
+
+ switch (result.GetType()) {
+ case SbxEMPTY:
+ break;
+ case SbxINTEGER:
+ result.PutInteger(static_cast< sal_Int16 >(iRetVal));
+ break;
+ case SbxLONG:
+ result.PutLong(static_cast< sal_Int32 >(iRetVal));
+ break;
+ case SbxSINGLE:
+ result.PutSingle(static_cast< float >(dRetVal));
+ break;
+ case SbxDOUBLE:
+ result.PutDouble(dRetVal);
+ break;
+ case SbxSTRING:
+ {
+ char const * s1 = reinterpret_cast< char const * >(iRetVal);
+ rtl::OUString s2;
+ SbError e = convert(s1, rtl_str_getLength(s1), &s2);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ result.PutString(String(s2));
+ break;
+ }
+ case SbxOBJECT:
+ //TODO
+ break;
+ case SbxBOOL:
+ result.PutBool(static_cast< sal_Bool >(iRetVal));
+ break;
+ case SbxBYTE:
+ result.PutByte(static_cast< sal_uInt8 >(iRetVal));
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ arguments->Get(i)->ResetFlag(SBX_REFERENCE);
+ //TODO: skipped for errors?!?
+ }
+ for (std::vector< UnmarshalData >::iterator i(data.unmarshal.begin());
+ i != data.unmarshal.end(); ++i)
+ {
+ unmarshal(i->variable, i->buffer);
+ }
+ for (std::vector< StringData >::iterator i(data.unmarshalStrings.begin());
+ i != data.unmarshalStrings.end(); ++i)
+ {
+ SbError e = unmarshalString(*i, result);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ return ERRCODE_NONE;
+}
+
+SbError getProcData(HMODULE handle, rtl::OUString const & name, ProcData * proc)
+{
+ OSL_ASSERT(proc != 0);
+ if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
+ sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
+ if (n <= 0 || n > 0xFFFF) {
+ return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
+ }
+ FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
+ if (p != 0) {
+ proc->name = rtl::OString(RTL_CONSTASCII_STRINGPARAM("#")) +
+ rtl::OString::valueOf(n);
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ } else {
+ rtl::OString name8;
+ SbError e = convert(name, &name8);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ FARPROC p = GetProcAddress(handle, name8.getStr());
+ if (p != 0) {
+ proc->name = name8;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ sal_Int32 i = name8.indexOf('#');
+ if (i != -1) {
+ name8 = name8.copy(0, i);
+ p = GetProcAddress(handle, name8.getStr());
+ if (p != 0) {
+ proc->name = name8;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ }
+ rtl::OString real(
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("_")) + name8);
+ p = GetProcAddress(handle, real.getStr());
+ if (p != 0) {
+ proc->name = real;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ real = name8 + rtl::OString(RTL_CONSTASCII_STRINGPARAM("A"));
+ p = GetProcAddress(handle, real.getStr());
+ if (p != 0) {
+ proc->name = real;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ }
+ return ERRCODE_BASIC_PROC_UNDEFINED;
+}
+
+struct Dll: public salhelper::SimpleReferenceObject {
+private:
+ typedef std::map< rtl::OUString, ProcData > Procs;
+
+ virtual ~Dll();
+
+public:
+ Dll(): handle(0) {}
+
+ SbError getProc(rtl::OUString const & name, ProcData * proc);
+
+ HMODULE handle;
+ Procs procs;
+};
+
+Dll::~Dll() {
+ if (handle != 0 && !FreeLibrary(handle)) {
+ OSL_TRACE("FreeLibrary(%p) failed with %u", handle, GetLastError());
+ }
+}
+
+SbError Dll::getProc(rtl::OUString const & name, ProcData * proc) {
+ Procs::iterator i(procs.find(name));
+ if (i != procs.end()) {
+ *proc = i->second;
+ return ERRCODE_NONE;
+ }
+ SbError e = getProcData(handle, name, proc);
+ if (e == ERRCODE_NONE) {
+ procs.insert(Procs::value_type(name, *proc));
+ }
+ return e;
+}
+
+rtl::OUString fullDllName(rtl::OUString const & name) {
+ rtl::OUString full(name);
+ if (full.indexOf('.') == -1) {
+ full += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".DLL"));
+ }
+ return full;
+}
+
+}
+
+struct SbiDllMgr::Impl: private boost::noncopyable {
+private:
+ typedef std::map< rtl::OUString, rtl::Reference< Dll > > Dlls;
+
+public:
+ Dll * getDll(rtl::OUString const & name);
+
+ Dlls dlls;
+};
+
+Dll * SbiDllMgr::Impl::getDll(rtl::OUString const & name) {
+ Dlls::iterator i(dlls.find(name));
+ if (i == dlls.end()) {
+ i = dlls.insert(Dlls::value_type(name, new Dll)).first;
+ HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
+ if (h == 0) {
+ dlls.erase(i);
+ return 0;
+ }
+ i->second->handle = h;
+ }
+ return i->second.get();
+}
+
+SbError SbiDllMgr::Call(
+ rtl::OUString const & function, rtl::OUString const & library,
+ SbxArray * arguments, SbxVariable & result, bool cdeclConvention)
+{
+ if (cdeclConvention) {
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+ }
+ rtl::OUString dllName(fullDllName(library));
+ Dll * dll = impl_->getDll(dllName);
+ if (dll == 0) {
+ return ERRCODE_BASIC_BAD_DLL_LOAD;
+ }
+ ProcData proc;
+ SbError e = dll->getProc(function, &proc);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ return call(dllName, proc, arguments, result);
+}
+
+void SbiDllMgr::FreeDll(rtl::OUString const & library) {
+ impl_->dlls.erase(library);
+}
+
+SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
+
+SbiDllMgr::~SbiDllMgr() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 8cc6ce7edd82..b2f48bd0ab1a 100644..100755
--- a/basic/source/runtime/dllmgr.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,8 +50,6 @@
/* Open issues:
- Only 32-bit Windows for now.
-
Missing support for functions returning structs (see TODO in call()).
Missing support for additional data types (64 bit integers, Any, ...; would
@@ -63,8 +62,6 @@
variables accordingly.
*/
-#if defined WNT // only 32-bit Windows, actually
-
extern "C" {
int __stdcall DllMgr_call32(FARPROC, void const * stack, std::size_t size);
@@ -719,21 +716,8 @@ void SbiDllMgr::FreeDll(rtl::OUString const & library) {
impl_->dlls.erase(library);
}
-#else
-
-struct SbiDllMgr::Impl {};
-
-SbError SbiDllMgr::Call(
- rtl::OUString const &, rtl::OUString const &, SbxArray *, SbxVariable &,
- bool)
-{
- return ERRCODE_BASIC_NOT_IMPLEMENTED;
-}
-
-void SbiDllMgr::FreeDll(rtl::OUString const &) {}
-
-#endif
-
SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
SbiDllMgr::~SbiDllMgr() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr.hxx b/basic/source/runtime/dllmgr.hxx
index fdff8c2849be..1507ffe7f94f 100644..100755
--- a/basic/source/runtime/dllmgr.hxx
+++ b/basic/source/runtime/dllmgr.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,3 +59,5 @@ private:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index c43519a9b2de..a21d3e794eee 100644..100755
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#ifndef _SV_BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
#include <vcl/fixed.hxx>
#include <vcl/edit.hxx>
#include <vcl/dialog.hxx>
@@ -195,3 +194,4 @@ RTLFUNC(InputBox)
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 06faa7c0aba5..cea9f7a01d3e 100644..100755
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,15 +30,13 @@
#include "precompiled_basic.hxx"
#include <vcl/dialog.hxx>
#include <vcl/edit.hxx>
-#ifndef _SV_BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <osl/security.h>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include "runtime.hxx"
@@ -68,7 +67,6 @@
#include <com/sun/star/bridge/XBridgeFactory.hpp>
using namespace comphelper;
-using namespace osl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
@@ -252,7 +250,7 @@ sal_Bool needSecurityRestrictions( void )
if( !xSMgr.is() )
return sal_True;
Reference< XBridgeFactory > xBridgeFac( xSMgr->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.bridge.BridgeFactory" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.BridgeFactory" )) ), UNO_QUERY );
Sequence< Reference< XBridge > > aBridgeSeq;
sal_Int32 nBridgeCount = 0;
@@ -323,10 +321,10 @@ sal_Bool hasUno( void )
}
else
{
- Reference< XContentProviderManager > xManager( xSMgr->createInstance( ::rtl::OUString::createFromAscii
- ( "com.sun.star.ucb.UniversalContentBroker" ) ), UNO_QUERY );
+ Reference< XContentProviderManager > xManager( xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM
+ ( "com.sun.star.ucb.UniversalContentBroker" )) ), UNO_QUERY );
- if ( !( xManager.is() && xManager->queryContentProvider( ::rtl::OUString::createFromAscii( "file:///" ) ).is() ) )
+ if ( !( xManager.is() && xManager->queryContentProvider( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "file:///" )) ).is() ) )
{
// No UCB
bRetVal = sal_False;
@@ -345,7 +343,7 @@ sal_Bool hasUno( void )
class OslStream : public SvStream
{
- File maFile;
+ osl::File maFile;
short mnStrmMode;
public:
@@ -366,25 +364,25 @@ OslStream::OslStream( const String& rName, short nStrmMode )
if( (nStrmMode & (STREAM_READ | STREAM_WRITE)) == (STREAM_READ | STREAM_WRITE) )
{
- nFlags = OpenFlag_Read | OpenFlag_Write;
+ nFlags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write;
}
else if( nStrmMode & STREAM_WRITE )
{
- nFlags = OpenFlag_Write;
+ nFlags = osl_File_OpenFlag_Write;
}
else //if( nStrmMode & STREAM_READ )
{
- nFlags = OpenFlag_Read;
+ nFlags = osl_File_OpenFlag_Read;
}
- FileBase::RC nRet = maFile.open( nFlags );
- if( nRet == FileBase::E_NOENT && nFlags != OpenFlag_Read )
+ osl::FileBase::RC nRet = maFile.open( nFlags );
+ if( nRet == osl::FileBase::E_NOENT && nFlags != osl_File_OpenFlag_Read )
{
- nFlags |= OpenFlag_Create;
+ nFlags |= osl_File_OpenFlag_Create;
nRet = maFile.open( nFlags );
}
- if( nRet != FileBase::E_None )
+ if( nRet != osl::FileBase::E_None )
{
SetError( ERRCODE_IO_GENERAL );
}
@@ -399,32 +397,25 @@ OslStream::~OslStream()
sal_uIntPtr OslStream::GetData( void* pData, sal_uIntPtr nSize )
{
sal_uInt64 nBytesRead = nSize;
- FileBase::RC nRet = FileBase::E_None;
- nRet = maFile.read( pData, nBytesRead, nBytesRead );
+ maFile.read( pData, nBytesRead, nBytesRead );
return (sal_uIntPtr)nBytesRead;
}
sal_uIntPtr OslStream::PutData( const void* pData, sal_uIntPtr nSize )
{
sal_uInt64 nBytesWritten;
- FileBase::RC nRet = FileBase::E_None;
- nRet = maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
+ maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
return (sal_uIntPtr)nBytesWritten;
}
sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
{
- FileBase::RC nRet;
if( nPos == STREAM_SEEK_TO_END )
- {
- nRet = maFile.setPos( Pos_End, 0 );
- }
+ maFile.setPos( Pos_End, 0 );
else
- {
- nRet = maFile.setPos( Pos_Absolut, (sal_uInt64)nPos );
- }
- sal_uInt64 nRealPos;
- nRet = maFile.getPos( nRealPos );
+ maFile.setPos( Pos_Absolut, (sal_uInt64)nPos );
+ sal_uInt64 nRealPos(0);
+ maFile.getPos( nRealPos );
return sal::static_int_cast<sal_uIntPtr>(nRealPos);
}
@@ -434,8 +425,7 @@ void OslStream::FlushData()
void OslStream::SetSize( sal_uIntPtr nSize )
{
- FileBase::RC nRet = FileBase::E_None;
- nRet = maFile.setSize( (sal_uInt64)nSize );
+ maFile.setSize( (sal_uInt64)nSize );
}
#endif
@@ -635,7 +625,7 @@ void UCBStream::SetSize( sal_uIntPtr nSize )
{
(void)nSize;
- DBG_ERROR( "not allowed to call from basic" );
+ OSL_FAIL( "not allowed to call from basic" );
SetError( ERRCODE_IO_GENERAL );
}
@@ -662,7 +652,7 @@ SbError SbiStream::Open
if( xSMgr.is() )
{
Reference< XSimpleFileAccess >
- xSFI( xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ xSFI( xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
if( xSFI.is() )
{
try
@@ -1037,7 +1027,7 @@ void SbiIoSystem::WriteCon( const ByteString& rText )
aOut.Erase( 0, 1 );
String aStr( s, gsl_getSystemTextEncoding() );
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
if( !MessBox( GetpApp()->GetDefDialogParent(),
WinBits( WB_OK_CANCEL | WB_DEF_OK ),
String(), aStr ).Execute() )
@@ -1046,3 +1036,4 @@ void SbiIoSystem::WriteCon( const ByteString& rText )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk
index 8ca052aaae1a..29969416caab 100644..100755
--- a/basic/source/runtime/makefile.mk
+++ b/basic/source/runtime/makefile.mk
@@ -42,7 +42,7 @@ ENABLE_EXCEPTIONS = TRUE
SLOFILES= \
$(SLO)$/basrdll.obj \
$(SLO)$/comenumwrapper.obj \
- $(SLO)$/inputbox.obj \
+ $(SLO)$/inputbox.obj\
$(SLO)$/runtime.obj \
$(SLO)$/step0.obj \
$(SLO)$/step1.obj \
@@ -51,15 +51,26 @@ SLOFILES= \
$(SLO)$/stdobj.obj \
$(SLO)$/stdobj1.obj \
$(SLO)$/methods.obj \
- $(SLO)$/methods1.obj \
+ $(SLO)$/methods1.obj\
$(SLO)$/props.obj \
- $(SLO)$/ddectrl.obj \
- $(SLO)$/dllmgr.obj
+ $(SLO)$/ddectrl.obj
+.IF "$(GUI)$(CPU)" == "WNTI"
+SLOFILES+= \
+ $(SLO)$/dllmgr-x86.obj
+.ELIF "$(GUI)$(CPU)" == "WNTX"
+SLOFILES+= \
+ $(SLO)$/dllmgr-x64.obj
+.ELSE
+SLOFILES+= \
+ $(SLO)$/dllmgr-none.obj
+.ENDIF
.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
-SLOFILES+= $(SLO)$/wnt.obj
+SLOFILES+= \
+ $(SLO)$/wnt-x86.obj
.ELIF "$(GUI)$(COM)$(CPU)" == "WNTGCCI"
-SLOFILES+= $(SLO)$/wnt-mingw.obj
+SLOFILES+= \
+ $(SLO)$/wnt-mingw.obj
.ENDIF
# --- Targets -------------------------------------------------------------
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 1d1f1c641547..8335d6f88d26 100644..100755
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,7 @@
#include <tools/date.hxx>
#include <basic/sbxvar.hxx>
-#ifndef _VOS_PROCESS_HXX
-#include <vos/process.hxx>
-#endif
+#include <osl/process.h>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/sound.hxx>
@@ -48,16 +47,14 @@
#include <unotools/ucbstreamhelper.hxx>
#include <tools/wldcrd.hxx>
#include <i18npool/lang.h>
+#include <rtl/string.hxx>
#include "runtime.hxx"
#include "sbunoobj.hxx"
#ifdef WNT
-#include <tools/prewin.h>
-#include "winbase.h"
-#include <tools/postwin.h>
-#ifndef _FSYS_HXX //autogen
+#include <prewin.h>
+#include <postwin.h>
#include <tools/fsys.hxx>
-#endif
#else
#include <osl/file.hxx>
#endif
@@ -75,13 +72,16 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-
+#include <com/sun/star/script/XErrorQuery.hpp>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
using namespace comphelper;
using namespace osl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
+using namespace com::sun::star::script;
#endif /* _USE_UNO */
@@ -103,6 +103,8 @@ using namespace com::sun::star::io;
#include <stdlib.h>
#include <ctype.h>
+SbxVariable* getDefaultProp( SbxVariable* pRef );
+
#if defined (WNT) || defined (OS2)
#include <direct.h> // _getdcwd get current work directory, _chdrive
#endif
@@ -116,6 +118,9 @@ using namespace com::sun::star::io;
#include <io.h>
#endif
+
+#include <basic/sbobjmod.hxx>
+
#include <basic/sbobjmod.hxx>
static void FilterWhiteSpace( String& rStr )
@@ -212,7 +217,7 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void
if( xSMgr.is() )
{
xSFI = com::sun::star::uno::Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
}
}
return xSFI;
@@ -701,6 +706,36 @@ RTLFUNC(MkDir) // JSM
{
try
{
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ // If aPath is the folder name, not a path, then create the folder under current directory.
+ INetURLObject aTryPathURL( aPath );
+ ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
+ if ( !sPathURL.getLength() )
+ {
+ File::getFileURLFromSystemPath( aPath, sPathURL );
+ }
+ INetURLObject aPathURL( sPathURL );
+ if ( !aPathURL.GetPath().getLength() )
+ {
+ ::rtl::OUString sCurDirURL;
+ SbxArrayRef pPar = new SbxArray;
+ SbxVariableRef pVar = new SbxVariable();
+ pPar->Put( pVar, 0 );
+ SbRtl_CurDir( pBasic, *pPar, sal_False );
+ String aCurPath = pPar->Get(0)->GetString();
+
+ File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
+ INetURLObject aDirURL( sCurDirURL );
+ aDirURL.Append( aPath );
+ ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
+ if ( aTmpPath.getLength() > 0 )
+ {
+ aPath = aTmpPath;
+ }
+ }
+ }
+
xSFI->createFolder( getFullPath( aPath ) );
}
catch( Exception & )
@@ -905,9 +940,9 @@ RTLFUNC(FileLen)
nLen = aStat.GetSize();
#else
DirectoryItem aItem;
- FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem );
+ DirectoryItem::get( getFullPathUNC( aStr ), aItem );
FileStatus aFileStatus( FileStatusMask_FileSize );
- nRet = aItem.getFileStatus( aFileStatus );
+ aItem.getFileStatus( aFileStatus );
nLen = (sal_Int32)aFileStatus.getFileSize();
#endif
}
@@ -935,6 +970,26 @@ RTLFUNC(Hex)
}
}
+RTLFUNC(FuncCaller)
+{
+ (void)pBasic;
+ (void)bWrite;
+ if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
+ {
+ if ( pINST->pRun->GetExternalCaller() )
+ *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
+ else
+ {
+ SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
+ *rPar.Get(0) = *pVar;
+ }
+ }
+ else
+ {
+ StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
+ }
+
+}
// InStr( [start],string,string,[compare] )
RTLFUNC(InStr)
@@ -2406,7 +2461,18 @@ RTLFUNC(IsEmpty)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ {
+ SbxVariable* pVar = NULL;
+ if( SbiRuntime::isVBAEnabled() )
+ pVar = getDefaultProp( rPar.Get(1) );
+ if ( pVar )
+ {
+ pVar->Broadcast( SBX_HINT_DATAWANTED );
+ rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
+ }
+ else
+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ }
}
RTLFUNC(IsError)
@@ -2417,7 +2483,22 @@ RTLFUNC(IsError)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ {
+ SbxVariable* pVar =rPar.Get( 1 );
+ SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
+ if ( !pObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ Reference< XErrorQuery > xError;
+ if ( pObj )
+ xError.set( pObj->getUnoAny(), UNO_QUERY );
+ if ( xError.is() )
+ rPar.Get( 0 )->PutBool( xError->hasError() );
+ else
+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ }
}
RTLFUNC(IsNull)
@@ -2712,11 +2793,11 @@ RTLFUNC(Dir)
{
if( pRTLData->nCurDirPos == -2 )
{
- aPath = ::rtl::OUString::createFromAscii( "." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "." ));
}
else if( pRTLData->nCurDirPos == -1 )
{
- aPath = ::rtl::OUString::createFromAscii( ".." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".." ));
}
pRTLData->nCurDirPos++;
}
@@ -2874,11 +2955,11 @@ RTLFUNC(Dir)
{
if( pRTLData->nCurDirPos == -2 )
{
- aPath = ::rtl::OUString::createFromAscii( "." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "." ));
}
else if( pRTLData->nCurDirPos == -1 )
{
- aPath = ::rtl::OUString::createFromAscii( ".." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".." ));
}
pRTLData->nCurDirPos++;
}
@@ -2997,9 +3078,9 @@ RTLFUNC(GetAttr)
// --> UCB
{
DirectoryItem aItem;
- FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
+ DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
FileStatus aFileStatus( FileStatusMask_Attributes | FileStatusMask_Type );
- nRet = aItem.getFileStatus( aFileStatus );
+ aItem.getFileStatus( aFileStatus );
sal_uInt64 nAttributes = aFileStatus.getAttributes();
sal_Bool bReadOnly = (nAttributes & Attribute_ReadOnly) != 0;
@@ -3057,9 +3138,9 @@ RTLFUNC(FileDateTime)
aDate = Date( aStat.DateModified() );
#else
DirectoryItem aItem;
- FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aPath ), aItem );
+ DirectoryItem::get( getFullPathUNC( aPath ), aItem );
FileStatus aFileStatus( FileStatusMask_ModifyTime );
- nRet = aItem.getFileStatus( aFileStatus );
+ aItem.getFileStatus( aFileStatus );
TimeValue aTimeVal = aFileStatus.getModifyTime();
oslDateTime aDT;
osl_getDateTimeFromTimeValue( &aTimeVal, &aDT );
@@ -3332,7 +3413,7 @@ RTLFUNC(Rnd)
else
{
double nRand = (double)rand();
- nRand = ( nRand / (double)RAND_MAX );
+ nRand = ( nRand / ((double)RAND_MAX + 1.0));
rPar.Get(0)->PutDouble( nRand );
}
}
@@ -3371,8 +3452,8 @@ RTLFUNC(Shell)
}
else
{
- sal_uInt16 nOptions = vos::OProcess::TOption_SearchPath|
- vos::OProcess::TOption_Detached;
+ oslProcessOption nOptions = osl_Process_SEARCHPATH | osl_Process_DETACHED;
+
String aCmdLine = rPar.Get(1)->GetString();
// Zusaetzliche Parameter anhaengen, es muss eh alles geparsed werden
if( nArgCount >= 4 )
@@ -3449,81 +3530,80 @@ RTLFUNC(Shell)
nWinStyle = rPar.Get(2)->GetInteger();
switch( nWinStyle )
{
- case 2:
- nOptions |= vos::OProcess::TOption_Minimized;
- break;
- case 3:
- nOptions |= vos::OProcess::TOption_Maximized;
- break;
- case 10:
- nOptions |= vos::OProcess::TOption_FullScreen;
- break;
+ case 2:
+ nOptions |= osl_Process_MINIMIZED;
+ break;
+ case 3:
+ nOptions |= osl_Process_MAXIMIZED;
+ break;
+ case 10:
+ nOptions |= osl_Process_FULLSCREEN;
+ break;
}
sal_Bool bSync = sal_False;
if( nArgCount >= 5 )
bSync = rPar.Get(4)->GetBool();
if( bSync )
- nOptions |= vos::OProcess::TOption_Wait;
+ nOptions |= osl_Process_WAIT;
}
- vos::OProcess::TProcessOption eOptions =
- (vos::OProcess::TProcessOption)nOptions;
-
// #72471 Parameter aufbereiten
std::list<String>::const_iterator iter = aTokenList.begin();
const String& rStr = *iter;
::rtl::OUString aOUStrProg( rStr.GetBuffer(), rStr.Len() );
- String aOUStrProgUNC = getFullPathUNC( aOUStrProg );
+ ::rtl::OUString aOUStrProgUNC = getFullPathUNC( aOUStrProg );
- iter++;
+ ++iter;
sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >(
aTokenList.size() - 1 );
- ::rtl::OUString* pArgumentList = NULL;
- //const char** pParamList = NULL;
+ rtl_uString** pParamList = NULL;
if( nParamCount )
{
- pArgumentList = new ::rtl::OUString[ nParamCount ];
- //pParamList = new const char*[ nParamCount ];
- sal_uInt16 iList = 0;
- while( iter != aTokenList.end() )
+ pParamList = new rtl_uString*[nParamCount];
+ for(int iList = 0; iter != aTokenList.end(); ++iList, ++iter)
{
const String& rParamStr = (*iter);
- pArgumentList[iList++] = ::rtl::OUString( rParamStr.GetBuffer(), rParamStr.Len() );
- //pParamList[iList++] = (*iter).GetStr();
- iter++;
+ const ::rtl::OUString aTempStr( rParamStr.GetBuffer(), rParamStr.Len());
+ pParamList[iList] = NULL;
+ rtl_uString_assign(&(pParamList[iList]), aTempStr.pData);
}
}
- //const char* pParams = aParams.Len() ? aParams.GetStr() : 0;
- vos::OProcess* pApp;
- pApp = new vos::OProcess( aOUStrProgUNC );
- sal_Bool bSucc;
- if( nParamCount == 0 )
+ oslProcess pApp;
+ sal_Bool bSucc = osl_executeProcess(
+ aOUStrProgUNC.pData,
+ pParamList,
+ nParamCount,
+ nOptions,
+ NULL,
+ NULL,
+ NULL, 0,
+ &pApp ) == osl_Process_E_None;
+
+ osl_freeProcessHandle( pApp );
+
+ for(int j = 0; i < nParamCount; i++)
{
- bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
+ rtl_uString_release(pParamList[j]);
+ pParamList[j] = NULL;
}
- else
+
+ long nResult = 0;
+ // We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
+ if ( bSucc && SbiRuntime::isVBAEnabled())
{
- vos::OArgumentList aArgList( pArgumentList, nParamCount );
- bSucc = pApp->execute( eOptions, aArgList ) == vos::OProcess::E_None;
+ oslProcessInfo aInfo;
+ aInfo.Size = sizeof(oslProcessInfo);
+ osl_getProcessInfo( pApp, osl_Process_IDENTIFIER, &aInfo );
+ nResult = aInfo.Ident;
}
- /*
- if( nParamCount == 0 )
- pApp = new vos::OProcess( pProg );
- else
- pApp = new vos::OProcess( pProg, pParamList, nParamCount );
- sal_Bool bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
- */
-
- delete pApp;
- delete[] pArgumentList;
if( !bSucc )
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
else
- rPar.Get(0)->PutLong( 0 );
+ rPar.Get(0)->PutLong( nResult );
}
}
@@ -3594,6 +3674,65 @@ String getBasicTypeName( SbxDataType eType )
return aRetStr;
}
+String getObjectTypeName( SbxVariable* pVar )
+{
+ rtl::OUString sRet( RTL_CONSTASCII_USTRINGPARAM("Object") );
+ if ( pVar )
+ {
+ SbxBase* pObj = pVar->GetObject();
+ if( !pObj )
+ sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
+ else
+ {
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
+ if ( !pUnoObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ if ( pUnoObj )
+ {
+ Any aObj = pUnoObj->getUnoAny();
+ // For upstreaming unless we start to build oovbaapi by default
+ // we need to get detect the vba-ness of the object in some
+ // other way
+ // note: Automation objects do not support XServiceInfo
+ Reference< XServiceInfo > xServInfo( aObj, UNO_QUERY );
+ if ( xServInfo.is() )
+ {
+ // is this a VBA object ?
+ Reference< ooo::vba::XHelperInterface > xVBA( aObj, UNO_QUERY );
+ Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
+ if ( sServices.getLength() )
+ sRet = sServices[ 0 ];
+ }
+ else
+ {
+ Reference< com::sun::star::bridge::oleautomation::XAutomationObject > xAutoMation( aObj, UNO_QUERY );
+ if ( xAutoMation.is() )
+ {
+ Reference< XInvocation > xInv( aObj, UNO_QUERY );
+ if ( xInv.is() )
+ {
+ try
+ {
+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sRet;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+ }
+ sal_Int32 nDot = sRet.lastIndexOf( '.' );
+ if ( nDot != -1 && nDot < sRet.getLength() )
+ sRet = sRet.copy( nDot + 1 );
+ }
+ }
+ }
+ return sRet;
+}
+
RTLFUNC(TypeName)
{
(void)pBasic;
@@ -3605,7 +3744,12 @@ RTLFUNC(TypeName)
{
SbxDataType eType = rPar.Get(1)->GetType();
sal_Bool bIsArray = ( ( eType & SbxARRAY ) != 0 );
- String aRetStr = getBasicTypeName( eType );
+
+ String aRetStr;
+ if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
+ aRetStr = getObjectTypeName( rPar.Get(1) );
+ else
+ aRetStr = getBasicTypeName( eType );
if( bIsArray )
aRetStr.AppendAscii( "()" );
rPar.Get(0)->PutString( aRetStr );
@@ -4538,3 +4682,5 @@ RTLFUNC(Partition)
aRetStr.append( aUpperValue );
rPar.Get(0)->PutString( String(aRetStr.makeStringAndClear()) );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 2f6d18685803..4d8b0380ff2f 100755
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,9 +35,7 @@
#include <vcl/wrkwin.hxx>
#include <vcl/timer.hxx>
#include <basic/sbxvar.hxx>
-#ifndef _SBX_HXX
#include <basic/sbx.hxx>
-#endif
#include <svl/zforlist.hxx>
#include <tools/fsys.hxx>
#include <tools/urlobj.hxx>
@@ -70,11 +69,15 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/i18n/XCalendar.hpp>
+#include <com/sun/star/sheet/XFunctionAccess.hpp>
using namespace comphelper;
+using namespace com::sun::star::sheet;
using namespace com::sun::star::uno;
using namespace com::sun::star::i18n;
+void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
+Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
static Reference< XCalendar > getLocaleCalendar( void )
{
@@ -85,7 +88,7 @@ static Reference< XCalendar > getLocaleCalendar( void )
if( xSMgr.is() )
{
xCalendar = Reference< XCalendar >( xSMgr->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.LocaleCalendar" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleCalendar" )) ), UNO_QUERY );
}
}
@@ -267,12 +270,12 @@ RTLFUNC(CByte) // JSM
rPar.Get(0)->PutByte(nByte);
}
-RTLFUNC(CCur) // JSM
+RTLFUNC(CCur)
{
(void)pBasic;
(void)bWrite;
- SbxINT64 nCur;
+ sal_Int64 nCur = 0;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -284,7 +287,7 @@ RTLFUNC(CCur) // JSM
rPar.Get(0)->PutCurrency( nCur );
}
-RTLFUNC(CDec) // JSM
+RTLFUNC(CDec)
{
(void)pBasic;
(void)bWrite;
@@ -640,13 +643,11 @@ RTLFUNC(DoEvents)
(void)pBasic;
(void)bWrite;
(void)rPar;
- // Dummy implementation as the following code leads
- // to performance problems for unknown reasons
- //Timer aTimer;
- //aTimer.SetTimeout( 1 );
- //aTimer.Start();
- //while ( aTimer.IsActive() )
- // Application::Reschedule();
+// don't undstand what upstream are up to
+// we already process application events etc. in between
+// basic runtime pcode ( on a timed basis )
+ // always return 0
+ rPar.Get(0)->PutInteger( 0 );
Application::Reschedule( true );
}
@@ -993,13 +994,16 @@ sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
case SbxLONG:
case SbxULONG:
- case SbxLONG64:
- case SbxULONG64:
if( bIsVariant )
*pStrm << (sal_uInt16)SbxLONG; // VarType Id
*pStrm << rVar.GetLong();
break;
-
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ if( bIsVariant )
+ *pStrm << (sal_uInt16)SbxSALINT64; // VarType Id
+ *pStrm << (sal_uInt64)rVar.GetInt64();
+ break;
case SbxSINGLE:
if( bIsVariant )
*pStrm << (sal_uInt16)eType; // VarType Id
@@ -1095,15 +1099,20 @@ sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxLONG:
case SbxULONG:
- case SbxLONG64:
- case SbxULONG64:
{
sal_Int32 aInt;
*pStrm >> aInt;
rVar.PutLong( aInt );
}
break;
-
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ {
+ sal_uInt32 aInt;
+ *pStrm >> aInt;
+ rVar.PutInt64( (sal_Int64)aInt );
+ }
+ break;
case SbxSINGLE:
{
float nS;
@@ -1441,8 +1450,8 @@ RTLFUNC(TypeLen)
case SbxDOUBLE:
case SbxCURRENCY:
case SbxDATE:
- case SbxLONG64:
- case SbxULONG64:
+ case SbxSALINT64:
+ case SbxSALUINT64:
nLen = 8;
break;
@@ -2612,6 +2621,546 @@ RTLFUNC(Round)
rPar.Get(0)->PutDouble( dRes );
}
+void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUString& sFuncName, SbxVariable* pRet )
+{
+ static Reference< XFunctionAccess > xFunc;
+ Any aRes;
+ try
+ {
+ if ( !xFunc.is() )
+ {
+ Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ xFunc.set( xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FunctionAccess"))), UNO_QUERY_THROW);
+ }
+ }
+ Any aRet = xFunc->callFunction( sFuncName, aArgs );
+
+ unoToSbxValue( pRet, aRet );
+
+ }
+ catch( Exception& )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
+}
+
+RTLFUNC(SYD)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 4 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+ aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYD") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(SLN)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 3 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SLN") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(Pmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Pmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(PPmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double per = rPar.Get(2)->GetDouble();
+ double nper = rPar.Get(3)->GetDouble();
+ double pv = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ fv = rPar.Get(5)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= per;
+ aParams[ 2 ] <<= nper;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= fv;
+ aParams[ 5 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PPmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(PV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(NPV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 1 || nArgCount > 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ Sequence< Any > aParams( 2 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ Any aValues = sbxToUnoValue( rPar.Get(2),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ aParams[ 1 ] <<= aValues;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(NPer)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double pmt = rPar.Get(2)->GetDouble();
+ double pv = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= pmt;
+ aParams[ 2 ] <<= pv;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPer") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(MIRR)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 3 );
+ Any aValues = sbxToUnoValue( rPar.Get(1),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ aParams[ 0 ] <<= aValues;
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MIRR") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(IRR)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 1 || nArgCount > 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+ Any aValues = sbxToUnoValue( rPar.Get(1),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ // set default values for Optional args
+ double guess = 0.1;
+ // guess
+ if ( nArgCount >= 2 )
+ {
+ if( rPar.Get(2)->GetType() != SbxEMPTY )
+ guess = rPar.Get(2)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 2 );
+ aParams[ 0 ] <<= aValues;
+ aParams[ 1 ] <<= guess;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IRR") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(IPmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double per = rPar.Get(2)->GetInteger();
+ double nper = rPar.Get(3)->GetDouble();
+ double pv = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ fv = rPar.Get(5)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= per;
+ aParams[ 2 ] <<= nper;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= fv;
+ aParams[ 5 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IPmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(FV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double pv = 0;
+ double type = 0;
+
+ // pv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ pv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(DDB)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double cost = rPar.Get(1)->GetDouble();
+ double salvage = rPar.Get(2)->GetDouble();
+ double life = rPar.Get(3)->GetDouble();
+ double period = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double factor = 2;
+
+ // factor
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ factor = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= cost;
+ aParams[ 1 ] <<= salvage;
+ aParams[ 2 ] <<= life;
+ aParams[ 3 ] <<= period;
+ aParams[ 4 ] <<= factor;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DDB") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(Rate)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uLong nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double nper = 0;
+ double pmt = 0;
+ double pv = 0;
+
+ nper = rPar.Get(1)->GetDouble();
+ pmt = rPar.Get(2)->GetDouble();
+ pv = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+ double guess = 0.1;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ // guess
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= nper;
+ aParams[ 1 ] <<= pmt;
+ aParams[ 2 ] <<= pv;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+ aParams[ 5 ] <<= guess;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rate") ), rPar.Get( 0 ) );
+}
+
RTLFUNC(StrReverse)
{
(void)pBasic;
@@ -2713,3 +3262,4 @@ RTLFUNC(Me)
refVar->PutObject( pClassModuleObject );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 032b687b987b..8f441827905f 100644..100755
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -774,3 +775,4 @@ RTLFUNC(TYP_JUMPEDITFLD)
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index bb8687ee0db6..c129d997ca9d 100644..100755
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -166,29 +167,41 @@ extern RTLFUNC(Kill); // JSM
extern RTLFUNC(MkDir); // JSM
extern RTLFUNC(RmDir); // JSM
extern RTLFUNC(SendKeys); // JSM
+extern RTLFUNC(DDB);
extern RTLFUNC(DimArray);
extern RTLFUNC(Dir);
extern RTLFUNC(DoEvents);
extern RTLFUNC(Exp);
extern RTLFUNC(FileLen);
extern RTLFUNC(Fix);
+extern RTLFUNC(FV);
extern RTLFUNC(Hex);
extern RTLFUNC(Input);
extern RTLFUNC(InStr);
extern RTLFUNC(InStrRev);
extern RTLFUNC(Int);
+extern RTLFUNC(IPmt);
+extern RTLFUNC(IRR);
extern RTLFUNC(Join);
extern RTLFUNC(LCase);
extern RTLFUNC(Left);
extern RTLFUNC(Log);
extern RTLFUNC(LTrim);
extern RTLFUNC(Mid);
+extern RTLFUNC(MIRR);
+extern RTLFUNC(NPer);
+extern RTLFUNC(NPV);
extern RTLFUNC(Oct);
+extern RTLFUNC(Pmt);
+extern RTLFUNC(PPmt);
+extern RTLFUNC(PV);
+extern RTLFUNC(Rate);
extern RTLFUNC(Replace);
extern RTLFUNC(Right);
extern RTLFUNC(RTrim);
extern RTLFUNC(RTL);
extern RTLFUNC(Sgn);
+extern RTLFUNC(SLN);
extern RTLFUNC(Space);
extern RTLFUNC(Split);
extern RTLFUNC(Sqr);
@@ -196,6 +209,7 @@ extern RTLFUNC(Str);
extern RTLFUNC(StrComp);
extern RTLFUNC(String);
extern RTLFUNC(StrReverse);
+extern RTLFUNC(SYD);
extern RTLFUNC(Tan);
extern RTLFUNC(UCase);
extern RTLFUNC(Val);
@@ -299,6 +313,7 @@ extern RTLFUNC(Switch);
extern RTLFUNC(Wait);
//i#64882# add new WaitUntil
extern RTLFUNC(WaitUntil);
+extern RTLFUNC(FuncCaller);
extern RTLFUNC(GetGUIVersion);
extern RTLFUNC(Choose);
@@ -353,3 +368,5 @@ extern RTLFUNC(TraceCommand);
extern double Now_Impl();
extern void Wait_Impl( bool bDurationBased, SbxArray& rPar );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 10d25cc2292b..8609c2a2c97d 100644..100755
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -44,9 +45,11 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include "sbunoobj.hxx"
#include "errobject.hxx"
-#include "sbtrace.hxx"
+
#include "comenumwrapper.hxx"
+SbxVariable* getDefaultProp( SbxVariable* pRef );
+
using namespace ::com::sun::star;
bool SbiRuntime::isVBAEnabled()
@@ -323,7 +326,7 @@ SbiInstance::~SbiInstance()
}
catch( const Exception& )
{
- DBG_ERROR( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" );
+ OSL_FAIL( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" );
}
ComponentVector.clear();
@@ -545,7 +548,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart )
: rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
{
nFlags = pe ? pe->GetDebugFlags() : 0;
pIosys = pInst->pIosys;
@@ -602,6 +605,13 @@ SbiRuntime::~SbiRuntime()
void SbiRuntime::SetVBAEnabled(bool bEnabled )
{
bVBAEnabled = bEnabled;
+ if ( bVBAEnabled )
+ {
+ if ( pMeth )
+ mpExtCaller = pMeth->mCaller;
+ }
+ else
+ mpExtCaller = 0;
}
// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
@@ -723,11 +733,6 @@ sal_Bool SbiRuntime::Step()
Application::Reschedule();
}
-#ifdef DBG_TRACE_BASIC
- sal_uInt32 nPC = ( pCode - (const sal_uInt8* )pImg->GetCode() );
- dbg_traceStep( pMod, nPC, pINST->nCallLvl );
-#endif
-
SbiOpcode eOp = (SbiOpcode ) ( *pCode++ );
sal_uInt32 nOp1, nOp2;
if( eOp <= SbOP0_END )
@@ -764,11 +769,6 @@ sal_Bool SbiRuntime::Step()
// (insbesondere nicht nach Compiler-Fehlern zur Laufzeit)
if( nError && bRun )
{
-#ifdef DBG_TRACE_BASIC
- SbError nTraceErr = nError;
- String aTraceErrMsg = GetSbData()->aErrMsg;
- bool bTraceErrHandled = true;
-#endif
SbError err = nError;
ClearExprStack();
nError = 0;
@@ -776,7 +776,7 @@ sal_Bool SbiRuntime::Step()
pInst->nErl = nLine;
pErrCode = pCode;
pErrStmnt = pStmnt;
- // An error occured in an error handler
+ // An error occurred in an error handler
// force parent handler ( if there is one )
// to handle the error
bool bLetParentHandleThis = false;
@@ -849,19 +849,12 @@ sal_Bool SbiRuntime::Step()
// Kein Error-Hdl gefunden -> altes Vorgehen
else
{
-#ifdef DBG_TRACE_BASIC
- bTraceErrHandled = false;
-#endif
pInst->Abort();
}
// ALT: Nur
// pInst->Abort();
}
-
-#ifdef DBG_TRACE_BASIC
- dbg_traceNotifyError( nTraceErr, aTraceErrMsg, bTraceErrHandled, pINST->nCallLvl );
-#endif
}
}
return bRun;
@@ -1031,7 +1024,25 @@ SbxVariable* SbiRuntime::GetTOS( short n )
void SbiRuntime::TOSMakeTemp()
{
SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
- if( p->GetRefCount() != 1 )
+ if ( p->GetType() == SbxEMPTY )
+ p->Broadcast( SBX_HINT_DATAWANTED );
+
+ SbxVariable* pDflt = NULL;
+ if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ((pDflt = getDefaultProp(p)) != NULL) )
+ {
+ pDflt->Broadcast( SBX_HINT_DATAWANTED );
+ // replacing new p on stack causes object pointed by
+ // pDft->pParent to be deleted, when p2->Compute() is
+ // called below pParent is accessed ( but its deleted )
+ // so set it to NULL now
+ pDflt->SetParent( NULL );
+ p = new SbxVariable( *pDflt );
+ p->SetFlag( SBX_READWRITE );
+ refExprStk->Put( p, nExprLvl - 1 );
+// return;
+ }
+
+ else if( p->GetRefCount() != 1 )
{
SbxVariable* pNew = new SbxVariable( *p );
pNew->SetFlag( SBX_READWRITE );
@@ -1040,7 +1051,6 @@ void SbiRuntime::TOSMakeTemp()
}
// Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
-
void SbiRuntime::PushGosub( const sal_uInt8* pc )
{
if( ++nGosubLvl > MAXRECURSION )
@@ -1285,3 +1295,5 @@ sal_uInt16 SbiRuntime::GetBase()
{
return pImg->GetBase();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index ecc0dfb3321b..40a1fa911437 100644..100755
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,10 @@
#include "runtime.hxx"
#include "stdobj.hxx"
#include <basic/sbstdobj.hxx>
+#include <sal/macros.h>
#include "rtlproto.hxx"
#include "sbintern.hxx"
-
+#include <boost/unordered_map.hpp>
// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
// Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
// benoetigen!
@@ -69,6 +71,45 @@ struct Methods {
sal_uInt16 nHash; // Hashcode
};
+struct StringHashCode
+{
+ size_t operator()( const String& rStr ) const
+ {
+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
+ }
+};
+
+class VBABlacklist
+{
+friend class VBABlackListQuery;
+ boost::unordered_map< String, bool, StringHashCode > mBlackList;
+ VBABlacklist()
+ {
+ const char* list[] = { "Red" };
+ sal_Int32 nSize = SAL_N_ELEMENTS( list );
+ for ( sal_Int32 index = 0; index < nSize; ++index )
+ {
+ mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
+ }
+ }
+public:
+ bool isBlackListed( const String& sName )
+ {
+ String sNameLower( sName );
+ sNameLower.ToLowerAscii();
+ return ( mBlackList.find( sNameLower ) != mBlackList.end() );
+ }
+};
+
+class VBABlackListQuery
+{
+public:
+ static bool isBlackListed( const String& sName )
+ {
+ static VBABlacklist blackList;
+ return blackList.isBlackListed( sName );
+ }
+};
static Methods aMethods[] = {
{ "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
@@ -175,7 +216,12 @@ static Methods aMethods[] = {
{ "expression", SbxVARIANT, 0,NULL,0 },
{ "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr),0 },
{ "expression", SbxVARIANT, 0,NULL,0 },
-
+{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(DDB),0 },
+ { "Cost", SbxDOUBLE, 0, NULL,0 },
+ { "Salvage", SbxDOUBLE, 0, NULL,0 },
+ { "Life", SbxDOUBLE, 0, NULL,0 },
+ { "Period", SbxDOUBLE, 0, NULL,0 },
+ { "Factor", SbxVARIANT, _OPT, NULL,0 },
{ "Date", SbxDATE, _LFUNCTION,RTLNAME(Date),0 },
{ "DateAdd", SbxDATE, 3 | _FUNCTION, RTLNAME(DateAdd),0 },
{ "Interval", SbxSTRING, 0,NULL,0 },
@@ -220,7 +266,7 @@ static Methods aMethods[] = {
{ "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 },
{ "FileSpec", SbxSTRING, _OPT, NULL,0 },
{ "attrmask", SbxINTEGER, _OPT, NULL,0 },
-{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 },
+{ "DoEvents", SbxINTEGER, _FUNCTION, RTLNAME(DoEvents),0 },
{ "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 },
{ "FileSpec", SbxSTRING, 0,NULL,0 },
{ "DumpAll", SbxINTEGER, _OPT, NULL,0 },
@@ -275,6 +321,12 @@ static Methods aMethods[] = {
{ "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
{ "Modulename", SbxSTRING, 0,NULL,0 },
+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
{ "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get),0 },
{ "filenumber", SbxINTEGER, 0,NULL,0 },
{ "recordnumber", SbxLONG, 0,NULL,0 },
@@ -335,6 +387,16 @@ static Methods aMethods[] = {
{ "Compare", SbxINTEGER, _OPT, NULL,0 },
{ "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
+{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(IPmt),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "Per", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(IRR),0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
{ "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
{ "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate),0 },
@@ -405,6 +467,10 @@ static Methods aMethods[] = {
{ "Length", SbxLONG, _OPT, NULL,0 },
{ "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute),0 },
{ "Date", SbxDATE, 0,NULL,0 },
+{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MIRR),0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
+ { "FinanceRate", SbxDOUBLE, 0, NULL,0 },
+ { "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
{ "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir),0 },
{ "pathname", SbxSTRING, 0,NULL,0 },
{ "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
@@ -421,6 +487,15 @@ static Methods aMethods[] = {
{ "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
{ "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(NPer),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(NPV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
{ "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
{ "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct),0 },
@@ -432,16 +507,46 @@ static Methods aMethods[] = {
{ "stop", SbxLONG, 0,NULL,0 },
{ "interval", SbxLONG, 0,NULL,0 },
{ "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
+
+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(Pmt),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
+{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(PPmt),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "Per", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
{ "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put),0 },
{ "filenumber", SbxINTEGER, 0,NULL,0 },
{ "recordnumber", SbxLONG, 0,NULL,0 },
{ "variablename", SbxVARIANT, 0,NULL,0 },
+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
{ "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor),0 },
{ "number", SbxINTEGER, 0,NULL,0 },
{ "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
{ "Number", SbxDOUBLE, _OPT, NULL,0 },
+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(Rate),0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
{ "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red),0 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
{ "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
@@ -495,6 +600,15 @@ static Methods aMethods[] = {
{ "WindowStyle", SbxINTEGER, _OPT, NULL,0 },
{ "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
+{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SLN),0 },
+ { "Cost", SbxDOUBLE, 0,NULL,0 },
+ { "Double", SbxDOUBLE, 0,NULL,0 },
+ { "Life", SbxDOUBLE, 0,NULL,0 },
+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
+ { "Cost", SbxDOUBLE, 0,NULL,0 },
+ { "Salvage", SbxDOUBLE, 0,NULL,0 },
+ { "Life", SbxDOUBLE, 0,NULL,0 },
+ { "Period", SbxDOUBLE, 0,NULL,0 },
{ "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space),0 },
{ "string", SbxLONG, 0,NULL,0 },
{ "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc),0 },
@@ -613,6 +727,7 @@ static Methods aMethods[] = {
{ "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
{ "Milliseconds", SbxLONG, 0,NULL,0 },
+{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
//#i64882#
{ "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
{ "Date", SbxDOUBLE, 0,NULL,0 },
@@ -691,13 +806,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
&& ( p->nHash == nHash_ )
&& ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
{
+ SbiInstance* pInst = pINST;
bFound = sal_True;
if( p->nArgs & _COMPTMASK )
{
- SbiInstance* pInst = pINST;
if( !pInst || !pInst->IsCompatibility() )
bFound = sal_False;
}
+ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
+ bFound = sal_False;
break;
}
nIndex += ( p->nArgs & _ARGSMASK ) + 1;
@@ -725,7 +842,7 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
return pVar;
}
-// SetModified muß bei der RTL abgklemmt werden
+// SetModified mu� bei der RTL abgklemmt werden
void SbiStdObject::SetModified( sal_Bool )
{
}
@@ -794,3 +911,4 @@ SbxInfo* SbiStdObject::GetInfo( short nIdx )
return pInfo_;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index 29cbf16125c7..10b4269227c9 100644..100755
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -549,3 +550,4 @@ void SbStdClipboard::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 43c930e975d2..520df18ecdd5 100644..100755
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,7 +48,12 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
#include <algorithm>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
+
+// for a patch forward declaring these methods below makes sense
+// but, #FIXME lets really just move the methods to the top
+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
SbxVariable* getDefaultProp( SbxVariable* pRef );
@@ -60,34 +66,6 @@ void SbiRuntime::StepArith( SbxOperator eOp )
TOSMakeTemp();
SbxVariable* p2 = GetTOS();
-
- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
- // In the code which this is cut'npaste from there is a check for a ref
- // count != 1 based on which the copy of the SbxVariable is done.
- // see orig code in MakeTempTOS ( and I'm not sure what the significance,
- // of that is )
- // here we alway seem to have a refcount of 1. Also it seems that
- // MakeTempTOS is called for other operation, so I hold off for now
- // until I have a better idea
- if ( bVBAEnabled
- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
- )
- {
- SbxVariable* pDflt = getDefaultProp( p2 );
- if ( pDflt )
- {
- pDflt->Broadcast( SBX_HINT_DATAWANTED );
- // replacing new p2 on stack causes object pointed by
- // pDft->pParent to be deleted, when p2->Compute() is
- // called below pParent is accessed ( but its deleted )
- // so set it to NULL now
- pDflt->SetParent( NULL );
- p2 = new SbxVariable( *pDflt );
- p2->SetFlag( SBX_READWRITE );
- refExprStk->Put( p2, nExprLvl - 1 );
- }
- }
-
p2->ResetFlag( SBX_FIXED );
p2->Compute( eOp, *p1 );
@@ -110,19 +88,24 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
// values ( and type ) set as appropriate
SbxDataType p1Type = p1->GetType();
SbxDataType p2Type = p2->GetType();
+ if ( p1Type == SbxEMPTY )
+ {
+ p1->Broadcast( SBX_HINT_DATAWANTED );
+ p1Type = p1->GetType();
+ }
+ if ( p2Type == SbxEMPTY )
+ {
+ p2->Broadcast( SBX_HINT_DATAWANTED );
+ p2Type = p2->GetType();
+ }
if ( p1Type == p2Type )
{
- if ( p1Type == SbxEMPTY )
- {
- p1->Broadcast( SBX_HINT_DATAWANTED );
- p2->Broadcast( SBX_HINT_DATAWANTED );
- }
// if both sides are an object and have default props
// then we need to use the default props
// we don't need to worry if only one side ( lhs, rhs ) is an
// object ( object side will get coerced to correct type in
// Compare )
- else if ( p1Type == SbxOBJECT )
+ if ( p1Type == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( p1 );
if ( pDflt )
@@ -141,8 +124,21 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
}
static SbxVariable* pTRUE = NULL;
static SbxVariable* pFALSE = NULL;
-
- if( p2->Compare( eOp, *p1 ) )
+ static SbxVariable* pNULL = NULL;
+ // why do this on non-windows ?
+ // why do this at all ?
+ // I dumbly follow the pattern :-/
+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
+ {
+ if( !pNULL )
+ {
+ pNULL = new SbxVariable;
+ pNULL->PutNull();
+ pNULL->AddRef();
+ }
+ PushVar( pNULL );
+ }
+ else if( p2->Compare( eOp, *p1 ) )
{
if( !pTRUE )
{
@@ -449,7 +445,8 @@ struct SbxVariablePtrHash
{ return (size_t)pVar; }
};
-typedef std::hash_map< SbxVariable*, DimAsNewRecoverItem, SbxVariablePtrHash > DimAsNewRecoverHash;
+typedef boost::unordered_map< SbxVariable*, DimAsNewRecoverItem,
+ SbxVariablePtrHash > DimAsNewRecoverHash;
static DimAsNewRecoverHash GaDimAsNewRecoverHash;
@@ -785,6 +782,17 @@ void SbiRuntime::StepDIM()
// #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
void SbiRuntime::DimImpl( SbxVariableRef refVar )
{
+ // If refDim then this DIM statement is terminating a ReDIM and
+ // previous StepERASE_CLEAR for an array, the following actions have
+ // been delayed from ( StepERASE_CLEAR ) 'till here
+ if ( refRedim )
+ {
+ if ( !refRedimpArray ) // only erase the array not ReDim Preserve
+ lcl_eraseImpl( refVar, bVBAEnabled );
+ SbxDataType eType = refVar->GetType();
+ lcl_clearImpl( refVar, eType );
+ refRedim = NULL;
+ }
SbxArray* pDims = refVar->GetParameters();
// Muss eine gerade Anzahl Argumente haben
// Man denke daran, dass Arg[0] nicht zaehlt!
@@ -950,6 +958,7 @@ void SbiRuntime::StepREDIMP()
void SbiRuntime::StepREDIMP_ERASE()
{
SbxVariableRef refVar = PopVar();
+ refRedim = refVar;
SbxDataType eType = refVar->GetType();
if( eType & SbxARRAY )
{
@@ -960,12 +969,6 @@ void SbiRuntime::StepREDIMP_ERASE()
refRedimpArray = pDimArray;
}
- // As in ERASE
- sal_uInt16 nSavFlags = refVar->GetFlags();
- refVar->ResetFlag( SBX_FIXED );
- refVar->SetType( SbxDataType(eType & 0x0FFF) );
- refVar->SetFlags( nSavFlags );
- refVar->Clear();
}
else
if( refVar->IsFixed() )
@@ -1038,10 +1041,7 @@ void SbiRuntime::StepERASE()
void SbiRuntime::StepERASE_CLEAR()
{
- SbxVariableRef refVar = PopVar();
- lcl_eraseImpl( refVar, bVBAEnabled );
- SbxDataType eType = refVar->GetType();
- lcl_clearImpl( refVar, eType );
+ refRedim = PopVar();
}
void SbiRuntime::StepARRAYACCESS()
@@ -1436,3 +1436,4 @@ void SbiRuntime::StepERROR()
Error( error );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 0a9572906cc8..659152548e53 100644..100755
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -93,6 +94,15 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
{
String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxVariableRef pVal = PopVar();
+ if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
+ {
+ // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
+ if ( pVal->GetType() == SbxEMPTY )
+ pVal->Broadcast( SBX_HINT_DATAWANTED );
+ // Methoden und Properties evaluieren!
+ SbxVariable* pRes = new SbxVariable( *pVal );
+ pVal = pRes;
+ }
refArgv->Put( pVal, nArgc );
refArgv->PutAlias( aAlias, nArgc++ );
}
@@ -110,8 +120,8 @@ void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
SbxDataType t = (SbxDataType) (nOp1 & 0x7FFF);
SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // letztes Arg
- // BYVAL prüfen
- if( pVar->GetRefCount() > 2 ) // 2 ist normal für BYVAL
+ // BYVAL pr�fen
+ if( pVar->GetRefCount() > 2 ) // 2 ist normal f�r BYVAL
{
// Parameter ist eine Referenz
if( bByVal )
@@ -122,7 +132,7 @@ void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
refExprStk->Put( pVar, refArgv->Count() - 1 );
}
else
- pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag für DllMgr
+ pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag f�r DllMgr
}
else
{
@@ -182,7 +192,9 @@ void SbiRuntime::StepJUMPT( sal_uInt32 nOp1 )
void SbiRuntime::StepJUMPF( sal_uInt32 nOp1 )
{
SbxVariableRef p = PopVar();
- if( !p->GetBool() )
+ // In a test e.g. If Null then
+ // will evaluate Null will act as if False
+ if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
StepJUMP( nOp1 );
}
@@ -572,3 +584,4 @@ void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 02b22a35b732..2b8dbc71cf03 100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,8 +30,6 @@
#include "precompiled_basic.hxx"
#include "runtime.hxx"
-#ifndef GCC
-#endif
#include "iosys.hxx"
#include "image.hxx"
#include "sbintern.hxx"
@@ -141,7 +140,7 @@ SbxVariable* SbiRuntime::FindElement
if ( pElem )
bSetName = false; // don't overwrite uno name
else
- pElem = getVBAConstant( aName );
+ pElem = VBAConstantHelper::instance().getVBAConstant( aName );
}
if( !pElem )
@@ -489,7 +488,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
// Falls wir ein Array haben, wollen wir bitte das Array-Element!
SbxArray* pPar;
- if( pElem->GetType() & SbxARRAY )
+ if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
{
SbxBase* pElemObj = pElem->GetObject();
SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj);
@@ -521,7 +520,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pPar->Put( NULL, 0 );
}
// Index-Access bei UnoObjekten beruecksichtigen
- else if( pElem->GetType() == SbxOBJECT && (!pElem->ISA(SbxMethod) || !pElem->IsBroadcaster()) )
+ else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) )
{
pPar = pElem->GetParameters();
if ( pPar )
@@ -771,6 +770,8 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SaveRef( q );
*q = *p;
p = q;
+ if ( i )
+ refParams->Put( p, i );
}
SetupArgs( p, nOp1 );
PushVar( CheckArray( p ) );
@@ -885,7 +886,7 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// #29955 for-Schleifen-Ebene korrigieren, #67452 NICHT im Error-Handler sonst Chaos
if( !bInError )
{
- // (Bei Sprüngen aus Schleifen tritt hier eine Differenz auf)
+ // (Bei Spr�ngen aus Schleifen tritt hier eine Differenz auf)
sal_uInt16 nExspectedForLevel = static_cast<sal_uInt16>( nOp2 / 0x100 );
if( pGosubStk )
nExspectedForLevel = nExspectedForLevel + pGosubStk->nStartForLvl;
@@ -897,7 +898,7 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
// 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
- // Erklärung siehe bei _ImplGetBreakCallLevel.
+ // Erkl�rung siehe bei _ImplGetBreakCallLevel.
if( pInst->nCallLvl <= pInst->nBreakCallLvl )
//if( nFlags & SbDEBUG_STEPINTO )
{
@@ -1299,3 +1300,4 @@ void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
StepSTATIC_Impl( aName, t );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/wnt-mingw.s b/basic/source/runtime/wnt-mingw.s
index 8c332c1a8ce8..8c332c1a8ce8 100644..100755
--- a/basic/source/runtime/wnt-mingw.s
+++ b/basic/source/runtime/wnt-mingw.s
diff --git a/basic/source/runtime/wnt.asm b/basic/source/runtime/wnt-x86.asm
index 2a8710e34243..2a8710e34243 100644..100755
--- a/basic/source/runtime/wnt.asm
+++ b/basic/source/runtime/wnt-x86.asm
diff --git a/basic/source/sample/collelem.cxx b/basic/source/sample/collelem.cxx
index 0ada7b60ea6a..80ee91db309f 100644..100755
--- a/basic/source/sample/collelem.cxx
+++ b/basic/source/sample/collelem.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -77,3 +78,4 @@ void SampleElement::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sample/makefile.mk b/basic/source/sample/makefile.mk
index 9aeb8e353414..5261f13cfe43 100644..100755
--- a/basic/source/sample/makefile.mk
+++ b/basic/source/sample/makefile.mk
@@ -40,6 +40,9 @@ CXXFILES = \
object.cxx \
collelem.cxx
+EXCEPTIONSFILES= \
+ $(OBJ)$/object.obj \
+ $(OBJ)$/collelem.obj
OBJFILES = \
$(OBJ)$/object.obj \
diff --git a/basic/source/sample/object.cxx b/basic/source/sample/object.cxx
index 15ad6b0168f8..2c3ca7e29797 100644..100755
--- a/basic/source/sample/object.cxx
+++ b/basic/source/sample/object.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,12 +31,8 @@
#include <tools/errcode.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbx.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include "object.hxx"
#include "collelem.hxx"
@@ -276,3 +273,4 @@ SbxObject* SampleObjectFac::CreateObject( const String& rClass )
return NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sample/sample.bas b/basic/source/sample/sample.bas
index d0e416871af0..d0e416871af0 100644..100755
--- a/basic/source/sample/sample.bas
+++ b/basic/source/sample/sample.bas
diff --git a/basic/source/sbx/format.src b/basic/source/sbx/format.src
index 7e576134fad5..7e576134fad5 100644..100755
--- a/basic/source/sbx/format.src
+++ b/basic/source/sbx/format.src
diff --git a/basic/source/sbx/makefile.mk b/basic/source/sbx/makefile.mk
index dfd8e72bf4da..332c6a0d426d 100644..100755
--- a/basic/source/sbx/makefile.mk
+++ b/basic/source/sbx/makefile.mk
@@ -41,34 +41,34 @@ SRS1NAME=$(TARGET)
SRC1FILES= format.src
SLOFILES= \
- $(SLO)$/sbxbase.obj \
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/sbxbase.obj \
+ $(SLO)$/sbxbool.obj \
+ $(SLO)$/sbxbyte.obj \
+ $(SLO)$/sbxchar.obj \
+ $(SLO)$/sbxcoll.obj \
+ $(SLO)$/sbxdec.obj \
+ $(SLO)$/sbxform.obj \
+ $(SLO)$/sbxint.obj \
+ $(SLO)$/sbxlng.obj \
+ $(SLO)$/sbxmstrm.obj \
+ $(SLO)$/sbxobj.obj \
$(SLO)$/sbxres.obj \
- $(SLO)$/sbxvalue.obj \
- $(SLO)$/sbxvals.obj \
- $(SLO)$/sbxvar.obj \
+ $(SLO)$/sbxsng.obj \
+ $(SLO)$/sbxuint.obj \
+ $(SLO)$/sbxulng.obj \
+ $(SLO)$/sbxvar.obj
+
+
+EXCEPTIONSFILES= \
$(SLO)$/sbxarray.obj \
- $(SLO)$/sbxobj.obj \
- $(SLO)$/sbxcoll.obj \
- $(SLO)$/sbxexec.obj \
- $(SLO)$/sbxint.obj \
- $(SLO)$/sbxlng.obj \
- $(SLO)$/sbxsng.obj \
- $(SLO)$/sbxmstrm.obj \
- $(SLO)$/sbxdbl.obj \
$(SLO)$/sbxcurr.obj \
- $(SLO)$/sbxdate.obj \
- $(SLO)$/sbxstr.obj \
- $(SLO)$/sbxbool.obj \
- $(SLO)$/sbxchar.obj \
- $(SLO)$/sbxbyte.obj \
- $(SLO)$/sbxuint.obj \
- $(SLO)$/sbxulng.obj \
- $(SLO)$/sbxform.obj \
+ $(SLO)$/sbxdate.obj \
+ $(SLO)$/sbxdbl.obj \
+ $(SLO)$/sbxexec.obj \
$(SLO)$/sbxscan.obj \
- $(SLO)$/sbxdec.obj
-
-
-EXCEPTIONSFILES=$(SLO)$/sbxarray.obj
+ $(SLO)$/sbxstr.obj \
+ $(SLO)$/sbxvalue.obj \
# --- Targets -------------------------------------------------------------
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 7a68f2ea5a31..f230a6b8ed83 100644..100755
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,10 +34,10 @@
#include <vector>
using namespace std;
-struct SbxDim { // eine Array-Dimension:
+struct SbxDim { // an array-dimension:
SbxDim* pNext; // Link
- sal_Int32 nLbound, nUbound; // Begrenzungen
- sal_Int32 nSize; // Anzahl Elemente
+ sal_Int32 nLbound, nUbound; // Limitations
+ sal_Int32 nSize; // Number of elements
};
class SbxVarEntry : public SbxVariableRef {
@@ -99,7 +100,7 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray )
if( pSrcRef->pAlias )
pDstRef->pAlias = new XubString( *pSrcRef->pAlias );
if( eType != SbxVARIANT )
- // Keine Objekte konvertieren
+ // Convert no objects
if( eType != SbxOBJECT || pSrc_->GetClass() != SbxCLASS_OBJECT )
((SbxVariable*) pSrc_)->Convert( eType );
pData->push_back( pDstRef );
@@ -149,7 +150,7 @@ sal_uInt16 SbxArray::Count() const
SbxVariableRef& SbxArray::GetRef32( sal_uInt32 nIdx )
{
- // Array ggf. vergroessern
+ // If necessary extend the array
DBG_ASSERT( nIdx <= SBX_MAXINDEX32, "SBX: Array-Index > SBX_MAXINDEX32" );
// Very Hot Fix
if( nIdx > SBX_MAXINDEX32 )
@@ -167,7 +168,7 @@ SbxVariableRef& SbxArray::GetRef32( sal_uInt32 nIdx )
SbxVariableRef& SbxArray::GetRef( sal_uInt16 nIdx )
{
- // Array ggf. vergroessern
+ // If necessary extend the array
DBG_ASSERT( nIdx <= SBX_MAXINDEX, "SBX: Array-Index > SBX_MAXINDEX" );
// Very Hot Fix
if( nIdx > SBX_MAXINDEX )
@@ -229,7 +230,7 @@ void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx )
{
if( pVar )
if( eType != SbxVARIANT )
- // Keine Objekte konvertieren
+ // Convert no objects
if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef32( nIdx );
@@ -249,7 +250,7 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx )
{
if( pVar )
if( eType != SbxVARIANT )
- // Keine Objekte konvertieren
+ // Convert no objects
if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef( nIdx );
@@ -363,8 +364,8 @@ void SbxArray::Remove( SbxVariable* pVar )
}
}
-// Uebernahme der Daten aus dem uebergebenen Array, wobei
-// gleichnamige Variable ueberschrieben werden.
+// Taking over of the data from the passed array, at which
+// the variable of the same name will be overwritten.
void SbxArray::Merge( SbxArray* p )
{
@@ -374,8 +375,8 @@ void SbxArray::Merge( SbxArray* p )
for( sal_uInt32 i = 0; i < nSize; i++ )
{
SbxVarEntryPtr pRef1 = (*(p->pData))[i];
- // Ist das Element by name schon drin?
- // Dann ueberschreiben!
+ // Is the element by name already inside?
+ // Then overwrite!
SbxVariable* pVar = *pRef1;
if( pVar )
{
@@ -405,8 +406,8 @@ void SbxArray::Merge( SbxArray* p )
}
}
-// Suchen eines Elements ueber die Userdaten. Falls ein Element
-// ein Objekt ist, wird dieses ebenfalls durchsucht.
+// Search of an element via the user data. If the element is
+// object, it will also be scanned.
SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
{
@@ -421,16 +422,16 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
{
p = pVar;
p->ResetFlag( SBX_EXTFOUND );
- break; // JSM 06.10.95
+ break; // JSM 1995-10-06
}
- // Haben wir ein Array/Objekt mit Extended Search?
+ // Did we have an array/object with extended search?
else if( pVar->IsSet( SBX_EXTSEARCH ) )
{
switch( pVar->GetClass() )
{
case SbxCLASS_OBJECT:
{
- // Objekte duerfen ihren Parent nicht durchsuchen
+ // Objects are not allowed to scan their parent.
sal_uInt16 nOld = pVar->GetFlags();
pVar->ResetFlag( SBX_GBLSEARCH );
p = ((SbxObject*) pVar)->FindUserData( nData );
@@ -453,8 +454,8 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
return p;
}
-// Suchen eines Elements ueber den Namen und den Typ. Falls ein Element
-// ein Objekt ist, wird dieses ebenfalls durchsucht.
+// Search of an element by his name and type. If an element is an object,
+// it will also be scanned..
SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t )
{
@@ -470,8 +471,7 @@ SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t )
SbxVariable* pVar = *pRef;
if( pVar && pVar->IsVisible() )
{
- // Die ganz sichere Suche klappt auch, wenn es
- // keinen Hascode gibt!
+ // The very secure search works as well, if there is no hashcode!
sal_uInt16 nVarHash = pVar->GetHashCode();
if( ( !nVarHash || nVarHash == nHash )
&& ( t == SbxCLASS_DONTCARE || pVar->GetClass() == t )
@@ -481,14 +481,14 @@ SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t )
p->ResetFlag( SBX_EXTFOUND );
break;
}
- // Haben wir ein Array/Objekt mit Extended Search?
+ // Did we have an array/object with extended search?
else if( bExtSearch && pVar->IsSet( SBX_EXTSEARCH ) )
{
switch( pVar->GetClass() )
{
case SbxCLASS_OBJECT:
{
- // Objekte duerfen ihren Parent nicht durchsuchen
+ // Objects are not allowed to scan their parent.
sal_uInt16 nOld = pVar->GetFlags();
pVar->ResetFlag( SBX_GBLSEARCH );
p = ((SbxObject*) pVar)->Find( rName, t );
@@ -545,7 +545,7 @@ sal_Bool SbxArray::StoreData( SvStream& rStrm ) const
{
sal_uInt32 nElem = 0;
sal_uInt32 n;
- // Welche Elemente sind ueberhaupt definiert?
+ // Which elements are even defined?
for( n = 0; n < pData->size(); n++ )
{
SbxVariableRef* pRef = (*pData)[n];
@@ -630,7 +630,7 @@ void SbxDimArray::Clear()
nDim = 0;
}
-// Dimension hinzufuegen
+// Add a dimension
void SbxDimArray::AddDimImpl32( sal_Int32 lb, sal_Int32 ub, sal_Bool bAllowSize0 )
{
@@ -675,7 +675,7 @@ void SbxDimArray::unoAddDim32( sal_Int32 lb, sal_Int32 ub )
}
-// Dimensionsdaten auslesen
+// Readout dimension data
sal_Bool SbxDimArray::GetDim32( sal_Int32 n, sal_Int32& rlb, sal_Int32& rub ) const
{
@@ -708,7 +708,7 @@ sal_Bool SbxDimArray::GetDim( short n, short& rlb, short& rub ) const
return bRet;
}
-// Element-Ptr anhand einer Index-Liste
+// Element-Ptr with the help of an index list
sal_uInt32 SbxDimArray::Offset32( const sal_Int32* pIdx )
{
@@ -779,7 +779,7 @@ void SbxDimArray::Put32( SbxVariable* p, const sal_Int32* pIdx )
}
-// Element-Nr anhand eines Parameter-Arrays
+// Element-Number with the help of Parameter-Array
sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar )
{
@@ -788,7 +788,7 @@ sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar )
SetError( SbxERR_BOUNDS ); return 0;
}
sal_uInt32 nPos = 0;
- sal_uInt16 nOff = 1; // Nicht Element 0!
+ sal_uInt16 nOff = 1; // Non element 0!
for( SbxDim* p = pFirst; p && !IsError(); p = p->pNext )
{
sal_Int32 nIdx = pPar->Get( nOff++ )->GetLong();
@@ -855,3 +855,4 @@ sal_Bool SbxDimArray::StoreData( SvStream& rStrm ) const
return SbxArray::StoreData( rStrm );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 54e45c79a8d2..77f34d90f370 100644..100755
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,15 +37,15 @@
#include <basic/sbxfac.hxx>
#include <basic/sbxbase.hxx>
-// AppData-Struktur fuer SBX:
+// AppData-Structure for SBX:
SV_IMPL_PTRARR(SbxParams,SbxParamInfo*);
SV_IMPL_PTRARR(SbxFacs,SbxFactory*);
TYPEINIT0(SbxBase)
-// SBX-Daten anfordern oder ggf. anlegen
-// wir legen den Bereich einfach an und verzichten auf die Freigabe!
+// Request SBX-Data or if necessary create them
+// we just create the area and waive the release!
SbxAppData* GetSbxData_Impl()
{
@@ -152,11 +153,11 @@ void SbxBase::AddFactory( SbxFactory* pFac )
SbxAppData* p = GetSbxData_Impl();
const SbxFactory* pTemp = pFac;
- // AB, 6.3.96: HandleLast-Flag beruecksichtigen
- sal_uInt16 nPos = p->aFacs.Count(); // Einfuege-Position
- if( !pFac->IsHandleLast() ) // Nur, wenn nicht selbst HandleLast
+ // From 1996-03-06: take the HandleLast-Flag into account
+ sal_uInt16 nPos = p->aFacs.Count(); // Insert position
+ if( !pFac->IsHandleLast() ) // Only if not self HandleLast
{
- // Neue Factory vor Factories mit HandleLast einordnen
+ // Rank new factory in front of factories with HandleLast
while( nPos > 0 &&
(static_cast<SbxFactory*>(p->aFacs.GetObject( nPos-1 )))->IsHandleLast() )
nPos--;
@@ -200,7 +201,7 @@ SbxBase* SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
case SBXID_METHOD: return new SbxMethod( aEmptyStr, SbxEMPTY );
case SBXID_PROPERTY: return new SbxProperty( aEmptyStr, SbxEMPTY );
}
- // Unbekanter Typ: ber die Factories gehen!
+ // Unknown type: go over the factories!
SbxAppData* p = GetSbxData_Impl();
SbxBase* pNew = NULL;
for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ )
@@ -245,7 +246,7 @@ SbxObject* SbxBase::CreateObject( const XubString& rClass )
static sal_Bool bStaticEnableBroadcasting = sal_True;
-// Sbx-Loesung als Ersatz fuer SfxBroadcaster::Enable()
+// Sbx-Solution in exchange for SfxBroadcaster::Enable()
void SbxBase::StaticEnableBroadcasting( sal_Bool bEnable )
{
bStaticEnableBroadcasting = bEnable;
@@ -263,7 +264,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
sal_uInt32 nCreator, nSize;
rStrm >> nCreator >> nSbxId >> nFlags >> nVer;
- // Eine Dummheit meinerseits korrigieren:
+ // Correcting a foolishness of mine:
if( nFlags & SBX_RESERVED )
nFlags = ( nFlags & ~SBX_RESERVED ) | SBX_GBLSEARCH;
@@ -282,7 +283,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
rStrm.Seek( nOldPos );
if( !p->LoadCompleted() )
{
- // Loeschen des Objekts
+ // Deleting of the object
SbxBaseRef aRef( p );
p = NULL;
}
@@ -290,7 +291,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
else
{
rStrm.SetError( SVSTREAM_FILEFORMAT_ERROR );
- // Loeschen des Objekts
+ // Deleting of the object
SbxBaseRef aRef( p );
p = NULL;
}
@@ -300,7 +301,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
return p;
}
-// Sbx-Objekt im Stream ueberspringen
+// Skip the Sbx-Object inside the stream
void SbxBase::Skip( SvStream& rStrm )
{
sal_uInt16 nSbxId, nFlags, nVer;
@@ -453,3 +454,4 @@ sal_Bool SbxInfo::StoreData( SvStream& rStrm ) const
return sal_True;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 7b9ffe8a1136..7efb748355cc 100644..100755
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,11 +33,6 @@
#include "sbxconv.hxx"
#include "sbxres.hxx"
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
enum SbxBOOL ImpGetBool( const SbxValues* p )
{
enum SbxBOOL nRes;
@@ -75,14 +71,10 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
}
break;
case SbxSALINT64:
+ case SbxCURRENCY:
nRes = p->nInt64 ? SbxTRUE : SbxFALSE; break;
case SbxSALUINT64:
nRes = p->uInt64 ? SbxTRUE : SbxFALSE; break;
- case SbxULONG64:
- nRes = !!p->nULong64 ? SbxTRUE : SbxFALSE; break;
- case SbxLONG64:
- case SbxCURRENCY:
- nRes = !!p->nLong64 ? SbxTRUE : SbxFALSE; break;
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
@@ -143,16 +135,11 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
nRes = ( *p->pDouble != 0 ) ? SbxTRUE : SbxFALSE; break;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
nRes = ( *p->pnInt64 ) ? SbxTRUE : SbxFALSE; break;
case SbxBYREF | SbxSALUINT64:
nRes = ( *p->puInt64 ) ? SbxTRUE : SbxFALSE; break;
- case SbxBYREF | SbxULONG64:
- nRes = !!*p->pULong64 ? SbxTRUE : SbxFALSE; break;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- nRes = !!*p->pLong64 ? SbxTRUE : SbxFALSE; break;
-
default:
SbxBase::SetError( SbxERR_CONVERSION ); nRes = SbxFALSE;
}
@@ -184,15 +171,11 @@ void ImpPutBool( SbxValues* p, sal_Int16 n )
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
case SbxSALINT64:
- p->nInt64 = n; break;
+ p->nInt64 = (sal_Int64) n; break;
case SbxSALUINT64:
- p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64.Set( (sal_uInt32)n ); break;
- case SbxLONG64:
- case SbxCURRENCY:
- p->nLong64.Set( (sal_Int32)n ); break;
+ p->uInt64 = (sal_uInt64) n; break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setInt( (sal_Int16)n );
@@ -235,18 +218,14 @@ void ImpPutBool( SbxValues* p, sal_Int16 n )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = n; break;
+ *p->pnInt64 = (sal_Int64) n; break;
case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = n; break;
- case SbxBYREF | SbxULONG64:
- p->pULong64->Set( (sal_uInt32)n ); break;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- p->pLong64->Set( (sal_Int32)n ); break;
-
+ *p->puInt64 = (sal_uInt64) n; break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index 1a9c80f1dd06..90d8ecc40a20 100644..100755
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -94,8 +95,13 @@ start:
else
nRes = (sal_uInt8) p->nULong;
break;
+ case SbxCURRENCY:
case SbxSALINT64:
- if( p->nInt64 > SbxMAXBYTE )
+ {
+ sal_Int64 val = p->nInt64;
+ if ( p->eType == SbxCURRENCY )
+ val = val / CURRENCY_FACTOR;
+ if( val > SbxMAXBYTE )
{
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE;
}
@@ -104,8 +110,9 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
}
else
- nRes = (sal_uInt8) p->nInt64;
+ nRes = (sal_uInt8) val;
break;
+ }
case SbxSALUINT64:
if( p->uInt64 > SbxMAXBYTE )
{
@@ -128,20 +135,11 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -200,7 +198,7 @@ start:
case SbxBYREF | SbxBYTE:
nRes = p->nByte; break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYREF | SbxCHAR:
aTmp.nChar = *p->pChar; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -218,11 +216,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -258,16 +252,12 @@ void ImpPutByte( SbxValues* p, sal_uInt8 n )
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxSALUINT64:
p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setByte( n );
@@ -311,19 +301,16 @@ void ImpPutByte( SbxValues* p, sal_uInt8 n )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
+ case SbxBYREF | SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index 578f0cfb8adf..ee4cb48b8efb 100644..100755
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,11 +32,6 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
xub_Unicode ImpGetChar( const SbxValues* p )
{
SbxValues aTmp;
@@ -85,8 +81,15 @@ start:
else
nRes = (xub_Unicode) p->nULong;
break;
+ case SbxCURRENCY:
case SbxSALINT64:
- if( p->nInt64 > SbxMAXCHAR )
+ {
+ sal_Int64 val = p->nInt64;
+
+ if ( p->eType == SbxCURRENCY )
+ val = val / CURRENCY_FACTOR;
+
+ if( val > SbxMAXCHAR )
{
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXCHAR;
}
@@ -95,8 +98,9 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) p->nInt64;
+ nRes = (xub_Unicode) val;
break;
+ }
case SbxSALUINT64:
if( p->uInt64 > SbxMAXCHAR )
{
@@ -119,20 +123,11 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -188,7 +183,7 @@ start:
case SbxBYREF | SbxCHAR:
nRes = *p->pChar; break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYREF | SbxBYTE:
aTmp.nByte = *p->pByte; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -206,11 +201,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -243,21 +234,17 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxSALUINT64:
p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setChar( n );
break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYTE:
aTmp.pByte = &p->nByte; goto direct;
case SbxULONG:
@@ -305,16 +292,12 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
+ case SbxBYREF | SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
@@ -322,3 +305,4 @@ start:
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 1c95591e28dd..7023be059f5e 100644..100755
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -60,7 +61,7 @@ SbxCollection::SbxCollection( const XubString& rClass )
nRemoveHash = MakeHashCode( String::CreateFromAscii( pRemove ) );
}
Initialize();
- // Fuer Zugriffe auf sich selbst
+ // For Access on itself
StartListening( GetBroadcaster(), sal_True );
}
@@ -159,7 +160,7 @@ void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
SbxObject::SFX_NOTIFY( rCst, rId1, rHint, rId2 );
}
-// Default: Argument ist Objekt
+// Default: argument is object
void SbxCollection::CollAdd( SbxArray* pPar_ )
{
@@ -175,7 +176,7 @@ void SbxCollection::CollAdd( SbxArray* pPar_ )
}
}
-// Default: Index ab 1 oder der Objektname
+// Default: index from 1 or object name
void SbxCollection::CollItem( SbxArray* pPar_ )
{
@@ -199,7 +200,7 @@ void SbxCollection::CollItem( SbxArray* pPar_ )
}
}
-// Default: Index ab 1
+// Default: index from 1
void SbxCollection::CollRemove( SbxArray* pPar_ )
{
@@ -250,7 +251,7 @@ SbxStdCollection& SbxStdCollection::operator=( const SbxStdCollection& r )
SbxStdCollection::~SbxStdCollection()
{}
-// Default: Fehler, wenn falsches Objekt
+// Default: Error, if wrong object
void SbxStdCollection::Insert( SbxVariable* p )
{
@@ -299,3 +300,4 @@ sal_Bool SbxStdCollection::StoreData( SvStream& rStrm ) const
return bRes;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx
index 61edeef3a4fa..2a11f151d862 100644..100755
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -38,7 +39,7 @@ extern SbxError ImpScan
( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
sal_Bool bAllowIntntl=sal_False, sal_Bool bOnlyIntntl=sal_False );
-// mit erweiterter Auswertung (International, "sal_True"/"sal_False")
+// with advanced evaluation (International, "TRUE"/"FALSE")
extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
// SBXINT.CXX
@@ -46,13 +47,15 @@ extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType
double ImpRound( double );
sal_Int16 ImpGetInteger( const SbxValues* );
void ImpPutInteger( SbxValues*, sal_Int16 );
+
sal_Int64 ImpGetInt64( const SbxValues* );
void ImpPutInt64( SbxValues*, sal_Int64 );
sal_uInt64 ImpGetUInt64( const SbxValues* );
void ImpPutUInt64( SbxValues*, sal_uInt64 );
-sal_Int64 ImpDoubleToSalInt64( double d );
+sal_Int64 ImpDoubleToSalInt64 ( double d );
sal_uInt64 ImpDoubleToSalUInt64( double d );
+double ImpSalInt64ToDouble ( sal_Int64 n );
double ImpSalUInt64ToDouble( sal_uInt64 n );
// SBXLNG.CXX
@@ -70,37 +73,18 @@ void ImpPutSingle( SbxValues*, float );
double ImpGetDouble( const SbxValues* );
void ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False );
-#if FALSE
-// SBX64.CXX
-
-SbxINT64 ImpGetINT64( const SbxValues* );
-void ImpPutINT64( SbxValues*, const SbxINT64& );
-SbxUINT64 ImpGetUINT64( const SbxValues* );
-void ImpPutUINT64( SbxValues*, const SbxUINT64& );
-#endif
-
// SBXCURR.CXX
-SbxUINT64 ImpDoubleToUINT64( double );
-double ImpUINT64ToDouble( const SbxUINT64& );
-SbxINT64 ImpDoubleToINT64( double );
-double ImpINT64ToDouble( const SbxINT64& );
+sal_Int64 ImpGetCurrency( const SbxValues* );
+void ImpPutCurrency( SbxValues*, const sal_Int64 );
-#if TRUE
-sal_Int32 ImpGetCurrLong( const SbxValues* );
-void ImpPutCurrLong( SbxValues*, sal_Int32 );
-sal_Int32 ImpDoubleToCurrLong( double );
-double ImpCurrLongToDouble( sal_Int32 );
-#endif
+inline sal_Int64 ImpDoubleToCurrency( double d )
+ { if (d > 0) return (sal_Int64)( d * CURRENCY_FACTOR + 0.5);
+ else return (sal_Int64)( d * CURRENCY_FACTOR - 0.5);
+ }
-SbxINT64 ImpGetCurrency( const SbxValues* );
-void ImpPutCurrency( SbxValues*, const SbxINT64& );
-inline
-SbxINT64 ImpDoubleToCurrency( double d )
- { return ImpDoubleToINT64( d * CURRENCY_FACTOR ); }
-inline
-double ImpCurrencyToDouble( const SbxINT64 &r )
- { return ImpINT64ToDouble( r ) / CURRENCY_FACTOR; }
+inline double ImpCurrencyToDouble( const sal_Int64 r )
+ { return (double)r / (double)CURRENCY_FACTOR; }
// SBXDEC.CXX
@@ -123,7 +107,7 @@ void ImpPutString( SbxValues*, const ::rtl::OUString* );
// SBXCHAR.CXX
sal_Unicode ImpGetChar( const SbxValues* );
-void ImpPutChar( SbxValues*, sal_Unicode );
+void ImpPutChar( SbxValues*, sal_Unicode );
// SBXBYTE.CXX
sal_uInt8 ImpGetByte( const SbxValues* );
@@ -144,8 +128,10 @@ void ImpPutULong( SbxValues*, sal_uInt32 );
enum SbxBOOL ImpGetBool( const SbxValues* );
void ImpPutBool( SbxValues*, sal_Int16 );
-// ByteArry <--> String
+// ByteArray <--> String
SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
::rtl::OUString ByteArrayToString(SbxArray* pArr);
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 5b6e631d174f..0ea500bb0ba2 100644..100755
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,101 +29,305 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#include <basic/sbx.hxx>
#include <tools/errcode.hxx>
+#include <vcl/svapp.hxx> // for SvtSysLocale
-#define _TLBIGINT_INT64
-#include <tools/bigint.hxx>
-
+#include <basic/sbx.hxx>
#include <basic/sbxvar.hxx>
#include "sbxconv.hxx"
-static ::rtl::OUString ImpCurrencyToString( const SbxINT64& );
-static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& );
-SbxINT64 ImpGetCurrency( const SbxValues* p )
+static rtl::OUString ImpCurrencyToString( const sal_Int64 &rVal )
{
- SbxValues aTmp;
- SbxINT64 nRes;
+ bool isNeg = ( rVal < 0 );
+ sal_Int64 absVal = isNeg ? -rVal : rVal;
+
+ SvtSysLocale aSysLocale;
+ sal_Unicode cDecimalSep = '.';
+#if MAYBEFUTURE
+ sal_Unicode cThousandSep = ',';
+ const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
+ cDecimalSep = rData.getNumDecimalSep().GetBuffer()[0];
+ cThousandSep = rData.getNumThousandSep().GetBuffer()[0];
+#endif
+
+ rtl::OUString aAbsStr = rtl::OUString::valueOf( absVal );
+ rtl::OUStringBuffer aBuf;
+
+ sal_Int32 initialLen = aAbsStr.getLength();
+
+ bool bLessThanOne = false;
+ if ( initialLen <= 4 ) // if less the 1
+ bLessThanOne = true;
+
+ sal_Int32 nCapacity = 6; // minimum e.g. 0.0000
+
+ if ( !bLessThanOne )
+ {
+ nCapacity = initialLen + 1;
+#if MAYBEFUTURE
+ if ( initialLen > 5 )
+ {
+ sal_Int32 nThouSeperators = ( initialLen - 5 ) / 3;
+ nCapacity += nThouSeperators;
+ }
+#endif
+ }
+
+ if ( isNeg )
+ ++nCapacity;
+
+ aBuf.setLength( nCapacity );
+
+
+ sal_Int32 nDigitCount = 0;
+ sal_Int32 nInsertIndex = nCapacity - 1;
+ sal_Int32 nEndIndex = isNeg ? 1 : 0;
+
+ for ( sal_Int32 charCpyIndex = aAbsStr.getLength() - 1; nInsertIndex >= nEndIndex; ++nDigitCount )
+ {
+ if ( nDigitCount == 4 )
+ aBuf.setCharAt( nInsertIndex--, cDecimalSep );
+#if MAYBEFUTURE
+ if ( nDigitCount > 4 && ! ( ( nDigitCount - 4 ) % 3) )
+ aBuf.setCharAt( nInsertIndex--, cThousandSep );
+#endif
+ if ( nDigitCount < initialLen )
+ aBuf.setCharAt( nInsertIndex--, aAbsStr[ charCpyIndex-- ] );
+ else
+ // Handle leading 0's to right of decimal point
+ // Note: in VBA the stringification is a little more complex
+ // but more natural as only the necessary digits
+ // to the right of the decimal places are displayed
+ // It would be great to conditionally be able to display like that too
+ //
+ // Val OOo (Cur) VBA (Cur)
+ // --- --------- ---------
+ // 0 0.0000 0
+ // 0.1 0.1000 0.1
+
+ aBuf.setCharAt( nInsertIndex--, (sal_Unicode)'0' );
+ }
+ if ( isNeg )
+ aBuf.setCharAt( nInsertIndex, (sal_Unicode)'-' );
+
+ aAbsStr = aBuf.makeStringAndClear();
+ return aAbsStr;
+}
+
+
+static sal_Int64 ImpStringToCurrency( const rtl::OUString &rStr )
+{
+
+ sal_Int32 nFractDigit = 4;
+
+ SvtSysLocale aSysLocale;
+ sal_Unicode cDeciPnt = sal_Unicode('.');
+ sal_Unicode c1000Sep = sal_Unicode(',');
+
+#if MAYBEFUTURE
+ const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
+ sal_Unicode cLocaleDeciPnt = rData.getNumDecimalSep().GetBuffer()[0];
+ sal_Unicode cLocale1000Sep = rData.getNumThousandSep().GetBuffer()[0];
+
+ // score each set of separators (Locale and Basic) on total number of matches
+ // if one set has more matches use that set
+ // if tied use the set with the only or rightmost decimal separator match
+ // currency is fixed pt system: usually expect the decimal pt, 1000sep may occur
+ sal_Int32 LocaleScore = 0;
+ sal_Int32 LocaleLastDeci = -1;
+ sal_Int32 LOBasicScore = 0;
+ sal_Int32 LOBasicLastDeci = -1;
+
+ for( int idx=0; idx<rStr.getLength(); idx++ )
+ {
+ if ( *(p+idx) == cLocaleDeciPnt )
+ {
+ LocaleScore++;
+ LocaleLastDeci = idx;
+ }
+ if ( *(p+idx) == cLocale1000Sep )
+ LocaleScore++;
+
+ if ( *(p+idx) == cDeciPnt )
+ {
+ LOBasicScore++;
+ LOBasicLastDeci = idx;
+ }
+ if ( *(p+idx) == c1000Sep )
+ LOBasicScore++;
+ }
+ if ( ( LocaleScore > LOBasicScore )
+ ||( LocaleScore = LOBasicScore && LocaleLastDeci > LOBasicLastDeci ) )
+ {
+ cDeciPnt = cLocaleDeciPnt;
+ c1000Sep = cLocale1000Sep;
+ }
+#endif
+
+ // lets use the existing string number conversions
+ // there is a performance impact here ( multiple string copies )
+ // but better I think than a home brewed string parser, if we need a parser
+ // we should share some existing ( possibly from calc is there a currency
+ // conversion there ? #TODO check )
+
+ rtl::OUString sTmp( rStr.trim() );
+ const sal_Unicode* p = sTmp.getStr();
+
+ // normalise string number by removeing thousands & decimal point seperators
+ rtl::OUStringBuffer sNormalisedNumString( sTmp.getLength() + nFractDigit );
+
+ if ( *p == '-' || *p == '+' )
+ sNormalisedNumString.append( *p );
+
+ while ( ( *p >= '0' && *p <= '9' ) )
+ {
+ sNormalisedNumString.append( *p++ );
+ // #TODO in vba mode set runtime error when a space ( or other )
+ // illegal character is found
+ if( *p == c1000Sep )
+ p++;
+ }
+
+ bool bRoundUp = false;
+
+ if( *p == cDeciPnt )
+ {
+ p++;
+ while( nFractDigit && *p >= '0' && *p <= '9' )
+ {
+ sNormalisedNumString.append( *p++ );
+ nFractDigit--;
+ }
+ // Consume trailing content
+ if ( p != NULL )
+ {
+ // Round up if necessary
+ if( *p >= '5' && *p <= '9' )
+ bRoundUp = true;
+ while( *p >= '0' && *p <= '9' )
+ p++;
+ }
+
+ }
+ // can we raise error here ? ( previous behaviour was more forgiving )
+ // so... not sure that could bread existing code, lets see if anyone
+ // complains.
+
+ if ( p != sTmp.getStr() + sTmp.getLength() )
+ SbxBase::SetError( SbxERR_CONVERSION );
+ while( nFractDigit )
+ {
+ sNormalisedNumString.append( sal_Unicode('0') );
+ nFractDigit--;
+ }
+
+ sal_Int64 result = sNormalisedNumString.makeStringAndClear().toInt64();
+
+ if ( bRoundUp )
+ ++result;
+ return result;
+}
+
+
+sal_Int64 ImpGetCurrency( const SbxValues* p )
+{
+ SbxValues aTmp;
+ sal_Int64 nRes;
start:
switch( +p->eType )
{
+ case SbxERROR:
case SbxNULL:
SbxBase::SetError( SbxERR_CONVERSION );
+ nRes = 0; break;
case SbxEMPTY:
- nRes.SetNull(); break;
- case SbxCHAR:
- nRes = ImpDoubleToCurrency( (double)p->nChar ); break;
+ nRes = 0; break;
+ case SbxCURRENCY:
+ nRes = p->nInt64; break;
case SbxBYTE:
- nRes = ImpDoubleToCurrency( (double)p->nByte ); break;
- case SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nByte);
+ break;
+ case SbxCHAR:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->pChar);
+ break;
case SbxBOOL:
- nRes = ImpDoubleToCurrency( (double)p->nInteger ); break;
- case SbxERROR:
+ case SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nInteger);
+ break;
case SbxUSHORT:
- nRes = ImpDoubleToCurrency( (double)p->nUShort ); break;
- case SbxCURRENCY:
- nRes = p->nLong64; break;
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nUShort);
+ break;
case SbxLONG:
- nRes = ImpDoubleToCurrency( (double)p->nLong );
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nLong);
break;
case SbxULONG:
- nRes = ImpDoubleToCurrency( (double)p->nULong );
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nULong);
break;
+
case SbxSALINT64:
- nRes = ImpDoubleToCurrency( (double)p->nInt64 );
- break;
+ {
+ nRes = p->nInt64 * CURRENCY_FACTOR; break;
+ if ( nRes > SbxMAXSALINT64 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSALINT64;
+ }
+ }
case SbxSALUINT64:
- nRes = ImpDoubleToCurrency( ImpSalUInt64ToDouble( p->uInt64 ) );
- break;
- case SbxSINGLE:
- if( p->nSingle > SbxMAXCURR )
+ nRes = p->nInt64 * CURRENCY_FACTOR; break;
+ if ( nRes > SbxMAXSALINT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMax();
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSALINT64;
}
- else if( p->nSingle < SbxMINCURR )
+ else if ( nRes < SbxMINSALINT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMin();
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINSALINT64;
}
- else
- nRes = ImpDoubleToCurrency( (double)p->nSingle );
break;
- case SbxDATE:
- case SbxDOUBLE:
- if( p->nDouble > SbxMAXCURR )
+//TODO: bring back SbxINT64 types here for limits -1 with flag value at SAL_MAX/MIN
+ case SbxSINGLE:
+ if( p->nSingle * CURRENCY_FACTOR + 0.5 > (float)SAL_MAX_INT64
+ || p->nSingle * CURRENCY_FACTOR - 0.5 < (float)SAL_MIN_INT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMax();
+ nRes = SAL_MAX_INT64;
+ if( p->nSingle * CURRENCY_FACTOR - 0.5 < (float)SAL_MIN_INT64 )
+ nRes = SAL_MIN_INT64;
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ break;
}
- else if( p->nDouble < SbxMINCURR )
+ nRes = ImpDoubleToCurrency( (double)p->nSingle );
+ break;
+
+ case SbxDATE:
+ case SbxDOUBLE:
+ if( p->nDouble * CURRENCY_FACTOR + 0.5 > (double)SAL_MAX_INT64
+ || p->nDouble * CURRENCY_FACTOR - 0.5 < (double)SAL_MIN_INT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMin();
+ nRes = SAL_MAX_INT64;
+ if( p->nDouble * CURRENCY_FACTOR - 0.5 < (double)SAL_MIN_INT64 )
+ nRes = SAL_MIN_INT64;
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ break;
}
- else
- nRes = ImpDoubleToCurrency( p->nDouble );
+ nRes = ImpDoubleToCurrency( p->nDouble );
break;
+
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double d = 0.0;
if( p->pDecimal )
p->pDecimal->getDouble( d );
- if( d > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMax();
- }
- else if( d < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMin();
- }
- else
- nRes = ImpDoubleToCurrency( d );
+ nRes = ImpDoubleToCurrency( d );
break;
}
+
+
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pOUString )
- nRes.SetNull();
+ nRes=0;
else
nRes = ImpStringToCurrency( *p->pOUString );
break;
@@ -133,25 +338,28 @@ start:
nRes = pVal->GetCurrency();
else
{
- SbxBase::SetError( SbxERR_NO_OBJECT ); nRes.SetNull();
+ SbxBase::SetError( SbxERR_NO_OBJECT );
+ nRes=0;
}
break;
}
case SbxBYREF | SbxCHAR:
- nRes = ImpDoubleToCurrency( (double)*p->pChar ); break;
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pChar);
+ break;
case SbxBYREF | SbxBYTE:
- nRes = ImpDoubleToCurrency( (double)*p->pByte ); break;
- case SbxBYREF | SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pByte);
+ break;
case SbxBYREF | SbxBOOL:
- nRes = ImpDoubleToCurrency( (double)*p->pInteger ); break;
+ case SbxBYREF | SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pInteger);
+ break;
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
- nRes = ImpDoubleToCurrency( (double)*p->pUShort ); break;
- case SbxBYREF | SbxCURRENCY:
- nRes = *p->pLong64; break;
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pUShort);
+ break;
- // ab hier muss getestet werden
+ // from here on had to be tested
case SbxBYREF | SbxLONG:
aTmp.nLong = *p->pLong; goto ref;
case SbxBYREF | SbxULONG:
@@ -161,28 +369,30 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
aTmp.uInt64 = *p->puInt64; goto ref;
ref:
- aTmp.eType = SbxDataType( p->eType & 0x0FFF );
+ aTmp.eType = SbxDataType( p->eType & ~SbxBYREF );
p = &aTmp; goto start;
default:
- SbxBase::SetError( SbxERR_CONVERSION ); nRes.SetNull();
+ SbxBase::SetError( SbxERR_CONVERSION );
+ nRes=0;
}
return nRes;
}
-void ImpPutCurrency( SbxValues* p, const SbxINT64 &r )
+
+void ImpPutCurrency( SbxValues* p, const sal_Int64 r )
{
- double dVal = ImpCurrencyToDouble( r );
SbxValues aTmp;
start:
switch( +p->eType )
{
- // Hier sind Tests notwendig
+ // Here are tests necessary
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -201,23 +411,25 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // from here no longer
case SbxSINGLE:
- p->nSingle = (float)dVal; break;
+ p->nSingle = (float)( r / CURRENCY_FACTOR ); break;
case SbxDATE:
case SbxDOUBLE:
- p->nDouble = dVal; break;
- case SbxSALINT64:
- p->nInt64 = ImpDoubleToSalInt64( dVal ); break;
+ p->nDouble = ImpCurrencyToDouble( r ); break;
case SbxSALUINT64:
- p->uInt64 = ImpDoubleToSalUInt64( dVal ); break;
+ p->uInt64 = r / CURRENCY_FACTOR; break;
+ case SbxSALINT64:
+ p->nInt64 = r / CURRENCY_FACTOR; break;
+
case SbxCURRENCY:
- p->nLong64 = r; break;
+ p->nInt64 = r; break;
+
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
SbxDecimal* pDec = ImpCreateDecimal( p );
- if( !pDec->setDouble( dVal ) )
+ if( !pDec->setDouble( ImpCurrencyToDouble( r ) / CURRENCY_FACTOR ) )
SbxBase::SetError( SbxERR_OVERFLOW );
break;
}
@@ -225,7 +437,7 @@ start:
case SbxSTRING:
case SbxLPSTR:
if( !p->pOUString )
- p->pOUString = new ::rtl::OUString;
+ p->pOUString = new rtl::OUString;
*p->pOUString = ImpCurrencyToString( r );
break;
@@ -239,157 +451,100 @@ start:
break;
}
case SbxBYREF | SbxCHAR:
- if( dVal > SbxMAXCHAR )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXCHAR )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXCHAR;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXCHAR;
}
- else if( dVal < SbxMINCHAR )
+ else if( val < SbxMINCHAR )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMINCHAR;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMINCHAR;
}
- *p->pChar = (xub_Unicode) dVal; break;
+ *p->pChar = (sal_Unicode) val; break;
+ }
case SbxBYREF | SbxBYTE:
- if( dVal > SbxMAXBYTE )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXBYTE )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXBYTE;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXBYTE;
}
- else if( dVal < 0 )
+ else if( val < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = 0;
}
- *p->pByte = (sal_uInt8) dVal; break;
+ *p->pByte = (sal_uInt8) val; break;
+ }
case SbxBYREF | SbxINTEGER:
case SbxBYREF | SbxBOOL:
- if( dVal > SbxMAXINT )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( r > SbxMAXINT )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXINT;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXINT;
}
- else if( dVal < SbxMININT )
+ else if( r < SbxMININT )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMININT;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMININT;
}
- *p->pInteger = (sal_Int16) dVal; break;
+ *p->pInteger = (sal_uInt16) val; break;
+ }
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
- if( dVal > SbxMAXUINT )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXUINT )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXUINT;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXUINT;
}
- else if( dVal < 0 )
+ else if( val < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = 0;
}
- *p->pUShort = (sal_uInt16) dVal; break;
+ *p->pUShort = (sal_uInt16) val; break;
+ }
case SbxBYREF | SbxLONG:
- if( dVal > SbxMAXLNG )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXLNG )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXLNG;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXLNG;
}
- else if( dVal < SbxMINLNG )
+ else if( val < SbxMINLNG )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMINLNG;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMINLNG;
}
- *p->pLong = (sal_Int32) dVal; break;
+ *p->pLong = (sal_Int32) val; break;
+ }
case SbxBYREF | SbxULONG:
- if( dVal > SbxMAXULNG )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXULNG )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXULNG;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXULNG;
}
- else if( dVal < 0 )
+ else if( val < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = 0;
}
- *p->pULong = (sal_uInt32) dVal; break;
+ *p->pULong = (sal_uInt32) val; break;
+ break;
+ }
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = r; break;
case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = ImpDoubleToSalInt64( dVal ); break;
+ *p->pnInt64 = r / CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = ImpDoubleToSalUInt64( dVal ); break;
+ *p->puInt64 = (sal_uInt64)r / CURRENCY_FACTOR; break;
case SbxBYREF | SbxSINGLE:
- *p->pSingle = (float) dVal; break;
+ p->nSingle = (float)( r / CURRENCY_FACTOR ); break;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
- *p->pDouble = (double) dVal; break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = r; break;
-
+ *p->pDouble = ImpCurrencyToDouble( r ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
-// Hilfs-Funktionen zur Wandlung
-
-static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r )
-{
- BigInt a10000 = 10000;
-
- //return GetpApp()->GetAppInternational().GetCurr( BigInt( r ), 4 );
- BigInt aInt( r );
- aInt.Abs();
- BigInt aFrac = aInt;
- aInt /= a10000;
- aFrac %= a10000;
- aFrac += a10000;
-
- ::rtl::OUString aString;
- if( r.nHigh < 0 )
- aString = ::rtl::OUString( (sal_Unicode)'-' );
- aString += aInt.GetString();
- aString += ::rtl::OUString( (sal_Unicode)'.' );
- aString += aFrac.GetString().GetBuffer()+1;
- return aString;
-}
-
-static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r )
-{
- int nDec = 4;
- String aStr;
- const sal_Unicode* p = r.getStr();
-
- if( *p == '-' )
- aStr += *p++;
-
- while( *p >= '0' && *p <= '9' ) {
- aStr += *p++;
- if( *p == ',' )
- p++;
- }
-
- if( *p == '.' ) {
- p++;
- while( nDec && *p >= '0' && *p <= '9' ) {
- aStr += *p++;
- nDec--;
- }
- }
- while( nDec ) {
- aStr += '0';
- nDec--;
- }
-
- BigInt aBig( aStr );
- SbxINT64 nRes;
- aBig.INT64( &nRes );
- return nRes;
-}
-
-double ImpINT64ToDouble( const SbxINT64 &r )
-{ return (double)r.nHigh*(double)4294967296.0 + (double)r.nLow; }
-
-SbxINT64 ImpDoubleToINT64( double d )
-{
- SbxINT64 nRes;
- nRes.Set( d );
- return nRes;
-}
-
-double ImpUINT64ToDouble( const SbxUINT64 &r )
-{ return (double)r.nHigh*(double)4294967296.0 + (double)r.nLow; }
-
-SbxUINT64 ImpDoubleToUINT64( double d )
-{
- SbxUINT64 nRes;
- nRes.Set( d );
- return nRes;
-}
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index 1d0b81ed98f6..804506c18215 100644..100755
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -66,12 +67,8 @@ double ImpGetDate( const SbxValues* p )
case SbxDATE:
case SbxDOUBLE:
nRes = p->nDouble; break;
- case SbxULONG64:
- nRes = ImpUINT64ToDouble( p->nULong64 ); break;
- case SbxLONG64:
- nRes = ImpINT64ToDouble( p->nLong64 ); break;
case SbxCURRENCY:
- nRes = ImpCurrencyToDouble( p->nLong64 ); break;
+ nRes = ImpCurrencyToDouble( p->nInt64 ); break;
case SbxSALINT64:
nRes = static_cast< double >(p->nInt64); break;
case SbxSALUINT64:
@@ -101,13 +98,13 @@ double ImpGetDate( const SbxValues* p )
xub_StrLen nCheckPos = 0;
short nType = 127;
- // Standard-Vorlagen des Formatters haben nur zweistellige
- // Jahreszahl. Deshalb eigenes Format registrieren
+ // Default templates of the formatter have only two-digit
+ // date. Therefore register an own format.
- // HACK, da der Numberformatter in PutandConvertEntry die Platzhalter
- // fuer Monat, Tag, Jahr nicht entsprechend der Systemeinstellung
- // austauscht. Problem: Print Year(Date) unter engl. BS
- // siehe auch basic\source\runtime\runtime.cxx
+ // HACK, because the number formatter in PutandConvertEntry replace the wildcard
+ // for month, day, year not according to the configuration.
+ // Problem: Print Year(Date) under Engl. OS
+ // quod vide basic\source\runtime\runtime.cxx
SvtSysLocale aSysLocale;
DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
@@ -173,12 +170,8 @@ double ImpGetDate( const SbxValues* p )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
nRes = *p->pDouble; break;
- case SbxBYREF | SbxULONG64:
- nRes = ImpUINT64ToDouble( *p->pULong64 ); break;
- case SbxBYREF | SbxLONG64:
- nRes = ImpINT64ToDouble( *p->pLong64 ); break;
case SbxBYREF | SbxCURRENCY:
- nRes = ImpCurrencyToDouble( *p->pLong64 ); break;
+ nRes = ImpCurrencyToDouble( *p->pnInt64 ); break;
case SbxBYREF | SbxSALINT64:
nRes = static_cast< double >(*p->pnInt64); break;
case SbxBYREF | SbxSALUINT64:
@@ -201,7 +194,7 @@ start:
case SbxDOUBLE:
p->nDouble = n; break;
- // ab hier wird getestet
+ // from here will be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -218,11 +211,7 @@ start:
aTmp.pUShort = &p->nUShort; goto direct;
case SbxSINGLE:
aTmp.pSingle = &p->nSingle; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
@@ -260,7 +249,7 @@ start:
SvtSysLocale aSysLocale;
DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
String aStr;
- // ist der ganzzahlige Teil 0, wollen wir kein Jahr!
+ // if the whole-number part is 0, we want no year!
if( n <= -1.0 || n >= 1.0 )
{
// Time only if != 00:00:00
@@ -397,10 +386,11 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index efbad5521f3b..c4bbbe46c4ec 100644..100755
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,7 +62,7 @@ double ImpGetDouble( const SbxValues* p )
case SbxDOUBLE:
nRes = p->nDouble; break;
case SbxCURRENCY:
- nRes = ImpCurrencyToDouble( p->nLong64 ); break;
+ nRes = ImpCurrencyToDouble( p->nInt64 ); break;
case SbxSALINT64:
nRes = static_cast< double >(p->nInt64); break;
case SbxSALUINT64:
@@ -128,7 +129,7 @@ double ImpGetDouble( const SbxValues* p )
case SbxBYREF | SbxDOUBLE:
nRes = *p->pDouble; break;
case SbxBYREF | SbxCURRENCY:
- nRes = ImpCurrencyToDouble( *p->pLong64 ); break;
+ nRes = ImpCurrencyToDouble( *p->pnInt64 ); break;
case SbxBYREF | SbxSALINT64:
nRes = static_cast< double >(*p->pnInt64); break;
case SbxBYREF | SbxSALUINT64:
@@ -146,7 +147,7 @@ void ImpPutDouble( SbxValues* p, double n, sal_Bool bCoreString )
start:
switch( +p->eType )
{
- // Hier sind Tests notwendig
+ // Here are tests necessary
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -155,7 +156,6 @@ start:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
case SbxLONG:
- case SbxCURRENCY:
aTmp.pLong = &p->nLong; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
@@ -176,7 +176,19 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ case SbxCURRENCY:
+ if( n > SbxMAXCURR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCURR;
+ }
+ else if( n < SbxMINCURR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
+ }
+ p->nInt64 = ImpDoubleToCurrency( n );
+ break;
+
+ // from here on no longer
case SbxSALINT64:
p->nInt64 = ImpDoubleToSalInt64( n ); break;
case SbxSALUINT64:
@@ -297,10 +309,11 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 3a0e65c142e2..91553270736a 100644..100755
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,14 +36,11 @@
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
-// int GnDecCounter = 0;
-
// Implementation SbxDecimal
SbxDecimal::SbxDecimal( void )
{
setInt( 0 );
mnRefCount = 0;
- // GnDecCounter++;
}
SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
@@ -53,7 +51,6 @@ SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
(void)rDec;
#endif
mnRefCount = 0;
- // GnDecCounter++;
}
SbxDecimal::SbxDecimal
@@ -493,38 +490,32 @@ start:
if( !pnDecRes->setSingle( p->nSingle ) )
SbxBase::SetError( SbxERR_OVERFLOW );
break;
+ case SbxCURRENCY:
+ {
+ if( !pnDecRes->setDouble( ImpCurrencyToDouble( p->nInt64 ) ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ break;
+ }
case SbxSALINT64:
{
- double d = (double)p->nInt64;
- pnDecRes->setDouble( d );
+ if( !pnDecRes->setDouble( (double)p->nInt64 ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
break;
}
case SbxSALUINT64:
{
- double d = ImpSalUInt64ToDouble( p->uInt64 );
- pnDecRes->setDouble( d );
+ if( !pnDecRes->setDouble( (double)p->uInt64 ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
break;
}
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
- {
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else
- dVal = p->nDouble;
-
+ {
+ double dVal = p->nDouble;
if( !pnDecRes->setDouble( dVal ) )
SbxBase::SetError( SbxERR_OVERFLOW );
break;
- }
+ }
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
@@ -557,17 +548,13 @@ start:
case SbxBYREF | SbxUSHORT:
pnDecRes->setUShort( *p->pUShort ); break;
- // ab hier muss getestet werden
+ // from here on had to be tested
case SbxBYREF | SbxSINGLE:
aTmp.nSingle = *p->pSingle; goto ref;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -597,7 +584,7 @@ void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec )
start:
switch( +p->eType )
{
- // hier muss getestet werden
+ // here had to be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -607,30 +594,28 @@ start:
case SbxERROR:
case SbxUSHORT:
aTmp.pUShort = &p->nUShort; goto direct;
- case SbxSALUINT64:
- aTmp.puInt64 = &p->uInt64; goto direct;
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
case SbxLONG:
aTmp.pLong = &p->nLong; goto direct;
+ case SbxCURRENCY:
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
+ case SbxSALUINT64:
+ aTmp.puInt64 = &p->uInt64; goto direct;
+
direct:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // from here on no longer
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
if( pDec != p->pDecimal )
{
releaseDecimalPtr( p->pDecimal );
- // if( p->pDecimal )
- // p->pDecimal->ReleaseRef();
p->pDecimal = pDec;
if( pDec )
pDec->addRef();
@@ -652,20 +637,6 @@ start:
p->nDouble = d;
break;
}
- case SbxULONG64:
- {
- double d;
- pDec->getDouble( d );
- p->nULong64 = ImpDoubleToUINT64( d );
- break;
- }
- case SbxLONG64:
- {
- double d;
- pDec->getDouble( d );
- p->nLong64 = ImpDoubleToINT64( d );
- break;
- }
case SbxLPSTR:
case SbxSTRING:
@@ -730,6 +701,12 @@ start:
*p->pULong = 0;
}
break;
+ case SbxBYREF | SbxCURRENCY:
+ double d;
+ if( !pDec->getDouble( d ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ *p->pnInt64 = ImpDoubleToCurrency( d );
+ break;
case SbxBYREF | SbxSALINT64:
{
double d;
@@ -755,7 +732,6 @@ start:
*p->pSingle = 0;
}
break;
- // *p->pSingle = (float) n; break;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
if( !pDec->getDouble( *p->pDouble ) )
@@ -764,28 +740,6 @@ start:
*p->pDouble = 0;
}
break;
- case SbxBYREF | SbxULONG64:
- {
- double d;
- pDec->getDouble( d );
- *p->pULong64 = ImpDoubleToUINT64( d );
- break;
- }
- case SbxBYREF | SbxLONG64:
- {
- double d;
- pDec->getDouble( d );
- *p->pLong64 = ImpDoubleToINT64( d );
- break;
- }
- case SbxBYREF | SbxCURRENCY:
- {
- double d;
- pDec->getDouble( d );
- *p->pLong64 = ImpDoubleToCurrency( d );
- break;
- }
-
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
@@ -795,3 +749,4 @@ start:
#endif
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx
index 6b8cd7e31336..c783010f0ed2 100644..100755
--- a/basic/source/sbx/sbxdec.hxx
+++ b/basic/source/sbx/sbxdec.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,7 @@
#undef WB_LEFT
#undef WB_RIGHT
-#include <tools/prewin.h>
+#include <prewin.h>
} // close extern "C" {
#ifndef __MINGW32__
@@ -42,7 +43,7 @@
#include <oleauto.h>
extern "C" { // reopen extern "C" {
-#include <tools/postwin.h>
+#include <postwin.h>
#endif
#endif
@@ -120,3 +121,4 @@ public:
friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 9b43a94873f0..f12ffc0bf817 100644..100755
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
#include <tools/errcode.hxx>
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <basic/sbx.hxx>
@@ -68,13 +67,13 @@ static const xub_Unicode* SkipWhitespace( const xub_Unicode* p )
return p;
}
-// Scannen eines Symbol. Das Symbol wird in rSym eingetragen, der Returnwert
-// ist die neue Scanposition. Bei Fehlern ist das Symbol leer.
+// Scanning of a symbol. The symbol were inserted in rSym, the return value
+// is the new scan position. The symbol is at errors empty.
static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const SbxSimpleCharClass& rCharClass )
{
sal_uInt16 nLen = 0;
- // Haben wir ein Sondersymbol?
+ // Did we have a nonstandard symbol?
if( *p == '[' )
{
rSym = ++p;
@@ -84,16 +83,16 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
}
else
{
- // Ein Symbol muss mit einem Buchstaben oder einem Underline beginnen
+ // A symbol had to begin with a alphabetic character or an underline
if( !rCharClass.isAlpha( *p ) && *p != '_' )
SbxBase::SetError( SbxERR_SYNTAX );
else
{
rSym = p;
- // Dann darf es Buchstaben, Zahlen oder Underlines enthalten
+ // The it can contain alphabetic characters, numbers or underlines
while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
p++, nLen++;
- // BASIC-Standard-Suffixe werden ignoriert
+ // BASIC-Standard-Suffixes were ignored
if( *p && (*p == '%' || *p == '&' || *p == '!' || *p == '#' || *p == '$' ) )
p++;
}
@@ -102,7 +101,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
return p;
}
-// Qualifizierter Name. Element.Element....
+// Qualified name. Element.Element....
static SbxVariable* QualifiedName
( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, SbxClassType t )
@@ -113,21 +112,21 @@ static SbxVariable* QualifiedName
const xub_Unicode* p = SkipWhitespace( *ppBuf );
if( aCharClass.isAlpha( *p ) || *p == '_' || *p == '[' )
{
- // Element einlesen
+ // Read in the element
refVar = Element( pObj, pGbl, &p, t, aCharClass );
while( refVar.Is() && (*p == '.' || *p == '!') )
{
- // Es folgt noch ein Objektelement. Das aktuelle Element
- // muss also ein SBX-Objekt sein oder liefern!
+ // It follows still an objectelement. The current element
+ // had to be a SBX-Object or had to deliver such an object!
pObj = PTR_CAST(SbxObject,(SbxVariable*) refVar);
if( !pObj )
- // Dann muss es ein Objekt liefern
+ // Then it had to deliver an object
pObj = PTR_CAST(SbxObject,refVar->GetObject());
refVar.Clear();
if( !pObj )
break;
p++;
- // Und das naechste Element bitte
+ // And the next element please
refVar = Element( pObj, pGbl, &p, t, aCharClass );
}
}
@@ -139,8 +138,8 @@ static SbxVariable* QualifiedName
return refVar;
}
-// Einlesen eines Operanden. Dies kann eine Zahl, ein String oder
-// eine Funktion (mit optionalen Parametern) sein.
+// Read in of an operand. This could be a number, a string or
+// a function (with optional parameters).
static SbxVariable* Operand
( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, sal_Bool bVar )
@@ -154,7 +153,7 @@ static SbxVariable* Operand
|| *p == '-'
|| *p == '&' ) )
{
- // Eine Zahl kann direkt eingescant werden!
+ // A number could be scanned in directly!
sal_uInt16 nLen;
if( !refVar->Scan( XubString( p ), &nLen ) )
refVar.Clear();
@@ -163,15 +162,15 @@ static SbxVariable* Operand
}
else if( !bVar && *p == '"' )
{
- // Ein String
+ // A string
XubString aString;
p++;
for( ;; )
{
- // Das ist wohl ein Fehler
+ // This is perhaps an error
if( !*p )
return NULL;
- // Doppelte Quotes sind OK
+ // Double quotes are OK
if( *p == '"' )
if( *++p != '"' )
break;
@@ -187,8 +186,8 @@ static SbxVariable* Operand
return refVar;
}
-// Einlesen einer einfachen Term. Die Operatoren +, -, * und /
-// werden unterstuetzt.
+// Read in of a simple term. The operands +, -, * and /
+// are supported.
static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf )
{
@@ -201,7 +200,7 @@ static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
SbxVariableRef refVar2( Operand( pObj, pGbl, &p, sal_False ) );
if( refVar2.Is() )
{
- // temporaere Variable!
+ // temporary variable!
SbxVariable* pVar = refVar;
pVar = new SbxVariable( *pVar );
refVar = pVar;
@@ -263,7 +262,7 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
{
if( *p == '=' )
{
- // Nur auf Props zuweisen!
+ // Assign only onto properties!
if( refVar->GetClass() != SbxCLASS_PROPERTY )
{
SbxBase::SetError( SbxERR_BAD_ACTION );
@@ -283,7 +282,7 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
}
}
else
- // Einfacher Aufruf: einmal aktivieren
+ // Simple call: once activating
refVar->Broadcast( SBX_HINT_DATAWANTED );
}
*ppBuf = p;
@@ -292,9 +291,9 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
return refVar;
}
-// Einlesen eines Elements. Dies ist ein Symbol, optional gefolgt
-// von einer Parameterliste. Das Symbol wird im angegebenen Objekt
-// gesucht und die Parameterliste wird ggf. angefuegt.
+// Read in of an element. This is a symbol, optional followed
+// by a parameter list. The symbol will be searched in the
+// specified object and the parameter list will be attached if necessary.
static SbxVariable* Element
( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf,
@@ -313,29 +312,29 @@ static SbxVariable* Element
if( refVar.Is() )
{
refVar->SetParameters( NULL );
- // folgen noch Parameter?
+ // Follow still parameter?
p = SkipWhitespace( p );
if( *p == '(' )
{
p++;
SbxArrayRef refPar = new SbxArray;
sal_uInt16 nArg = 0;
- // Wird sind mal relaxed und akzeptieren auch
- // das Zeilen- oder Komandoende als Begrenzer
- // Parameter immer global suchen!
+ // We are once relaxed and accept as well
+ // the line- or commandend as delimiter
+ // Search parameter always global!
while( *p && *p != ')' && *p != ']' )
{
SbxVariableRef refArg = PlusMinus( pGbl, pGbl, &p );
if( !refArg )
{
- // Fehler beim Parsing
+ // Error during the parsing
refVar.Clear(); break;
}
else
{
- // Man kopiere den Parameter, damit
- // man den aktuellen Zustand hat (loest auch
- // den Aufruf per Zugriff aus)
+ // One copies the parameter, so that
+ // one have the current status (triggers also
+ // the call per access)
SbxVariable* pArg = refArg;
refPar->Put( new SbxVariable( *pArg ), ++nArg );
}
@@ -358,7 +357,7 @@ static SbxVariable* Element
return refVar;
}
-// Hauptroutine
+// Mainroutine
SbxVariable* SbxObject::Execute( const XubString& rTxt )
{
@@ -399,3 +398,4 @@ SbxVariable* SbxObject::FindQualified( const XubString& rName, SbxClassType t )
return pVar;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 46b6e6caa445..d1a85cb07d3a 100644..100755
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -384,13 +385,11 @@ short SbxBasicFormater::GetDigitAtPos( double dNumber, short nPos,
double& dNextNumber, sal_Bool& bFoundFirstDigit )
// ACHTUNG: nPos kann auch negativ werden, f"ur Stellen nach dem Dezimal-Punkt
{
- double dTemp = dNumber;
- double dDigit,dPos;
+ double dDigit;
short nMaxDigit;
// erst mal aus der Zahl eine positive Zahl machen:
dNumber = fabs( dNumber );
- dPos = (double)nPos;
// "uberpr"ufe ob Zahl zu klein f"ur angegebene Stelle ist
nMaxDigit = (short)get_number_of_digits( dNumber );
@@ -1166,3 +1165,4 @@ sal_Bool SbxBasicFormater::isBasicFormat( String sFormatStrg )
return sal_False;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 4c4b3959e7a0..289622a016fd 100644..100755
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -95,6 +96,22 @@ start:
else
nRes = (sal_Int16) ImpRound( p->nSingle );
break;
+ case SbxCURRENCY:
+ {
+ sal_Int64 tstVal = (sal_Int64) p->nInt64 / (sal_Int64) CURRENCY_FACTOR;
+
+ if( tstVal > SbxMAXINT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXINT;
+ }
+ else if( tstVal < SbxMININT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT;
+ }
+ else
+ nRes = (sal_Int16) (tstVal);
+ break;
+ }
case SbxSALINT64:
if( p->nInt64 > SbxMAXINT )
{
@@ -117,22 +134,12 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
+ {
+ double dVal = 0.0;
+ if( p->eType == SbxDECIMAL )
{
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
- {
- dVal = 0.0;
if( p->pDecimal )
p->pDecimal->getDouble( dVal );
}
@@ -194,7 +201,7 @@ start:
case SbxBYREF | SbxBOOL:
nRes = *p->pInteger; break;
- // ab hier muss getestet werden
+ // from here had to be tested
case SbxBYREF | SbxLONG:
aTmp.nLong = *p->pLong; goto ref;
case SbxBYREF | SbxULONG:
@@ -207,11 +214,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -232,7 +235,7 @@ void ImpPutInteger( SbxValues* p, sal_Int16 n )
start:
switch( +p->eType )
{
- // hier muss getestet werden
+ // here had to be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -248,7 +251,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // from here no tests needed
case SbxINTEGER:
case SbxBOOL:
p->nInteger = n; break;
@@ -259,14 +262,10 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setInt( n );
@@ -322,12 +321,15 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
}
*p->pULong = (sal_uInt32) n; break;
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
if( n < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); *p->puInt64 = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ *p->puInt64 = 0;
}
else
*p->puInt64 = n;
@@ -337,12 +339,6 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
@@ -384,6 +380,7 @@ sal_uInt64 ImpDoubleToSalUInt64( double d )
return nRes;
}
+
double ImpSalUInt64ToDouble( sal_uInt64 n )
{
double d = 0.0;
@@ -415,33 +412,20 @@ start:
nRes = p->nInteger; break;
case SbxERROR:
case SbxUSHORT:
- nRes = p->nUShort; break;
+ nRes = (sal_Int64) p->nUShort; break;
case SbxLONG:
- nRes = p->nLong; break;
+ nRes = (sal_Int64) p->nLong; break;
case SbxULONG:
nRes = (sal_Int64) p->nULong; break;
case SbxSINGLE:
- nRes = ImpDoubleToSalInt64( (double)p->nSingle );
+ nRes = (sal_Int64) p->nSingle;
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
- {
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else
- dVal = p->nDouble;
-
- nRes = ImpDoubleToSalInt64( dVal );
+ nRes = (sal_Int64) p->nDouble;
break;
- }
+ case SbxCURRENCY:
+ nRes = p->nInt64 / CURRENCY_FACTOR; break;
case SbxSALINT64:
nRes = p->nInt64; break;
case SbxSALUINT64:
@@ -471,7 +455,7 @@ start:
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else
- nRes = ImpDoubleToSalInt64( d );
+ nRes = (sal_Int64) d;
}
}
break;
@@ -498,10 +482,15 @@ start:
nRes = *p->pLong; break;
case SbxBYREF | SbxULONG:
nRes = *p->pULong; break;
+ case SbxBYREF | SbxCURRENCY:
+ nRes = p->nInt64 / CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
nRes = *p->pnInt64; break;
// from here the values has to be checked
+ case SbxBYREF | SbxSALUINT64:
+ aTmp.uInt64 = *p->puInt64; goto ref;
+
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
aTmp.nUShort = *p->pUShort; goto ref;
@@ -510,13 +499,6 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
- case SbxBYREF | SbxSALUINT64:
- aTmp.uInt64 = *p->puInt64; goto ref;
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -542,11 +524,6 @@ start:
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
case SbxERROR:
@@ -554,6 +531,9 @@ start:
aTmp.pUShort = &p->nUShort; goto direct;
case SbxLONG:
aTmp.pnInt64 = &p->nInt64; goto direct;
+ case SbxCURRENCY:
+ case SbxSALINT64:
+ aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
aTmp.puInt64 = &p->uInt64; goto direct;
@@ -561,9 +541,6 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // Check not neccessary
- case SbxSALINT64:
- p->nInt64 = n; break;
case SbxSINGLE:
p->nSingle = (float) n; break;
case SbxDATE:
@@ -659,16 +636,7 @@ start:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
case SbxBYREF | SbxCURRENCY:
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = (sal_Int64) SbxMAXCURR;
- }
- else if( n < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = (sal_Int64) SbxMINCURR;
- }
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
-
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
@@ -709,27 +677,16 @@ start:
case SbxULONG:
nRes = (sal_uInt64) p->nULong; break;
case SbxSINGLE:
- nRes = ImpDoubleToSalUInt64( (double)p->nSingle );
- break;
+ nRes = (sal_uInt64) p->nSingle; break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
{
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else
- dVal = p->nDouble;
-
- nRes = ImpDoubleToSalUInt64( dVal );
+//TODO overflow check
+ nRes = (sal_uInt64) p->nDouble;
break;
}
+ case SbxCURRENCY:
+ nRes = p->nInt64 * CURRENCY_FACTOR; break;
case SbxSALINT64:
if( p->nInt64 < 0 )
{
@@ -737,6 +694,7 @@ start:
}
else
nRes = (sal_uInt64) p->nInt64;
+ break;
case SbxSALUINT64:
nRes = p->uInt64; break;
@@ -804,7 +762,7 @@ start:
case SbxBYREF | SbxSALUINT64:
nRes = *p->puInt64; break;
- // from here the values has to be checked
+ // from here on the value has to be checked
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
aTmp.nUShort = *p->pUShort; goto ref;
@@ -813,11 +771,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
ref:
@@ -845,11 +799,6 @@ start:
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
case SbxERROR:
@@ -857,6 +806,7 @@ start:
aTmp.pUShort = &p->nUShort; goto direct;
case SbxLONG:
aTmp.pnInt64 = &p->nInt64; goto direct;
+ case SbxCURRENCY:
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSINGLE:
@@ -938,14 +888,12 @@ start:
*p->pDouble = (float)ImpSalUInt64ToDouble( n ); break;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
+
*p->pDouble = ImpSalUInt64ToDouble( n ); break;
case SbxBYREF | SbxCURRENCY:
- if( n > SbxMAXSALINT64 || (sal_Int64)n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = (sal_Int64) SbxMAXCURR;
- }
- *p->pLong64 = ImpDoubleToCurrency( (double)(sal_Int64) n ); break;
-
+ if ( n > ( SbxMAXSALINT64 / CURRENCY_FACTOR ) )
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXSALINT64;
+ *p->pnInt64 = ( sal_Int64) ( n * CURRENCY_FACTOR ); break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
case SbxBYREF | SbxSALINT64:
@@ -961,3 +909,4 @@ start:
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index ae873d8eba1b..dd772fe4a52a 100644..100755
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -74,28 +75,28 @@ start:
else
nRes = (sal_Int32) ImpRound( p->nSingle );
break;
- case SbxDATE:
- case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
case SbxSALINT64:
+ nRes = p->nInt64;
+ break;
case SbxSALUINT64:
+ nRes = p->uInt64;
+ break;
case SbxCURRENCY:
+ {
+ sal_Int64 tstVal = p->nInt64 / CURRENCY_FACTOR;
+ nRes = (sal_Int32) (tstVal);
+ if( tstVal < SbxMINLNG || SbxMAXLNG < tstVal ) SbxBase::SetError( SbxERR_OVERFLOW );
+ if( SbxMAXLNG < tstVal ) nRes = SbxMAXLNG;
+ if( tstVal < SbxMINLNG ) nRes = SbxMINLNG;
+ break;
+ }
+ case SbxDATE:
+ case SbxDOUBLE:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxSALINT64 )
- dVal = static_cast< double >(p->nInt64);
- else if( p->eType == SbxSALUINT64 )
- dVal = ImpSalUInt64ToDouble( p->uInt64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -161,7 +162,7 @@ start:
case SbxBYREF | SbxLONG:
nRes = *p->pLong; break;
- // ab hier muss getestet werden
+ // from here had to be tested
case SbxBYREF | SbxULONG:
aTmp.nULong = *p->pULong; goto ref;
case SbxBYREF | SbxERROR:
@@ -172,15 +173,12 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
aTmp.uInt64 = *p->puInt64; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
+
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -198,7 +196,7 @@ void ImpPutLong( SbxValues* p, sal_Int32 n )
start:
switch( +p->eType )
{
- // Ab hier muss getestet werden
+ // From here had to be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -206,11 +204,6 @@ start:
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
case SbxSALUINT64:
@@ -222,7 +215,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // from here no longer
case SbxLONG:
p->nLong = n; break;
case SbxSINGLE:
@@ -230,6 +223,8 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxDECIMAL:
@@ -319,23 +314,10 @@ start:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
case SbxBYREF | SbxCURRENCY:
- double d;
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMAXCURR;
- }
- else if( n < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMINCURR;
- }
- else
- {
- d = n;
- }
- *p->pLong64 = ImpDoubleToCurrency( d ); break;
-
+ *p->pnInt64 = (sal_Int64)n * (sal_Int64)CURRENCY_FACTOR; break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxmstrm.cxx b/basic/source/sbx/sbxmstrm.cxx
index 671c0bc5d1d9..e4ed782d75b2 100644..100755
--- a/basic/source/sbx/sbxmstrm.cxx
+++ b/basic/source/sbx/sbxmstrm.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,3 +38,5 @@ SbxDataType SbxMemoryStream::GetType() const
SbxMemoryStream::~SbxMemoryStream()
{
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 266e39907b66..a6d089602ba4 100644..100755
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <tools/stream.hxx>
#include <vcl/sound.hxx>
#include <basic/sbx.hxx>
-#include <basic/sbxbase.hxx>
#include "sbxres.hxx"
#include <svl/brdcst.hxx>
@@ -78,11 +78,11 @@ SbxObject& SbxObject::operator=( const SbxObject& r )
pMethods = new SbxArray;
pProps = new SbxArray;
pObjs = new SbxArray( SbxOBJECT );
- // Die Arrays werden kopiert, die Inhalte uebernommen
+ // The arrays were copied, the content taken over
*pMethods = *r.pMethods;
*pProps = *r.pProps;
*pObjs = *r.pObjs;
- // Da die Variablen uebernommen wurden, ist dies OK
+ // Because the variables were taken over, this is OK
pDfltProp = r.pDfltProp;
SetName( r.GetName() );
SetFlags( r.GetFlags() );
@@ -98,7 +98,7 @@ static void CheckParentsOnDelete( SbxObject* pObj, SbxArray* p )
SbxVariableRef& rRef = p->GetRef( i );
if( rRef->IsBroadcaster() )
pObj->EndListening( rRef->GetBroadcaster(), sal_True );
- // Hat das Element mehr als eine Referenz und noch einen Listener?
+ // Did the element have more then one reference and still a Listener?
if( rRef->GetRefCount() > 1 )
{
rRef->SetParent( NULL );
@@ -191,16 +191,16 @@ SbxVariable* SbxObject::FindUserData( sal_uInt32 nData )
pRes = pProps->FindUserData( nData );
if( !pRes )
pRes = pObjs->FindUserData( nData );
- // Search in den Parents?
+ // Search in the parents?
if( !pRes && IsSet( SBX_GBLSEARCH ) )
{
SbxObject* pCur = this;
while( !pRes && pCur->pParent )
{
- // Ich selbst bin schon durchsucht worden!
+ // I myself was already searched through!
sal_uInt16 nOwn = pCur->GetFlags();
pCur->ResetFlag( SBX_EXTSEARCH );
- // Ich suche bereits global!
+ // I search already global!
sal_uInt16 nPar = pCur->pParent->GetFlags();
pCur->pParent->ResetFlag( SBX_GBLSEARCH );
pRes = pCur->pParent->FindUserData( nData );
@@ -253,21 +253,21 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t )
if( pArray )
pRes = pArray->Find( rName, t );
}
- // Extended Search im Objekt-Array?
- // Fuer Objekte und DontCare ist das Objektarray bereits
- // durchsucht worden
+ // ExtendedsSearch in the Object-Array?
+ // For objects and DontCare is the Objektarray already
+ // searched through
if( !pRes && ( t == SbxCLASS_METHOD || t == SbxCLASS_PROPERTY ) )
pRes = pObjs->Find( rName, t );
- // Search in den Parents?
+ // Search in the parents?
if( !pRes && IsSet( SBX_GBLSEARCH ) )
{
SbxObject* pCur = this;
while( !pRes && pCur->pParent )
{
- // Ich selbst bin schon durchsucht worden!
+ // I myself was already searched through!
sal_uInt16 nOwn = pCur->GetFlags();
pCur->ResetFlag( SBX_EXTSEARCH );
- // Ich suche bereits global!
+ // I search already global!
sal_uInt16 nPar = pCur->pParent->GetFlags();
pCur->pParent->ResetFlag( SBX_GBLSEARCH );
pRes = pCur->pParent->Find( rName, t );
@@ -289,16 +289,16 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t )
return pRes;
}
-// Kurzform: Die Parent-Kette wird durchsucht
-// Das ganze rekursiv, da Call() ueberladen sein kann
-// Qualified Names sind zugelassen
+// Abbreviated version: The parent-string will be searched through
+// The whole thing recursive, because Call() might be overloaded
+// Qualified names are allowed
sal_Bool SbxObject::Call( const XubString& rName, SbxArray* pParam )
{
SbxVariable* pMeth = FindQualified( rName, SbxCLASS_DONTCARE);
if( pMeth && pMeth->ISA(SbxMethod) )
{
- // FindQualified() koennte schon zugeschlagen haben!
+ // FindQualified() might have been stroked!
if( pParam )
pMeth->SetParameters( pParam );
pMeth->Broadcast( SBX_HINT_DATAWANTED );
@@ -342,9 +342,9 @@ void SbxObject::SetDfltProperty( SbxProperty* p )
SetModified( sal_True );
}
-// Suchen einer bereits vorhandenen Variablen. Falls sie gefunden wurde,
-// wird der Index gesetzt, sonst wird der Count des Arrays geliefert.
-// In jedem Fall wird das korrekte Array geliefert.
+// Search of a already available variable. If she was located,
+// the index will be set, elsewise will be delivered the Count of the Array.
+// In any case it will be delivered the correct Array.
SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
{
@@ -361,7 +361,7 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
if( pArray )
{
nArrayIdx = pArray->Count();
- // ist die Variable per Name vorhanden?
+ // Is the variable per name available?
pArray->ResetFlag( SBX_EXTSEARCH );
SbxVariable* pOld = pArray->Find( pVar->GetName(), pVar->GetClass() );
if( pOld )
@@ -377,12 +377,12 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
return pArray;
}
-// Falls ein neues Objekt eingerichtet wird, wird es, falls es bereits
-// eines mit diesem Namen gibt, indiziert.
+// If a new object will be established, this object will be indexed,
+// if an object of this name exists already.
SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataType dt )
{
- // Ist das Objekt bereits vorhanden?
+ // Is the object already available?
SbxArray* pArray = NULL;
switch( ct )
{
@@ -395,13 +395,13 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
}
if( !pArray )
return NULL;
- // Collections duerfen gleichnamige Objekte enthalten
+ // Collections may contain objects of the same name
if( !( ct == SbxCLASS_OBJECT && ISA(SbxCollection) ) )
{
SbxVariable* pRes = pArray->Find( rName, ct );
if( pRes )
{
-/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus
+/* Due to often problems (e.g. #67000) first of all completly out
#ifdef DBG_UTIL
if( pRes->GetHashCode() != nNameHash
&& pRes->GetHashCode() != nParentHash )
@@ -436,7 +436,7 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
pVar->SetParent( this );
pArray->Put( pVar, pArray->Count() );
SetModified( sal_True );
- // Das Objekt lauscht immer
+ // The object listen always
StartListening( pVar->GetBroadcaster(), sal_True );
Broadcast( SBX_HINT_OBJECTCHANGED );
return pVar;
@@ -444,13 +444,13 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClass )
{
- // Ist das Objekt bereits vorhanden?
+ // Is the object already available?
if( !ISA(SbxCollection) )
{
SbxVariable* pRes = pObjs->Find( rName, SbxCLASS_OBJECT );
if( pRes )
{
-/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus
+/* Due to often problems (e.g. #67000) first of all completly out
#ifdef DBG_UTIL
if( pRes->GetHashCode() != nNameHash
&& pRes->GetHashCode() != nParentHash )
@@ -474,7 +474,7 @@ SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClas
pVar->SetParent( this );
pObjs->Put( pVar, pObjs->Count() );
SetModified( sal_True );
- // Das Objekt lauscht immer
+ // The object listen always
StartListening( pVar->GetBroadcaster(), sal_True );
Broadcast( SBX_HINT_OBJECTCHANGED );
}
@@ -487,21 +487,21 @@ void SbxObject::Insert( SbxVariable* pVar )
SbxArray* pArray = FindVar( pVar, nIdx );
if( pArray )
{
- // Hinein damit. Man sollte allerdings auf die Pointer aufpassen!
+ // Into with it. But you should pay attention at the Pointer!
if( nIdx < pArray->Count() )
{
- // dann gibt es dieses Element bereits
- // Bei Collections duerfen gleichnamige Objekte hinein
+ // Then this element exists already
+ // There are objects of the same name allowed at collections
if( pArray == pObjs && ISA(SbxCollection) )
nIdx = pArray->Count();
else
{
SbxVariable* pOld = pArray->Get( nIdx );
- // schon drin: ueberschreiben
+ // already inside: overwrite
if( pOld == pVar )
return;
-/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus
+/* Due to often problems (e.g. #67000) first of all completly out
#ifdef DBG_UTIL
if( pOld->GetHashCode() != nNameHash
&& pOld->GetHashCode() != nParentHash )
@@ -545,8 +545,8 @@ void SbxObject::Insert( SbxVariable* pVar )
}
}
-// AB 23.4.1997, Optimierung, Einfuegen ohne Ueberpruefung auf doppelte
-// Eintraege und ohne Broadcasts, wird nur in SO2/auto.cxx genutzt
+// From 1997-04-23, Optimisation, Insertion without checking about
+// double entry and without broadcasts, will only be used in SO2/auto.cxx
void SbxObject::QuickInsert( SbxVariable* pVar )
{
SbxArray* pArray = NULL;
@@ -585,7 +585,7 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Spezial-Methode, gleichnamige Controls zulassen
+// From 1997-03-23, special method, allow controls of the same name
void SbxObject::VCPtrInsert( SbxVariable* pVar )
{
SbxArray* pArray = NULL;
@@ -643,11 +643,11 @@ void SbxObject::Remove( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Loeschen per Pointer fuer Controls (doppelte Namen!)
+// From 1997-03-23, cleanup per Pointer for Controls (double names!)
void SbxObject::VCPtrRemove( SbxVariable* pVar )
{
sal_uInt16 nIdx;
- // Neu FindVar-Methode, sonst identisch mit normaler Methode
+ // New FindVar-Method, otherwise identical with the normal method
SbxArray* pArray = VCPtrFindVar( pVar, nIdx );
if( pArray && nIdx < pArray->Count() )
{
@@ -664,7 +664,7 @@ void SbxObject::VCPtrRemove( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Zugehoerige Spezial-Methode, nur ueber Pointer suchen
+// From 1997-03-23, associated special method, search only by Pointer
SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
{
SbxArray* pArray = NULL;
@@ -732,19 +732,19 @@ static sal_Bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray )
return sal_True;
}
-// Der Load eines Objekts ist additiv!
+// The load of an object is additive!
sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
- // Hilfe fuer das Einlesen alter Objekte: einfach sal_True zurueck,
- // LoadPrivateData() muss Default-Zustand herstellen
+ // Help for the read in of old objects: just TRUE back,
+ // LoadPrivateData() had to set the default status up
if( !nVer )
return sal_True;
pDfltProp = NULL;
if( !SbxVariable::LoadData( rStrm, nVer ) )
return sal_False;
- // Wenn kein fremdes Objekt enthalten ist, uns selbst eintragen
+ // If it contains no alien object, insert ourselves
if( aData.eType == SbxOBJECT && !aData.pObj )
aData.pObj = this;
sal_uInt32 nSize;
@@ -764,7 +764,7 @@ sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
|| !LoadArray( rStrm, this, pProps )
|| !LoadArray( rStrm, this, pObjs ) )
return sal_False;
- // Properties setzen
+ // Set properties
if( aDfltProp.Len() )
pDfltProp = (SbxProperty*) pProps->Find( aDfltProp, SbxCLASS_PROPERTY );
SetModified( sal_False );
@@ -801,7 +801,7 @@ sal_Bool SbxObject::StoreData( SvStream& rStrm ) const
XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
const SbxObject* )
{
- // Properties in einem String einsammeln
+ // Collect the properties in a String
XubString aSource;
SbxArrayRef xProps( GetProperties() );
bool bLineFeed = false;
@@ -813,7 +813,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
&& !( xProp->GetHashCode() == nNameHash
&& aPropName.EqualsIgnoreCaseAscii( pNameProp ) ) )
{
- // ausser vor dem ersten Property immer einen Umbruch einfuegen
+ // Insert a break except in front of the first property
if ( bLineFeed )
aSource.AppendAscii( "\n" );
else
@@ -824,17 +824,17 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
aSource += aPropName;
aSource.AppendAscii( " = " );
- // den Property-Wert textuell darstellen
+ // Display the property value textual
switch ( xProp->GetType() )
{
case SbxEMPTY:
case SbxNULL:
- // kein Wert
+ // no value
break;
case SbxSTRING:
{
- // Strings in Anf"uhrungszeichen
+ // Strings in quotation mark
aSource.AppendAscii( "\"" );
aSource += xProp->GetString();
aSource.AppendAscii( "\"" );
@@ -843,7 +843,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
default:
{
- // sonstiges wie z.B. Zahlen direkt
+ // miscellaneous, such as e.g.numerary directly
aSource += xProp->GetString();
break;
}
@@ -892,7 +892,7 @@ static sal_Bool CollectAttrs( const SbxBase* p, XubString& rRes )
void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
{
- // Einr"uckung
+ // Shifting
static sal_uInt16 nLevel = 0;
if ( nLevel > 10 )
{
@@ -904,11 +904,11 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
for ( sal_uInt16 n = 1; n < nLevel; ++n )
aIndent.AppendAscii( " " );
- // ggf. Objekt vervollst"andigen
+ // if necessary complete the object
if ( bFill )
GetAll( SbxCLASS_DONTCARE );
- // Daten des Objekts selbst ausgeben
+ // Output the data of the object itself
ByteString aNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US );
ByteString aClassNameStr( (const UniString&)aClassName, RTL_TEXTENCODING_ASCII_US );
rStrm << "Object( "
@@ -957,7 +957,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
aLine.AppendAscii( " !! Not a Method !!" );
rStrm.WriteByteString( aLine, RTL_TEXTENCODING_ASCII_US );
- // bei Object-Methods auch das Object ausgeben
+ // Output also the object at object-methods
if ( pVar->GetValues_Impl().eType == SbxOBJECT &&
pVar->GetValues_Impl().pObj &&
pVar->GetValues_Impl().pObj != this &&
@@ -990,7 +990,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
aLine.AppendAscii( " !! Not a Property !!" );
rStrm.WriteByteString( aLine, RTL_TEXTENCODING_ASCII_US );
- // bei Object-Properties auch das Object ausgeben
+ // output also the object at object properties
if ( pVar->GetValues_Impl().eType == SbxOBJECT &&
pVar->GetValues_Impl().pObj &&
pVar->GetValues_Impl().pObj != this &&
@@ -1051,98 +1051,18 @@ SbxClassType SbxProperty::GetClass() const
return SbxCLASS_PROPERTY;
}
-void SbxObject::GarbageCollection( sal_uIntPtr nObjects )
+void SbxObject::GarbageCollection( sal_uIntPtr /* nObjects */ )
-/* [Beschreibung]
+/* [Description]
- Diese statische Methode durchsucht die n"achsten 'nObjects' der zur Zeit
- existierenden <SbxObject>-Instanzen nach zyklischen Referenzen, die sich
- nur noch selbst am Leben erhalten. Ist 'nObjects==0', dann werden
- alle existierenden durchsucht.
+ This statistic method browse the next 'nObjects' of the currently existing
+ <SbxObject>-Instances for cyclic references, which keep only themselfes alive
+ If there is 'nObjects==0', then all existing will be browsed.
- zur Zeit nur implementiert: Object -> Parent-Property -> Parent -> Object
+ currently only implemented: Object -> Parent-Property -> Parent -> Object
*/
{
- (void)nObjects;
-
- static sal_Bool bInGarbageCollection = sal_False;
- if ( bInGarbageCollection )
- return;
- bInGarbageCollection = sal_True;
-
-#if 0
- // erstes Object dieser Runde anspringen
- sal_Bool bAll = !nObjects;
- if ( bAll )
- rObjects.First();
- SbxObject *pObj = rObjects.GetCurObject();
- if ( !pObj )
- pObj = rObjects.First();
-
- while ( pObj && 0 != nObjects-- )
- {
- // hat der Parent nur noch 1 Ref-Count?
- SbxObject *pParent = PTR_CAST( SbxObject, pObj->GetParent() );
- if ( pParent && 1 == pParent->GetRefCount() )
- {
- // dann alle Properies des Objects durchsuchen
- SbxArray *pProps = pObj->GetProperties();
- for ( sal_uInt16 n = 0; n < pProps->Count(); ++n )
- {
- // verweist die Property auf den Parent des Object?
- SbxVariable *pProp = pProps->Get(n);
- const SbxValues &rValues = pProp->GetValues_Impl();
- if ( SbxOBJECT == rValues.eType &&
- pParent == rValues.pObj )
- {
-#ifdef DBG_UTIL
- DbgOutf( "SBX: %s.%s with Object %s was garbage",
- pObj->GetName().GetStr(),
- pProp->GetName().GetStr(),
- pParent->GetName().GetStr() );
-#endif
- // dann freigeben
- pProp->SbxValue::Clear();
- Sound::Beep();
- break;
- }
- }
- }
-
- // zum n"achsten
- pObj = rObjects.Next();
- if ( !bAll && !pObj )
- pObj = rObjects.First();
- }
-#endif
-
-// AB 28.10. Zur 507a vorerst raus, da SfxBroadcaster::Enable() wegfaellt
-#if 0
-#ifdef DBG_UTIL
- SbxVarList_Impl &rVars = GetSbxData_Impl()->aVars;
- DbgOutf( "SBX: garbage collector done, %lu objects remainding",
- rVars.Count() );
- if ( rVars.Count() > 200 && rVars.Count() < 210 )
- {
- SvFileStream aStream( "d:\\tmp\\dump.sbx", STREAM_STD_WRITE );
- SfxBroadcaster::Enable(sal_False);
- for ( sal_uIntPtr n = 0; n < rVars.Count(); ++n )
- {
- SbxVariable *pVar = rVars.GetObject(n);
- SbxObject *pObj = PTR_CAST(SbxObject, pVar);
- sal_uInt16 nFlags = pVar->GetFlags();
- pVar->SetFlag(SBX_NO_BROADCAST);
- if ( pObj )
- pObj->Dump(aStream);
- else if ( !pVar->GetParent() || !pVar->GetParent()->ISA(SbxObject) )
- pVar->Dump(aStream);
- pVar->SetFlags(nFlags);
- }
- SfxBroadcaster::Enable(sal_True);
- }
-#endif
-#endif
- bInGarbageCollection = sal_False;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx
index ec1e1f4c900e..5b6466e21e2c 100644..100755
--- a/basic/source/sbx/sbxres.cxx
+++ b/basic/source/sbx/sbxres.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -75,7 +76,7 @@ static const char* pSbxRes[] = {
"Item",
"Remove",
- "Error ", // mit Blank!
+ "Error ", // with blank!
"False",
"True"
};
@@ -89,3 +90,4 @@ SbxRes::SbxRes( sal_uInt16 nId )
: ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) )
{}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx
index 75fddc0d90fe..c50b197a4e88 100644..100755
--- a/basic/source/sbx/sbxres.hxx
+++ b/basic/source/sbx/sbxres.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,9 @@
#include <tools/string.hxx>
-// Zur Zeit sind Ressources im SVTOOLS-Projekt nicht vorgesehen.
-// Da es sich um unkritische Ressourcen handelt (BASIC-Keywords),
-// koennen wir mit Dummies arbeiten.
+// Currently there are no resources provided in the SVTOOLS-Project.
+// Because it is non-critical resources (BASIC-Keywords),
+// we can work with dummies.
#define STRING_TYPES 0
#define STRING_EMPTY 0
@@ -85,3 +86,5 @@ const char* GetSbxRes( sal_uInt16 );
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index d1bf716234a8..3b6d37286cd1 100644..100755
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,9 +38,7 @@
#include <stdlib.h>
#endif
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <math.h>
#include <string.h>
#include <ctype.h>
@@ -290,7 +289,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
short nExp = 0; // Exponent
short nDig = nPrec + 1; // Anzahl Digits in Zahl
short nDec; // Anzahl Vorkommastellen
- register int i, digit;
+ register int i;
// Komma besorgen
sal_Unicode cDecimalSep, cThousandSep;
@@ -340,6 +339,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
// Zahl ausgeben:
if( nDig > 0 )
{
+ register int digit;
for( i = 0 ; ; ++i )
{
if( i < 16 )
@@ -406,7 +406,7 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreS
*p++ = '-';
}
double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14;
- myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum > dMaxNumWithoutExp ) ) ? 4:0,
+ myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >= dMaxNumWithoutExp ) ) ? 4:0,
sal_False, sal_True, cDecimalSep );
// Trailing Zeroes weg:
for( p = cBuf; *p &&( *p != 'E' ); p++ ) {}
@@ -428,7 +428,7 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
sal_Bool bChanged = sal_False;
::rtl::OUString aNewString;
- // Nur Spezial-Fälle behandeln, als Default tun wir nichts
+ // Nur Spezial-F�lle behandeln, als Default tun wir nichts
switch( eTargetType )
{
// Bei Fliesskomma International beruecksichtigen
@@ -748,8 +748,6 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
SvNumberFormatter aFormatter( xFactory, eLangType );
sal_uInt32 nIndex;
- xub_StrLen nCheckPos = 0;
- short nType;
double nNumber;
Color* pCol;
@@ -758,6 +756,8 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
// number format, use SvNumberFormatter to handle it.
if( bSuccess )
{
+ xub_StrLen nCheckPos = 0;
+ short nType;
String aFmtStr = *pFmt;
VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
if( pInfo && pInfo->meType != VBA_FORMAT_TYPE_NULL )
@@ -966,3 +966,4 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 50313cfe1780..62c98131a2c2 100644..100755
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,10 +59,6 @@ start:
nRes = (float) p->nULong; break;
case SbxSINGLE:
nRes = p->nSingle; break;
- case SbxSALINT64:
- nRes = (float) p->nInt64; break;
- case SbxSALUINT64:
- nRes = (float) ImpSalUInt64ToDouble( p->uInt64 ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
if( p->pDecimal )
@@ -71,17 +68,17 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
case SbxCURRENCY:
+ case SbxSALINT64:
+ case SbxSALUINT64:
{
double dVal;
if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
+ dVal = ImpCurrencyToDouble( p->nInt64 );
+ else if( p->eType == SbxSALINT64 )
+ dVal = (float) p->nInt64;
+ else if( p->eType == SbxSALUINT64 )
+ dVal = (float) p->uInt64;
else
dVal = p->nDouble;
@@ -95,6 +92,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW );
nRes = static_cast< float >(SbxMINSNG);
}
+ // tests for underflow - storing value too small for precision of single
else if( dVal > 0 && dVal < SbxMAXSNG2 )
{
SbxBase::SetError( SbxERR_OVERFLOW );
@@ -162,19 +160,15 @@ start:
nRes = *p->pUShort; break;
case SbxBYREF | SbxSINGLE:
nRes = *p->pSingle; break;
- // ab hier muss getestet werden
+ // from here had to be tested
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxSALINT64:
- nRes = (float) *p->pnInt64; break;
- case SbxBYREF | SbxSALUINT64:
- nRes = (float) ImpSalUInt64ToDouble( *p->puInt64 ); break;
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
+ aTmp.nInt64 = *p->pnInt64; goto ref;
+ case SbxBYREF | SbxSALUINT64:
+ aTmp.uInt64 = *p->puInt64; goto ref;
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -205,11 +199,7 @@ start:
case SbxERROR:
case SbxUSHORT:
aTmp.pUShort = &p->nUShort; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
@@ -226,7 +216,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // keine Tests ab hier
+ // from here no tests
case SbxSINGLE:
p->nSingle = n; break;
case SbxDATE:
@@ -333,9 +323,9 @@ start:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = ImpDoubleToSalInt64( (double) n ); break;
+ *p->pnInt64 = (sal_Int64)n; break;
case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = ImpDoubleToSalUInt64( (double) n ); break;
+ *p->puInt64 = (sal_uInt64)n; break;
case SbxBYREF | SbxCURRENCY:
double d;
if( n > SbxMAXCURR )
@@ -350,10 +340,11 @@ start:
{
d = n;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( d ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index 3a73c2757579..27d1ca192868 100644..100755
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,17 +33,10 @@
#include "sbxconv.hxx"
#include "sbxres.hxx"
#include "runtime.hxx"
-#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
-#endif
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
-// Die Konversion eines Items auf String wird ueber die Put-Methoden
-// der einzelnen Datentypen abgewickelt, um doppelten Code zu vermeiden.
+// The conversion of an item onto String was handled via the Put-Methods
+// of the several data types to avoid double code.
::rtl::OUString ImpGetString( const SbxValues* p )
{
@@ -75,7 +69,7 @@ using namespace rtl;
case SbxDOUBLE:
ImpPutDouble( &aTmp, p->nDouble ); break;
case SbxCURRENCY:
- ImpPutCurrency( &aTmp, p->nLong64 ); break;
+ ImpPutCurrency( &aTmp, p->nInt64 ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpPutDecimal( &aTmp, p->pDecimal ); break;
@@ -107,7 +101,7 @@ using namespace rtl;
break;
}
case SbxERROR:
- // Hier wird der String "Error n" erzeugt
+ // Here will be created the String "Error n"
aRes = SbxRes( STRING_ERRORMSG );
aRes += ::rtl::OUString( p->nUShort ); break;
case SbxDATE:
@@ -133,7 +127,7 @@ using namespace rtl;
case SbxBYREF | SbxDOUBLE:
ImpPutDouble( &aTmp, *p->pDouble ); break;
case SbxBYREF | SbxCURRENCY:
- ImpPutCurrency( &aTmp, *p->pLong64 ); break;
+ ImpPutCurrency( &aTmp, *p->pnInt64 ); break;
case SbxBYREF | SbxSALINT64:
ImpPutInt64( &aTmp, *p->pnInt64 ); break;
case SbxBYREF | SbxSALUINT64:
@@ -144,19 +138,19 @@ using namespace rtl;
return aRes;
}
-// AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString()
+// From 1997-04-10, new function for SbxValue::GetCoreString()
::rtl::OUString ImpGetCoreString( const SbxValues* p )
{
- // Vorerst nur fuer double
+ // For now only for double
if( ( p->eType & (~SbxBYREF) ) == SbxDOUBLE )
{
SbxValues aTmp;
XubString aRes;
aTmp.eType = SbxSTRING;
if( p->eType == SbxDOUBLE )
- ImpPutDouble( &aTmp, p->nDouble, /*bCoreString=*/sal_True );
+ ImpPutDouble( &aTmp, p->nDouble, sal_True ); // true = bCoreString
else
- ImpPutDouble( &aTmp, *p->pDouble, /*bCoreString=*/sal_True );
+ ImpPutDouble( &aTmp, *p->pDouble, sal_True ); // true = bCoreString
return aRes;
}
else
@@ -168,7 +162,7 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
SbxValues aTmp;
aTmp.eType = SbxSTRING;
::rtl::OUString* pTmp = NULL;
- // Sicherheitshalber, falls ein NULL-Ptr kommt
+ // as a precaution, if a NULL-Ptr appears
if( !n )
n = pTmp = new ::rtl::OUString;
aTmp.pOUString = (::rtl::OUString*)n;
@@ -194,8 +188,8 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
p->nDouble = ImpGetDate( &aTmp ); break;
case SbxDOUBLE:
p->nDouble = ImpGetDouble( &aTmp ); break;
- case SbxULONG64:
- p->nLong64 = ImpGetCurrency( &aTmp ); break;
+ case SbxCURRENCY:
+ p->nInt64 = ImpGetCurrency( &aTmp ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
releaseDecimalPtr( p->pDecimal );
@@ -250,13 +244,18 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
case SbxBYREF | SbxDOUBLE:
*p->pDouble = ImpGetDouble( p ); break;
case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpGetCurrency( p ); break;
+ *p->pnInt64 = ImpGetCurrency( p ); break;
+ case SbxBYREF | SbxSALINT64:
+ *p->pnInt64 = ImpGetInt64( p ); break;
+ case SbxBYREF | SbxSALUINT64:
+ *p->puInt64 = ImpGetUInt64( p ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
delete pTmp;
}
+
// Convert string to an array of bytes, preserving unicode (2bytes per character)
SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
{
@@ -293,7 +292,7 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
::rtl::OUString ByteArrayToString(SbxArray* pArr)
{
sal_uInt16 nCount = pArr->Count();
- OUStringBuffer aStrBuf;
+ ::rtl::OUStringBuffer aStrBuf;
sal_Unicode aChar = 0;
for( sal_uInt16 i = 0 ; i < nCount ; i++ )
{
@@ -317,3 +316,6 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
return aStrBuf.makeStringAndClear();
}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index 6bfc0c39d260..5922b3571987 100644..100755
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,6 +81,18 @@ start:
else
nRes = (sal_uInt16) p->nULong;
break;
+ case SbxCURRENCY:
+ if( p->nInt64 / CURRENCY_FACTOR > SbxMAXUINT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXUINT;
+ }
+ else if( p->nInt64 < 0 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
+ }
+ else
+ nRes = (sal_uInt16) (p->nInt64 / CURRENCY_FACTOR);
+ break;
case SbxSALINT64:
if( p->nInt64 > SbxMAXUINT )
{
@@ -114,20 +127,11 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -189,7 +193,7 @@ start:
case SbxBYREF | SbxUSHORT:
nRes = *p->pUShort; break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYREF | SbxCHAR:
aTmp.nChar = *p->pChar; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -204,11 +208,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -242,22 +242,18 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxSALUINT64:
p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setUInt( n );
break;
- // Tests ab hier
+ // from here on tests
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -313,19 +309,16 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index 7322863f3475..b8f74b4bf5e6 100644..100755
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -84,8 +85,6 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
case SbxSALINT64:
case SbxSALUINT64:
case SbxCURRENCY:
@@ -94,11 +93,7 @@ start:
{
double dVal;
if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
+ dVal = ImpCurrencyToDouble( p->nInt64 );
else if( p->eType == SbxSALINT64 )
dVal = static_cast< double >(p->nInt64);
else if( p->eType == SbxSALUINT64 )
@@ -167,7 +162,7 @@ start:
case SbxBYREF | SbxULONG:
nRes = *p->pULong; break;
- // Tests ab hier
+ // from here on tests
case SbxBYREF | SbxCHAR:
aTmp.nChar = *p->pChar; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -180,15 +175,11 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
aTmp.uInt64 = *p->puInt64; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -212,8 +203,9 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
case SbxSALINT64:
- p->nInt64 = n; break;
+ aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
p->uInt64 = n; break;
case SbxDECIMAL:
@@ -221,7 +213,7 @@ start:
ImpCreateDecimal( p )->setULong( n );
break;
- // Tests ab hier
+ // from here on tests
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxUINT:
@@ -234,11 +226,6 @@ start:
case SbxERROR:
case SbxUSHORT:
aTmp.pUShort = &p->nUShort; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
direct:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
@@ -298,24 +285,16 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxCURRENCY:
- double d;
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMAXCURR;
- }
- else
- {
- d = n;
- }
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvals.cxx b/basic/source/sbx/sbxvals.cxx
index 71a3bfc7f0d8..71a3bfc7f0d8 100644..100755
--- a/basic/source/sbx/sbxvals.cxx
+++ b/basic/source/sbx/sbxvals.cxx
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index d7a3e27603ab..2c3adaa4302d 100755
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,163 +29,22 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#define _TLBIGINT_INT64
-#include <tools/bigint.hxx>
+#include <math.h>
#include <tools/stream.hxx>
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
-#include <math.h>
#include "runtime.hxx"
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
TYPEINIT1(SbxValue,SbxBase)
-/////////////////////////// SbxINT64 /////////////////////////////////////
-SbxINT64 &SbxINT64::operator -= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b -= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator += ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b += BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator *= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b *= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator %= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b %= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator /= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b /= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator &= ( const SbxINT64 &r )
-{
- nHigh &= r.nHigh;
- nLow &= r.nLow;
- return *this;
-}
-SbxINT64 &SbxINT64::operator |= ( const SbxINT64 &r )
-{
- nHigh |= r.nHigh;
- nLow |= r.nLow;
- return *this;
-}
-SbxINT64 &SbxINT64::operator ^= ( const SbxINT64 &r )
-{
- nHigh ^= r.nHigh;
- nLow ^= r.nLow;
- return *this;
-}
-
-SbxINT64 operator - ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a -= r;
- return a;
-}
-SbxINT64 operator + ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a += r;
- return a;
-}
-SbxINT64 operator / ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a /= r;
- return a;
-}
-SbxINT64 operator % ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a %= r;
- return a;
-}
-SbxINT64 operator * ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a *= r;
- return a;
-}
-SbxINT64 operator & ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a;
- a.nHigh = r.nHigh & l.nHigh;
- a.nLow = r.nLow & l.nLow;
- return a;
-}
-SbxINT64 operator | ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a;
- a.nHigh = r.nHigh | l.nHigh;
- a.nLow = r.nLow | l.nLow;
- return a;
-}
-SbxINT64 operator ^ ( const SbxINT64 &r, const SbxINT64 &l )
-{
- SbxINT64 a;
- a.nHigh = r.nHigh ^ l.nHigh;
- a.nLow = r.nLow ^ l.nLow;
- return a;
-}
-
-SbxINT64 operator - ( const SbxINT64 &r )
-{
- SbxINT64 a( r );
- a.CHS();
- return a;
-}
-SbxINT64 operator ~ ( const SbxINT64 &r )
-{
- SbxINT64 a;
- a.nHigh = ~r.nHigh;
- a.nLow = ~r.nLow;
- return a;
-}
-
-SbxUINT64 &SbxUINT64::operator %= ( const SbxUINT64 &r )
-{
- BigInt b( *this );
- b %= BigInt( r );
- b.UINT64( this );
- return *this;
-}
-SbxUINT64 &SbxUINT64::operator /= ( const SbxUINT64 &r )
-{
- BigInt b( *this );
- b /= BigInt( r );
- b.UINT64( this );
- return *this;
-}
-/////////////////////////// Fehlerbehandlung /////////////////////////////
+///////////////////////////// error handling //////////////////////////////
+// bring back ?? was ever in ?? currently ifdef out ?
#ifdef _USED
-// NOCH NACHZUBAUEN!
+// STILL Reverse ENGINEERING!
-// Das Default-Handling setzt nur den Fehlercode.
+// The default handling sets the error code only.
#ifndef WNT
#if defined ( UNX )
@@ -208,8 +68,7 @@ int matherr( struct _exception* p )
#endif // _USED
-
-///////////////////////////// Konstruktoren //////////////////////////////
+///////////////////////////// constructors //////////////////////////////
SbxValue::SbxValue() : SbxBase()
{
@@ -229,9 +88,9 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase()
switch( t & 0x0FFF )
{
case SbxINTEGER: n |= SbxBYREF; aData.pInteger = (sal_Int16*) p; break;
- case SbxULONG64: n |= SbxBYREF; aData.pULong64 = (SbxUINT64*) p; break;
- case SbxLONG64:
- case SbxCURRENCY: n |= SbxBYREF; aData.pLong64 = (SbxINT64*) p; break;
+ case SbxSALUINT64: n |= SbxBYREF; aData.puInt64 = (sal_uInt64*) p; break;
+ case SbxSALINT64:
+ case SbxCURRENCY: n |= SbxBYREF; aData.pnInt64 = (sal_Int64*) p; break;
case SbxLONG: n |= SbxBYREF; aData.pLong = (sal_Int32*) p; break;
case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break;
case SbxDATE:
@@ -241,7 +100,7 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase()
case SbxUSHORT:
case SbxBOOL: n |= SbxBYREF; aData.pUShort = (sal_uInt16*) p; break;
case SbxULONG: n |= SbxBYREF; aData.pULong = (sal_uInt32*) p; break;
- case SbxCHAR: n |= SbxBYREF; aData.pChar = (xub_Unicode*) p; break;
+ case SbxCHAR: n |= SbxBYREF; aData.pChar = (sal_Unicode*) p; break;
case SbxBYTE: n |= SbxBYREF; aData.pByte = (sal_uInt8*) p; break;
case SbxINT: n |= SbxBYREF; aData.pInt = (int*) p; break;
case SbxOBJECT:
@@ -276,7 +135,7 @@ SbxValue::SbxValue( const SbxValue& r )
{
((SbxValue*) &r)->Broadcast( SBX_HINT_DATAWANTED );
aData = r.aData;
- // Pointer kopieren, Referenzen inkrementieren
+ // Copy pointer, increment references
switch( aData.eType )
{
case SbxSTRING:
@@ -328,16 +187,16 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
return *this;
}
}
- // Den Inhalt der Variablen auslesen
+ // Readout the content of the variables
SbxValues aNew;
if( IsFixed() )
- // fest: dann muss der Typ stimmen
+ // firm: then the type had to match
aNew.eType = aData.eType;
else if( r.IsFixed() )
- // Quelle fest: Typ uebernehmen
+ // Source firm: take over the type
aNew.eType = SbxDataType( r.aData.eType & 0x0FFF );
else
- // beides Variant: dann isses egal
+ // both variant: then it is equal
aNew.eType = SbxVARIANT;
if( r.Get( aNew ) )
Put( aNew );
@@ -353,10 +212,10 @@ SbxValue::~SbxValue()
SetFlag( SBX_WRITE );
SbxValue::Clear();
#else
- // Provisorischer Fix fuer Solaris 5.0 Compiler Bug
- // bei Nutzung virtueller Vererbung. Virtuelle Calls
- // im Destruktor vermeiden. Statt Clear() zu rufen
- // moegliche Objekt-Referenzen direkt freigeben.
+ // Provisional fix for the Solaris 5.0 compiler bbug
+ // at using virtual inheritance. Avoid virtual calls
+ // in the destructor. Instead of calling clear()
+ // de-allocate posible object references direct.
if( aData.eType == SbxOBJECT )
{
if( aData.pObj && aData.pObj != this )
@@ -423,19 +282,19 @@ void SbxValue::Clear()
void SbxValue::Broadcast( sal_uIntPtr )
{}
-//////////////////////////// Daten auslesen //////////////////////////////
+//////////////////////////// Readout data //////////////////////////////
-// Ermitteln der "richtigen" Variablen. Falls es ein Objekt ist, wird
-// entweder das Objekt selbst oder dessen Default-Property angesprochen.
-// Falls die Variable eine Variable oder ein Objekt enthaelt, wird
-// dieses angesprochen.
+// Detect the "right" variables. If it is an object, will be addressed either
+// the object itself or its default property.
+// If the variable contain a variable or an object, this will be
+// addressed.
SbxValue* SbxValue::TheRealValue() const
{
return TheRealValue( sal_True );
}
-// #55226 Zusaetzliche Info transportieren
+// #55226 ship additional information
bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx
SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const
@@ -446,19 +305,19 @@ SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const
SbxDataType t = SbxDataType( p->aData.eType & 0x0FFF );
if( t == SbxOBJECT )
{
- // Der Block enthaelt ein Objekt oder eine Variable
+ // The block contains an object or a variable
SbxObject* pObj = PTR_CAST(SbxObject,p->aData.pObj);
if( pObj )
{
- // Hat das Objekt eine Default-Property?
+ // Has the object a default property?
SbxVariable* pDflt = pObj->GetDfltProperty();
- // Falls dies ein Objekt ist und sich selbst enthaelt,
- // koennen wir nicht darauf zugreifen
- // #55226# Die alte Bedingung, um einen Fehler zu setzen,
- // ist nicht richtig, da z.B. eine ganz normale Variant-
- // Variable mit Objekt davon betroffen sein kann, wenn ein
- // anderer Wert zugewiesen werden soll. Daher mit Flag.
+ // If this is an object and contains itself,
+ // we cannot access on it
+ // #55226# The old condition to set an error
+ // is not correct, because e.g. a regular variant variable with an object
+ // could be affected thereof, if another value should be assigned.
+ // Therefore with flag.
if( bObjInObjError && !pDflt &&
((SbxValue*) pObj)->aData.eType == SbxOBJECT &&
((SbxValue*) pObj)->aData.pObj == pObj )
@@ -478,18 +337,18 @@ SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const
*/
break;
}
- // Haben wir ein Array?
+ // Did we have an array?
SbxArray* pArray = PTR_CAST(SbxArray,p->aData.pObj);
if( pArray )
{
- // Ggf. Parameter holen
+ // When indicated get the parameter
SbxArray* pPar = NULL;
SbxVariable* pVar = PTR_CAST(SbxVariable,p);
if( pVar )
pPar = pVar->GetParameters();
if( pPar )
{
- // Haben wir ein dimensioniertes Array?
+ // Did we have a dimensioned array?
SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,p->aData.pObj);
if( pDimArray )
p = pDimArray->Get( pPar );
@@ -498,7 +357,7 @@ SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const
break;
}
}
- // Sonst einen SbxValue annehmen
+ // Elsewise guess a SbxValue
SbxValue* pVal = PTR_CAST(SbxValue,p->aData.pObj);
if( pVal )
p = pVal;
@@ -524,8 +383,8 @@ sal_Bool SbxValue::Get( SbxValues& rRes ) const
}
else
{
- // Falls nach einem Objekt oder einem VARIANT gefragt wird, nicht
- // die wahren Werte suchen
+ // If there was asked for an object or a VARIANT, don't search
+ // the real values
SbxValue* p = (SbxValue*) this;
if( rRes.eType != SbxOBJECT && rRes.eType != SbxVARIANT )
p = TheRealValue();
@@ -544,7 +403,7 @@ sal_Bool SbxValue::Get( SbxValues& rRes ) const
case SbxSALUINT64: rRes.uInt64 = ImpGetUInt64( &p->aData ); break;
case SbxSINGLE: rRes.nSingle = ImpGetSingle( &p->aData ); break;
case SbxDOUBLE: rRes.nDouble = ImpGetDouble( &p->aData ); break;
- case SbxCURRENCY:rRes.nLong64 = ImpGetCurrency( &p->aData ); break;
+ case SbxCURRENCY:rRes.nInt64 = ImpGetCurrency( &p->aData ); break;
case SbxDECIMAL: rRes.pDecimal = ImpGetDecimal( &p->aData ); break;
case SbxDATE: rRes.nDouble = ImpGetDate( &p->aData ); break;
case SbxBOOL:
@@ -595,7 +454,7 @@ sal_Bool SbxValue::Get( SbxValues& rRes ) const
}
else
{
- // Objekt enthielt sich selbst
+ // Object contained itself
SbxDataType eTemp = rRes.eType;
memset( &rRes, 0, sizeof( SbxValues ) );
rRes.eType = eTemp;
@@ -675,28 +534,26 @@ sal_Bool SbxValue::GetBool() const
#define GET( g, e, t, m ) \
t SbxValue::g() const { SbxValues aRes(e); Get( aRes ); return aRes.m; }
-GET( GetByte, SbxBYTE, sal_uInt8, nByte )
-GET( GetChar, SbxCHAR, xub_Unicode, nChar )
-GET( GetCurrency, SbxCURRENCY, SbxINT64, nLong64 )
-GET( GetDate, SbxDATE, double, nDouble )
-GET( GetData, SbxDATAOBJECT, void*, pData )
-GET( GetDouble, SbxDOUBLE, double, nDouble )
-GET( GetErr, SbxERROR, sal_uInt16, nUShort )
-GET( GetInt, SbxINT, int, nInt )
-GET( GetInteger, SbxINTEGER, sal_Int16, nInteger )
-GET( GetLong, SbxLONG, sal_Int32, nLong )
-GET( GetLong64, SbxLONG64, SbxINT64, nLong64 )
-GET( GetObject, SbxOBJECT, SbxBase*, pObj )
-GET( GetSingle, SbxSINGLE, float, nSingle )
-GET( GetULong, SbxULONG, sal_uInt32, nULong )
-GET( GetULong64, SbxULONG64, SbxUINT64, nULong64 )
-GET( GetUShort, SbxUSHORT, sal_uInt16, nUShort )
-GET( GetInt64, SbxSALINT64, sal_Int64, nInt64 )
-GET( GetUInt64, SbxSALUINT64, sal_uInt64, uInt64 )
-GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal )
-
-
-//////////////////////////// Daten schreiben /////////////////////////////
+GET( GetByte, SbxBYTE, sal_uInt8, nByte )
+GET( GetChar, SbxCHAR, xub_Unicode, nChar )
+GET( GetCurrency, SbxCURRENCY, sal_Int64, nInt64 )
+GET( GetDate, SbxDATE, double, nDouble )
+GET( GetData, SbxDATAOBJECT, void*, pData )
+GET( GetDouble, SbxDOUBLE, double, nDouble )
+GET( GetErr, SbxERROR, sal_uInt16, nUShort )
+GET( GetInt, SbxINT, int, nInt )
+GET( GetInteger, SbxINTEGER, sal_Int16, nInteger )
+GET( GetLong, SbxLONG, sal_Int32, nLong )
+GET( GetObject, SbxOBJECT, SbxBase*, pObj )
+GET( GetSingle, SbxSINGLE, float, nSingle )
+GET( GetULong, SbxULONG, sal_uInt32, nULong )
+GET( GetUShort, SbxUSHORT, sal_uInt16, nUShort )
+GET( GetInt64, SbxSALINT64, sal_Int64, nInt64 )
+GET( GetUInt64, SbxSALUINT64, sal_uInt64, uInt64 )
+GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal )
+
+
+//////////////////////////// Write data /////////////////////////////
sal_Bool SbxValue::Put( const SbxValues& rVal )
{
@@ -710,11 +567,11 @@ sal_Bool SbxValue::Put( const SbxValues& rVal )
SetError( SbxERR_NOTIMP );
else
{
- // Falls nach einem Objekt gefragt wird, nicht
- // die wahren Werte suchen
+ // If there was asked for an object, don't search
+ // the real values
SbxValue* p = this;
if( rVal.eType != SbxOBJECT )
- p = TheRealValue( sal_False ); // #55226 Hier keinen Fehler erlauben
+ p = TheRealValue( sal_False ); // Don't allow an error here
if( p )
{
if( !p->CanWrite() )
@@ -731,7 +588,7 @@ sal_Bool SbxValue::Put( const SbxValues& rVal )
case SbxSALUINT64: ImpPutUInt64( &p->aData, rVal.uInt64 ); break;
case SbxSINGLE: ImpPutSingle( &p->aData, rVal.nSingle ); break;
case SbxDOUBLE: ImpPutDouble( &p->aData, rVal.nDouble ); break;
- case SbxCURRENCY: ImpPutCurrency( &p->aData, rVal.nLong64 ); break;
+ case SbxCURRENCY: ImpPutCurrency( &p->aData, rVal.nInt64 ); break;
case SbxDECIMAL: ImpPutDecimal( &p->aData, rVal.pDecimal ); break;
case SbxDATE: ImpPutDate( &p->aData, rVal.nDouble ); break;
case SbxBOOL: ImpPutBool( &p->aData, rVal.nInteger ); break;
@@ -758,22 +615,22 @@ sal_Bool SbxValue::Put( const SbxValues& rVal )
case SbxOBJECT:
if( !p->IsFixed() || p->aData.eType == SbxOBJECT )
{
- // ist schon drin
+ // is already inside
if( p->aData.eType == SbxOBJECT && p->aData.pObj == rVal.pObj )
break;
- // Nur den Werteteil loeschen!
+ // Delete only the value part!
p->SbxValue::Clear();
- // eingentliche Zuweisung
+ // real allocation
p->aData.pObj = rVal.pObj;
- // ggf. Ref-Count mitzaehlen
+ // if necessary cont in Ref-Count
if( p->aData.pObj && p->aData.pObj != p )
{
if ( p != this )
{
- DBG_ERROR( "TheRealValue" );
+ OSL_FAIL( "TheRealValue" );
}
HACK(nicht bei Parent-Prop - sonst CyclicRef)
SbxVariable *pThisVar = PTR_CAST(SbxVariable, this);
@@ -809,36 +666,36 @@ sal_Bool SbxValue::Put( const SbxValues& rVal )
return bRes;
}
-// AB, 28.3.96:
-// Methode, um bei speziellen Typen eine Vorbehandlung des Strings
-// durchzufuehren. Insbesondere erforderlich fuer BASIC-IDE, damit
-// die Ausgaben im Watch-Fenster mit PutStringExt zurueckgeschrieben
-// werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs
-// explizit mit "TRUE" oder "FALSE" angegeben werden.
-// Implementierung in ImpConvStringExt (SBXSCAN.CXX)
+// From 1996-03-28:
+// Method to execute a pretreatment of the strings at special types.
+// In particular necessary for BASIC-IDE, so that
+// the output in the Watch-Window can be writen back with PutStringExt,
+// if Float were declared with ',' as the decimal seperator or BOOl
+// explicit with "TRUE" or "FALSE".
+// Implementation in ImpConvStringExt (SBXSCAN.CXX)
sal_Bool SbxValue::PutStringExt( const ::rtl::OUString& r )
{
- // Kopieren, bei Unicode gleich konvertieren
+ // Copy; if it is Unicode convert it immediately
::rtl::OUString aStr( r );
- // Eigenen Typ bestimmen (nicht wie in Put() mit TheRealValue(),
- // Objekte werden sowieso nicht behandelt)
+ // Identify the own type (not as in Put() with TheRealValue(),
+ // Objects are not handled anyway)
SbxDataType eTargetType = SbxDataType( aData.eType & 0x0FFF );
- // Source-Value basteln
+ // tinker a Source-Value
SbxValues aRes;
aRes.eType = SbxSTRING;
- // Nur, wenn wirklich was konvertiert wurde, Kopie nehmen,
- // sonst Original (Unicode bleibt erhalten)
+ // Only if really something was converted, take the copy,
+ // elsewise take the original (Unicode remain)
sal_Bool bRet;
if( ImpConvStringExt( aStr, eTargetType ) )
aRes.pOUString = (::rtl::OUString*)&aStr;
else
aRes.pOUString = (::rtl::OUString*)&r;
- // #34939: Bei Strings. die eine Zahl enthalten und wenn this einen
- // Num-Typ hat, Fixed-Flag setzen, damit der Typ nicht veraendert wird
+ // #34939: Set a Fixed-Flag at Strings. which contain a number, and
+ // if this has a Num-Type, so that the type will not be changed
sal_uInt16 nFlags_ = GetFlags();
if( ( eTargetType >= SbxINTEGER && eTargetType <= SbxCURRENCY ) ||
( eTargetType >= SbxCHAR && eTargetType <= SbxUINT ) ||
@@ -853,8 +710,8 @@ sal_Bool SbxValue::PutStringExt( const ::rtl::OUString& r )
Put( aRes );
bRet = sal_Bool( !IsError() );
- // Falls das mit dem FIXED einen Error gegeben hat, zuruecksetzen
- // (UI-Aktion sollte keinen Error ergeben, sondern nur scheitern)
+ // If it throwed an error with FIXED, set it back
+ // (UI-Action should not cast an error, but only fail)
if( !bRet )
ResetError();
@@ -945,8 +802,8 @@ sal_Bool SbxValue::p( t n ) \
{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return sal_Bool( !IsError() ); }
PUT( PutByte, SbxBYTE, sal_uInt8, nByte )
-PUT( PutChar, SbxCHAR, xub_Unicode, nChar )
-PUT( PutCurrency, SbxCURRENCY, const SbxINT64&, nLong64 )
+PUT( PutChar, SbxCHAR, sal_Unicode, nChar )
+PUT( PutCurrency, SbxCURRENCY, const sal_Int64&, nInt64 )
PUT( PutDate, SbxDATE, double, nDouble )
PUT( PutData, SbxDATAOBJECT, void*, pData )
PUT( PutDouble, SbxDOUBLE, double, nDouble )
@@ -954,28 +811,26 @@ PUT( PutErr, SbxERROR, sal_uInt16, nUShort )
PUT( PutInt, SbxINT, int, nInt )
PUT( PutInteger, SbxINTEGER, sal_Int16, nInteger )
PUT( PutLong, SbxLONG, sal_Int32, nLong )
-PUT( PutLong64, SbxLONG64, const SbxINT64&, nLong64 )
PUT( PutObject, SbxOBJECT, SbxBase*, pObj )
PUT( PutSingle, SbxSINGLE, float, nSingle )
PUT( PutULong, SbxULONG, sal_uInt32, nULong )
-PUT( PutULong64, SbxULONG64, const SbxUINT64&, nULong64 )
PUT( PutUShort, SbxUSHORT, sal_uInt16, nUShort )
PUT( PutInt64, SbxSALINT64, sal_Int64, nInt64 )
PUT( PutUInt64, SbxSALUINT64, sal_uInt64, uInt64 )
PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal )
-////////////////////////// Setzen des Datentyps ///////////////////////////
+////////////////////////// Setting of the data type ///////////////////////////
sal_Bool SbxValue::IsFixed() const
{
return ( (GetFlags() & SBX_FIXED) | (aData.eType & SbxBYREF) ) != 0;
}
-// Eine Variable ist numerisch, wenn sie EMPTY oder wirklich numerisch ist
-// oder einen vollstaendig konvertierbaren String enthaelt
+// A variable is numeric, if it is EMPTY or realy numeric
+// or if it contains a complete convertible String
-// #41692, fuer RTL und Basic-Core getrennt implementieren
+// #41692, implement it for RTL and Basic-Core seperably
sal_Bool SbxValue::IsNumeric() const
{
return ImpIsNumeric( /*bOnlyIntntl*/sal_False );
@@ -993,7 +848,7 @@ sal_Bool SbxValue::ImpIsNumeric( sal_Bool bOnlyIntntl ) const
{
SetError( SbxERR_PROP_WRITEONLY ); return sal_False;
}
- // Downcast pruefen!!!
+ // Test downcast!!!
if( this->ISA(SbxVariable) )
((SbxVariable*)this)->Broadcast( SBX_HINT_DATAWANTED );
SbxDataType t = GetType();
@@ -1039,7 +894,7 @@ sal_Bool SbxValue::SetType( SbxDataType t )
return sal_True;
if( ( t & 0x0FFF ) == SbxVARIANT )
{
- // Versuch, den Datentyp auf Variant zu setzen
+ // Trial to set the data type to Variant
ResetFlag( SBX_FIXED );
if( IsFixed() )
{
@@ -1055,7 +910,7 @@ sal_Bool SbxValue::SetType( SbxDataType t )
}
else
{
- // Eventuelle Objekte freigeben
+ // De-allocate potential objects
switch( aData.eType )
{
case SbxSTRING:
@@ -1078,7 +933,7 @@ sal_Bool SbxValue::SetType( SbxDataType t )
break;
default: break;
}
- // Das klappt immer, da auch die Float-Repraesentationen 0 sind.
+ // This works always, because the Float representations are 0 as well.
memset( &aData, 0, sizeof( SbxValues ) );
aData.eType = t;
}
@@ -1095,7 +950,7 @@ sal_Bool SbxValue::Convert( SbxDataType eTo )
return sal_False;
if( eTo == SbxVARIANT )
{
- // Versuch, den Datentyp auf Variant zu setzen
+ // Trial to set the data type to Variant
ResetFlag( SBX_FIXED );
if( IsFixed() )
{
@@ -1104,19 +959,19 @@ sal_Bool SbxValue::Convert( SbxDataType eTo )
else
return sal_True;
}
- // Convert from Null geht niemals. Einmal Null, immer Null!
+ // Converting from zero doesn't work. Once zero, always zero!
if( aData.eType == SbxNULL )
{
SetError( SbxERR_CONVERSION ); return sal_False;
}
- // Konversion der Daten:
+ // Conversion of the data:
SbxValues aNew;
aNew.eType = eTo;
if( Get( aNew ) )
{
- // Der Datentyp konnte konvertiert werden. Bei Fixed-Elementen
- // ist hier Ende, da die Daten nicht uebernommen zu werden brauchen
+ // The data type could be converted. It ends here with fixed elements,
+ // because the data had not to be taken over
if( !IsFixed() )
{
SetType( eTo );
@@ -1129,7 +984,7 @@ sal_Bool SbxValue::Convert( SbxDataType eTo )
else
return sal_False;
}
-////////////////////////////////// Rechnen /////////////////////////////////
+////////////////////////////////// Calculating /////////////////////////////////
sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
@@ -1144,21 +999,21 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
SetError( SbxERR_PROP_READONLY );
else if( !rOp.CanRead() )
SetError( SbxERR_PROP_WRITEONLY );
- // Sonderregel 1: Ist ein Operand Null, ist das Ergebnis Null
+ // Special rule 1: If one operand is zero, the result is zero
else if( eThisType == SbxNULL || eOpType == SbxNULL )
SetType( SbxNULL );
- // Sonderregel 2: Ist ein Operand Empty, ist das Ergebnis der 2. Operand
+ // Special rule 2: If the operand is Empty, the result is the 2. operand
else if( eThisType == SbxEMPTY
&& !bVBAInterop
)
*this = rOp;
- // 13.2.96: Nicht schon vor Get auf SbxEMPTY pruefen
+ // 1996-2-13: Don't test already before Get upon SbxEMPTY
else
{
SbxValues aL, aR;
bool bDecimal = false;
- if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING ) ||
- ( eThisType != SbxSTRING && eOpType == SbxSTRING ) ) &&
+ if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING && eOpType != SbxEMPTY ) ||
+ ( eThisType != SbxSTRING && eThisType != SbxEMPTY && eOpType == SbxSTRING ) ) &&
( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS ) )
{
goto Lbl_OpIsDouble;
@@ -1167,20 +1022,20 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
if( eOp == SbxCAT || eOp == SbxPLUS )
{
- // AB 5.11.1999, OUString beruecksichtigen
+ // From 1999-11-5, keep OUString in mind
aL.eType = aR.eType = SbxSTRING;
rOp.Get( aR );
- // AB 8.12.1999, #70399: Hier wieder GetType() rufen, Get() kann Typ aendern!
+ // From 1999-12-8, #70399: Here call GetType() again, Get() can change the type!
if( rOp.GetType() == SbxEMPTY )
goto Lbl_OpIsEmpty;
Get( aL );
- // #30576: Erstmal testen, ob Wandlung geklappt hat
+ // #30576: To begin with test, if the conversion worked
if( aL.pOUString != NULL && aR.pOUString != NULL )
{
*aL.pOUString += *aR.pOUString;
}
- // Nicht einmal Left OK?
+ // Not even Left OK?
else if( aL.pOUString == NULL )
{
aL.pOUString = new ::rtl::OUString();
@@ -1191,34 +1046,26 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
SetError( SbxERR_CONVERSION );
}
else if( eOpType == SbxSTRING && rOp.IsFixed() )
- { // Numerisch: rechts darf kein String stehen
+ { // Numeric: there is no String allowed on the right side
SetError( SbxERR_CONVERSION );
+ // falls all the way out
}
else if( ( eOp >= SbxIDIV && eOp <= SbxNOT ) || eOp == SbxMOD )
{
if( GetType() == eOpType )
{
- if( GetType() == SbxULONG64
- || GetType() == SbxLONG64
- || GetType() == SbxCURRENCY
- || GetType() == SbxULONG )
+ if( GetType() == SbxSALUINT64 || GetType() == SbxSALINT64
+ || GetType() == SbxCURRENCY || GetType() == SbxULONG )
aL.eType = aR.eType = GetType();
-// else if( GetType() == SbxDouble || GetType() == SbxSingle )
-// aL.eType = aR.eType = SbxLONG64;
+ else if ( bVBAInterop && eOpType == SbxBOOL )
+ aL.eType = aR.eType = SbxBOOL;
else
aL.eType = aR.eType = SbxLONG;
}
- else if( GetType() == SbxCURRENCY || eOpType == SbxCURRENCY
- || GetType() == SbxULONG64 || eOpType == SbxULONG64
- || GetType() == SbxLONG64 || eOpType == SbxLONG64 )
- aL.eType = aR.eType = SbxLONG64;
-// else if( GetType() == SbxDouble || rOP.GetType() == SbxDouble
-// || GetType() == SbxSingle || rOP.GetType() == SbxSingle )
-// aL.eType = aR.eType = SbxLONG64;
else
aL.eType = aR.eType = SbxLONG;
- if( rOp.Get( aR ) )
+ if( rOp.Get( aR ) ) // re-do Get after type assigns above
{
if( rOp.GetType() == SbxEMPTY )
{
@@ -1229,13 +1076,17 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
case SbxIDIV:
if( aL.eType == SbxCURRENCY )
- aL.eType = SbxLONG64;
- if( aL.eType == SbxLONG64 )
- if( !aR.nLong64 ) SetError( SbxERR_ZERODIV );
- else aL.nLong64 /= aR.nLong64;
- else if( aL.eType == SbxULONG64 )
- if( !aR.nULong64 ) SetError( SbxERR_ZERODIV );
- else aL.nULong64 /= aR.nULong64;
+ if( !aR.nInt64 ) SetError( SbxERR_ZERODIV );
+ else {
+ aL.nInt64 /= aR.nInt64;
+ aL.nInt64 *= CURRENCY_FACTOR;
+ }
+ else if( aL.eType == SbxSALUINT64 )
+ if( !aR.uInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.uInt64 /= aR.uInt64;
+ else if( aL.eType == SbxSALINT64 )
+ if( !aR.nInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.nInt64 /= aR.nInt64;
else if( aL.eType == SbxLONG )
if( !aR.nLong ) SetError( SbxERR_ZERODIV );
else aL.nLong /= aR.nLong;
@@ -1244,14 +1095,12 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
else aL.nULong /= aR.nULong;
break;
case SbxMOD:
- if( aL.eType == SbxCURRENCY )
- aL.eType = SbxLONG64;
- if( aL.eType == SbxLONG64 )
- if( !aR.nLong64 ) SetError( SbxERR_ZERODIV );
- else aL.nLong64 %= aR.nLong64;
- else if( aL.eType == SbxULONG64 )
- if( !aR.nULong64 ) SetError( SbxERR_ZERODIV );
- else aL.nULong64 %= aR.nULong64;
+ if( aL.eType == SbxCURRENCY || aL.eType == SbxSALINT64 )
+ if( !aR.nInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.nInt64 %= aR.nInt64;
+ else if( aL.eType == SbxSALUINT64 )
+ if( !aR.uInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.uInt64 %= aR.uInt64;
else if( aL.eType == SbxLONG )
if( !aR.nLong ) SetError( SbxERR_ZERODIV );
else aL.nLong %= aR.nLong;
@@ -1261,37 +1110,42 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
break;
case SbxAND:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 &= aR.nLong64;
+ aL.nInt64 &= aR.nInt64;
else
aL.nLong &= aR.nLong;
break;
case SbxOR:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 |= aR.nLong64;
+ aL.nInt64 |= aR.nInt64;
else
aL.nLong |= aR.nLong;
break;
case SbxXOR:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 ^= aR.nLong64;
+ aL.nInt64 ^= aR.nInt64;
else
aL.nLong ^= aR.nLong;
break;
case SbxEQV:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = (aL.nLong64 & aR.nLong64) | (~aL.nLong64 & ~aR.nLong64);
+ aL.nInt64 = (aL.nInt64 & aR.nInt64) | (~aL.nInt64 & ~aR.nInt64);
else
aL.nLong = (aL.nLong & aR.nLong) | (~aL.nLong & ~aR.nLong);
break;
case SbxIMP:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = ~aL.nLong64 | aR.nLong64;
+ aL.nInt64 = ~aL.nInt64 | aR.nInt64;
else
aL.nLong = ~aL.nLong | aR.nLong;
break;
case SbxNOT:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = ~aL.nLong64;
+ {
+ if ( aL.eType != SbxBOOL )
+ aL.nInt64 = ~aL.nInt64;
+ else
+ aL.nLong = ~aL.nLong;
+ }
else
aL.nLong = ~aL.nLong;
break;
@@ -1299,8 +1153,8 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
}
}
- else if( ( GetType() == SbxDECIMAL || rOp.GetType() == SbxDECIMAL ) &&
- ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS || eOp == SbxNEG ) )
+ else if( ( GetType() == SbxDECIMAL || rOp.GetType() == SbxDECIMAL )
+ && ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS || eOp == SbxNEG ) )
{
aL.eType = aR.eType = SbxDECIMAL;
bDecimal = true;
@@ -1356,52 +1210,81 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
if( rOp.Get( aR ) )
{
- static BigInt n10K( 10000 );
-
if( rOp.GetType() == SbxEMPTY )
goto Lbl_OpIsEmpty;
if( Get( aL ) ) switch( eOp )
{
+ double dTest;
case SbxMUL:
- {
- // #i20704 Implement directly
- BigInt b1( aL.nLong64 );
- BigInt b2( aR.nLong64 );
- b1 *= b2;
- b1 /= n10K;
- double d = double( b1 ) / 10000.0;
- if( d > SbxMAXCURR || d < SbxMINCURR )
+ // first overflow check: see if product will fit - test real value of product (hence 2 curr factors)
+ dTest = (double)aL.nInt64 * (double)aR.nInt64 / (double)CURRENCY_FACTOR_SQUARE;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
+ {
+ aL.nInt64 = SAL_MAX_INT64;
+ if( dTest < SbxMINCURR ) aL.nInt64 = SAL_MIN_INT64;
SetError( SbxERR_OVERFLOW );
- else
- b1.INT64( &aL.nLong64 );
+ break;
+ }
+ // second overflow check: see if unscaled product overflows - if so use doubles
+ dTest = (double)aL.nInt64 * (double)aR.nInt64;
+ if( dTest < SAL_MIN_INT64 || SAL_MAX_INT64 < dTest)
+ {
+ aL.nInt64 = (sal_Int64)( dTest / (double)CURRENCY_FACTOR );
+ break;
+ }
+ // precise calc: multiply then scale back (move decimal pt)
+ aL.nInt64 *= aR.nInt64;
+ aL.nInt64 /= CURRENCY_FACTOR;
break;
- }
+
case SbxDIV:
- if( !aR.nLong64 )
+ if( !aR.nInt64 )
{
SetError( SbxERR_ZERODIV );
+ break;
}
- else
+ // first overflow check: see if quotient will fit - calc real value of quotient (curr factors cancel)
+ dTest = (double)aL.nInt64 / (double)aR.nInt64;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
{
- // #i20704 Implement directly
- BigInt b1( aL.nLong64 );
- BigInt b2( aR.nLong64 );
- b1 *= n10K;
- b1 /= b2;
- double d = double( b1 ) / 10000.0;
- if( d > SbxMAXCURR || d < SbxMINCURR )
- SetError( SbxERR_OVERFLOW );
- else
- b1.INT64( &aL.nLong64 );
+ SetError( SbxERR_OVERFLOW );
+ break;
}
+ // second overflow check: see if scaled dividend overflows - if so use doubles
+ dTest = (double)aL.nInt64 * (double)CURRENCY_FACTOR;
+ if( dTest < SAL_MIN_INT64 || SAL_MAX_INT64 < dTest)
+ {
+ aL.nInt64 = (sal_Int64)(dTest / (double)aR.nInt64);
+ break;
+ }
+ // precise calc: scale (move decimal pt) then divide
+ aL.nInt64 *= CURRENCY_FACTOR;
+ aL.nInt64 /= aR.nInt64;
break;
+
case SbxPLUS:
- aL.nLong64 += aR.nLong64; break;
+ dTest = ( (double)aL.nInt64 + (double)aR.nInt64 ) / (double)CURRENCY_FACTOR;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
+ {
+ SetError( SbxERR_OVERFLOW );
+ break;
+ }
+ aL.nInt64 += aR.nInt64;
+ break;
+
case SbxMINUS:
- aL.nLong64 -= aR.nLong64; break;
+ dTest = ( (double)aL.nInt64 - (double)aR.nInt64 ) / (double)CURRENCY_FACTOR;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
+ {
+ SetError( SbxERR_OVERFLOW );
+ break;
+ }
+ aL.nInt64 -= aR.nInt64;
+ break;
case SbxNEG:
- aL.nLong64 = -aL.nLong64; break;
+ aL.nInt64 = -aL.nInt64;
+ break;
default:
SetError( SbxERR_NOTIMP );
}
@@ -1409,7 +1292,7 @@ sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
else
Lbl_OpIsDouble:
- { // Andere Operatoren
+ { // other types and operators including Date, Double and Single
aL.eType = aR.eType = SbxDOUBLE;
if( rOp.Get( aR ) )
{
@@ -1432,6 +1315,9 @@ Lbl_OpIsDouble:
else aL.nDouble /= aR.nDouble; break;
case SbxPLUS:
aL.nDouble += aR.nDouble; break;
+ // #45465 Date needs with "+" a special handling: forces date type
+ if( GetType() == SbxDATE || rOp.GetType() == SbxDATE )
+ aL.eType = SbxDATE;
case SbxMINUS:
aL.nDouble -= aR.nDouble; break;
case SbxNEG:
@@ -1440,9 +1326,6 @@ Lbl_OpIsDouble:
SetError( SbxERR_NOTIMP );
}
- // #45465 Date braucht bei + eine Spezial-Behandlung
- if( eOp == SbxPLUS && (GetType() == SbxDATE || rOp.GetType() == SbxDATE ) )
- aL.eType = SbxDATE;
}
}
@@ -1463,7 +1346,7 @@ Lbl_OpIsEmpty:
return bRes;
}
-// Die Vergleichs-Routine liefert sal_True oder sal_False.
+// The comparison routine deliver TRUE or FALSE.
sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
{
@@ -1481,11 +1364,11 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
}
else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY )
bRes = !bVBAInterop ? sal_True : ( eOp == SbxEQ ? sal_True : sal_False );
- // Sonderregel 1: Ist ein Operand Null, ist das Ergebnis FALSE
+ // Special rule 1: If an operand is zero, the result is FALSE
else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL )
bRes = sal_False;
- // Sonderregel 2: Wenn beide Variant sind und einer ist numerisch,
- // und der andere ein String, ist num < str
+ // Special rule 2: If both are variant and one is numeric
+ // and the other is a String, num is < str
else if( !IsFixed() && !rOp.IsFixed()
&& ( rOp.GetType() == SbxSTRING && GetType() != SbxSTRING && IsNumeric() ) && !bVBAInterop
)
@@ -1498,8 +1381,8 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
else
{
SbxValues aL, aR;
- // Wenn einer der Operanden ein String ist,
- // findet ein Stringvergleich statt
+ // If one of the operands is a String,
+ // a String comparing take place
if( GetType() == SbxSTRING || rOp.GetType() == SbxSTRING )
{
aL.eType = aR.eType = SbxSTRING;
@@ -1521,8 +1404,8 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
SetError( SbxERR_NOTIMP );
}
}
- // AB 19.12.95: Wenn SbxSINGLE beteiligt, auf SINGLE konvertieren,
- // sonst gibt es numerische Fehler
+ // From 1995-12-19: If SbxSINGLE participate, then convert to SINGLE,
+ // elsewise it shows a numeric error
else if( GetType() == SbxSINGLE || rOp.GetType() == SbxSINGLE )
{
aL.eType = aR.eType = SbxSINGLE;
@@ -1578,7 +1461,7 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
releaseDecimalPtr( aL.pDecimal );
releaseDecimalPtr( aR.pDecimal );
}
- // Alles andere auf SbxDOUBLE-Basis vergleichen
+ // Everything else comparing on a SbxDOUBLE-Basis
else
{
aL.eType = aR.eType = SbxDOUBLE;
@@ -1621,10 +1504,12 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
return bRes;
}
-///////////////////////////// Lesen/Schreiben ////////////////////////////
+///////////////////////////// Reading/Writing ////////////////////////////
sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
{
+ // #TODO see if these types are really dumped to any stream
+ // more than likely this is functionality used in the binfilter alone
SbxValue::Clear();
sal_uInt16 nType;
r >> nType;
@@ -1638,7 +1523,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
r >> aData.nLong; break;
case SbxSINGLE:
{
- // Floats als ASCII
+ // Floats as ASCII
XubString aVal;
r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
double d;
@@ -1654,7 +1539,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
case SbxDATE:
case SbxDOUBLE:
{
- // Floats als ASCII
+ // Floats as ASCII
XubString aVal;
r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
SbxDataType t;
@@ -1665,15 +1550,21 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
}
break;
}
- case SbxULONG64:
- {
- r >> aData.nULong64.nHigh >> aData.nULong64.nLow;
+ case SbxSALUINT64:
+ case SbxSALINT64:
+ // Rather ugly use of the union here because we only
+ // have a SvStream& SvStream::operator>>(sal_uInt64&) available to us
+ // There is no SvStream::operator>>(sal_Int64&) due to conflict with
+ // SvStream::operator>>(long&) ( at least on 64 bit linux )
+ r >> aData.uInt64;
break;
- }
- case SbxLONG64:
case SbxCURRENCY:
{
- r >> aData.nLong64.nHigh >> aData.nLong64.nLow;
+ sal_uInt32 tmpHi = 0;
+ sal_uInt32 tmpLo = 0;
+ r >> tmpHi >> tmpLo;
+ aData.nInt64 = ((sal_Int64)tmpHi << 32);
+ aData.nInt64 |= (sal_Int64)tmpLo;
break;
}
case SbxSTRING:
@@ -1683,7 +1574,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
if( aVal.Len() )
aData.pOUString = new ::rtl::OUString( aVal );
else
- aData.pOUString = NULL; // JSM 22.09.1995
+ aData.pOUString = NULL; // JSM 1995-09-22
break;
}
case SbxERROR:
@@ -1722,7 +1613,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
{
sal_uInt8 n;
r >> n;
- // Passt der Int auf diesem System?
+ // Match the Int on this system?
if( n > SAL_TYPES_SIZEOFINT )
r >> aData.nLong, aData.eType = SbxLONG;
else
@@ -1733,7 +1624,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
{
sal_uInt8 n;
r >> n;
- // Passt der UInt auf diesem System?
+ // Match the UInt on this system?
if( n > SAL_TYPES_SIZEOFINT )
r >> aData.nULong, aData.eType = SbxULONG;
else
@@ -1773,7 +1664,7 @@ sal_Bool SbxValue::StoreData( SvStream& r ) const
case SbxLONG:
r << aData.nLong; break;
case SbxDATE:
- // #49935: Als double speichern, sonst Fehler beim Einlesen
+ // #49935: Save as double, elsewise an error during the read in
((SbxValue*)this)->aData.eType = (SbxDataType)( ( nType & 0xF000 ) | SbxDOUBLE );
r.WriteByteString( GetCoreString(), RTL_TEXTENCODING_ASCII_US );
((SbxValue*)this)->aData.eType = (SbxDataType)nType;
@@ -1782,15 +1673,16 @@ sal_Bool SbxValue::StoreData( SvStream& r ) const
case SbxDOUBLE:
r.WriteByteString( GetCoreString(), RTL_TEXTENCODING_ASCII_US );
break;
- case SbxULONG64:
- {
- r << aData.nULong64.nHigh << aData.nULong64.nLow;
+ case SbxSALUINT64:
+ case SbxSALINT64:
+ // see comment in SbxValue::StoreData
+ r << aData.uInt64;
break;
- }
- case SbxLONG64:
case SbxCURRENCY:
{
- r << aData.nLong64.nHigh << aData.nLong64.nLow;
+ sal_Int32 tmpHi = ( (aData.nInt64 >> 32) & 0xFFFFFFFF );
+ sal_Int32 tmpLo = ( sal_Int32 )aData.nInt64;
+ r << tmpHi << tmpLo;
break;
}
case SbxSTRING:
@@ -1808,7 +1700,7 @@ sal_Bool SbxValue::StoreData( SvStream& r ) const
case SbxUSHORT:
r << aData.nUShort; break;
case SbxOBJECT:
- // sich selbst als Objektptr speichern geht nicht!
+ // to save itself as Objektptr doesn't work!
if( aData.pObj )
{
if( PTR_CAST(SbxValue,aData.pObj) != this )
@@ -1862,3 +1754,4 @@ sal_Bool SbxValue::StoreData( SvStream& r ) const
return sal_True;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 1f33cc8acfd2..9a981cccc7ca 100644..100755
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,6 @@
#include "svl/brdcst.hxx"
#include <basic/sbx.hxx>
-#include <basic/sbxbase.hxx>
#include "sbxres.hxx"
#include "sbxconv.hxx"
#include <math.h>
@@ -73,7 +73,7 @@ class SbxVariableImpl
};
-///////////////////////////// Konstruktoren //////////////////////////////
+///////////////////////////// Constructors //////////////////////////////
SbxVariable::SbxVariable() : SbxValue()
{
@@ -84,7 +84,6 @@ SbxVariable::SbxVariable() : SbxValue()
nHash = 0;
#ifdef DBG_UTIL
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#endif
}
@@ -119,7 +118,6 @@ SbxVariable::SbxVariable( const SbxVariable& r )
if ( maName.EqualsAscii( aCellsStr ) )
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#endif
}
@@ -132,7 +130,6 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
nHash = 0;
#ifdef DBG_UTIL
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#endif
}
@@ -146,7 +143,6 @@ SbxVariable::~SbxVariable()
static sal_Char const aCellsStr[] = "Cells";
if ( maName.EqualsAscii( aCellsStr ) )
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
- GetSbxData_Impl()->aVars.Remove( this );
#endif
if( IsSet( SBX_DIM_AS_NEW ))
removeDimAsNewRecoverItem( this );
@@ -163,31 +159,31 @@ SfxBroadcaster& SbxVariable::GetBroadcaster()
return *pCst;
}
-// Eines Tages kann man vielleicht den Parameter 0 schleifen,
-// dann entfaellt die Kopiererei...
+// Perhaps some day one could cut the parameter 0.
+// then the copying will be dropped ...
void SbxVariable::Broadcast( sal_uIntPtr nHintId )
{
if( pCst && !IsSet( SBX_NO_BROADCAST ) && StaticIsEnabledBroadcasting() )
{
- // Da die Methode von aussen aufrufbar ist, hier noch einmal
- // die Berechtigung testen
+ // Because the method could be called from outside, check the Da die Methode von aussen aufrufbar ist, hier noch einmal
+ // rights here again
if( nHintId & SBX_HINT_DATAWANTED )
if( !CanRead() )
return;
if( nHintId & SBX_HINT_DATACHANGED )
if( !CanWrite() )
return;
- // Weitere Broadcasts verhindern
+ // Avoid further broadcasting
SfxBroadcaster* pSave = pCst;
pCst = NULL;
sal_uInt16 nSaveFlags = GetFlags();
SetFlag( SBX_READWRITE );
if( mpPar.Is() )
- // this, als Element 0 eintragen, aber den Parent nicht umsetzen!
+ // Register this as element 0, but don't change over the parent!
mpPar->GetRef( 0 ) = this;
pSave->Broadcast( SbxHint( nHintId, this ) );
- delete pCst; // wer weiss schon, auf welche Gedanken mancher kommt?
+ delete pCst; // who knows already, onto which thoughts someone comes?
pCst = pSave;
SetFlags( nSaveFlags );
}
@@ -215,7 +211,7 @@ void SbxVariable::SetParameters( SbxArray* p )
}
-/////////////////////////// Name der Variablen ///////////////////////////
+/////////////////////////// Name of the variables ///////////////////////////
void SbxVariable::SetName( const XubString& rName )
{
@@ -228,15 +224,15 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
static char cSuffixes[] = " %&!#@ $";
if( t == SbxNAME_NONE )
return maName;
- // Parameter-Infos anfordern (nicht fuer Objekte)
+ // Request parameter-information (not for objects)
((SbxVariable*)this)->GetInfo();
- // Nix anfuegen, wenn einfache Property (keine leeren Klammern)
+ // Append nothing, if it is a simple property (no empty brackets)
if( !pInfo
|| ( !pInfo->aParams.Count() && GetClass() == SbxCLASS_PROPERTY ) )
return maName;
xub_Unicode cType = ' ';
XubString aTmp( maName );
- // Kurzer Typ? Dann holen, evtl. ist dieser 0.
+ // short type? Then fetch it, posible this is 0.
SbxDataType et = GetType();
if( t == SbxNAME_SHORT_TYPES )
{
@@ -258,7 +254,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
aTmp += String( SbxRes( STRING_BYREF ) );
aTmp += q->aName;
cType = ' ';
- // Kurzer Typ? Dann holen, evtl. ist dieser 0.
+ // short type? Then fetch it, posible this is 0.
if( t == SbxNAME_SHORT_TYPES )
{
if( nt <= SbxSTRING )
@@ -274,7 +270,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
{
if( q->eType & SbxARRAY )
aTmp.AppendAscii( "()" );
- // langer Typ?
+ // long type?
if( t != SbxNAME_SHORT )
{
aTmp += String( SbxRes( STRING_AS ) );
@@ -287,7 +283,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
}
}
aTmp += ')';
- // Langer Typ? Dann holen
+ // Long type? Then fetch it
if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
{
aTmp += String( SbxRes( STRING_AS ) );
@@ -301,7 +297,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
return aToolString;
}
-// Einen simplen Hashcode erzeugen: Es werden die ersten 6 Zeichen gewertet.
+// Create a simple hashcode: the first six characters were evaluated.
sal_uInt16 SbxVariable::MakeHashCode( const XubString& rName )
{
@@ -314,7 +310,7 @@ sal_uInt16 SbxVariable::MakeHashCode( const XubString& rName )
{
sal_uInt8 c = (sal_uInt8)*p;
p++;
- // Falls wir ein Schweinezeichen haben, abbrechen!!
+ // If we have a commen sigen break!!
if( c >= 0x80 )
return 0;
n = sal::static_int_cast< sal_uInt16 >( ( n << 3 ) + toupper( c ) );
@@ -322,7 +318,7 @@ sal_uInt16 SbxVariable::MakeHashCode( const XubString& rName )
return n;
}
-////////////////////////////// Operatoren ////////////////////////////////
+////////////////////////////// Operators ////////////////////////////////
SbxVariable& SbxVariable::operator=( const SbxVariable& r )
{
@@ -339,7 +335,7 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
return *this;
}
-//////////////////////////////// Konversion ////////////////////////////////
+//////////////////////////////// Conversion ////////////////////////////////
SbxDataType SbxVariable::GetType() const
{
@@ -361,17 +357,17 @@ void SbxVariable::SetModified( sal_Bool b )
if( IsSet( SBX_NO_MODIFY ) )
return;
SbxBase::SetModified( b );
- if( pParent && pParent != this ) //??? HotFix: Rekursion raus MM
+ if( pParent && pParent != this ) //??? HotFix: Recursion out here MM
pParent->SetModified( b );
}
void SbxVariable::SetParent( SbxObject* p )
{
#ifdef DBG_UTIL
- // wird der Parent eines SbxObjects gesetzt?
+ // Will the parent of a SbxObject be set?
if ( p && ISA(SbxObject) )
{
- // dann mu\s dieses auch Child vom neuen Parent sein
+ // then this had to be a child of the new parent
sal_Bool bFound = sal_False;
SbxArray *pChilds = p->GetObjects();
if ( pChilds )
@@ -430,7 +426,7 @@ void SbxVariable::ClearComListener( void )
}
-////////////////////////////// Laden/Speichern /////////////////////////////
+////////////////////////////// Loading/Saving /////////////////////////////
sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
@@ -454,7 +450,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
sal_uInt32 nTemp;
rStrm >> nTemp;
nUserData = nTemp;
- // Korrektur: Alte Methoden haben statt SbxNULL jetzt SbxEMPTY
+ // correction: old methods have instead of SbxNULL now SbxEMPTY
if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD )
nType = SbxEMPTY;
SbxValues aTmp;
@@ -472,7 +468,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
rStrm >> aTmp.nLong; break;
case SbxSINGLE:
{
- // Floats als ASCII
+ // Floats as ASCII
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
double d;
SbxDataType t;
@@ -487,7 +483,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
case SbxDATE:
case SbxDOUBLE:
{
- // Floats als ASCII
+ // Floats as ASCII
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
SbxDataType t;
if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK )
@@ -509,14 +505,14 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
DBG_ASSERT( !this, "Nicht unterstuetzer Datentyp geladen" );
return sal_False;
}
- // Wert putten
+ // putt value
if( nType != SbxNULL && nType != SbxEMPTY && !Put( aTmp ) )
return sal_False;
}
rStrm >> cMark;
- // cMark ist auch eine Versionsnummer!
+ // cMark is also a version number!
// 1: initial version
- // 2: mit nUserData
+ // 2: with nUserData
if( cMark )
{
if( cMark > 2 )
@@ -524,7 +520,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
pInfo = new SbxInfo;
pInfo->LoadData( rStrm, (sal_uInt16) cMark );
}
- // Privatdaten nur laden, wenn es eine SbxVariable ist
+ // Load private data only, if it is a SbxVariable
if( GetClass() == SbxCLASS_VARIABLE && !LoadPrivateData( rStrm, nVer ) )
return sal_False;
((SbxVariable*) this)->Broadcast( SBX_HINT_DATACHANGED );
@@ -539,16 +535,16 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const
sal_Bool bValStore;
if( this->IsA( TYPE(SbxMethod) ) )
{
- // #50200 Verhindern, dass Objekte, die zur Laufzeit als Return-Wert
- // in der Methode als Value gespeichert sind, mit gespeichert werden
+ // #50200 Avoid that objects , which during the runtime
+ // as return-value are saved in the method as a value were saved
SbxVariable* pThis = (SbxVariable*)this;
sal_uInt16 nSaveFlags = GetFlags();
pThis->SetFlag( SBX_WRITE );
pThis->SbxValue::Clear();
pThis->SetFlags( nSaveFlags );
- // Damit die Methode in keinem Fall ausgefuehrt wird!
- // CAST, um const zu umgehen!
+ // So that the method will not be executed in any case!
+ // CAST, to avoid const!
pThis->SetFlag( SBX_NO_BROADCAST );
bValStore = SbxValue::StoreData( rStrm );
pThis->ResetFlag( SBX_NO_BROADCAST );
@@ -563,12 +559,12 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const
rStrm << (sal_uInt32)nUserData;
if( pInfo.Is() )
{
- rStrm << (sal_uInt8) 2; // Version 2: mit UserData!
+ rStrm << (sal_uInt8) 2; // Version 2: with UserData!
pInfo->StoreData( rStrm );
}
else
rStrm << (sal_uInt8) 0;
- // Privatdaten nur speichern, wenn es eine SbxVariable ist
+ // Save private data only, if it is a SbxVariable
if( GetClass() == SbxCLASS_VARIABLE )
return StorePrivateData( rStrm );
else
@@ -637,7 +633,7 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
if( p && p->GetId() == SBX_HINT_DYING )
{
xAlias.Clear();
- // Alias loeschen?
+ // delete the alias?
if( pParent )
pParent->Remove( this );
}
@@ -656,7 +652,7 @@ void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill )
rStrm << " no parent";
rStrm << " ) ";
- // bei Object-Vars auch das Object ausgeben
+ // output also the object at object-vars
if ( GetValues_Impl().eType == SbxOBJECT &&
GetValues_Impl().pObj &&
GetValues_Impl().pObj != this &&
@@ -669,3 +665,4 @@ void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill )
rStrm << endl;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index f173ae5f18ff..04df56763a13 100644..100755
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,6 +41,7 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include "com/sun/star/resource/XStringResourceWithStorage.hpp"
#include "com/sun/star/resource/XStringResourceWithLocation.hpp"
+#include "com/sun/star/document/XGraphicObjectResolver.hpp"
#include "dlgcont.hxx"
#include "sbmodule.hxx"
#include <comphelper/processfactory.hxx>
@@ -68,11 +70,14 @@ using namespace com::sun::star::script;
using namespace com::sun::star::xml::sax;
using namespace com::sun::star;
using namespace cppu;
-using namespace rtl;
using namespace osl;
+using ::rtl::OUString;
+
using com::sun::star::uno::Reference;
+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+
//============================================================================
// Implementation class SfxDialogLibraryContainer
@@ -132,7 +137,7 @@ bool writeOasis2OOoLibraryElement(
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue(
- OUString::createFromAscii(("DefaultContext")) ) >>= xContext );
+ OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< lang::XMultiComponentFactory > xSMgr(
xContext->getServiceManager() );
@@ -178,7 +183,7 @@ bool writeOasis2OOoLibraryElement(
xml::sax::InputSource source;
source.aInputStream = xInput;
- source.sSystemId = OUString::createFromAscii( "virtual file" );
+ source.sSystemId = OUString(RTL_CONSTASCII_USTRINGPARAM("virtual file"));
xParser->parseStream( source );
@@ -224,6 +229,35 @@ void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement
xInput->closeInput();
}
+void lcl_deepInspectForEmbeddedImages( const Reference< XInterface >& xIf, std::vector< rtl::OUString >& rvEmbedImgUrls )
+{
+ static rtl::OUString sImageURL= OUString(RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) );
+ Reference< beans::XPropertySet > xProps( xIf, UNO_QUERY );
+ if ( xProps.is() )
+ {
+
+ if ( xProps->getPropertySetInfo()->hasPropertyByName( sImageURL ) )
+ {
+ rtl::OUString sURL;
+ xProps->getPropertyValue( sImageURL ) >>= sURL;
+ if ( sURL.getLength() && sURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 )
+ rvEmbedImgUrls.push_back( sURL );
+ }
+ }
+ Reference< XNameContainer > xContainer( xIf, UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ Sequence< rtl::OUString > sNames = xContainer->getElementNames();
+ sal_Int32 nContainees = sNames.getLength();
+ for ( sal_Int32 index = 0; index < nContainees; ++index )
+ {
+ Reference< XInterface > xCtrl;
+ xContainer->getByName( sNames[ index ] ) >>= xCtrl;
+ lcl_deepInspectForEmbeddedImages( xCtrl, rvEmbedImgUrls );
+ }
+ }
+}
+
void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< embed::XStorage >& xStorage ) throw ( RuntimeException )
{
LibraryContainerMethodGuard aGuard( *this );
@@ -252,6 +286,54 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
SfxLibraryContainer::storeLibrariesToStorage( xStorage );
+ // we need to export out any embedded image object(s)
+ // associated with any Dialogs. First, we need to actually gather any such urls
+ // for each dialog in this container
+ Sequence< OUString > sLibraries = getElementNames();
+ for ( sal_Int32 i=0; i < sLibraries.getLength(); ++i )
+ {
+ // libraries will already be loaded from above
+ Reference< XNameContainer > xLib;
+ getByName( sLibraries[ i ] ) >>= xLib;
+ if ( xLib.is() )
+ {
+ Sequence< OUString > sDialogs = xLib->getElementNames();
+ sal_Int32 nDialogs( sDialogs.getLength() );
+ for ( sal_Int32 j=0; j < nDialogs; ++j )
+ {
+ // Each Dialog has an associated xISP
+ Reference< io::XInputStreamProvider > xISP;
+ xLib->getByName( sDialogs[ j ] ) >>= xISP;
+ if ( xISP.is() )
+ {
+ Reference< io::XInputStream > xInput( xISP->createInputStream() );
+ Reference< XNameContainer > xDialogModel( mxMSF->createInstance
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
+ Reference< XComponentContext > xContext;
+ Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
+ std::vector< rtl::OUString > vEmbeddedImageURLs;
+ lcl_deepInspectForEmbeddedImages( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
+ if ( vEmbeddedImageURLs.size() )
+ {
+ // Export the images to the storage
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= xStorage;
+ Reference< document::XGraphicObjectResolver > xGraphicResolver( mxMSF->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Svx.GraphicExportHelper" ) ), aArgs ), UNO_QUERY );
+ std::vector< rtl::OUString >::iterator it = vEmbeddedImageURLs.begin();
+ std::vector< rtl::OUString >::iterator it_end = vEmbeddedImageURLs.end();
+ if ( xGraphicResolver.is() )
+ {
+ for ( sal_Int32 count = 0; it != it_end; ++it, ++count )
+ xGraphicResolver->resolveGraphicObjectURL( *it );
+ }
+ }
+ }
+ }
+ }
+ }
mbOasis2OOoFormat = sal_False;
}
@@ -322,7 +404,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
try {
// start parsing
- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
xParser->parseStream( source );
}
catch( Exception& )
@@ -336,7 +418,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
// Create InputStream, TODO: Implement own InputStreamProvider
// to avoid creating the DialogModel here!
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
aRetAny <<= xISP;
return aRetAny;
}
@@ -352,8 +434,8 @@ SfxLibraryContainer* SfxDialogLibraryContainer::createInstanceImpl( void )
}
-static OUString aResourceFileNameBase = OUString::createFromAscii( "DialogStrings" );
-static OUString aResourceFileCommentBase = OUString::createFromAscii( "# Strings for Dialog Library " );
+static OUString aResourceFileNameBase(RTL_CONSTASCII_USTRINGPARAM("DialogStrings"));
+static OUString aResourceFileCommentBase(RTL_CONSTASCII_USTRINGPARAM("# Strings for Dialog Library "));
// Resource handling
Reference< ::com::sun::star::resource::XStringResourcePersistence >
@@ -380,7 +462,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
// TODO: Ctor
xRet = Reference< resource::XStringResourcePersistence >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.resource.StringResourceWithStorage" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.resource.StringResourceWithStorage")) ), UNO_QUERY );
uno::Reference< embed::XStorage > xLibrariesStor;
uno::Reference< embed::XStorage > xLibraryStor;
@@ -428,7 +510,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
// TODO: Ctor
xRet = Reference< resource::XStringResourcePersistence >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.resource.StringResourceWithLocation")) ), UNO_QUERY );
// TODO: Ctor
if( xRet.is() )
@@ -484,7 +566,11 @@ void SfxDialogLibraryContainer::onNewRootStorage()
}
}
-
+sal_Bool SAL_CALL
+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& /*Library*/ ) throw (uno::RuntimeException)
+{
+ return sal_False; // dialog library has no executable code
+}
//============================================================================
// Service
@@ -506,9 +592,9 @@ Sequence< ::rtl::OUString > SAL_CALL SfxDialogLibraryContainer::getSupportedServ
Sequence< OUString > SfxDialogLibraryContainer::getSupportedServiceNames_static()
{
Sequence< OUString > aServiceNames( 2 );
- aServiceNames[0] = OUString::createFromAscii( "com.sun.star.script.DocumentDialogLibraryContainer" );
+ aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.DocumentDialogLibraryContainer"));
// plus, for compatibility:
- aServiceNames[1] = OUString::createFromAscii( "com.sun.star.script.DialogLibraryContainer" );
+ aServiceNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.DialogLibraryContainer"));
return aServiceNames;
}
@@ -520,7 +606,7 @@ OUString SfxDialogLibraryContainer::getImplementationName_static()
MutexGuard aGuard( Mutex::getGlobalMutex() );
if( bNeedsInit )
{
- aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.DialogLibraryContainer" );
+ aImplName = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sfx2.DialogLibraryContainer"));
bNeedsInit = sal_False;
}
return aImplName;
@@ -656,3 +742,4 @@ bool SAL_CALL SfxDialogLibrary::isLibraryElementValid( ::com::sun::star::uno::An
}
//============================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/makefile.mk b/basic/source/uno/makefile.mk
index 52e7f7004c4d..52e7f7004c4d 100644..100755
--- a/basic/source/uno/makefile.mk
+++ b/basic/source/uno/makefile.mk
diff --git a/basic/source/uno/modsizeexceeded.cxx b/basic/source/uno/modsizeexceeded.cxx
index 3efc7f2d230b..d46108e92dad 100644..100755
--- a/basic/source/uno/modsizeexceeded.cxx
+++ b/basic/source/uno/modsizeexceeded.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,9 +35,10 @@
using namespace com::sun::star;
using namespace cppu;
-using namespace rtl;
using namespace osl;
+using ::rtl::OUString;
+
ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& sModules )
{
script::ModuleSizeExceededRequest aReq;
@@ -66,3 +68,4 @@ ModuleSizeExceeded::isApprove() const
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index fbf1429f9753..9479d56e0844 100644..100755
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,18 +34,16 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#ifndef __RSC //autogen
#include <tools/errinf.hxx>
#endif
#include <osl/mutex.hxx>
-#include <vos/diagnose.hxx>
+#include <osl/diagnose.h>
#include <rtl/uri.hxx>
#include <rtl/strbuf.hxx>
#include <comphelper/processfactory.hxx>
-#ifndef INCLUDED_COMPHELPER_ANYTOSTRING_HXX
#include <comphelper/anytostring.hxx>
-#endif
#include "namecont.hxx"
#include <basic/basicmanagerrepository.hxx>
@@ -67,11 +66,10 @@
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
#include "com/sun/star/deployment/ExtensionManager.hpp"
#include <comphelper/storagehelper.hxx>
-#ifndef _RTL_USTRING_HXX_
#include <comphelper/anytostring.hxx>
-#endif
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
+#include <boost/scoped_ptr.hpp>
namespace basic
{
@@ -92,11 +90,15 @@ using namespace com::sun::star::frame;
using namespace com::sun::star::deployment;
using namespace com::sun::star;
using namespace cppu;
-using namespace rtl;
using namespace osl;
using com::sun::star::uno::Reference;
+using ::rtl::OUString;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringToOString;
+using ::rtl::Uri;
+
// #i34411: Flag for error handling during migration
static bool GbMigrationSuppressErrors = false;
@@ -343,14 +345,14 @@ SfxLibraryContainer::SfxLibraryContainer( void )
}
mxSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
if( !mxSFI.is() )
{
OSL_ENSURE( 0, "### couln't create SimpleFileAccess component\n" );
}
mxStringSubstitution = Reference< XStringSubstitution >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.util.PathSubstitution" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")) ), UNO_QUERY );
if( !mxStringSubstitution.is() )
{
OSL_ENSURE( 0, "### couln't create PathSubstitution component\n" );
@@ -535,14 +537,14 @@ static void createVariableURL( OUString& rStr, const OUString& rLibName,
const OUString& rInfoFileName, bool bUser )
{
if( bUser )
- rStr = OUString::createFromAscii( "$(USER)/basic/" );
+ rStr = OUString(RTL_CONSTASCII_USTRINGPARAM("$(USER)/basic/"));
else
- rStr = OUString::createFromAscii( "$(INST)/share/basic/" );
+ rStr = OUString(RTL_CONSTASCII_USTRINGPARAM("$(INST)/share/basic/"));
rStr += rLibName;
- rStr += OUString::createFromAscii( "/" );
+ rStr += OUString(sal_Unicode('/'));
rStr += rInfoFileName;
- rStr += OUString::createFromAscii( ".xlb/" );
+ rStr += OUString(RTL_CONSTASCII_USTRINGPARAM(".xlb/"));
}
sal_Bool SfxLibraryContainer::init( const OUString& rInitialDocumentURL, const uno::Reference< embed::XStorage >& rxInitialStorage )
@@ -945,7 +947,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
catch( uno::Exception& )
{
// TODO: error handling?
- OSL_ASSERT( "Cannot access extensions!" );
+ OSL_FAIL( "Cannot access extensions!" );
}
}
@@ -983,7 +985,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
{
INetURLObject aPrevUserBasicInetObj = aPrevUserBasicInetObj_1;
String aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
- bool bSecondTime = false;
if( mxSFI->isFolder( aPrevFolder ) )
{
// #110101 Check if Standard folder exists and is complete
@@ -1029,7 +1030,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
}
else
{
- bSecondTime = true;
aPrevUserBasicInetObj = aPrevUserBasicInetObj_2;
aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
}
@@ -1078,10 +1078,10 @@ sal_Bool SfxLibraryContainer::init_Impl(
mxSFI->move( aFolderUserBasic, aPrevFolder );
mxSFI->move( aFolderTmp, aFolderUserBasic );
- OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" );
- OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" );
- OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" );
- OUString aInstSearchStr = OUString::createFromAscii( "$(INST)" );
+ OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"));
+ OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"));
+ OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"));
+ OUString aInstSearchStr(RTL_CONSTASCII_USTRINGPARAM("$(INST)"));
Sequence< OUString > aNames = pPrevCont->getElementNames();
const OUString* pNames = aNames.getConstArray();
@@ -1163,7 +1163,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
// #i93163
if( bCleanUp )
{
- DBG_ERROR( "Upgrade of Basic installation failed somehow" );
+ OSL_FAIL( "Upgrade of Basic installation failed somehow" );
static char strErrorSavFolderName[] = "__basic_80_err";
INetURLObject aPrevUserBasicInetObj_Err( aUserBasicInetObj );
@@ -1207,7 +1207,7 @@ void SfxLibraryContainer::implScanExtensions( void )
bool bPureDialogLib = false;
while( (aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).getLength() > 0 )
{
- if( bPureDialogLib && maInfoFileName.equalsAscii( "script" ) )
+ if( bPureDialogLib && maInfoFileName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "script" ) ) )
continue;
// Extract lib name
@@ -1229,9 +1229,9 @@ void SfxLibraryContainer::implScanExtensions( void )
// Add index file to URL
OUString aIndexFileURL = aLibURL;
if( nReduceCopy == 0 )
- aIndexFileURL += OUString::createFromAscii( "/" );
+ aIndexFileURL += OUString(sal_Unicode('/'));
aIndexFileURL += maInfoFileName;
- aIndexFileURL += OUString::createFromAscii( ".xlb" );
+ aIndexFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM(".xlb"));
// Create link
const bool bReadOnly = false;
@@ -1403,7 +1403,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
// #87671 Allow encryption
-//REMOVE aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") );
aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "UseCommonStoragePasswordEncryption" ) );
xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) );
@@ -1551,7 +1550,6 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
// #87671 Allow encryption
-//REMOVE aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") );
aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "UseCommonStoragePasswordEncryption" ) );
xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) );
@@ -1700,9 +1698,6 @@ sal_Bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
}
catch( Exception& )
{
- // throw WrappedTargetException( OUString::createFromAscii( "parsing error!\n" ),
- // Reference< XInterface >(),
- // makeAny( e ) );
OSL_ENSURE( 0, "Parsing error\n" );
SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath );
sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
@@ -1766,7 +1761,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if( !nLibsToSave )
return;
- ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave );
+ boost::scoped_ptr< ::xmlscript::LibDescriptorArray > pLibArray(new ::xmlscript::LibDescriptorArray(nLibsToSave));
// Write to storage?
sal_Bool bStorage = i_rStorage.is();
@@ -1777,7 +1772,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if ( bStorage )
{
// Don't write if only empty standard lib exists
- if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) )
+ if ( ( nNameCount == 1 ) && ( aNames[0].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Standard" ) ) ) )
{
Any aLibAny = maNameContainer.getByName( aNames[0] );
Reference< XNameAccess > xNameAccess;
@@ -2072,7 +2067,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
try
{
- xmlscript::exportLibraryContainer( xHandler, pLibArray );
+ xmlscript::exportLibraryContainer( xHandler, pLibArray.get() );
if ( bStorage )
{
uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY );
@@ -2089,8 +2084,6 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
ErrorHandler::HandleError( nErrorCode );
}
-
- delete pLibArray;
}
@@ -2185,9 +2178,9 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
maNameContainer.insertByName( Name, aElement );
maModifiable.setModified( sal_True );
- OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" );
- OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" );
- OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" );
+ OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"));
+ OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"));
+ OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"));
if( StorageURL.indexOf( aUserSearchStr ) != -1 )
{
pNewLib->mbExtension = sal_True;
@@ -2712,7 +2705,7 @@ void SAL_CALL SfxLibraryContainer::exportLibrary( const OUString& Name, const OU
if( Handler.is() )
{
xToUseSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
if( xToUseSFI.is() )
xToUseSFI->setInteractionHandler( Handler );
}
@@ -2848,6 +2841,18 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
}
}
+void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _projectname ) throw (RuntimeException)
+{
+ msProjectName = _projectname;
+ BasicManager* pBasMgr = getBasicManager();
+ // Temporary HACK
+ // Some parts of the VBA handling ( e.g. in core basic )
+ // code expect the name of the VBA project to be set as the name of
+ // the basic manager. Provide fail back here.
+ if( pBasMgr )
+ pBasMgr->SetName( msProjectName );
+}
+
// Methods XServiceInfo
::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
throw (RuntimeException)
@@ -3131,8 +3136,8 @@ void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerLi
//============================================================================
// Implementation class ScriptExtensionIterator
-static rtl::OUString aBasicLibMediaType( rtl::OUString::createFromAscii( "application/vnd.sun.star.basic-library" ) );
-static rtl::OUString aDialogLibMediaType( rtl::OUString::createFromAscii( "application/vnd.sun.star.dialog-library" ) );
+#define sBasicLibMediaType "application/vnd.sun.star.basic-library"
+#define sDialogLibMediaType "application/vnd.sun.star.dialog-library"
ScriptExtensionIterator::ScriptExtensionIterator( void )
: m_eState( USER_EXTENSIONS )
@@ -3156,7 +3161,7 @@ ScriptExtensionIterator::ScriptExtensionIterator( void )
if( !m_xContext.is() )
{
throw RuntimeException(
- ::rtl::OUString::createFromAscii( "ScriptExtensionIterator::init(), no XComponentContext" ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptExtensionIterator::init(), no XComponentContext")),
Reference< XInterface >() );
}
}
@@ -3201,7 +3206,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
break;
}
case END_REACHED:
- VOS_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
+ OSL_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
break;
}
}
@@ -3283,11 +3288,11 @@ Reference< deployment::XPackage > ScriptSubPackageIterator::implDetectScriptPack
{
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType();
rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
- if( aMediaType.equals( aBasicLibMediaType ) )
+ if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBasicLibMediaType)) )
{
xScriptPackage = xPackage;
}
- else if( aMediaType.equals( aDialogLibMediaType ) )
+ else if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDialogLibMediaType)) )
{
rbPureDialogLib = true;
xScriptPackage = xPackage;
@@ -3329,12 +3334,12 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetScriptPackageF
const Reference< deployment::XPackage > xSubPkg = pSeq[ iPkg ];
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xSubPkg->getPackageType();
rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
- if( aMediaType.equals( aBasicLibMediaType ) )
+ if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBasicLibMediaType)) )
{
xScriptPackage = xSubPkg;
break;
}
- else if( aMediaType.equals( aDialogLibMediaType ) )
+ else if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDialogLibMediaType)) )
{
rbPureDialogLib = true;
xScriptPackage = xSubPkg;
@@ -3346,11 +3351,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetScriptPackageF
{
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType();
rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
- if( aMediaType.equals( aBasicLibMediaType ) )
+ if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBasicLibMediaType)) )
{
xScriptPackage = xPackage;
}
- else if( aMediaType.equals( aDialogLibMediaType ) )
+ else if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDialogLibMediaType)) )
{
rbPureDialogLib = true;
xScriptPackage = xPackage;
@@ -3373,7 +3378,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
Reference< XExtensionManager > xManager =
ExtensionManager::get( m_xContext );
m_aUserPackagesSeq = xManager->getDeployedExtensions
- (rtl::OUString::createFromAscii("user"),
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
@@ -3396,7 +3401,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
{
const Reference< deployment::XPackage >* pUserPackages = m_aUserPackagesSeq.getConstArray();
Reference< deployment::XPackage > xPackage = pUserPackages[ m_iUserPackage ];
- VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextUserScriptPackage(): Invalid package" );
+ OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextUserScriptPackage(): Invalid package" );
m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
}
@@ -3427,7 +3432,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
Reference< XExtensionManager > xSharedManager =
ExtensionManager::get( m_xContext );
m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions
- (rtl::OUString::createFromAscii("shared"),
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
@@ -3449,7 +3454,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
{
const Reference< deployment::XPackage >* pSharedPackages = m_aSharedPackagesSeq.getConstArray();
Reference< deployment::XPackage > xPackage = pSharedPackages[ m_iSharedPackage ];
- VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextSharedScriptPackage(): Invalid package" );
+ OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextSharedScriptPackage(): Invalid package" );
m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
}
@@ -3480,7 +3485,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
Reference< XExtensionManager > xManager =
ExtensionManager::get( m_xContext );
m_aBundledPackagesSeq = xManager->getDeployedExtensions
- (rtl::OUString::createFromAscii("bundled"),
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
@@ -3502,7 +3507,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
{
const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray();
Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage ];
- VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" );
+ OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" );
m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
}
@@ -3522,3 +3527,5 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
}
} // namespace basic
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/sbmodule.cxx b/basic/source/uno/sbmodule.cxx
index db9383a019b5..3c8d115b1912 100644..100755
--- a/basic/source/uno/sbmodule.cxx
+++ b/basic/source/uno/sbmodule.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,3 +43,4 @@ namespace basic
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/sbmodule.hxx b/basic/source/uno/sbmodule.hxx
index 459dac691896..2dd0b3dd7910 100644..100755
--- a/basic/source/uno/sbmodule.hxx
+++ b/basic/source/uno/sbmodule.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,3 +44,4 @@ namespace basic
#endif // SBMODULE_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/sbservices.cxx b/basic/source/uno/sbservices.cxx
index 7a1a4fd2d1cb..5c4e1fc98309 100644..100755
--- a/basic/source/uno/sbservices.cxx
+++ b/basic/source/uno/sbservices.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,4 @@ namespace basic
IMPLEMENT_COMPONENT_LIBRARY_API( ::basic::BasicModule, ::basic::initializeModule )
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index f51ce54cd7ee..ebfc68863ea0 100644..100755
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,9 +44,7 @@
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <comphelper/processfactory.hxx>
-#ifndef _COMPHELPER_STORAGEHELPER_HXX_
#include <comphelper/storagehelper.hxx>
-#endif
#include <unotools/streamwrap.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <osl/mutex.hxx>
@@ -66,7 +65,8 @@
#include <xmlscript/xmlmod_imexp.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/util/VetoException.hpp>
-
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
+#include <cppuhelper/implbase1.hxx>
namespace basic
{
@@ -84,6 +84,8 @@ using namespace osl;
using ::rtl::OUString;
+using ::rtl::OUString;
+
//============================================================================
// Implementation class SfxScriptLibraryContainer
@@ -136,7 +138,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa
return pImplLib->mbPasswordProtected;
}
-
// Ctor for service
SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
:maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
@@ -1144,11 +1145,6 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
}
}
-//REMOVE // If the password is verified the library must remain modified, because
-//REMOVE // otherwise for saving the storage would be copied and that doesn't work
-//REMOVE // with mtg's storages when the password is verified
-//REMOVE if( !pLib->mbPasswordVerified )
-//REMOVE pLib->mbModified = sal_False;
return bRet;
}
@@ -1157,6 +1153,17 @@ void SfxScriptLibraryContainer::onNewRootStorage()
{
}
+sal_Bool SAL_CALL
+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
+{
+ BasicManager* pBasicMgr = getBasicManager();
+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
+ if ( pBasicMgr )
+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name
+ // default to it has code if we can't decide
+ return sal_True;
+}
+
//============================================================================
// Service
void createRegistryInfo_SfxScriptLibraryContainer()
@@ -1177,9 +1184,9 @@ Sequence< ::rtl::OUString > SAL_CALL SfxScriptLibraryContainer::getSupportedServ
Sequence< OUString > SfxScriptLibraryContainer::getSupportedServiceNames_static()
{
Sequence< OUString > aServiceNames( 2 );
- aServiceNames[0] = OUString::createFromAscii( "com.sun.star.script.DocumentScriptLibraryContainer" );
+ aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentScriptLibraryContainer" ));
// plus, for compatibility:
- aServiceNames[1] = OUString::createFromAscii( "com.sun.star.script.ScriptLibraryContainer" );
+ aServiceNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.ScriptLibraryContainer" ));
return aServiceNames;
}
@@ -1191,7 +1198,7 @@ OUString SfxScriptLibraryContainer::getImplementationName_static()
MutexGuard aGuard( Mutex::getGlobalMutex() );
if( bNeedsInit )
{
- aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.ScriptLibraryContainer" );
+ aImplName = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sfx2.ScriptLibraryContainer" ));
bNeedsInit = sal_False;
}
return aImplName;
@@ -1318,3 +1325,5 @@ void SAL_CALL SfxScriptLibrary::removeModuleInfo( const ::rtl::OUString& ModuleN
//============================================================================
} // namespace basic
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */