summaryrefslogtreecommitdiff
path: root/basic/source/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/runtime')
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/basrdll.cxx14
-rwxr-xr-xbasic/source/runtime/comenumwrapper.cxx81
-rwxr-xr-xbasic/source/runtime/comenumwrapper.hxx54
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/ddectrl.cxx32
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/ddectrl.hxx12
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/dllmgr-none.cxx0
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/dllmgr-x64.cxx22
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/dllmgr-x86.cxx29
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/dllmgr.hxx0
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/inputbox.cxx4
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/iosys.cxx98
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/makefile.mk1
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/methods.cxx485
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/methods1.cxx518
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/props.cxx12
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/rtlproto.hxx10
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/runtime.cxx108
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/stdobj.cxx36
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/stdobj1.cxx60
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step0.cxx186
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step1.cxx88
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step2.cxx252
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/wnt-mingw.s0
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/wnt-x86.asm0
24 files changed, 1233 insertions, 869 deletions
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index a705aa24aa00..910ecce98f72 100644..100755
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -55,8 +55,8 @@ BasicDLL::BasicDLL()
::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
pSttResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(stt), aLocale );
pBasResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(sb), aLocale );
- bDebugMode = FALSE;
- bBreakEnabled = TRUE;
+ bDebugMode = sal_False;
+ bBreakEnabled = sal_True;
}
BasicDLL::~BasicDLL()
@@ -65,7 +65,7 @@ BasicDLL::~BasicDLL()
delete pBasResMgr;
}
-void BasicDLL::EnableBreak( BOOL bEnable )
+void BasicDLL::EnableBreak( sal_Bool bEnable )
{
BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC);
DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
@@ -73,7 +73,7 @@ void BasicDLL::EnableBreak( BOOL bEnable )
pThis->bBreakEnabled = bEnable;
}
-void BasicDLL::SetDebugMode( BOOL bDebugMode )
+void BasicDLL::SetDebugMode( sal_Bool bDebugMode )
{
BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC);
DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
@@ -86,7 +86,7 @@ void BasicDLL::BasicBreak()
{
//bJustStopping: Wenn jemand wie wild x-mal STOP drueckt, aber das Basic
// nicht schnell genug anhaelt, kommt die Box ggf. oefters...
- static BOOL bJustStopping = FALSE;
+ static sal_Bool bJustStopping = sal_False;
BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC);
DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
@@ -94,11 +94,11 @@ void BasicDLL::BasicBreak()
{
if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) )
{
- bJustStopping = TRUE;
+ bJustStopping = sal_True;
StarBASIC::Stop();
String aMessageStr( BasResId( IDS_SBERR_TERMINATED ) );
InfoBox( 0, aMessageStr ).Execute();
- bJustStopping = FALSE;
+ bJustStopping = sal_False;
}
}
}
diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx
new file mode 100755
index 000000000000..ba3def41838f
--- /dev/null
+++ b/basic/source/runtime/comenumwrapper.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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 "comenumwrapper.hxx"
+
+using namespace ::com::sun::star;
+
+::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements()
+ throw ( uno::RuntimeException )
+{
+ sal_Bool bResult = sal_False;
+
+ try
+ {
+ if ( m_xInvocation.is() )
+ {
+ sal_Int32 nLength = 0;
+ bResult =
+ ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength )
+ && nLength > m_nCurInd );
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ return bResult;
+}
+
+uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
+ throw ( container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ try
+ {
+ if ( m_xInvocation.is() )
+ {
+ uno::Sequence< sal_Int16 > aNamedParamIndex;
+ uno::Sequence< uno::Any > aNamedParam;
+ uno::Sequence< uno::Any > aArgs( 1 );
+
+ aArgs[0] <<= m_nCurInd++;
+
+ return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ),
+ aArgs,
+ aNamedParamIndex,
+ aNamedParam );
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ throw container::NoSuchElementException();
+}
+
+
diff --git a/basic/source/runtime/comenumwrapper.hxx b/basic/source/runtime/comenumwrapper.hxx
new file mode 100755
index 000000000000..b2464d686f67
--- /dev/null
+++ b/basic/source/runtime/comenumwrapper.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _COMENUMWRAPPER_HXX
+#define _COMENUMWRAPPER_HXX
+
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+class ComEnumerationWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > m_xInvocation;
+ sal_Int32 m_nCurInd;
+
+public:
+ ComEnumerationWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation >& xInvocation )
+ : m_xInvocation( xInvocation )
+ , m_nCurInd( 0 )
+ {
+ }
+
+ // container::XEnumeration
+ virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _COMENUMWRAPPER_HXX
+
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index a2536bfab045..83ce5b05adb5 100644..100755
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -92,12 +92,12 @@ SbiDdeControl::~SbiDdeControl()
delete pConvList;
}
-INT16 SbiDdeControl::GetFreeChannel()
+sal_Int16 SbiDdeControl::GetFreeChannel()
{
- INT16 nListSize = (INT16)pConvList->Count();
+ sal_Int16 nListSize = (sal_Int16)pConvList->Count();
DdeConnection* pPtr = pConvList->First();
pPtr = pConvList->Next(); // nullten eintrag ueberspringen
- INT16 nChannel;
+ sal_Int16 nChannel;
for( nChannel = 1; nChannel < nListSize; nChannel++ )
{
if( pPtr == DDE_FREECHANNEL )
@@ -110,7 +110,7 @@ INT16 SbiDdeControl::GetFreeChannel()
}
SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic,
- INT16& rnHandle )
+ sal_Int16& rnHandle )
{
SbError nErr;
DdeConnection* pConv = new DdeConnection( rService, rTopic );
@@ -122,26 +122,26 @@ SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic,
}
else
{
- INT16 nChannel = GetFreeChannel();
- pConvList->Replace( pConv, (ULONG)nChannel );
+ sal_Int16 nChannel = GetFreeChannel();
+ pConvList->Replace( pConv, (sal_uIntPtr)nChannel );
rnHandle = nChannel;
}
return 0;
}
-SbError SbiDdeControl::Terminate( INT16 nChannel )
+SbError SbiDdeControl::Terminate( sal_Int16 nChannel )
{
- DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel );
+ DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel );
if( !nChannel || !pConv || pConv == DDE_FREECHANNEL )
return SbERR_DDE_NO_CHANNEL;
- pConvList->Replace( DDE_FREECHANNEL, (ULONG)nChannel );
+ pConvList->Replace( DDE_FREECHANNEL, (sal_uIntPtr)nChannel );
delete pConv;
return 0L;
}
SbError SbiDdeControl::TerminateAll()
{
- INT16 nChannel = (INT16)pConvList->Count();
+ sal_Int16 nChannel = (sal_Int16)pConvList->Count();
while( nChannel )
{
nChannel--;
@@ -155,9 +155,9 @@ SbError SbiDdeControl::TerminateAll()
return 0;
}
-SbError SbiDdeControl::Request( INT16 nChannel, const String& rItem, String& rResult )
+SbError SbiDdeControl::Request( sal_Int16 nChannel, const String& rItem, String& rResult )
{
- DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel );
+ DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel );
if( !nChannel || !pConv || pConv == DDE_FREECHANNEL )
return SbERR_DDE_NO_CHANNEL;
@@ -168,9 +168,9 @@ SbError SbiDdeControl::Request( INT16 nChannel, const String& rItem, String& rRe
return GetLastErr( pConv );
}
-SbError SbiDdeControl::Execute( INT16 nChannel, const String& rCommand )
+SbError SbiDdeControl::Execute( sal_Int16 nChannel, const String& rCommand )
{
- DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel );
+ DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel );
if( !nChannel || !pConv || pConv == DDE_FREECHANNEL )
return SbERR_DDE_NO_CHANNEL;
DdeExecute aRequest( *pConv, rCommand, 30000 );
@@ -178,9 +178,9 @@ SbError SbiDdeControl::Execute( INT16 nChannel, const String& rCommand )
return GetLastErr( pConv );
}
-SbError SbiDdeControl::Poke( INT16 nChannel, const String& rItem, const String& rData )
+SbError SbiDdeControl::Poke( sal_Int16 nChannel, const String& rItem, const String& rData )
{
- DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel );
+ DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel );
if( !nChannel || !pConv || pConv == DDE_FREECHANNEL )
return SbERR_DDE_NO_CHANNEL;
DdePoke aRequest( *pConv, rItem, DdeData(rData), 30000 );
diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx
index 65be2e76ecff..2f12e8128791 100644..100755
--- a/basic/source/runtime/ddectrl.hxx
+++ b/basic/source/runtime/ddectrl.hxx
@@ -42,7 +42,7 @@ class SbiDdeControl
private:
DECL_LINK( Data, DdeData* );
SbError GetLastErr( DdeConnection* );
- INT16 GetFreeChannel();
+ sal_Int16 GetFreeChannel();
DdeConnections* pConvList;
String aData;
@@ -52,12 +52,12 @@ public:
~SbiDdeControl();
SbError Initiate( const String& rService, const String& rTopic,
- INT16& rnHandle );
- SbError Terminate( INT16 nChannel );
+ sal_Int16& rnHandle );
+ SbError Terminate( sal_Int16 nChannel );
SbError TerminateAll();
- SbError Request( INT16 nChannel, const String& rItem, String& rResult );
- SbError Execute( INT16 nChannel, const String& rCommand );
- SbError Poke( INT16 nChannel, const String& rItem, const String& rData );
+ SbError Request( sal_Int16 nChannel, const String& rItem, String& rResult );
+ SbError Execute( sal_Int16 nChannel, const String& rCommand );
+ SbError Poke( sal_Int16 nChannel, const String& rItem, const String& rData );
};
#endif
diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx
index db32b646b619..db32b646b619 100644..100755
--- a/basic/source/runtime/dllmgr-none.cxx
+++ b/basic/source/runtime/dllmgr-none.cxx
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index 87be0587bb81..1a5845e10ee2 100644..100755
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -158,7 +158,7 @@ std::size_t alignment(SbxVariable * variable) {
std::size_t n = 1;
SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
GetProperties();
- for (USHORT i = 0; i < props->Count(); ++i) {
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
n = std::max(n, alignment(props->Get(i)));
}
return n;
@@ -173,9 +173,9 @@ std::size_t alignment(SbxVariable * variable) {
} else {
SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
int dims = arr->GetDims();
- std::vector< INT32 > low(dims);
+ std::vector< sal_Int32 > low(dims);
for (int i = 0; i < dims; ++i) {
- INT32 up;
+ sal_Int32 up;
arr->GetDim32(i + 1, low[i], up);
}
return alignment(arr->Get32(&low[0]));
@@ -209,7 +209,7 @@ SbError marshalStruct(
OSL_ASSERT(variable != 0);
SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
GetProperties();
- for (USHORT i = 0; i < props->Count(); ++i) {
+ 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;
@@ -225,12 +225,12 @@ SbError marshalArray(
OSL_ASSERT(variable != 0);
SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
int dims = arr->GetDims();
- std::vector< INT32 > low(dims);
- std::vector< INT32 > up(dims);
+ 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< INT32 > idx = low;;) {
+ for (std::vector< sal_Int32 > idx = low;;) {
SbError e = marshal(
false, arr->Get32(&idx[0]), false, blob, offset, data);
if (e != ERRCODE_NONE) {
@@ -395,7 +395,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
alignment(variable)));
SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
GetProperties();
- for (USHORT i = 0; i < props->Count(); ++i) {
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
data = unmarshal(props->Get(i), data);
}
break;
@@ -413,12 +413,12 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
} else {
SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
int dims = arr->GetDims();
- std::vector< INT32 > low(dims);
- std::vector< INT32 > up(dims);
+ 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< INT32 > idx = low;;) {
+ for (std::vector< sal_Int32 > idx = low;;) {
data = unmarshal(arr->Get32(&idx[0]), data);
int i = dims - 1;
while (idx[i] == up[i]) {
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 64419c9e3b6e..b2f48bd0ab1a 100644..100755
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -165,7 +165,7 @@ std::size_t alignment(SbxVariable * variable) {
std::size_t n = 1;
SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
GetProperties();
- for (USHORT i = 0; i < props->Count(); ++i) {
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
n = std::max(n, alignment(props->Get(i)));
}
return n;
@@ -180,9 +180,9 @@ std::size_t alignment(SbxVariable * variable) {
} else {
SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
int dims = arr->GetDims();
- std::vector< INT32 > low(dims);
+ std::vector< sal_Int32 > low(dims);
for (int i = 0; i < dims; ++i) {
- INT32 up;
+ sal_Int32 up;
arr->GetDim32(i + 1, low[i], up);
}
return alignment(arr->Get32(&low[0]));
@@ -203,7 +203,8 @@ SbError marshalString(
return e;
}
std::vector< char > * blob = data.newBlob();
- blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1 );
+ 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;
@@ -216,7 +217,7 @@ SbError marshalStruct(
OSL_ASSERT(variable != 0);
SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
GetProperties();
- for (USHORT i = 0; i < props->Count(); ++i) {
+ 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;
@@ -232,12 +233,12 @@ SbError marshalArray(
OSL_ASSERT(variable != 0);
SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
int dims = arr->GetDims();
- std::vector< INT32 > low(dims);
- std::vector< INT32 > up(dims);
+ 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< INT32 > idx = low;;) {
+ for (std::vector< sal_Int32 > idx = low;;) {
SbError e = marshal(
false, arr->Get32(&idx[0]), false, blob, offset, data);
if (e != ERRCODE_NONE) {
@@ -402,7 +403,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
alignment(variable)));
SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
GetProperties();
- for (USHORT i = 0; i < props->Count(); ++i) {
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
data = unmarshal(props->Get(i), data);
}
break;
@@ -420,12 +421,12 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
} else {
SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
int dims = arr->GetDims();
- std::vector< INT32 > low(dims);
- std::vector< INT32 > up(dims);
+ 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< INT32 > idx = low;;) {
+ for (std::vector< sal_Int32 > idx = low;;) {
data = unmarshal(arr->Get32(&idx[0]), data);
int i = dims - 1;
while (idx[i] == up[i]) {
@@ -485,7 +486,7 @@ SbError call(
RTL_CONSTASCII_STRINGPARAM("KERNEL32.DLL")) &&
(proc.name ==
rtl::OString(RTL_CONSTASCII_STRINGPARAM("GetLogicalDriveStringsA")));
- for (USHORT i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
SbError e = marshal(
true, arguments->Get(i), special && i == 2, stack, stack.size(),
data);
@@ -547,7 +548,7 @@ SbError call(
OSL_ASSERT(false);
break;
}
- for (USHORT i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
arguments->Get(i)->ResetFlag(SBX_REFERENCE);
//TODO: skipped for errors?!?
}
diff --git a/basic/source/runtime/dllmgr.hxx b/basic/source/runtime/dllmgr.hxx
index 1507ffe7f94f..1507ffe7f94f 100644..100755
--- a/basic/source/runtime/dllmgr.hxx
+++ b/basic/source/runtime/dllmgr.hxx
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index cc385ce4a199..a21d3e794eee 100644..100755
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -161,14 +161,14 @@ RTLFUNC(InputBox)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count();
+ sal_uIntPtr nArgCount = rPar.Count();
if ( nArgCount < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
String aTitle;
String aDefault;
- INT32 nX = -1, nY = -1; // zentrieren
+ sal_Int32 nX = -1, nY = -1; // zentrieren
const String& rPrompt = rPar.Get(1)->GetString();
if ( nArgCount > 2 && !rPar.Get(2)->IsErr() )
aTitle = rPar.Get(2)->GetString();
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 10990fc9fb39..cea9f7a01d3e 100644..100755
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -215,13 +215,13 @@ void SbiStream::MapError()
// Hack for #83750
-BOOL runsInSetup( void );
+sal_Bool runsInSetup( void );
-BOOL needSecurityRestrictions( void )
+sal_Bool needSecurityRestrictions( void )
{
#ifdef _USE_UNO
- static BOOL bNeedInit = TRUE;
- static BOOL bRetVal = TRUE;
+ static sal_Bool bNeedInit = sal_True;
+ static sal_Bool bRetVal = sal_True;
if( bNeedInit )
{
@@ -230,11 +230,11 @@ BOOL needSecurityRestrictions( void )
if( runsInSetup() )
{
// Setup is not critical
- bRetVal = FALSE;
+ bRetVal = sal_False;
return bRetVal;
}
- bNeedInit = FALSE;
+ bNeedInit = sal_False;
// Get system user to compare to portal user
oslSecurity aSecurity = osl_getCurrentSecurity();
@@ -243,12 +243,12 @@ BOOL needSecurityRestrictions( void )
if( !bRet )
{
// No valid security! -> Secure mode!
- return TRUE;
+ return sal_True;
}
Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
if( !xSMgr.is() )
- return TRUE;
+ return sal_True;
Reference< XBridgeFactory > xBridgeFac( xSMgr->createInstance
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.BridgeFactory" )) ), UNO_QUERY );
@@ -263,13 +263,13 @@ BOOL needSecurityRestrictions( void )
if( nBridgeCount == 0 )
{
// No bridges -> local
- bRetVal = FALSE;
+ bRetVal = sal_False;
return bRetVal;
}
// Iterate through all bridges to find (portal) user property
const Reference< XBridge >* pBridges = aBridgeSeq.getConstArray();
- bRetVal = FALSE; // Now only TRUE if user different from portal user is found
+ bRetVal = sal_False; // Now only sal_True if user different from portal user is found
sal_Int32 i;
for( i = 0 ; i < nBridgeCount ; i++ )
{
@@ -287,7 +287,7 @@ BOOL needSecurityRestrictions( void )
else
{
// Different user -> Secure mode!
- bRetVal = TRUE;
+ bRetVal = sal_True;
break;
}
}
@@ -297,27 +297,27 @@ BOOL needSecurityRestrictions( void )
return bRetVal;
#else
- return FALSE;
+ return sal_False;
#endif
}
-// Returns TRUE if UNO is available, otherwise the old file
+// Returns sal_True if UNO is available, otherwise the old file
// system implementation has to be used
// #89378 New semantic: Don't just ask for UNO but for UCB
-BOOL hasUno( void )
+sal_Bool hasUno( void )
{
#ifdef _USE_UNO
- static BOOL bNeedInit = TRUE;
- static BOOL bRetVal = TRUE;
+ static sal_Bool bNeedInit = sal_True;
+ static sal_Bool bRetVal = sal_True;
if( bNeedInit )
{
- bNeedInit = FALSE;
+ bNeedInit = sal_False;
Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
if( !xSMgr.is() )
{
// No service manager at all
- bRetVal = FALSE;
+ bRetVal = sal_False;
}
else
{
@@ -327,13 +327,13 @@ BOOL hasUno( void )
if ( !( xManager.is() && xManager->queryContentProvider( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "file:///" )) ).is() ) )
{
// No UCB
- bRetVal = FALSE;
+ bRetVal = sal_False;
}
}
}
return bRetVal;
#else
- return FALSE;
+ return sal_False;
#endif
}
@@ -349,11 +349,11 @@ class OslStream : public SvStream
public:
OslStream( const String& rName, short nStrmMode );
~OslStream();
- virtual ULONG GetData( void* pData, ULONG nSize );
- virtual ULONG PutData( const void* pData, ULONG nSize );
- virtual ULONG SeekPos( ULONG nPos );
+ virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize );
+ virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize );
+ virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos );
virtual void FlushData();
- virtual void SetSize( ULONG nSize );
+ virtual void SetSize( sal_uIntPtr nSize );
};
OslStream::OslStream( const String& rName, short nStrmMode )
@@ -394,21 +394,21 @@ OslStream::~OslStream()
maFile.close();
}
-ULONG OslStream::GetData( void* pData, ULONG nSize )
+sal_uIntPtr OslStream::GetData( void* pData, sal_uIntPtr nSize )
{
sal_uInt64 nBytesRead = nSize;
maFile.read( pData, nBytesRead, nBytesRead );
- return (ULONG)nBytesRead;
+ return (sal_uIntPtr)nBytesRead;
}
-ULONG OslStream::PutData( const void* pData, ULONG nSize )
+sal_uIntPtr OslStream::PutData( const void* pData, sal_uIntPtr nSize )
{
sal_uInt64 nBytesWritten;
maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
- return (ULONG)nBytesWritten;
+ return (sal_uIntPtr)nBytesWritten;
}
-ULONG OslStream::SeekPos( ULONG nPos )
+sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
{
if( nPos == STREAM_SEEK_TO_END )
maFile.setPos( Pos_End, 0 );
@@ -416,14 +416,14 @@ ULONG OslStream::SeekPos( ULONG nPos )
maFile.setPos( Pos_Absolut, (sal_uInt64)nPos );
sal_uInt64 nRealPos(0);
maFile.getPos( nRealPos );
- return sal::static_int_cast<ULONG>(nRealPos);
+ return sal::static_int_cast<sal_uIntPtr>(nRealPos);
}
void OslStream::FlushData()
{
}
-void OslStream::SetSize( ULONG nSize )
+void OslStream::SetSize( sal_uIntPtr nSize )
{
maFile.setSize( (sal_uInt64)nSize );
}
@@ -444,17 +444,17 @@ public:
UCBStream( Reference< XOutputStream > & xOS );
UCBStream( Reference< XStream > & xS );
~UCBStream();
- virtual ULONG GetData( void* pData, ULONG nSize );
- virtual ULONG PutData( const void* pData, ULONG nSize );
- virtual ULONG SeekPos( ULONG nPos );
+ virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize );
+ virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize );
+ virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos );
virtual void FlushData();
- virtual void SetSize( ULONG nSize );
+ virtual void SetSize( sal_uIntPtr nSize );
};
/*
-ULONG UCBErrorToSvStramError( ucb::IOErrorCode nError )
+sal_uIntPtr UCBErrorToSvStramError( ucb::IOErrorCode nError )
{
- ULONG eReturn = ERRCODE_IO_GENERAL;
+ sal_uIntPtr eReturn = ERRCODE_IO_GENERAL;
switch( nError )
{
case ucb::IOErrorCode_ABORT: eReturn = SVSTREAM_GENERALERROR; break;
@@ -525,7 +525,7 @@ UCBStream::~UCBStream()
}
}
-ULONG UCBStream::GetData( void* pData, ULONG nSize )
+sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize )
{
try
{
@@ -554,7 +554,7 @@ ULONG UCBStream::GetData( void* pData, ULONG nSize )
return 0;
}
-ULONG UCBStream::PutData( const void* pData, ULONG nSize )
+sal_uIntPtr UCBStream::PutData( const void* pData, sal_uIntPtr nSize )
{
try
{
@@ -581,13 +581,13 @@ ULONG UCBStream::PutData( const void* pData, ULONG nSize )
return 0;
}
-ULONG UCBStream::SeekPos( ULONG nPos )
+sal_uIntPtr UCBStream::SeekPos( sal_uIntPtr nPos )
{
try
{
if( xSeek.is() )
{
- ULONG nLen = sal::static_int_cast<ULONG>( xSeek->getLength() );
+ sal_uIntPtr nLen = sal::static_int_cast<sal_uIntPtr>( xSeek->getLength() );
if( nPos > nLen )
nPos = nLen;
xSeek->seek( nPos );
@@ -621,7 +621,7 @@ void UCBStream::FlushData()
}
}
-void UCBStream::SetSize( ULONG nSize )
+void UCBStream::SetSize( sal_uIntPtr nSize )
{
(void)nSize;
@@ -728,7 +728,7 @@ SbError SbiStream::Close()
return nError;
}
-SbError SbiStream::Read( ByteString& rBuf, USHORT n, bool bForceReadingPerByte )
+SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerByte )
{
nExpandOnWriteTo = 0;
if( !bForceReadingPerByte && IsText() )
@@ -767,10 +767,10 @@ void SbiStream::ExpandFile()
{
if ( nExpandOnWriteTo )
{
- ULONG nCur = pStrm->Seek(STREAM_SEEK_TO_END);
+ sal_uIntPtr nCur = pStrm->Seek(STREAM_SEEK_TO_END);
if( nCur < nExpandOnWriteTo )
{
- ULONG nDiff = nExpandOnWriteTo - nCur;
+ sal_uIntPtr nDiff = nExpandOnWriteTo - nCur;
char c = 0;
while( nDiff-- )
*pStrm << c;
@@ -783,7 +783,7 @@ void SbiStream::ExpandFile()
}
}
-SbError SbiStream::Write( const ByteString& rBuf, USHORT n )
+SbError SbiStream::Write( const ByteString& rBuf, sal_uInt16 n )
{
ExpandFile();
if( IsAppend() )
@@ -794,7 +794,7 @@ SbError SbiStream::Write( const ByteString& rBuf, USHORT n )
aLine += rBuf;
// Raus damit, wenn das Ende ein LF ist, aber CRLF vorher
// strippen, da der SvStrm ein CRLF anfuegt!
- USHORT nLineLen = aLine.Len();
+ sal_uInt16 nLineLen = aLine.Len();
if( nLineLen && aLine.GetBuffer()[ --nLineLen ] == 0x0A )
{
aLine.Erase( nLineLen );
@@ -1013,8 +1013,8 @@ void SbiIoSystem::ReadCon( ByteString& rIn )
void SbiIoSystem::WriteCon( const ByteString& rText )
{
aOut += rText;
- USHORT n1 = aOut.Search( '\n' );
- USHORT n2 = aOut.Search( '\r' );
+ sal_uInt16 n1 = aOut.Search( '\n' );
+ sal_uInt16 n2 = aOut.Search( '\r' );
if( n1 != STRING_NOTFOUND || n2 != STRING_NOTFOUND )
{
if( n1 == STRING_NOTFOUND ) n1 = n2;
diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk
index 64d9a6ff446d..29969416caab 100644..100755
--- a/basic/source/runtime/makefile.mk
+++ b/basic/source/runtime/makefile.mk
@@ -41,6 +41,7 @@ ENABLE_EXCEPTIONS = TRUE
SLOFILES= \
$(SLO)$/basrdll.obj \
+ $(SLO)$/comenumwrapper.obj \
$(SLO)$/inputbox.obj\
$(SLO)$/runtime.obj \
$(SLO)$/step0.obj \
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 380064bb0da8..8335d6f88d26 100644..100755
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -36,7 +36,7 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/sound.hxx>
-#include <vcl/wintypes.hxx>
+#include <tools/wintypes.hxx>
#include <vcl/msgbox.hxx>
#include <basic/sbx.hxx>
#include <svl/zforlist.hxx>
@@ -105,15 +105,10 @@ using namespace com::sun::star::script;
SbxVariable* getDefaultProp( SbxVariable* pRef );
-#if defined (WIN) || defined (WNT) || defined (OS2)
+#if defined (WNT) || defined (OS2)
#include <direct.h> // _getdcwd get current work directory, _chdrive
#endif
-#ifdef WIN
-#include <dos.h> // _dos_getfileattr
-#include <errno.h>
-#endif
-
#ifdef UNX
#include <errno.h>
#include <unistd.h>
@@ -164,7 +159,7 @@ static CharClass& GetCharClass( void )
return aCharClass;
}
-static inline BOOL isFolder( FileStatus::Type aType )
+static inline sal_Bool isFolder( FileStatus::Type aType )
{
return ( aType == FileStatus::Directory || aType == FileStatus::Volume );
}
@@ -230,8 +225,8 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void
-// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert
-// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus
+// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert
+// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus
// Element 0 gespeichert.
// CreateObject( class )
@@ -264,7 +259,7 @@ RTLFUNC(Error)
{
String aErrorMsg;
SbError nErr = 0L;
- INT32 nCode = 0;
+ sal_Int32 nCode = 0;
if( rPar.Count() == 1 )
{
nErr = StarBASIC::GetErrBasic();
@@ -276,7 +271,7 @@ RTLFUNC(Error)
if( nCode > 65535L )
StarBASIC::Error( SbERR_CONVERSION );
else
- nErr = StarBASIC::GetSfxFromVBError( (USHORT)nCode );
+ nErr = StarBASIC::GetSfxFromVBError( (sal_uInt16)nCode );
}
bool bVBA = SbiRuntime::isVBAEnabled();
@@ -425,7 +420,7 @@ RTLFUNC(CurDir)
// zu ermitteln, dass eine virtuelle URL geliefert werden koennte.
// rPar.Get(0)->PutEmpty();
-#if defined (WIN) || defined (WNT) || defined (OS2)
+#if defined (WNT) || defined (OS2)
int nCurDir = 0; // Current dir // JSM
if ( rPar.Count() == 2 )
{
@@ -462,7 +457,7 @@ RTLFUNC(CurDir)
int nSize = _PATH_INCR;
char* pMem;
- while( TRUE )
+ while( sal_True )
{
pMem = new char[nSize];
if( !pMem )
@@ -499,17 +494,17 @@ RTLFUNC(ChDir) // JSM
{
#ifdef _ENABLE_CUR_DIR
String aPath = rPar.Get(1)->GetString();
- BOOL bError = FALSE;
+ sal_Bool bError = sal_False;
#ifdef WNT
// #55997 Laut MI hilft es bei File-URLs einen DirEntry zwischenzuschalten
// #40996 Harmoniert bei Verwendung der WIN32-Funktion nicht mit getdir
DirEntry aEntry( aPath );
ByteString aFullPath( aEntry.GetFull(), gsl_getSystemTextEncoding() );
if( chdir( aFullPath.GetBuffer()) )
- bError = TRUE;
+ bError = sal_True;
#else
if (!DirEntry(aPath).SetCWD())
- bError = TRUE;
+ bError = sal_True;
#endif
if( bError )
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
@@ -532,7 +527,7 @@ RTLFUNC(ChDrive) // JSM
#ifndef UNX
String aPar1 = rPar.Get(1)->GetString();
-#if defined (WIN) || defined (WNT) || defined (OS2)
+#if defined (WNT) || defined (OS2)
if (aPar1.Len() > 0)
{
int nCurDrive = (int)aPar1.GetBuffer()[0]; ;
@@ -727,7 +722,7 @@ RTLFUNC(MkDir) // JSM
SbxArrayRef pPar = new SbxArray;
SbxVariableRef pVar = new SbxVariable();
pPar->Put( pVar, 0 );
- SbRtl_CurDir( pBasic, *pPar, FALSE );
+ SbRtl_CurDir( pBasic, *pPar, sal_False );
String aCurPath = pPar->Get(0)->GetString();
File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
@@ -920,7 +915,7 @@ RTLFUNC(FileLen)
{
SbxVariableRef pArg = rPar.Get( 1 );
String aStr( pArg->GetString() );
- INT32 nLen = 0;
+ sal_Int32 nLen = 0;
// <-- UCB
if( hasUno() )
{
@@ -948,7 +943,7 @@ RTLFUNC(FileLen)
DirectoryItem::get( getFullPathUNC( aStr ), aItem );
FileStatus aFileStatus( FileStatusMask_FileSize );
aItem.getFileStatus( aFileStatus );
- nLen = (INT32)aFileStatus.getFileSize();
+ nLen = (sal_Int32)aFileStatus.getFileSize();
#endif
}
rPar.Get(0)->PutLong( (long)nLen );
@@ -1002,23 +997,23 @@ RTLFUNC(InStr)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- USHORT nStartPos = 1;
+ sal_uInt16 nStartPos = 1;
- USHORT nFirstStringPos = 1;
+ sal_uInt16 nFirstStringPos = 1;
if ( nArgCount >= 3 )
{
- INT32 lStartPos = rPar.Get(1)->GetLong();
+ sal_Int32 lStartPos = rPar.Get(1)->GetLong();
if( lStartPos <= 0 || lStartPos > 0xffff )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
lStartPos = 1;
}
- nStartPos = (USHORT)lStartPos;
+ nStartPos = (sal_uInt16)lStartPos;
nFirstStringPos++;
}
@@ -1028,7 +1023,7 @@ RTLFUNC(InStr)
if( bCompatibility )
{
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
- bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE;
+ bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
@@ -1037,7 +1032,7 @@ RTLFUNC(InStr)
if ( nArgCount == 4 )
bTextMode = rPar.Get(4)->GetInteger();
- USHORT nPos;
+ sal_uInt16 nPos;
const String& rToken = rPar.Get(nFirstStringPos+1)->GetString();
// #97545 Always find empty string
@@ -1084,7 +1079,7 @@ RTLFUNC(InStrRev)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -1092,7 +1087,7 @@ RTLFUNC(InStrRev)
String aStr1 = rPar.Get(1)->GetString();
String aToken = rPar.Get(2)->GetString();
- INT32 lStartPos = -1;
+ sal_Int32 lStartPos = -1;
if ( nArgCount >= 3 )
{
lStartPos = rPar.Get(3)->GetLong();
@@ -1109,7 +1104,7 @@ RTLFUNC(InStrRev)
if( bCompatibility )
{
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
- bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE;
+ bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
@@ -1118,13 +1113,13 @@ RTLFUNC(InStrRev)
if ( nArgCount == 4 )
bTextMode = rPar.Get(4)->GetInteger();
- USHORT nStrLen = aStr1.Len();
- USHORT nStartPos = lStartPos == -1 ? nStrLen : (USHORT)lStartPos;
+ sal_uInt16 nStrLen = aStr1.Len();
+ sal_uInt16 nStartPos = lStartPos == -1 ? nStrLen : (sal_uInt16)lStartPos;
- USHORT nPos = 0;
+ sal_uInt16 nPos = 0;
if( nStartPos <= nStrLen )
{
- USHORT nTokenLen = aToken.Len();
+ sal_uInt16 nTokenLen = aToken.Len();
if( !nTokenLen )
{
// Always find empty string
@@ -1140,7 +1135,7 @@ RTLFUNC(InStrRev)
if( nRet == -1 )
nPos = 0;
else
- nPos = (USHORT)nRet + 1;
+ nPos = (sal_uInt16)nRet + 1;
}
else
{
@@ -1154,7 +1149,7 @@ RTLFUNC(InStrRev)
if( nRet == -1 )
nPos = 0;
else
- nPos = (USHORT)nRet + 1;
+ nPos = (sal_uInt16)nRet + 1;
}
}
}
@@ -1238,7 +1233,7 @@ RTLFUNC(Left)
else
{
String aStr( rPar.Get(1)->GetString() );
- INT32 lResultLen = rPar.Get(2)->GetLong();
+ sal_Int32 lResultLen = rPar.Get(2)->GetLong();
if( lResultLen > 0xffff )
{
lResultLen = 0xffff;
@@ -1248,7 +1243,7 @@ RTLFUNC(Left)
lResultLen = 0;
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
- aStr.Erase( (USHORT)lResultLen );
+ aStr.Erase( (sal_uInt16)lResultLen );
rPar.Get(0)->PutString( aStr );
}
}
@@ -1297,7 +1292,7 @@ RTLFUNC(Mid)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -1307,23 +1302,23 @@ RTLFUNC(Mid)
// Anders als im Original kann in dieser Variante der 3. Parameter
// nLength nicht weggelassen werden. Ist ueber bWrite schon vorgesehen.
if( nArgCount == 4 )
- bWrite = TRUE;
+ bWrite = sal_True;
String aArgStr = rPar.Get(1)->GetString();
- USHORT nStartPos = (USHORT)(rPar.Get(2)->GetLong() );
+ sal_uInt16 nStartPos = (sal_uInt16)(rPar.Get(2)->GetLong() );
if ( nStartPos == 0 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
nStartPos--;
- USHORT nLen = 0xffff;
+ sal_uInt16 nLen = 0xffff;
bool bWriteNoLenParam = false;
if ( nArgCount == 3 || bWrite )
{
- INT32 n = rPar.Get(3)->GetLong();
+ sal_Int32 n = rPar.Get(3)->GetLong();
if( bWrite && n == -1 )
bWriteNoLenParam = true;
- nLen = (USHORT)n;
+ nLen = (sal_uInt16)n;
}
String aResultStr;
if ( bWrite )
@@ -1332,7 +1327,7 @@ RTLFUNC(Mid)
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
- USHORT nArgLen = aArgStr.Len();
+ sal_uInt16 nArgLen = aArgStr.Len();
if( nStartPos + 1 > nArgLen )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1340,8 +1335,8 @@ RTLFUNC(Mid)
}
String aReplaceStr = rPar.Get(4)->GetString();
- USHORT nReplaceStrLen = aReplaceStr.Len();
- USHORT nReplaceLen;
+ sal_uInt16 nReplaceStrLen = aReplaceStr.Len();
+ sal_uInt16 nReplaceLen;
if( bWriteNoLenParam )
{
nReplaceLen = nReplaceStrLen;
@@ -1353,12 +1348,12 @@ RTLFUNC(Mid)
nReplaceLen = nReplaceStrLen;
}
- USHORT nReplaceEndPos = nStartPos + nReplaceLen;
+ sal_uInt16 nReplaceEndPos = nStartPos + nReplaceLen;
if( nReplaceEndPos > nArgLen )
nReplaceLen -= (nReplaceEndPos - nArgLen);
aResultStr = aArgStr;
- USHORT nErase = nReplaceLen;
+ sal_uInt16 nErase = nReplaceLen;
aResultStr.Erase( nStartPos, nErase );
aResultStr.Insert( aReplaceStr, 0, nReplaceLen, nStartPos );
}
@@ -1406,7 +1401,7 @@ RTLFUNC(Replace)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 6 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -1415,7 +1410,7 @@ RTLFUNC(Replace)
String aFindStr = rPar.Get(2)->GetString();
String aReplaceStr = rPar.Get(3)->GetString();
- INT32 lStartPos = 1;
+ sal_Int32 lStartPos = 1;
if ( nArgCount >= 4 )
{
if( rPar.Get(4)->GetType() != SbxEMPTY )
@@ -1427,7 +1422,7 @@ RTLFUNC(Replace)
}
}
- INT32 lCount = -1;
+ sal_Int32 lCount = -1;
if( nArgCount >=5 )
{
if( rPar.Get(5)->GetType() != SbxEMPTY )
@@ -1445,7 +1440,7 @@ RTLFUNC(Replace)
if( bCompatibility )
{
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
- bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE;
+ bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
@@ -1454,14 +1449,14 @@ RTLFUNC(Replace)
if ( nArgCount == 6 )
bTextMode = rPar.Get(6)->GetInteger();
- USHORT nExpStrLen = aExpStr.Len();
- USHORT nFindStrLen = aFindStr.Len();
- USHORT nReplaceStrLen = aReplaceStr.Len();
+ sal_uInt16 nExpStrLen = aExpStr.Len();
+ sal_uInt16 nFindStrLen = aFindStr.Len();
+ sal_uInt16 nReplaceStrLen = aReplaceStr.Len();
if( lStartPos <= nExpStrLen )
{
- USHORT nPos = static_cast<USHORT>( lStartPos - 1 );
- USHORT nCounts = 0;
+ sal_uInt16 nPos = static_cast<sal_uInt16>( lStartPos - 1 );
+ sal_uInt16 nCounts = 0;
while( lCount == -1 || lCount > nCounts )
{
String aSrcStr( aExpStr );
@@ -1483,7 +1478,7 @@ RTLFUNC(Replace)
}
}
}
- rPar.Get(0)->PutString( aExpStr.Copy( static_cast<USHORT>(lStartPos - 1) ) );
+ rPar.Get(0)->PutString( aExpStr.Copy( static_cast<sal_uInt16>(lStartPos - 1) ) );
}
}
@@ -1497,7 +1492,7 @@ RTLFUNC(Right)
else
{
const String& rStr = rPar.Get(1)->GetString();
- INT32 lResultLen = rPar.Get(2)->GetLong();
+ sal_Int32 lResultLen = rPar.Get(2)->GetLong();
if( lResultLen > 0xffff )
{
lResultLen = 0xffff;
@@ -1507,8 +1502,8 @@ RTLFUNC(Right)
lResultLen = 0;
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
- USHORT nResultLen = (USHORT)lResultLen;
- USHORT nStrLen = rStr.Len();
+ sal_uInt16 nResultLen = (sal_uInt16)lResultLen;
+ sal_uInt16 nStrLen = rStr.Len();
if ( nResultLen > nStrLen )
nResultLen = nStrLen;
String aResultStr = rStr.Copy( nStrLen-nResultLen );
@@ -1549,7 +1544,7 @@ RTLFUNC(Sgn)
else
{
double aDouble = rPar.Get(1)->GetDouble();
- INT16 nResult = 0;
+ sal_Int16 nResult = 0;
if ( aDouble > 0 )
nResult = 1;
else if ( aDouble < 0 )
@@ -1568,7 +1563,7 @@ RTLFUNC(Space)
else
{
String aStr;
- aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() ));
+ aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() ));
rPar.Get(0)->PutString( aStr );
}
}
@@ -1583,7 +1578,7 @@ RTLFUNC(Spc)
else
{
String aStr;
- aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() ));
+ aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() ));
rPar.Get(0)->PutString( aStr );
}
}
@@ -1633,11 +1628,11 @@ RTLFUNC(Str)
const sal_Unicode* pBuf = aStr.GetBuffer();
bool bNeg = ( pBuf[0] == '-' );
- USHORT iZeroSearch = 0;
+ sal_uInt16 iZeroSearch = 0;
if( bNeg )
iZeroSearch++;
- USHORT iNext = iZeroSearch + 1;
+ sal_uInt16 iNext = iZeroSearch + 1;
if( pBuf[iZeroSearch] == '0' && nLen > iNext && pBuf[iNext] == '.' )
{
aStr.Erase( iZeroSearch, 1 );
@@ -1668,16 +1663,16 @@ RTLFUNC(StrComp)
const String& rStr2 = rPar.Get(2)->GetString();
SbiInstance* pInst = pINST;
- INT16 nTextCompare;
+ sal_Int16 nTextCompare;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
- nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE;
+ nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
- nTextCompare = TRUE;
+ nTextCompare = sal_True;
}
if ( rPar.Count() == 4 )
nTextCompare = rPar.Get(3)->GetInteger();
@@ -1713,7 +1708,7 @@ RTLFUNC(StrComp)
nRetValue = 1;
}
- rPar.Get(0)->PutInteger( sal::static_int_cast< INT16 >( nRetValue ) );
+ rPar.Get(0)->PutInteger( sal::static_int_cast< sal_Int16 >( nRetValue ) );
}
RTLFUNC(String)
@@ -1727,10 +1722,10 @@ RTLFUNC(String)
{
String aStr;
sal_Unicode aFiller;
- INT32 lCount = rPar.Get(1)->GetLong();
+ sal_Int32 lCount = rPar.Get(1)->GetLong();
if( lCount < 0 || lCount > 0xffff )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- USHORT nCount = (USHORT)lCount;
+ sal_uInt16 nCount = (sal_uInt16)lCount;
if( rPar.Get(2)->GetType() == SbxINTEGER )
aFiller = (sal_Unicode)rPar.Get(2)->GetInteger();
else
@@ -1788,7 +1783,7 @@ RTLFUNC(Val)
String aStr( rPar.Get(1)->GetString() );
// lt. Mikkysoft bei Kommas abbrechen!
-// for( USHORT n=0; n < aStr.Len(); n++ )
+// for( sal_uInt16 n=0; n < aStr.Len(); n++ )
// if( aStr[n] == ',' ) aStr[n] = '.';
FilterWhiteSpace( aStr );
@@ -1803,7 +1798,7 @@ RTLFUNC(Val)
if ( nRadix != 10 )
{
ByteString aByteStr( aStr, gsl_getSystemTextEncoding() );
- INT16 nlResult = (INT16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix);
+ sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix);
nResult = (double)nlResult;
}
}
@@ -1821,46 +1816,46 @@ RTLFUNC(Val)
// Helper functions for date conversion
-INT16 implGetDateDay( double aDate )
+sal_Int16 implGetDateDay( double aDate )
{
aDate -= 2.0; // normieren: 1.1.1900 => 0.0
Date aRefDate( 1, 1, 1900 );
if ( aDate >= 0.0 )
{
aDate = floor( aDate );
- aRefDate += (ULONG)aDate;
+ aRefDate += (sal_uIntPtr)aDate;
}
else
{
aDate = ceil( aDate );
- aRefDate -= (ULONG)(-1.0 * aDate);
+ aRefDate -= (sal_uIntPtr)(-1.0 * aDate);
}
- INT16 nRet = (INT16)( aRefDate.GetDay() );
+ sal_Int16 nRet = (sal_Int16)( aRefDate.GetDay() );
return nRet;
}
-INT16 implGetDateMonth( double aDate )
+sal_Int16 implGetDateMonth( double aDate )
{
Date aRefDate( 1,1,1900 );
long nDays = (long)aDate;
nDays -= 2; // normieren: 1.1.1900 => 0.0
aRefDate += nDays;
- INT16 nRet = (INT16)( aRefDate.GetMonth() );
+ sal_Int16 nRet = (sal_Int16)( aRefDate.GetMonth() );
return nRet;
}
-INT16 implGetDateYear( double aDate )
+sal_Int16 implGetDateYear( double aDate )
{
Date aRefDate( 1,1,1900 );
long nDays = (long) aDate;
nDays -= 2; // normieren: 1.1.1900 => 0.0
aRefDate += nDays;
- INT16 nRet = (INT16)( aRefDate.GetYear() );
+ sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() );
return nRet;
}
-BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
+sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet )
{
if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
nYear += 2000;
@@ -1870,7 +1865,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
if ((nYear < 100 || nYear > 9999) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return FALSE;
+ return sal_False;
}
if ( !SbiRuntime::isVBAEnabled() )
{
@@ -1878,7 +1873,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
(nDay < 1 || nDay > 31 ) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return FALSE;
+ return sal_False;
}
}
else
@@ -1893,7 +1888,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
{
// inacurrate around leap year, don't use days to calculate,
// just modify the months directory
- INT16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
+ sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
if ( nMonth <=0 )
nYearAdj = ( ( nMonth -12 ) / 12 );
aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
@@ -1910,7 +1905,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
long nDiffDays = GetDayDiff( aCurDate );
rdRet = (double)nDiffDays;
- return TRUE;
+ return sal_True;
}
// Function to convert date to ISO 8601 date format
@@ -1944,14 +1939,14 @@ RTLFUNC(CDateFromIso)
if ( rPar.Count() == 2 )
{
String aStr = rPar.Get(1)->GetString();
- INT16 iMonthStart = aStr.Len() - 4;
+ sal_Int16 iMonthStart = aStr.Len() - 4;
String aYearStr = aStr.Copy( 0, iMonthStart );
String aMonthStr = aStr.Copy( iMonthStart, 2 );
String aDayStr = aStr.Copy( iMonthStart+2, 2 );
double dDate;
- if( implDateSerial( (INT16)aYearStr.ToInt32(),
- (INT16)aMonthStr.ToInt32(), (INT16)aDayStr.ToInt32(), dDate ) )
+ if( implDateSerial( (sal_Int16)aYearStr.ToInt32(),
+ (sal_Int16)aMonthStr.ToInt32(), (sal_Int16)aDayStr.ToInt32(), dDate ) )
{
rPar.Get(0)->PutDate( dDate );
}
@@ -1970,9 +1965,9 @@ RTLFUNC(DateSerial)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nYear = rPar.Get(1)->GetInteger();
- INT16 nMonth = rPar.Get(2)->GetInteger();
- INT16 nDay = rPar.Get(3)->GetInteger();
+ sal_Int16 nYear = rPar.Get(1)->GetInteger();
+ sal_Int16 nMonth = rPar.Get(2)->GetInteger();
+ sal_Int16 nDay = rPar.Get(3)->GetInteger();
double dDate;
if( implDateSerial( nYear, nMonth, nDay, dDate ) )
@@ -1989,11 +1984,11 @@ RTLFUNC(TimeSerial)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nHour = rPar.Get(1)->GetInteger();
+ sal_Int16 nHour = rPar.Get(1)->GetInteger();
if ( nHour == 24 )
nHour = 0; // Wegen UNO DateTimes, die bis 24 Uhr gehen
- INT16 nMinute = rPar.Get(2)->GetInteger();
- INT16 nSecond = rPar.Get(3)->GetInteger();
+ sal_Int16 nMinute = rPar.Get(2)->GetInteger();
+ sal_Int16 nSecond = rPar.Get(3)->GetInteger();
if ((nHour < 0 || nHour > 23) ||
(nMinute < 0 || nMinute > 59 ) ||
(nSecond < 0 || nSecond > 59 ))
@@ -2002,7 +1997,7 @@ RTLFUNC(TimeSerial)
return;
}
- INT32 nSeconds = nHour;
+ sal_Int32 nSeconds = nHour;
nSeconds *= 3600;
nSeconds += nMinute * 60;
nSeconds += nSecond;
@@ -2032,7 +2027,7 @@ RTLFUNC(DateValue)
sal_uInt32 nIndex;
double fResult;
String aStr( rPar.Get(1)->GetString() );
- BOOL bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
+ sal_Bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
short nType = pFormatter->GetType( nIndex );
// DateValue("February 12, 1969") raises error if the system locale is not en_US
@@ -2093,7 +2088,7 @@ RTLFUNC(TimeValue)
sal_uInt32 nIndex;
double fResult;
- BOOL bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(),
+ sal_Bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(),
nIndex, fResult );
short nType = pFormatter->GetType(nIndex);
if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME))
@@ -2124,7 +2119,7 @@ RTLFUNC(Day)
SbxVariableRef pArg = rPar.Get( 1 );
double aDate = pArg->GetDate();
- INT16 nDay = implGetDateDay( aDate );
+ sal_Int16 nDay = implGetDateDay( aDate );
rPar.Get(0)->PutInteger( nDay );
}
}
@@ -2138,19 +2133,19 @@ RTLFUNC(Year)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nYear = implGetDateYear( rPar.Get(1)->GetDate() );
+ sal_Int16 nYear = implGetDateYear( rPar.Get(1)->GetDate() );
rPar.Get(0)->PutInteger( nYear );
}
}
-INT16 implGetHour( double dDate )
+sal_Int16 implGetHour( double dDate )
{
if( dDate < 0.0 )
dDate *= -1.0;
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
- INT32 nSeconds = (INT32)(nFrac + 0.5);
- INT16 nHour = (INT16)(nSeconds / 3600);
+ sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
+ sal_Int16 nHour = (sal_Int16)(nSeconds / 3600);
return nHour;
}
@@ -2164,20 +2159,20 @@ RTLFUNC(Hour)
else
{
double nArg = rPar.Get(1)->GetDate();
- INT16 nHour = implGetHour( nArg );
+ sal_Int16 nHour = implGetHour( nArg );
rPar.Get(0)->PutInteger( nHour );
}
}
-INT16 implGetMinute( double dDate )
+sal_Int16 implGetMinute( double dDate )
{
if( dDate < 0.0 )
dDate *= -1.0;
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
- INT32 nSeconds = (INT32)(nFrac + 0.5);
- INT16 nTemp = (INT16)(nSeconds % 3600);
- INT16 nMin = nTemp / 60;
+ sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
+ sal_Int16 nTemp = (sal_Int16)(nSeconds % 3600);
+ sal_Int16 nMin = nTemp / 60;
return nMin;
}
@@ -2191,7 +2186,7 @@ RTLFUNC(Minute)
else
{
double nArg = rPar.Get(1)->GetDate();
- INT16 nMin = implGetMinute( nArg );
+ sal_Int16 nMin = implGetMinute( nArg );
rPar.Get(0)->PutInteger( nMin );
}
}
@@ -2205,24 +2200,24 @@ RTLFUNC(Month)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() );
+ sal_Int16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() );
rPar.Get(0)->PutInteger( nMonth );
}
}
-INT16 implGetSecond( double dDate )
+sal_Int16 implGetSecond( double dDate )
{
if( dDate < 0.0 )
dDate *= -1.0;
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
- INT32 nSeconds = (INT32)(nFrac + 0.5);
- INT16 nTemp = (INT16)(nSeconds / 3600);
+ sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
+ sal_Int16 nTemp = (sal_Int16)(nSeconds / 3600);
nSeconds -= nTemp * 3600;
- nTemp = (INT16)(nSeconds / 60);
+ nTemp = (sal_Int16)(nSeconds / 60);
nSeconds -= nTemp * 60;
- INT16 nRet = (INT16)nSeconds;
+ sal_Int16 nRet = (sal_Int16)nSeconds;
return nRet;
}
@@ -2236,7 +2231,7 @@ RTLFUNC(Second)
else
{
double nArg = rPar.Get(1)->GetDate();
- INT16 nSecond = implGetSecond( nArg );
+ sal_Int16 nSecond = implGetSecond( nArg );
rPar.Get(0)->PutInteger( nSecond );
}
}
@@ -2388,7 +2383,7 @@ RTLFUNC(IsArray)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? TRUE : FALSE );
+ rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? sal_True : sal_False );
}
RTLFUNC(IsObject)
@@ -2407,7 +2402,7 @@ RTLFUNC(IsObject)
SbxBase::ResetError();
SbUnoClass* pUnoClass;
- BOOL bObject;
+ sal_Bool bObject;
if( pObj && NULL != ( pUnoClass=PTR_CAST(SbUnoClass,pObj) ) )
{
bObject = pUnoClass->getUnoClass().is();
@@ -2429,14 +2424,14 @@ RTLFUNC(IsDate)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // #46134 Nur String wird konvertiert, andere Typen ergeben FALSE
+ // #46134 Nur String wird konvertiert, andere Typen ergeben sal_False
SbxVariableRef xArg = rPar.Get( 1 );
SbxDataType eType = xArg->GetType();
- BOOL bDate = FALSE;
+ sal_Bool bDate = sal_False;
if( eType == SbxDATE )
{
- bDate = TRUE;
+ bDate = sal_True;
}
else if( eType == SbxSTRING )
{
@@ -2518,12 +2513,12 @@ RTLFUNC(IsNull)
// #51475 Wegen Uno-Objekten auch true liefern,
// wenn der pObj-Wert NULL ist
SbxVariableRef pArg = rPar.Get( 1 );
- BOOL bNull = rPar.Get(1)->IsNull();
+ sal_Bool bNull = rPar.Get(1)->IsNull();
if( !bNull && pArg->GetType() == SbxOBJECT )
{
SbxBase* pObj = pArg->GetObject();
if( !pObj )
- bNull = TRUE;
+ bNull = sal_True;
}
rPar.Get( 0 )->PutBool( bNull );
}
@@ -2663,7 +2658,7 @@ inline sal_Bool implCheckWildcard( const String& rName, SbiRTLData* pRTLData )
bool isRootDir( String aDirURLStr )
{
INetURLObject aDirURLObj( aDirURLStr );
- BOOL bRoot = FALSE;
+ sal_Bool bRoot = sal_False;
// Check if it's a root directory
sal_Int32 nCount = aDirURLObj.getSegmentCount();
@@ -2671,22 +2666,22 @@ bool isRootDir( String aDirURLStr )
// No segment means Unix root directory "file:///"
if( nCount == 0 )
{
- bRoot = TRUE;
+ bRoot = sal_True;
}
// Exactly one segment needs further checking, because it
// can be Unix "file:///foo/" -> no root
// or Windows "file:///c:/" -> root
else if( nCount == 1 )
{
- ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, TRUE,
+ ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, sal_True,
INetURLObject::DECODE_WITH_CHARSET );
if( aSeg1.getStr()[1] == (sal_Unicode)':' )
{
- bRoot = TRUE;
+ bRoot = sal_True;
}
}
// More than one segments can never be root
- // so bRoot remains FALSE
+ // so bRoot remains sal_False
return bRoot;
}
@@ -2698,7 +2693,7 @@ RTLFUNC(Dir)
String aPath;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount > 3 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -2753,7 +2748,7 @@ RTLFUNC(Dir)
rPar.Get(0)->PutString( aEmptyStr );
}
- USHORT nFlags = 0;
+ sal_uInt16 nFlags = 0;
if ( nParCount > 2 )
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
else
@@ -2767,7 +2762,7 @@ RTLFUNC(Dir)
// #78651 Add "." and ".." directories for VB compatibility
if( bIncludeFolders )
{
- BOOL bRoot = isRootDir( aDirURLStr );
+ sal_Bool bRoot = isRootDir( aDirURLStr );
// If it's no root directory we flag the need for
// the "." and ".." directories by the value -2
@@ -2837,7 +2832,7 @@ RTLFUNC(Dir)
}
INetURLObject aURL( aFile );
- aPath = aURL.getName( INetURLObject::LAST_SEGMENT, TRUE,
+ aPath = aURL.getName( INetURLObject::LAST_SEGMENT, sal_True,
INetURLObject::DECODE_WITH_CHARSET );
}
@@ -2868,23 +2863,19 @@ RTLFUNC(Dir)
rPar.Get(0)->PutString( aEntry.GetName() );
return;
}
- USHORT nFlags = 0;
+ sal_uInt16 nFlags = 0;
if ( nParCount > 2 )
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
else
pRTLData->nDirFlags = 0;
- // Nur diese Bitmaske ist unter Windows erlaubt
- #ifdef WIN
- if( nFlags & ~0x1E )
- StarBASIC::Error( SbERR_BAD_ARGUMENT ), pRTLData->nDirFlags = 0;
- #endif
+
// Sb_ATTR_VOLUME wird getrennt gehandelt
if( pRTLData->nDirFlags & Sb_ATTR_VOLUME )
aPath = aEntry.GetVolume();
else
{
// Die richtige Auswahl treffen
- USHORT nMode = FSYS_KIND_FILE;
+ sal_uInt16 nMode = FSYS_KIND_FILE;
if( nFlags & Sb_ATTR_DIRECTORY )
nMode |= FSYS_KIND_DIR;
if( nFlags == Sb_ATTR_DIRECTORY )
@@ -2907,31 +2898,7 @@ RTLFUNC(Dir)
}
DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++];
aPath = aNextEntry.GetName(); //Full();
- #ifdef WIN
- aNextEntry.ToAbs();
- String sFull(aNextEntry.GetFull());
- unsigned nFlags;
-
- if (_dos_getfileattr( sFull.GetStr(), &nFlags ))
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- else
- {
- INT16 nCurFlags = pRTLData->nDirFlags;
- if( (nCurFlags == Sb_ATTR_NORMAL)
- && !(nFlags & ( _A_HIDDEN | _A_SYSTEM | _A_VOLID | _A_SUBDIR ) ) )
- break;
- else if( (nCurFlags & Sb_ATTR_HIDDEN) && (nFlags & _A_HIDDEN) )
- break;
- else if( (nCurFlags & Sb_ATTR_SYSTEM) && (nFlags & _A_SYSTEM) )
- break;
- else if( (nCurFlags & Sb_ATTR_VOLUME) && (nFlags & _A_VOLID) )
- break;
- else if( (nCurFlags & Sb_ATTR_DIRECTORY) && (nFlags & _A_SUBDIR) )
- break;
- }
- #else
break;
- #endif
}
}
rPar.Get(0)->PutString( aPath );
@@ -2943,7 +2910,7 @@ RTLFUNC(Dir)
String aDirURL = implSetupWildcard( aFileParam, pRTLData );
- USHORT nFlags = 0;
+ sal_uInt16 nFlags = 0;
if ( nParCount > 2 )
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
else
@@ -2965,7 +2932,7 @@ RTLFUNC(Dir)
pRTLData->nCurDirPos = 0;
if( bIncludeFolders )
{
- BOOL bRoot = isRootDir( aDirURL );
+ sal_Bool bRoot = isRootDir( aDirURL );
// If it's no root directory we flag the need for
// the "." and ".." directories by the value -2
@@ -3045,7 +3012,7 @@ RTLFUNC(GetAttr)
if ( rPar.Count() == 2 )
{
- INT16 nFlags = 0;
+ sal_Int16 nFlags = 0;
// In Windows, We want to use Windows API to get the file attributes
// for VBA interoperability.
@@ -3062,7 +3029,7 @@ RTLFUNC(GetAttr)
{
if (nRealFlags == FILE_ATTRIBUTE_NORMAL)
nRealFlags = 0;
- nFlags = (INT16) (nRealFlags);
+ nFlags = (sal_Int16) (nRealFlags);
}
else
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
@@ -3228,7 +3195,7 @@ RTLFUNC(EOF)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
// nChannel--; // macht MD beim Oeffnen auch nicht
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
@@ -3237,7 +3204,7 @@ RTLFUNC(EOF)
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
- BOOL bIsEof;
+ sal_Bool bIsEof;
SvStream* pSvStrm = pSbStrm->GetStrm();
if ( pSbStrm->IsText() )
{
@@ -3268,7 +3235,7 @@ RTLFUNC(FileAttr)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
// nChannel--;
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
@@ -3277,9 +3244,9 @@ RTLFUNC(FileAttr)
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
- INT16 nRet;
+ sal_Int16 nRet;
if ( rPar.Get(2)->GetInteger() == 1 )
- nRet = (INT16)(pSbStrm->GetMode());
+ nRet = (sal_Int16)(pSbStrm->GetMode());
else
nRet = 0; // System file handle not supported
@@ -3296,7 +3263,7 @@ RTLFUNC(Loc)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
@@ -3305,7 +3272,7 @@ RTLFUNC(Loc)
return;
}
SvStream* pSvStrm = pSbStrm->GetStrm();
- ULONG nPos;
+ sal_uIntPtr nPos;
if( pSbStrm->IsRandom())
{
short nBlockLen = pSbStrm->GetBlockLen();
@@ -3320,7 +3287,7 @@ RTLFUNC(Loc)
nPos = ( pSvStrm->Tell()+1 ) / 128;
else
nPos = pSvStrm->Tell();
- rPar.Get(0)->PutLong( (INT32)nPos );
+ rPar.Get(0)->PutLong( (sal_Int32)nPos );
}
}
@@ -3334,7 +3301,7 @@ RTLFUNC(Lof)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
@@ -3343,10 +3310,10 @@ RTLFUNC(Lof)
return;
}
SvStream* pSvStrm = pSbStrm->GetStrm();
- ULONG nOldPos = pSvStrm->Tell();
- ULONG nLen = pSvStrm->Seek( STREAM_SEEK_TO_END );
+ sal_uIntPtr nOldPos = pSvStrm->Tell();
+ sal_uIntPtr nLen = pSvStrm->Seek( STREAM_SEEK_TO_END );
pSvStrm->Seek( nOldPos );
- rPar.Get(0)->PutLong( (INT32)nLen );
+ rPar.Get(0)->PutLong( (sal_Int32)nLen );
}
}
@@ -3363,7 +3330,7 @@ RTLFUNC(Seek)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
// nChannel--;
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
@@ -3376,15 +3343,15 @@ RTLFUNC(Seek)
if ( nArgs == 2 ) // Seek-Function
{
- ULONG nPos = pStrm->Tell();
+ sal_uIntPtr nPos = pStrm->Tell();
if( pSbStrm->IsRandom() )
nPos = nPos / pSbStrm->GetBlockLen();
nPos++; // Basic zaehlt ab 1
- rPar.Get(0)->PutLong( (INT32)nPos );
+ rPar.Get(0)->PutLong( (sal_Int32)nPos );
}
else // Seek-Statement
{
- INT32 nPos = rPar.Get(2)->GetLong();
+ sal_Int32 nPos = rPar.Get(2)->GetLong();
if ( nPos < 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -3394,7 +3361,7 @@ RTLFUNC(Seek)
pSbStrm->SetExpandOnWriteTo( 0 );
if ( pSbStrm->IsRandom() )
nPos *= pSbStrm->GetBlockLen();
- pStrm->Seek( (ULONG)nPos );
+ pStrm->Seek( (sal_uIntPtr)nPos );
pSbStrm->SetExpandOnWriteTo( nPos );
}
}
@@ -3404,7 +3371,7 @@ RTLFUNC(Format)
(void)pBasic;
(void)bWrite;
- USHORT nArgCount = (USHORT)rPar.Count();
+ sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
if ( nArgCount < 2 || nArgCount > 3 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -3428,11 +3395,11 @@ RTLFUNC(Randomize)
if ( rPar.Count() > 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- INT16 nSeed;
+ sal_Int16 nSeed;
if( rPar.Count() == 2 )
- nSeed = (INT16)rPar.Get(1)->GetInteger();
+ nSeed = (sal_Int16)rPar.Get(1)->GetInteger();
else
- nSeed = (INT16)rand();
+ nSeed = (sal_Int16)rand();
srand( nSeed );
}
@@ -3453,7 +3420,7 @@ RTLFUNC(Rnd)
//
-// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = FALSE ]]])
+// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = sal_False ]]])
//
// WindowStyles (VBA-kompatibel):
// 2 == Minimized
@@ -3477,7 +3444,7 @@ RTLFUNC(Shell)
return;
}
- ULONG nArgCount = rPar.Count();
+ sal_uIntPtr nArgCount = rPar.Count();
if ( nArgCount < 2 || nArgCount > 5 )
{
rPar.Get(0)->PutLong(0);
@@ -3499,13 +3466,13 @@ RTLFUNC(Shell)
// Spezial-Behandlung (leere Liste) vermeiden
aCmdLine.AppendAscii( " " );
}
- USHORT nLen = aCmdLine.Len();
+ sal_uInt16 nLen = aCmdLine.Len();
// #55735 Wenn Parameter dabei sind, muessen die abgetrennt werden
// #72471 Auch die einzelnen Parameter trennen
std::list<String> aTokenList;
String aToken;
- USHORT i = 0;
+ sal_uInt16 i = 0;
sal_Unicode c;
while( i < nLen )
{
@@ -3519,7 +3486,7 @@ RTLFUNC(Shell)
if( c == '\"' || c == '\'' )
{
- USHORT iFoundPos = aCmdLine.Search( c, i + 1 );
+ sal_uInt16 iFoundPos = aCmdLine.Search( c, i + 1 );
// Wenn nichts gefunden wurde, Rest kopieren
if( iFoundPos == STRING_NOTFOUND )
@@ -3535,9 +3502,9 @@ RTLFUNC(Shell)
}
else
{
- USHORT iFoundSpacePos = aCmdLine.Search( ' ', i );
- USHORT iFoundTabPos = aCmdLine.Search( '\t', i );
- USHORT iFoundPos = Min( iFoundSpacePos, iFoundTabPos );
+ sal_uInt16 iFoundSpacePos = aCmdLine.Search( ' ', i );
+ sal_uInt16 iFoundTabPos = aCmdLine.Search( '\t', i );
+ sal_uInt16 iFoundPos = Min( iFoundSpacePos, iFoundTabPos );
// Wenn nichts gefunden wurde, Rest kopieren
if( iFoundPos == STRING_NOTFOUND )
@@ -3557,7 +3524,7 @@ RTLFUNC(Shell)
}
// #55735 / #72471 Ende
- INT16 nWinStyle = 0;
+ sal_Int16 nWinStyle = 0;
if( nArgCount >= 3 )
{
nWinStyle = rPar.Get(2)->GetInteger();
@@ -3574,7 +3541,7 @@ RTLFUNC(Shell)
break;
}
- BOOL bSync = FALSE;
+ sal_Bool bSync = sal_False;
if( nArgCount >= 5 )
bSync = rPar.Get(4)->GetBool();
if( bSync )
@@ -3589,7 +3556,7 @@ RTLFUNC(Shell)
++iter;
- USHORT nParamCount = sal::static_int_cast< USHORT >(
+ sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >(
aTokenList.size() - 1 );
rtl_uString** pParamList = NULL;
if( nParamCount )
@@ -3605,7 +3572,7 @@ RTLFUNC(Shell)
}
oslProcess pApp;
- BOOL bSucc = osl_executeProcess(
+ sal_Bool bSucc = osl_executeProcess(
aOUStrProgUNC.pData,
pParamList,
nParamCount,
@@ -3650,7 +3617,7 @@ RTLFUNC(VarType)
else
{
SbxDataType eType = rPar.Get(1)->GetType();
- rPar.Get(0)->PutInteger( (INT16)eType );
+ rPar.Get(0)->PutInteger( (sal_Int16)eType );
}
}
@@ -3700,7 +3667,7 @@ String getBasicTypeName( SbxDataType eType )
};
int nPos = ((int)eType) & 0x0FFF;
- USHORT nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* );
+ sal_uInt16 nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* );
if ( nPos < 0 || nPos >= nTypeNameCount )
nPos = nTypeNameCount - 1;
String aRetStr = String::CreateFromAscii( pTypeNames[nPos] );
@@ -3776,7 +3743,7 @@ RTLFUNC(TypeName)
else
{
SbxDataType eType = rPar.Get(1)->GetType();
- BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 );
+ sal_Bool bIsArray = ( ( eType & SbxARRAY ) != 0 );
String aRetStr;
if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
@@ -3799,7 +3766,7 @@ RTLFUNC(Len)
else
{
const String& rStr = rPar.Get(1)->GetString();
- rPar.Get(0)->PutLong( (INT32)rStr.Len() );
+ rPar.Get(0)->PutLong( (sal_Int32)rStr.Len() );
}
}
@@ -3825,7 +3792,7 @@ RTLFUNC(DDEInitiate)
const String& rTopic = rPar.Get(2)->GetString();
SbiDdeControl* pDDE = pINST->GetDdeControl();
- INT16 nChannel;
+ sal_Int16 nChannel;
SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel );
if( nDdeErr )
StarBASIC::Error( nDdeErr );
@@ -3852,7 +3819,7 @@ RTLFUNC(DDETerminate)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
SbiDdeControl* pDDE = pINST->GetDdeControl();
SbError nDdeErr = pDDE->Terminate( nChannel );
if( nDdeErr )
@@ -3904,7 +3871,7 @@ RTLFUNC(DDERequest)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
const String& rItem = rPar.Get(2)->GetString();
SbiDdeControl* pDDE = pINST->GetDdeControl();
String aResult;
@@ -3934,7 +3901,7 @@ RTLFUNC(DDEExecute)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
const String& rCommand = rPar.Get(2)->GetString();
SbiDdeControl* pDDE = pINST->GetDdeControl();
SbError nDdeErr = pDDE->Execute( nChannel, rCommand );
@@ -3961,7 +3928,7 @@ RTLFUNC(DDEPoke)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nChannel = rPar.Get(1)->GetInteger();
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
const String& rItem = rPar.Get(2)->GetString();
const String& rData = rPar.Get(3)->GetString();
SbiDdeControl* pDDE = pINST->GetDdeControl();
@@ -4001,7 +3968,7 @@ RTLFUNC(LBound)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if ( nParCount != 3 && nParCount != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4011,7 +3978,7 @@ RTLFUNC(LBound)
SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj);
if( pArr )
{
- INT32 nLower, nUpper;
+ sal_Int32 nLower, nUpper;
short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1;
if( !pArr->GetDim32( nDim, nLower, nUpper ) )
StarBASIC::Error( SbERR_OUT_OF_RANGE );
@@ -4027,7 +3994,7 @@ RTLFUNC(UBound)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if ( nParCount != 3 && nParCount != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4038,7 +4005,7 @@ RTLFUNC(UBound)
SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj);
if( pArr )
{
- INT32 nLower, nUpper;
+ sal_Int32 nLower, nUpper;
short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1;
if( !pArr->GetDim32( nDim, nLower, nUpper ) )
StarBASIC::Error( SbERR_OUT_OF_RANGE );
@@ -4060,10 +4027,10 @@ RTLFUNC(RGB)
return;
}
- ULONG nRed = rPar.Get(1)->GetInteger() & 0xFF;
- ULONG nGreen = rPar.Get(2)->GetInteger() & 0xFF;
- ULONG nBlue = rPar.Get(3)->GetInteger() & 0xFF;
- ULONG nRGB;
+ sal_uIntPtr nRed = rPar.Get(1)->GetInteger() & 0xFF;
+ sal_uIntPtr nGreen = rPar.Get(2)->GetInteger() & 0xFF;
+ sal_uIntPtr nBlue = rPar.Get(3)->GetInteger() & 0xFF;
+ sal_uIntPtr nRGB;
SbiInstance* pInst = pINST;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
@@ -4083,7 +4050,7 @@ RTLFUNC(QBColor)
(void)pBasic;
(void)bWrite;
- static const INT32 pRGB[] =
+ static const sal_Int32 pRGB[] =
{
0x000000,
0x800000,
@@ -4109,13 +4076,13 @@ RTLFUNC(QBColor)
return;
}
- INT16 nCol = rPar.Get(1)->GetInteger();
+ sal_Int16 nCol = rPar.Get(1)->GetInteger();
if( nCol < 0 || nCol > 15 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT32 nRGB = pRGB[ nCol ];
+ sal_Int32 nRGB = pRGB[ nCol ];
rPar.Get(0)->PutLong( nRGB );
}
@@ -4125,7 +4092,7 @@ RTLFUNC(StrConv)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uIntPtr nArgCount = rPar.Count()-1;
if( nArgCount < 2 || nArgCount > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4133,16 +4100,16 @@ RTLFUNC(StrConv)
}
String aOldStr = rPar.Get(1)->GetString();
- INT32 nConversion = rPar.Get(2)->GetLong();
+ sal_Int32 nConversion = rPar.Get(2)->GetLong();
- USHORT nLanguage = LANGUAGE_SYSTEM;
+ sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
if( nArgCount == 3 )
{
// LCID not supported now
//nLanguage = rPar.Get(3)->GetInteger();
}
- USHORT nOldLen = aOldStr.Len();
+ sal_uInt16 nOldLen = aOldStr.Len();
if( nOldLen == 0 )
{
// null string,return
@@ -4150,7 +4117,7 @@ RTLFUNC(StrConv)
return;
}
- INT32 nType = 0;
+ sal_Int32 nType = 0;
if ( (nConversion & 0x03) == 3 ) // vbProperCase
{
CharClass& rCharClass = GetCharClass();
@@ -4184,10 +4151,10 @@ RTLFUNC(StrConv)
if ( (nConversion & 0x40) == 64 ) // vbUnicode
{
// convert the string to byte string, preserving unicode (2 bytes per character)
- USHORT nSize = aNewStr.Len()*2;
+ sal_uInt16 nSize = aNewStr.Len()*2;
const sal_Unicode* pSrc = aNewStr.GetBuffer();
sal_Char* pChar = new sal_Char[nSize+1];
- for( USHORT i=0; i < nSize; i++ )
+ for( sal_uInt16 i=0; i < nSize; i++ )
{
pChar[i] = static_cast< sal_Char >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff );
if( i%2 )
@@ -4208,7 +4175,7 @@ RTLFUNC(StrConv)
// there is no concept about default codepage in unix. so it is incorrectly in unix
::rtl::OString aOStr = ::rtl::OUStringToOString(aNewStr,osl_getThreadTextEncoding());
const sal_Char* pChar = aOStr.getStr();
- USHORT nArraySize = static_cast< USHORT >( aOStr.getLength() );
+ sal_uInt16 nArraySize = static_cast< sal_uInt16 >( aOStr.getLength() );
SbxDimArray* pArray = new SbxDimArray(SbxBYTE);
bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
if(nArraySize)
@@ -4223,7 +4190,7 @@ RTLFUNC(StrConv)
pArray->unoAddDim( 0, -1 );
}
- for( USHORT i=0; i< nArraySize; i++)
+ for( sal_uInt16 i=0; i< nArraySize; i++)
{
SbxVariable* pNew = new SbxVariable( SbxBYTE );
pNew->PutByte(*pChar);
@@ -4236,7 +4203,7 @@ RTLFUNC(StrConv)
}
SbxVariableRef refVar = rPar.Get(0);
- USHORT nFlags = refVar->GetFlags();
+ sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
@@ -4392,17 +4359,17 @@ RTLFUNC(MsgBox)
WB_YES_NO, // MB_YESNO
WB_RETRY_CANCEL // MB_RETRYCANCEL
};
- static const INT16 nButtonMap[] =
+ static const sal_Int16 nButtonMap[] =
{
- 2, // #define RET_CANCEL FALSE
- 1, // #define RET_OK TRUE
+ 2, // #define RET_CANCEL sal_False
+ 1, // #define RET_OK sal_True
6, // #define RET_YES 2
7, // #define RET_NO 3
4 // #define RET_RETRY 4
};
- USHORT nArgCount = (USHORT)rPar.Count();
+ sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
if( nArgCount < 2 || nArgCount > 6 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4469,11 +4436,11 @@ RTLFUNC(MsgBox)
pBox = new MessBox( pParent, nWinBits, aTitle, aMsg );
}
pBox->SetText( aTitle );
- USHORT nRet = (USHORT)pBox->Execute();
- if( nRet == TRUE )
+ sal_uInt16 nRet = (sal_uInt16)pBox->Execute();
+ if( nRet == sal_True )
nRet = 1;
- INT16 nMappedRet;
+ sal_Int16 nMappedRet;
if( nStyle == 2 )
{
nMappedRet = nRet;
@@ -4496,7 +4463,7 @@ RTLFUNC(SetAttr) // JSM
if ( rPar.Count() == 3 )
{
String aStr = rPar.Get(1)->GetString();
- INT16 nFlags = rPar.Get(2)->GetInteger();
+ sal_Int16 nFlags = rPar.Get(2)->GetInteger();
// <-- UCB
if( hasUno() )
@@ -4524,16 +4491,6 @@ RTLFUNC(SetAttr) // JSM
// #57064 Bei virtuellen URLs den Real-Path extrahieren
DirEntry aEntry( aStr );
String aFile = aEntry.GetFull();
- #ifdef WIN
- int nErr = _dos_setfileattr( aFile.GetStr(),(unsigned ) nFlags );
- if ( nErr )
- {
- if (errno == EACCES)
- StarBASIC::Error( SbERR_ACCESS_DENIED );
- else
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- }
- #endif
ByteString aByteFile( aFile, gsl_getSystemTextEncoding() );
#ifdef WNT
if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags))
@@ -4582,7 +4539,7 @@ RTLFUNC(DumpAllObjects)
(void)pBasic;
(void)bWrite;
- USHORT nArgCount = (USHORT)rPar.Count();
+ sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
if( nArgCount < 2 || nArgCount > 3 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else if( !pBasic )
@@ -4610,7 +4567,7 @@ RTLFUNC(FileExists)
if ( rPar.Count() == 2 )
{
String aStr = rPar.Get(1)->GetString();
- BOOL bExists = FALSE;
+ sal_Bool bExists = sal_False;
// <-- UCB
if( hasUno() )
@@ -4657,10 +4614,10 @@ RTLFUNC(Partition)
return;
}
- INT32 nNumber = rPar.Get(1)->GetLong();
- INT32 nStart = rPar.Get(2)->GetLong();
- INT32 nStop = rPar.Get(3)->GetLong();
- INT32 nInterval = rPar.Get(4)->GetLong();
+ sal_Int32 nNumber = rPar.Get(1)->GetLong();
+ sal_Int32 nStart = rPar.Get(2)->GetLong();
+ sal_Int32 nStop = rPar.Get(3)->GetLong();
+ sal_Int32 nInterval = rPar.Get(4)->GetLong();
if( nStart < 0 || nStop <= nStart || nInterval < 1 )
{
@@ -4677,9 +4634,9 @@ RTLFUNC(Partition)
// calculate the maximun number of characters before lowervalue and uppervalue
::rtl::OUString aBeforeStart = ::rtl::OUString::valueOf( nStart - 1 );
::rtl::OUString aAfterStop = ::rtl::OUString::valueOf( nStop + 1 );
- INT32 nLen1 = aBeforeStart.getLength();
- INT32 nLen2 = aAfterStop.getLength();
- INT32 nLen = nLen1 >= nLen2 ? nLen1:nLen2;
+ sal_Int32 nLen1 = aBeforeStart.getLength();
+ sal_Int32 nLen2 = aAfterStop.getLength();
+ sal_Int32 nLen = nLen1 >= nLen2 ? nLen1:nLen2;
::rtl::OUStringBuffer aRetStr( nLen * 2 + 1);
::rtl::OUString aLowerValue;
@@ -4694,8 +4651,8 @@ RTLFUNC(Partition)
}
else
{
- INT32 nLowerValue = nNumber;
- INT32 nUpperValue = nLowerValue;
+ sal_Int32 nLowerValue = nNumber;
+ sal_Int32 nUpperValue = nLowerValue;
if( nInterval > 1 )
{
nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart;
@@ -4712,14 +4669,14 @@ RTLFUNC(Partition)
if( nLen > nLen1 )
{
// appending the leading spaces for the lowervalue
- for ( INT32 i= (nLen - nLen1) ; i > 0; --i )
+ for ( sal_Int32 i= (nLen - nLen1) ; i > 0; --i )
aRetStr.appendAscii(" ");
}
aRetStr.append( aLowerValue ).appendAscii(":");
if( nLen > nLen2 )
{
// appending the leading spaces for the uppervalue
- for ( INT32 i= (nLen - nLen2) ; i > 0; --i )
+ for ( sal_Int32 i= (nLen - nLen2) ; i > 0; --i )
aRetStr.appendAscii(" ");
}
aRetStr.append( aUpperValue );
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 4c4cecb08b04..4d8b0380ff2f 100644..100755
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -29,11 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#if defined(WIN)
-#include <string.h>
-#else
#include <stdlib.h> // getenv
-#endif
#include <vcl/svapp.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/wrkwin.hxx>
@@ -51,10 +47,6 @@
#include <svpm.h>
#endif
-#if defined(WIN)
-#include <tools/svwin.h>
-#endif
-
#ifndef CLK_TCK
#define CLK_TCK CLOCKS_PER_SEC
#endif
@@ -123,13 +115,133 @@ static Reference< XCalendar > getLocaleCalendar( void )
return xCalendar;
}
+RTLFUNC(CallByName)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ const sal_Int16 vbGet = 2;
+ const sal_Int16 vbLet = 4;
+ const sal_Int16 vbMethod = 1;
+ const sal_Int16 vbSet = 8;
+
+ // At least 3 parameter needed plus function itself -> 4
+ sal_uInt16 nParCount = rPar.Count();
+ if ( nParCount < 4 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // 1. parameter is object
+ SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject();
+ SbxObject* pObj = NULL;
+ if( pObjVar )
+ pObj = PTR_CAST(SbxObject,pObjVar);
+ if( !pObj && pObjVar && pObjVar->ISA(SbxVariable) )
+ {
+ SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject();
+ pObj = PTR_CAST(SbxObject,pObjVarObj);
+ }
+ if( !pObj )
+ {
+ StarBASIC::Error( SbERR_BAD_PARAMETER );
+ return;
+ }
+
+ // 2. parameter is ProcedureName
+ String aNameStr = rPar.Get(2)->GetString();
+
+ // 3. parameter is CallType
+ sal_Int16 nCallType = rPar.Get(3)->GetInteger();
+
+ //SbxObject* pFindObj = NULL;
+ SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_DONTCARE );
+ if( pFindVar == NULL )
+ {
+ StarBASIC::Error( SbERR_PROC_UNDEFINED );
+ return;
+ }
+
+ switch( nCallType )
+ {
+ case vbGet:
+ {
+ SbxValues aVals;
+ aVals.eType = SbxVARIANT;
+ pFindVar->Get( aVals );
+
+ SbxVariableRef refVar = rPar.Get(0);
+ refVar->Put( aVals );
+ }
+ break;
+ case vbLet:
+ case vbSet:
+ {
+ if ( nParCount != 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ SbxVariableRef pValVar = rPar.Get(4);
+ if( nCallType == vbLet )
+ {
+ SbxValues aVals;
+ aVals.eType = SbxVARIANT;
+ pValVar->Get( aVals );
+ pFindVar->Put( aVals );
+ }
+ else
+ {
+ SbxVariableRef rFindVar = pFindVar;
+ SbiInstance* pInst = pINST;
+ SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
+ if( pRT != NULL )
+ pRT->StepSET_Impl( pValVar, rFindVar, false );
+ }
+ }
+ break;
+ case vbMethod:
+ {
+ SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar);
+ if( pMeth == NULL )
+ {
+ StarBASIC::Error( SbERR_PROC_UNDEFINED );
+ return;
+ }
+
+ // Setup parameters
+ SbxArrayRef xArray;
+ sal_uInt16 nMethParamCount = nParCount - 4;
+ if( nMethParamCount > 0 )
+ {
+ xArray = new SbxArray;
+ for( sal_uInt16 i = 0 ; i < nMethParamCount ; i++ )
+ {
+ SbxVariable* pPar = rPar.Get( i + 4 );
+ xArray->Put( pPar, i + 1 );
+ }
+ }
+
+ // Call method
+ SbxVariableRef refVar = rPar.Get(0);
+ if( xArray.Is() )
+ pMeth->SetParameters( xArray );
+ pMeth->Call( refVar );
+ pMeth->SetParameters( NULL );
+ }
+ break;
+ default:
+ StarBASIC::Error( SbERR_PROC_UNDEFINED );
+ }
+}
RTLFUNC(CBool) // JSM
{
(void)pBasic;
(void)bWrite;
- BOOL bVal = FALSE;
+ sal_Bool bVal = sal_False;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -146,7 +258,7 @@ RTLFUNC(CByte) // JSM
(void)pBasic;
(void)bWrite;
- BYTE nByte = 0;
+ sal_uInt8 nByte = 0;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -247,7 +359,7 @@ RTLFUNC(CInt) // JSM
(void)pBasic;
(void)bWrite;
- INT16 nVal = 0;
+ sal_Int16 nVal = 0;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -264,7 +376,7 @@ RTLFUNC(CLng) // JSM
(void)pBasic;
(void)bWrite;
- INT32 nVal = 0;
+ sal_Int32 nVal = 0;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -290,7 +402,7 @@ RTLFUNC(CSng) // JSM
// AB #41690 , String holen
double dVal = 0.0;
String aScanStr = pSbxVariable->GetString();
- SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/TRUE );
+ SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/sal_True );
if( SbxBase::GetError() == SbxERR_OK && Error != SbxERR_OK )
StarBASIC::Error( Error );
nVal = (float)dVal;
@@ -345,7 +457,7 @@ RTLFUNC(CVErr)
(void)pBasic;
(void)bWrite;
- INT16 nErrCode = 0;
+ sal_Int16 nErrCode = 0;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -416,10 +528,10 @@ RTLFUNC(Red)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- ULONG nRGB = (ULONG)rPar.Get(1)->GetLong();
+ sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong();
nRGB &= 0x00FF0000;
nRGB >>= 16;
- rPar.Get(0)->PutInteger( (INT16)nRGB );
+ rPar.Get(0)->PutInteger( (sal_Int16)nRGB );
}
}
@@ -432,10 +544,10 @@ RTLFUNC(Green)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- ULONG nRGB = (ULONG)rPar.Get(1)->GetLong();
+ sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong();
nRGB &= 0x0000FF00;
nRGB >>= 8;
- rPar.Get(0)->PutInteger( (INT16)nRGB );
+ rPar.Get(0)->PutInteger( (sal_Int16)nRGB );
}
}
@@ -448,9 +560,9 @@ RTLFUNC(Blue)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- ULONG nRGB = (ULONG)rPar.Get(1)->GetLong();
+ sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong();
nRGB &= 0x000000FF;
- rPar.Get(0)->PutInteger( (INT16)nRGB );
+ rPar.Get(0)->PutInteger( (sal_Int16)nRGB );
}
}
@@ -460,11 +572,11 @@ RTLFUNC(Switch)
(void)pBasic;
(void)bWrite;
- USHORT nCount = rPar.Count();
+ sal_uInt16 nCount = rPar.Count();
if( !(nCount & 0x0001 ))
// Anzahl der Argumente muss ungerade sein
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- USHORT nCurExpr = 1;
+ sal_uInt16 nCurExpr = 1;
while( nCurExpr < (nCount-1) )
{
if( rPar.Get( nCurExpr )->GetBool())
@@ -536,6 +648,7 @@ RTLFUNC(DoEvents)
// basic runtime pcode ( on a timed basis )
// always return 0
rPar.Get(0)->PutInteger( 0 );
+ Application::Reschedule( true );
}
RTLFUNC(GetGUIVersion)
@@ -559,8 +672,8 @@ RTLFUNC(Choose)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- INT16 nIndex = rPar.Get(1)->GetInteger();
- USHORT nCount = rPar.Count();
+ sal_Int16 nIndex = rPar.Get(1)->GetInteger();
+ sal_uInt16 nCount = rPar.Count();
nCount--;
if( nCount == 1 || nIndex > (nCount-1) || nIndex < 1 )
{
@@ -592,7 +705,7 @@ RTLFUNC(GetSolarVersion)
(void)pBasic;
(void)bWrite;
- rPar.Get(0)->PutLong( (INT32)SUPD );
+ rPar.Get(0)->PutLong( (sal_Int32)SUPD );
}
RTLFUNC(TwipsPerPixelX)
@@ -600,7 +713,7 @@ RTLFUNC(TwipsPerPixelX)
(void)pBasic;
(void)bWrite;
- INT32 nResult = 0;
+ sal_Int32 nResult = 0;
Size aSize( 100,0 );
MapMode aMap( MAP_TWIP );
OutputDevice* pDevice = Application::GetDefaultDevice();
@@ -617,7 +730,7 @@ RTLFUNC(TwipsPerPixelY)
(void)pBasic;
(void)bWrite;
- INT32 nResult = 0;
+ sal_Int32 nResult = 0;
Size aSize( 0,100 );
MapMode aMap( MAP_TWIP );
OutputDevice* pDevice = Application::GetDefaultDevice();
@@ -644,7 +757,7 @@ bool IsBaseIndexOne()
bool result = false;
if ( pINST && pINST->pRun )
{
- USHORT res = pINST->pRun->GetBase();
+ sal_uInt16 res = pINST->pRun->GetBase();
if ( res )
result = true;
}
@@ -657,7 +770,7 @@ RTLFUNC(Array)
(void)bWrite;
SbxDimArray* pArray = new SbxDimArray( SbxVARIANT );
- USHORT nArraySize = rPar.Count() - 1;
+ sal_uInt16 nArraySize = rPar.Count() - 1;
// Option Base zunaechst ignorieren (kennt leider nur der Compiler)
bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
@@ -674,10 +787,10 @@ RTLFUNC(Array)
}
// Parameter ins Array uebernehmen
- // ATTENTION: Using type USHORT for loop variable is
+ // ATTENTION: Using type sal_uInt16 for loop variable is
// mandatory to workaround a problem with the
// Solaris Intel compiler optimizer! See i104354
- for( USHORT i = 0 ; i < nArraySize ; i++ )
+ for( sal_uInt16 i = 0 ; i < nArraySize ; i++ )
{
SbxVariable* pVar = rPar.Get(i+1);
SbxVariable* pNew = new SbxVariable( *pVar );
@@ -690,7 +803,7 @@ RTLFUNC(Array)
// Array zurueckliefern
SbxVariableRef refVar = rPar.Get(0);
- USHORT nFlags = refVar->GetFlags();
+ sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
@@ -711,12 +824,12 @@ RTLFUNC(DimArray)
(void)bWrite;
SbxDimArray * pArray = new SbxDimArray( SbxVARIANT );
- USHORT nArrayDims = rPar.Count() - 1;
+ sal_uInt16 nArrayDims = rPar.Count() - 1;
if( nArrayDims > 0 )
{
- for( USHORT i = 0; i < nArrayDims ; i++ )
+ for( sal_uInt16 i = 0; i < nArrayDims ; i++ )
{
- INT32 ub = rPar.Get(i+1)->GetLong();
+ sal_Int32 ub = rPar.Get(i+1)->GetLong();
if( ub < 0 )
{
StarBASIC::Error( SbERR_OUT_OF_RANGE );
@@ -730,7 +843,7 @@ RTLFUNC(DimArray)
// Array zurueckliefern
SbxVariableRef refVar = rPar.Get(0);
- USHORT nFlags = refVar->GetFlags();
+ sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
@@ -849,12 +962,12 @@ RTLFUNC(FindPropertyObject)
-BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
- BOOL bBinary, short nBlockLen, BOOL bIsArray )
+sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
+ sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray )
{
- ULONG nFPos = pStrm->Tell();
+ sal_uIntPtr nFPos = pStrm->Tell();
- BOOL bIsVariant = !rVar.IsFixed();
+ sal_Bool bIsVariant = !rVar.IsFixed();
SbxDataType eType = rVar.GetType();
switch( eType )
@@ -863,7 +976,7 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
case SbxCHAR:
case SbxBYTE:
if( bIsVariant )
- *pStrm << (USHORT)SbxBYTE; // VarType Id
+ *pStrm << (sal_uInt16)SbxBYTE; // VarType Id
*pStrm << rVar.GetByte();
break;
@@ -875,25 +988,25 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
case SbxINT:
case SbxUINT:
if( bIsVariant )
- *pStrm << (USHORT)SbxINTEGER; // VarType Id
+ *pStrm << (sal_uInt16)SbxINTEGER; // VarType Id
*pStrm << rVar.GetInteger();
break;
case SbxLONG:
case SbxULONG:
if( bIsVariant )
- *pStrm << (USHORT)SbxLONG; // VarType Id
+ *pStrm << (sal_uInt16)SbxLONG; // VarType Id
*pStrm << rVar.GetLong();
break;
case SbxSALINT64:
case SbxSALUINT64:
if( bIsVariant )
- *pStrm << (USHORT)SbxSALINT64; // VarType Id
+ *pStrm << (sal_uInt16)SbxSALINT64; // VarType Id
*pStrm << (sal_uInt64)rVar.GetInt64();
break;
case SbxSINGLE:
if( bIsVariant )
- *pStrm << (USHORT)eType; // VarType Id
+ *pStrm << (sal_uInt16)eType; // VarType Id
*pStrm << rVar.GetSingle();
break;
@@ -901,7 +1014,7 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
case SbxCURRENCY:
case SbxDATE:
if( bIsVariant )
- *pStrm << (USHORT)eType; // VarType Id
+ *pStrm << (sal_uInt16)eType; // VarType Id
*pStrm << rVar.GetDouble();
break;
@@ -912,7 +1025,7 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
if( !bBinary || bIsArray )
{
if( bIsVariant )
- *pStrm << (USHORT)SbxSTRING;
+ *pStrm << (sal_uInt16)SbxSTRING;
pStrm->WriteByteString( rStr, gsl_getSystemTextEncoding() );
//*pStrm << rStr;
}
@@ -929,31 +1042,31 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
default:
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return FALSE;
+ return sal_False;
}
if( nBlockLen )
pStrm->Seek( nFPos + nBlockLen );
- return pStrm->GetErrorCode() ? FALSE : TRUE;
+ return pStrm->GetErrorCode() ? sal_False : sal_True;
}
-BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
- BOOL bBinary, short nBlockLen, BOOL bIsArray )
+sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
+ sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray )
{
(void)bBinary;
(void)bIsArray;
double aDouble;
- ULONG nFPos = pStrm->Tell();
+ sal_uIntPtr nFPos = pStrm->Tell();
- BOOL bIsVariant = !rVar.IsFixed();
+ sal_Bool bIsVariant = !rVar.IsFixed();
SbxDataType eVarType = rVar.GetType();
SbxDataType eSrcType = eVarType;
if( bIsVariant )
{
- USHORT nTemp;
+ sal_uInt16 nTemp;
*pStrm >> nTemp;
eSrcType = (SbxDataType)nTemp;
}
@@ -964,7 +1077,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxCHAR:
case SbxBYTE:
{
- BYTE aByte;
+ sal_uInt8 aByte;
*pStrm >> aByte;
rVar.PutByte( aByte );
}
@@ -978,7 +1091,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxINT:
case SbxUINT:
{
- INT16 aInt;
+ sal_Int16 aInt;
*pStrm >> aInt;
rVar.PutInteger( aInt );
}
@@ -987,7 +1100,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxLONG:
case SbxULONG:
{
- INT32 aInt;
+ sal_Int32 aInt;
*pStrm >> aInt;
rVar.PutLong( aInt );
}
@@ -1034,23 +1147,23 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
default:
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return FALSE;
+ return sal_False;
}
if( nBlockLen )
pStrm->Seek( nFPos + nBlockLen );
- return pStrm->GetErrorCode() ? FALSE : TRUE;
+ return pStrm->GetErrorCode() ? sal_False : sal_True;
}
// nCurDim = 1...n
-BOOL lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm,
- BOOL bBinary, short nCurDim, short* pOtherDims, BOOL bWrite )
+sal_Bool lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm,
+ sal_Bool bBinary, short nCurDim, short* pOtherDims, sal_Bool bWrite )
{
DBG_ASSERT( nCurDim > 0,"Bad Dim");
short nLower, nUpper;
if( !rArr.GetDim( nCurDim, nLower, nUpper ) )
- return FALSE;
+ return sal_False;
for( short nCur = nLower; nCur <= nUpper; nCur++ )
{
pOtherDims[ nCurDim-1 ] = nCur;
@@ -1059,19 +1172,19 @@ BOOL lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm,
else
{
SbxVariable* pVar = rArr.Get( (const short*)pOtherDims );
- BOOL bRet;
+ sal_Bool bRet;
if( bWrite )
- bRet = lcl_WriteSbxVariable(*pVar, pStrm, bBinary, 0, TRUE );
+ bRet = lcl_WriteSbxVariable(*pVar, pStrm, bBinary, 0, sal_True );
else
- bRet = lcl_ReadSbxVariable(*pVar, pStrm, bBinary, 0, TRUE );
+ bRet = lcl_ReadSbxVariable(*pVar, pStrm, bBinary, 0, sal_True );
if( !bRet )
- return FALSE;
+ return sal_False;
}
}
- return TRUE;
+ return sal_True;
}
-void PutGet( SbxArray& rPar, BOOL bPut )
+void PutGet( SbxArray& rPar, sal_Bool bPut )
{
// Wir brauchen 3 Parameter
if ( rPar.Count() != 4 )
@@ -1079,9 +1192,9 @@ void PutGet( SbxArray& rPar, BOOL bPut )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nFileNo = rPar.Get(1)->GetInteger();
+ sal_Int16 nFileNo = rPar.Get(1)->GetInteger();
SbxVariable* pVar2 = rPar.Get(2);
- BOOL bHasRecordNo = (BOOL)(pVar2->GetType() != SbxEMPTY);
+ sal_Bool bHasRecordNo = (sal_Bool)(pVar2->GetType() != SbxEMPTY);
long nRecordNo = pVar2->GetLong();
if ( nFileNo < 1 || ( bHasRecordNo && nRecordNo < 1 ) )
{
@@ -1099,7 +1212,7 @@ void PutGet( SbxArray& rPar, BOOL bPut )
}
SvStream* pStrm = pSbStrm->GetStrm();
- BOOL bRandom = pSbStrm->IsRandom();
+ sal_Bool bRandom = pSbStrm->IsRandom();
short nBlockLen = bRandom ? pSbStrm->GetBlockLen() : 0;
if( bPut )
@@ -1111,7 +1224,7 @@ void PutGet( SbxArray& rPar, BOOL bPut )
// auf die Startposition seeken
if( bHasRecordNo )
{
- ULONG nFilePos = bRandom ? (ULONG)(nBlockLen*nRecordNo) : (ULONG)nRecordNo;
+ sal_uIntPtr nFilePos = bRandom ? (sal_uIntPtr)(nBlockLen*nRecordNo) : (sal_uIntPtr)nRecordNo;
pStrm->Seek( nFilePos );
}
@@ -1123,11 +1236,11 @@ void PutGet( SbxArray& rPar, BOOL bPut )
pArr = PTR_CAST(SbxDimArray,pParObj);
}
- BOOL bRet;
+ sal_Bool bRet;
if( pArr )
{
- ULONG nFPos = pStrm->Tell();
+ sal_uIntPtr nFPos = pStrm->Tell();
short nDims = pArr->GetDims();
short* pDims = new short[ nDims ];
bRet = lcl_WriteReadSbxArray(*pArr,pStrm,!bRandom,nDims,pDims,bPut);
@@ -1138,9 +1251,9 @@ void PutGet( SbxArray& rPar, BOOL bPut )
else
{
if( bPut )
- bRet = lcl_WriteSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, FALSE);
+ bRet = lcl_WriteSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, sal_False);
else
- bRet = lcl_ReadSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, FALSE);
+ bRet = lcl_ReadSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, sal_False);
}
if( !bRet || pStrm->GetErrorCode() )
StarBASIC::Error( SbERR_IO_ERROR );
@@ -1151,7 +1264,7 @@ RTLFUNC(Put)
(void)pBasic;
(void)bWrite;
- PutGet( rPar, TRUE );
+ PutGet( rPar, sal_True );
}
RTLFUNC(Get)
@@ -1159,7 +1272,7 @@ RTLFUNC(Get)
(void)pBasic;
(void)bWrite;
- PutGet( rPar, FALSE );
+ PutGet( rPar, sal_False );
}
RTLFUNC(Environ)
@@ -1174,46 +1287,21 @@ RTLFUNC(Environ)
}
String aResult;
// sollte ANSI sein, aber unter Win16 in DLL nicht moeglich
-#if defined(WIN)
- LPSTR lpszEnv = GetDOSEnvironment();
- String aCompareStr( rPar.Get(1)->GetString() );
- aCompareStr += '=';
- const char* pCompare = aCompareStr.GetStr();
- int nCompareLen = aCompareStr.Len();
- while ( *lpszEnv )
- {
- // Es werden alle EnvString in der Form ENV=VAL 0-terminiert
- // aneinander gehaengt.
-
- if ( strnicmp( pCompare, lpszEnv, nCompareLen ) == 0 )
- {
- aResult = (const char*)(lpszEnv+nCompareLen);
- rPar.Get(0)->PutString( aResult );
- return;
- }
- lpszEnv += lstrlen( lpszEnv ) + 1; // Next Enviroment-String
- }
-#else
ByteString aByteStr( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() );
const char* pEnvStr = getenv( aByteStr.GetBuffer() );
if ( pEnvStr )
aResult = String::CreateFromAscii( pEnvStr );
-#endif
rPar.Get(0)->PutString( aResult );
}
-static double GetDialogZoomFactor( BOOL bX, long nValue )
+static double GetDialogZoomFactor( sal_Bool bX, long nValue )
{
OutputDevice* pDevice = Application::GetDefaultDevice();
double nResult = 0;
if( pDevice )
{
Size aRefSize( nValue, nValue );
-#ifndef WIN
Fraction aFracX( 1, 26 );
-#else
- Fraction aFracX( 1, 23 );
-#endif
Fraction aFracY( 1, 24 );
MapMode aMap( MAP_APPFONT, Point(), aFracX, aFracY );
Size aScaledSize = pDevice->LogicToPixel( aRefSize, aMap );
@@ -1246,7 +1334,7 @@ RTLFUNC(GetDialogZoomFactorX)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- rPar.Get(0)->PutDouble( GetDialogZoomFactor( TRUE, rPar.Get(1)->GetLong() ));
+ rPar.Get(0)->PutDouble( GetDialogZoomFactor( sal_True, rPar.Get(1)->GetLong() ));
}
RTLFUNC(GetDialogZoomFactorY)
@@ -1259,7 +1347,7 @@ RTLFUNC(GetDialogZoomFactorY)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- rPar.Get(0)->PutDouble( GetDialogZoomFactor( FALSE, rPar.Get(1)->GetLong()));
+ rPar.Get(0)->PutDouble( GetDialogZoomFactor( sal_False, rPar.Get(1)->GetLong()));
}
@@ -1328,7 +1416,7 @@ RTLFUNC(TypeLen)
else
{
SbxDataType eType = rPar.Get(1)->GetType();
- INT16 nLen = 0;
+ sal_Int16 nLen = 0;
switch( eType )
{
case SbxEMPTY:
@@ -1383,7 +1471,7 @@ RTLFUNC(TypeLen)
case SbxLPWSTR:
case SbxCoreSTRING:
case SbxSTRING:
- nLen = (INT16)rPar.Get(1)->GetString().Len();
+ nLen = (sal_Int16)rPar.Get(1)->GetString().Len();
break;
default:
@@ -1482,7 +1570,7 @@ RTLFUNC(EqualUnoObjects)
// Instanciate "com.sun.star.awt.UnoControlDialog" on basis
// of a DialogLibrary entry: Convert from XML-ByteSequence
// and attach events. Implemented in classes\eventatt.cxx
-void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
RTLFUNC(CreateUnoDialog)
{
@@ -1555,13 +1643,19 @@ RTLFUNC(GetDefaultContext)
RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite );
}
+#ifdef DBG_TRACE_BASIC
+RTLFUNC(TraceCommand)
+{
+ RTL_Impl_TraceCommand( pBasic, rPar, bWrite );
+}
+#endif
RTLFUNC(Join)
{
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if ( nParCount != 3 && nParCount != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1602,7 +1696,7 @@ RTLFUNC(Split)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if ( nParCount < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1620,7 +1714,7 @@ RTLFUNC(Split)
else
aDelim = String::CreateFromAscii( " " );
- INT32 nCount = -1;
+ sal_Int32 nCount = -1;
if( nParCount == 4 )
nCount = rPar.Get(3)->GetLong();
@@ -1674,7 +1768,7 @@ RTLFUNC(Split)
// Array zurueckliefern
SbxVariableRef refVar = rPar.Get(0);
- USHORT nFlags = refVar->GetFlags();
+ sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
@@ -1687,7 +1781,7 @@ RTLFUNC(MonthName)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount != 2 && nParCount != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1703,14 +1797,14 @@ RTLFUNC(MonthName)
Sequence< CalendarItem > aMonthSeq = xCalendar->getMonths();
sal_Int32 nMonthCount = aMonthSeq.getLength();
- INT16 nVal = rPar.Get(1)->GetInteger();
+ sal_Int16 nVal = rPar.Get(1)->GetInteger();
if( nVal < 1 || nVal > nMonthCount )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- BOOL bAbbreviate = false;
+ sal_Bool bAbbreviate = false;
if( nParCount == 3 )
bAbbreviate = rPar.Get(2)->GetBool();
@@ -1727,7 +1821,7 @@ RTLFUNC(WeekdayName)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount < 2 || nParCount > 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1742,9 +1836,9 @@ RTLFUNC(WeekdayName)
}
Sequence< CalendarItem > aDaySeq = xCalendar->getDays();
- INT16 nDayCount = (INT16)aDaySeq.getLength();
- INT16 nDay = rPar.Get(1)->GetInteger();
- INT16 nFirstDay = 0;
+ sal_Int16 nDayCount = (sal_Int16)aDaySeq.getLength();
+ sal_Int16 nDay = rPar.Get(1)->GetInteger();
+ sal_Int16 nFirstDay = 0;
if( nParCount == 4 )
{
nFirstDay = rPar.Get(3)->GetInteger();
@@ -1755,7 +1849,7 @@ RTLFUNC(WeekdayName)
}
}
if( nFirstDay == 0 )
- nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 );
+ nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 );
nDay = 1 + (nDay + nDayCount + nFirstDay - 2) % nDayCount;
if( nDay < 1 || nDay > nDayCount )
@@ -1764,7 +1858,7 @@ RTLFUNC(WeekdayName)
return;
}
- BOOL bAbbreviate = false;
+ sal_Bool bAbbreviate = false;
if( nParCount >= 3 )
{
SbxVariable* pPar2 = rPar.Get(2);
@@ -1779,16 +1873,16 @@ RTLFUNC(WeekdayName)
rPar.Get(0)->PutString( String(aRetStr) );
}
-INT16 implGetWeekDay( double aDate, bool bFirstDayParam = false, INT16 nFirstDay = 0 )
+sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 )
{
Date aRefDate( 1,1,1900 );
long nDays = (long) aDate;
nDays -= 2; // normieren: 1.1.1900 => 0
aRefDate += nDays;
DayOfWeek aDay = aRefDate.GetDayOfWeek();
- INT16 nDay;
+ sal_Int16 nDay;
if ( aDay != SUNDAY )
- nDay = (INT16)aDay + 2;
+ nDay = (sal_Int16)aDay + 2;
else
nDay = 1; // 1==Sonntag
@@ -1808,7 +1902,7 @@ INT16 implGetWeekDay( double aDate, bool bFirstDayParam = false, INT16 nFirstDay
StarBASIC::Error( SbERR_INTERNAL_ERROR );
return 0;
}
- nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 );
+ nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 );
}
nDay = 1 + (nDay + 7 - nFirstDay) % 7;
}
@@ -1820,7 +1914,7 @@ RTLFUNC(Weekday)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if ( nParCount < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -1828,13 +1922,13 @@ RTLFUNC(Weekday)
double aDate = rPar.Get(1)->GetDate();
bool bFirstDay = false;
- INT16 nFirstDay = 0;
+ sal_Int16 nFirstDay = 0;
if ( nParCount > 2 )
{
nFirstDay = rPar.Get(2)->GetInteger();
bFirstDay = true;
}
- INT16 nDay = implGetWeekDay( aDate, bFirstDay, nFirstDay );
+ sal_Int16 nDay = implGetWeekDay( aDate, bFirstDay, nFirstDay );
rPar.Get(0)->PutInteger( nDay );
}
}
@@ -1888,7 +1982,7 @@ static IntervalInfo pIntervalTable[] =
IntervalInfo* getIntervalInfo( const String& rStringCode )
{
IntervalInfo* pInfo = NULL;
- INT16 i = 0;
+ sal_Int16 i = 0;
while( (pInfo = pIntervalTable + i)->mpStringCode != NULL )
{
if( rStringCode.EqualsIgnoreCaseAscii( pInfo->mpStringCode ) )
@@ -1899,30 +1993,30 @@ IntervalInfo* getIntervalInfo( const String& rStringCode )
}
// From methods.cxx
-BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet );
-INT16 implGetDateDay( double aDate );
-INT16 implGetDateMonth( double aDate );
-INT16 implGetDateYear( double aDate );
+sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet );
+sal_Int16 implGetDateDay( double aDate );
+sal_Int16 implGetDateMonth( double aDate );
+sal_Int16 implGetDateYear( double aDate );
-INT16 implGetHour( double dDate );
-INT16 implGetMinute( double dDate );
-INT16 implGetSecond( double dDate );
+sal_Int16 implGetHour( double dDate );
+sal_Int16 implGetMinute( double dDate );
+sal_Int16 implGetSecond( double dDate );
-inline void implGetDayMonthYear( INT16& rnYear, INT16& rnMonth, INT16& rnDay, double dDate )
+inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int16& rnDay, double dDate )
{
rnDay = implGetDateDay( dDate );
rnMonth = implGetDateMonth( dDate );
rnYear = implGetDateYear( dDate );
}
-inline INT16 limitToINT16( INT32 n32 )
+inline sal_Int16 limitToINT16( sal_Int32 n32 )
{
if( n32 > 32767 )
n32 = 32767;
else if( n32 < -32768 )
n32 = -32768;
- return (INT16)n32;
+ return (sal_Int16)n32;
}
RTLFUNC(DateAdd)
@@ -1930,7 +2024,7 @@ RTLFUNC(DateAdd)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount != 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1945,7 +2039,7 @@ RTLFUNC(DateAdd)
return;
}
- INT32 lNumber = rPar.Get(2)->GetLong();
+ sal_Int32 lNumber = rPar.Get(2)->GetLong();
double dDate = rPar.Get(3)->GetDate();
double dNewDate = 0;
if( pInfo->mbSimple )
@@ -1958,15 +2052,15 @@ RTLFUNC(DateAdd)
// Keep hours, minutes, seconds
double dHoursMinutesSeconds = dDate - floor( dDate );
- BOOL bOk = TRUE;
- INT16 nYear, nMonth, nDay;
- INT16 nTargetYear16 = 0, nTargetMonth = 0;
+ sal_Bool bOk = sal_True;
+ sal_Int16 nYear, nMonth, nDay;
+ sal_Int16 nTargetYear16 = 0, nTargetMonth = 0;
implGetDayMonthYear( nYear, nMonth, nDay, dDate );
switch( pInfo->meInterval )
{
case INTERVAL_YYYY:
{
- INT32 nTargetYear = lNumber + nYear;
+ sal_Int32 nTargetYear = lNumber + nYear;
nTargetYear16 = limitToINT16( nTargetYear );
nTargetMonth = nMonth;
bOk = implDateSerial( nTargetYear16, nTargetMonth, nDay, dNewDate );
@@ -1978,20 +2072,20 @@ RTLFUNC(DateAdd)
bool bNeg = (lNumber < 0);
if( bNeg )
lNumber = -lNumber;
- INT32 nYearsAdd;
- INT16 nMonthAdd;
+ sal_Int32 nYearsAdd;
+ sal_Int16 nMonthAdd;
if( pInfo->meInterval == INTERVAL_Q )
{
nYearsAdd = lNumber / 4;
- nMonthAdd = (INT16)( 3 * (lNumber % 4) );
+ nMonthAdd = (sal_Int16)( 3 * (lNumber % 4) );
}
else
{
nYearsAdd = lNumber / 12;
- nMonthAdd = (INT16)( lNumber % 12 );
+ nMonthAdd = (sal_Int16)( lNumber % 12 );
}
- INT32 nTargetYear;
+ sal_Int32 nTargetYear;
if( bNeg )
{
nTargetMonth = nMonth - nMonthAdd;
@@ -2000,7 +2094,7 @@ RTLFUNC(DateAdd)
nTargetMonth += 12;
nYearsAdd++;
}
- nTargetYear = (INT32)nYear - nYearsAdd;
+ nTargetYear = (sal_Int32)nYear - nYearsAdd;
}
else
{
@@ -2010,7 +2104,7 @@ RTLFUNC(DateAdd)
nTargetMonth -= 12;
nYearsAdd++;
}
- nTargetYear = (INT32)nYear + nYearsAdd;
+ nTargetYear = (sal_Int32)nYear + nYearsAdd;
}
nTargetYear16 = limitToINT16( nTargetYear );
bOk = implDateSerial( nTargetYear16, nTargetMonth, nDay, dNewDate );
@@ -2022,14 +2116,14 @@ RTLFUNC(DateAdd)
if( bOk )
{
// Overflow?
- INT16 nNewYear, nNewMonth, nNewDay;
+ sal_Int16 nNewYear, nNewMonth, nNewDay;
implGetDayMonthYear( nNewYear, nNewMonth, nNewDay, dNewDate );
if( nNewYear > 9999 || nNewYear < 100 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nCorrectionDay = nDay;
+ sal_Int16 nCorrectionDay = nDay;
while( nNewMonth > nTargetMonth )
{
nCorrectionDay--;
@@ -2055,7 +2149,7 @@ RTLFUNC(DateDiff)
// DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount < 4 || nParCount > 6 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -2078,30 +2172,30 @@ RTLFUNC(DateDiff)
{
case INTERVAL_YYYY:
{
- INT16 nYear1 = implGetDateYear( dDate1 );
- INT16 nYear2 = implGetDateYear( dDate2 );
+ sal_Int16 nYear1 = implGetDateYear( dDate1 );
+ sal_Int16 nYear2 = implGetDateYear( dDate2 );
dRet = nYear2 - nYear1;
break;
}
case INTERVAL_Q:
{
- INT16 nYear1 = implGetDateYear( dDate1 );
- INT16 nYear2 = implGetDateYear( dDate2 );
- INT16 nQ1 = 1 + (implGetDateMonth( dDate1 ) - 1) / 3;
- INT16 nQ2 = 1 + (implGetDateMonth( dDate2 ) - 1) / 3;
- INT16 nQGes1 = 4 * nYear1 + nQ1;
- INT16 nQGes2 = 4 * nYear2 + nQ2;
+ sal_Int16 nYear1 = implGetDateYear( dDate1 );
+ sal_Int16 nYear2 = implGetDateYear( dDate2 );
+ sal_Int16 nQ1 = 1 + (implGetDateMonth( dDate1 ) - 1) / 3;
+ sal_Int16 nQ2 = 1 + (implGetDateMonth( dDate2 ) - 1) / 3;
+ sal_Int16 nQGes1 = 4 * nYear1 + nQ1;
+ sal_Int16 nQGes2 = 4 * nYear2 + nQ2;
dRet = nQGes2 - nQGes1;
break;
}
case INTERVAL_M:
{
- INT16 nYear1 = implGetDateYear( dDate1 );
- INT16 nYear2 = implGetDateYear( dDate2 );
- INT16 nMonth1 = implGetDateMonth( dDate1 );
- INT16 nMonth2 = implGetDateMonth( dDate2 );
- INT16 nMonthGes1 = 12 * nYear1 + nMonth1;
- INT16 nMonthGes2 = 12 * nYear2 + nMonth2;
+ sal_Int16 nYear1 = implGetDateYear( dDate1 );
+ sal_Int16 nYear2 = implGetDateYear( dDate2 );
+ sal_Int16 nMonth1 = implGetDateMonth( dDate1 );
+ sal_Int16 nMonth2 = implGetDateMonth( dDate2 );
+ sal_Int16 nMonthGes1 = 12 * nYear1 + nMonth1;
+ sal_Int16 nMonthGes2 = 12 * nYear2 + nMonth2;
dRet = nMonthGes2 - nMonthGes1;
break;
}
@@ -2120,7 +2214,7 @@ RTLFUNC(DateDiff)
double dDays2 = floor( dDate2 );
if( pInfo->meInterval == INTERVAL_WW )
{
- INT16 nFirstDay = 1; // Default
+ sal_Int16 nFirstDay = 1; // Default
if( nParCount >= 5 )
{
nFirstDay = rPar.Get(4)->GetInteger();
@@ -2137,17 +2231,17 @@ RTLFUNC(DateDiff)
StarBASIC::Error( SbERR_INTERNAL_ERROR );
return;
}
- nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 );
+ nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 );
}
}
- INT16 nDay1 = implGetWeekDay( dDate1 );
- INT16 nDay1_Diff = nDay1 - nFirstDay;
+ sal_Int16 nDay1 = implGetWeekDay( dDate1 );
+ sal_Int16 nDay1_Diff = nDay1 - nFirstDay;
if( nDay1_Diff < 0 )
nDay1_Diff += 7;
dDays1 -= nDay1_Diff;
- INT16 nDay2 = implGetWeekDay( dDate2 );
- INT16 nDay2_Diff = nDay2 - nFirstDay;
+ sal_Int16 nDay2 = implGetWeekDay( dDate2 );
+ sal_Int16 nDay2_Diff = nDay2 - nFirstDay;
if( nDay2_Diff < 0 )
nDay2_Diff += 7;
dDays2 -= nDay2_Diff;
@@ -2182,7 +2276,7 @@ RTLFUNC(DateDiff)
}
double implGetDateOfFirstDayInFirstWeek
- ( INT16 nYear, INT16& nFirstDay, INT16& nFirstWeek, bool* pbError = NULL )
+ ( sal_Int16 nYear, sal_Int16& nFirstDay, sal_Int16& nFirstWeek, bool* pbError = NULL )
{
SbError nError = 0;
if( nFirstDay < 0 || nFirstDay > 7 )
@@ -2208,9 +2302,9 @@ double implGetDateOfFirstDayInFirstWeek
}
if( nFirstDay == 0 )
- nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 );
+ nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 );
- INT16 nFirstWeekMinDays = 0; // Not used for vbFirstJan1 = default
+ sal_Int16 nFirstWeekMinDays = 0; // Not used for vbFirstJan1 = default
if( nFirstWeek == 0 )
{
nFirstWeekMinDays = xCalendar->getMinimumNumberOfDaysForFirstWeek();
@@ -2233,14 +2327,14 @@ double implGetDateOfFirstDayInFirstWeek
implDateSerial( nYear, 1, 1, dBaseDate );
double dRetDate = dBaseDate;
- INT16 nWeekDay0101 = implGetWeekDay( dBaseDate );
- INT16 nDayDiff = nWeekDay0101 - nFirstDay;
+ sal_Int16 nWeekDay0101 = implGetWeekDay( dBaseDate );
+ sal_Int16 nDayDiff = nWeekDay0101 - nFirstDay;
if( nDayDiff < 0 )
nDayDiff += 7;
if( nFirstWeekMinDays )
{
- INT16 nThisWeeksDaysInYearCount = 7 - nDayDiff;
+ sal_Int16 nThisWeeksDaysInYearCount = 7 - nDayDiff;
if( nThisWeeksDaysInYearCount < nFirstWeekMinDays )
nDayDiff -= 7;
}
@@ -2255,7 +2349,7 @@ RTLFUNC(DatePart)
// DatePart(interval, date[,firstdayofweek[, firstweekofyear]])
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount < 3 || nParCount > 5 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -2272,7 +2366,7 @@ RTLFUNC(DatePart)
double dDate = rPar.Get(2)->GetDate();
- INT32 nRet = 0;
+ sal_Int32 nRet = 0;
switch( pInfo->meInterval )
{
case INTERVAL_YYYY:
@@ -2292,10 +2386,10 @@ RTLFUNC(DatePart)
}
case INTERVAL_Y:
{
- INT16 nYear = implGetDateYear( dDate );
+ sal_Int16 nYear = implGetDateYear( dDate );
double dBaseDate;
implDateSerial( nYear, 1, 1, dBaseDate );
- nRet = 1 + INT32( dDate - dBaseDate );
+ nRet = 1 + sal_Int32( dDate - dBaseDate );
break;
}
case INTERVAL_D:
@@ -2306,7 +2400,7 @@ RTLFUNC(DatePart)
case INTERVAL_W:
{
bool bFirstDay = false;
- INT16 nFirstDay = 1; // Default
+ sal_Int16 nFirstDay = 1; // Default
if( nParCount >= 4 )
{
nFirstDay = rPar.Get(3)->GetInteger();
@@ -2317,15 +2411,15 @@ RTLFUNC(DatePart)
}
case INTERVAL_WW:
{
- INT16 nFirstDay = 1; // Default
+ sal_Int16 nFirstDay = 1; // Default
if( nParCount >= 4 )
nFirstDay = rPar.Get(3)->GetInteger();
- INT16 nFirstWeek = 1; // Default
+ sal_Int16 nFirstWeek = 1; // Default
if( nParCount == 5 )
nFirstWeek = rPar.Get(4)->GetInteger();
- INT16 nYear = implGetDateYear( dDate );
+ sal_Int16 nYear = implGetDateYear( dDate );
bool bError = false;
double dYearFirstDay = implGetDateOfFirstDayInFirstWeek( nYear, nFirstDay, nFirstWeek, &bError );
if( !bError )
@@ -2345,7 +2439,7 @@ RTLFUNC(DatePart)
// Calculate week
double dDiff = dDate - dYearFirstDay;
- nRet = 1 + INT32( dDiff / 7 );
+ nRet = 1 + sal_Int32( dDiff / 7 );
}
break;
}
@@ -2376,7 +2470,7 @@ RTLFUNC(FormatDateTime)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount < 2 || nParCount > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -2384,7 +2478,7 @@ RTLFUNC(FormatDateTime)
}
double dDate = rPar.Get(1)->GetDate();
- INT16 nNamedFormat = 0;
+ sal_Int16 nNamedFormat = 0;
if( nParCount > 2 )
{
nNamedFormat = rPar.Get(2)->GetInteger();
@@ -2434,7 +2528,7 @@ RTLFUNC(FormatDateTime)
}
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
- ULONG nIndex = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG, eLangType );
+ sal_uIntPtr nIndex = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG, eLangType );
Color* pCol;
pFormatter->GetOutputString( dDate, nIndex, aRetStr, &pCol );
@@ -2479,7 +2573,7 @@ RTLFUNC(Round)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount != 2 && nParCount != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -2498,7 +2592,7 @@ RTLFUNC(Round)
dVal = -dVal;
}
- INT16 numdecimalplaces = 0;
+ sal_Int16 numdecimalplaces = 0;
if( nParCount == 3 )
{
numdecimalplaces = rPar.Get(2)->GetInteger();
@@ -2557,7 +2651,7 @@ RTLFUNC(SYD)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 )
{
@@ -2581,7 +2675,7 @@ RTLFUNC(SLN)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 )
{
@@ -2604,7 +2698,7 @@ RTLFUNC(Pmt)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2649,7 +2743,7 @@ RTLFUNC(PPmt)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 || nArgCount > 6 )
{
@@ -2696,7 +2790,7 @@ RTLFUNC(PV)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2741,7 +2835,7 @@ RTLFUNC(NPV)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 1 || nArgCount > 2 )
{
@@ -2769,7 +2863,7 @@ RTLFUNC(NPer)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2814,7 +2908,7 @@ RTLFUNC(MIRR)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 )
{
@@ -2845,7 +2939,7 @@ RTLFUNC(IRR)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 1 || nArgCount > 2 )
{
@@ -2882,7 +2976,7 @@ RTLFUNC(IPmt)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 || nArgCount > 6 )
{
@@ -2929,7 +3023,7 @@ RTLFUNC(FV)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2974,7 +3068,7 @@ RTLFUNC(DDB)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 || nArgCount > 5 )
{
@@ -3013,7 +3107,7 @@ RTLFUNC(Rate)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 6 )
{
@@ -3096,7 +3190,7 @@ RTLFUNC(CompatibilityMode)
(void)bWrite;
bool bEnabled = false;
- USHORT nCount = rPar.Count();
+ sal_uInt16 nCount = rPar.Count();
if ( nCount != 1 && nCount != 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -3123,8 +3217,8 @@ RTLFUNC(Input)
return;
}
- USHORT nByteCount = rPar.Get(1)->GetUShort();
- INT16 nFileNumber = rPar.Get(2)->GetInteger();
+ sal_uInt16 nByteCount = rPar.Get(1)->GetUShort();
+ sal_Int16 nFileNumber = rPar.Get(2)->GetInteger();
SbiIoSystem* pIosys = pINST->GetIoSystem();
SbiStream* pSbStrm = pIosys->GetStream( nFileNumber );
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 42b0dd0dddca..8f441827905f 100644..100755
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -35,8 +35,8 @@
#include "errobject.hxx"
-// Properties und Methoden legen beim Get (bWrite = FALSE) den Returnwert
-// im Element 0 des Argv ab; beim Put (bWrite = TRUE) wird der Wert aus
+// Properties und Methoden legen beim Get (bWrite = sal_False) den Returnwert
+// im Element 0 des Argv ab; beim Put (bWrite = sal_True) wird der Wert aus
// Element 0 gespeichert.
RTLFUNC(Erl)
@@ -60,9 +60,9 @@ RTLFUNC(Err)
{
if( bWrite )
{
- INT32 nVal = rPar.Get( 0 )->GetLong();
+ sal_Int32 nVal = rPar.Get( 0 )->GetLong();
if( nVal <= 65535L )
- StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) );
+ StarBASIC::Error( StarBASIC::GetSfxFromVBError( (sal_uInt16) nVal ) );
}
else
rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) );
@@ -74,7 +74,7 @@ RTLFUNC(False)
(void)pBasic;
(void)bWrite;
- rPar.Get(0)->PutBool( FALSE );
+ rPar.Get(0)->PutBool( sal_False );
}
RTLFUNC(Empty)
@@ -115,7 +115,7 @@ RTLFUNC(True)
(void)pBasic;
(void)bWrite;
- rPar.Get( 0 )->PutBool( TRUE );
+ rPar.Get( 0 )->PutBool( sal_True );
}
RTLFUNC(ATTR_NORMAL)
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index 9eb6f495f433..c129d997ca9d 100644..100755
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -27,11 +27,12 @@
************************************************************************/
#include <basic/sbstar.hxx>
+#include "sbtrace.hxx"
-#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
+#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
#define RTLNAME( name ) &SbRtl_##name
-typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, BOOL bWrite );
+typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, sal_Bool bWrite );
// Properties
@@ -285,6 +286,7 @@ extern RTLFUNC(AboutStarBasic);
extern RTLFUNC(LoadPicture);
extern RTLFUNC(SavePicture);
+extern RTLFUNC(CallByName);
extern RTLFUNC(CBool); // JSM
extern RTLFUNC(CByte); // JSM
extern RTLFUNC(CCur); // JSM
@@ -360,6 +362,10 @@ extern RTLFUNC(CDec);
extern RTLFUNC(Partition); // Fong
+#ifdef DBG_TRACE_BASIC
+extern RTLFUNC(TraceCommand);
+#endif
+
extern double Now_Impl();
extern void Wait_Impl( bool bDurationBased, SbxArray& rPar );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index d0babeee3d96..8609c2a2c97d 100644..100755
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -46,6 +46,8 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
+#include "comenumwrapper.hxx"
+
SbxVariable* getDefaultProp( SbxVariable* pRef );
using namespace ::com::sun::star;
@@ -60,13 +62,13 @@ bool SbiRuntime::isVBAEnabled()
}
// #91147 Global reschedule flag
-static BOOL bStaticGlobalEnableReschedule = TRUE;
+static sal_Bool bStaticGlobalEnableReschedule = sal_True;
-void StarBASIC::StaticEnableReschedule( BOOL bReschedule )
+void StarBASIC::StaticEnableReschedule( sal_Bool bReschedule )
{
bStaticGlobalEnableReschedule = bReschedule;
}
-void StarBASIC::SetVBAEnabled( BOOL bEnabled )
+void StarBASIC::SetVBAEnabled( sal_Bool bEnabled )
{
if ( bDocBasic )
{
@@ -74,15 +76,15 @@ void StarBASIC::SetVBAEnabled( BOOL bEnabled )
}
}
-BOOL StarBASIC::isVBAEnabled()
+sal_Bool StarBASIC::isVBAEnabled()
{
if ( bDocBasic )
{
if( SbiRuntime::isVBAEnabled() )
- return TRUE;
+ return sal_True;
return bVBAEnabled;
}
- return FALSE;
+ return sal_False;
}
@@ -254,12 +256,12 @@ SbiRTLData::~SbiRTLData()
// (siehe auch step2.cxx, SbiRuntime::StepSTMNT() )
// Hilfsfunktion, um den BreakCallLevel gemaess der der Debug-Flags zu ermitteln
-void SbiInstance::CalcBreakCallLevel( USHORT nFlags )
+void SbiInstance::CalcBreakCallLevel( sal_uInt16 nFlags )
{
// Break-Flag wegfiltern
- nFlags &= ~((USHORT)SbDEBUG_BREAK);
+ nFlags &= ~((sal_uInt16)SbDEBUG_BREAK);
- USHORT nRet;
+ sal_uInt16 nRet;
switch( nFlags )
{
case SbDEBUG_STEPINTO:
@@ -292,8 +294,8 @@ SbiInstance::SbiInstance( StarBASIC* p )
nBreakCallLvl = 0;
nErr =
nErl = 0;
- bReschedule = TRUE;
- bCompatibility = FALSE;
+ bReschedule = sal_True;
+ bCompatibility = sal_False;
}
SbiInstance::~SbiInstance()
@@ -451,7 +453,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg )
{
if( !bWatchMode )
{
- SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) );
+ SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
if ( !n )
n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
@@ -465,7 +467,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg )
void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const String& rMsg )
{
- SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) );
+ SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
if( !n )
n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
@@ -516,7 +518,7 @@ SbModule* SbiInstance::GetActiveModule()
return NULL;
}
-SbMethod* SbiInstance::GetCaller( USHORT nLevel )
+SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel )
{
SbiRuntime* p = pRun;
while( nLevel-- && p )
@@ -544,7 +546,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
// Achtung: pMeth kann auch NULL sein (beim Aufruf des Init-Codes)
-SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
+SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart )
: rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
{
@@ -559,11 +561,11 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
pRestart = NULL;
pNext = NULL;
pCode =
- pStmnt = (const BYTE* ) pImg->GetCode() + nStart;
+ pStmnt = (const sal_uInt8* ) pImg->GetCode() + nStart;
bRun =
- bError = TRUE;
- bInError = FALSE;
- bBlocked = FALSE;
+ bError = sal_True;
+ bInError = sal_False;
+ bBlocked = sal_False;
nLine = 0;
nCol1 = 0;
nCol2 = 0;
@@ -623,10 +625,10 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
refParams->Put( pMeth, 0 );
SbxInfo* pInfo = pMeth ? pMeth->GetInfo() : NULL;
- USHORT nParamCount = pParams ? pParams->Count() : 1;
+ sal_uInt16 nParamCount = pParams ? pParams->Count() : 1;
if( nParamCount > 1 )
{
- for( USHORT i = 1 ; i < nParamCount ; i++ )
+ for( sal_uInt16 i = 1 ; i < nParamCount ; i++ )
{
const SbxParamInfo* p = pInfo ? pInfo->GetParam( i ) : NULL;
@@ -634,9 +636,9 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
if( p && (p->nUserData & PARAM_INFO_PARAMARRAY) != 0 )
{
SbxDimArray* pArray = new SbxDimArray( SbxVARIANT );
- USHORT nParamArrayParamCount = nParamCount - i;
+ sal_uInt16 nParamArrayParamCount = nParamCount - i;
pArray->unoAddDim( 0, nParamArrayParamCount - 1 );
- for( USHORT j = i ; j < nParamCount ; j++ )
+ for( sal_uInt16 j = i ; j < nParamCount ; j++ )
{
SbxVariable* v = pParams->Get( j );
short nDimIndex = j - i;
@@ -654,16 +656,16 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
SbxVariable* v = pParams->Get( i );
// Methoden sind immer byval!
- BOOL bByVal = v->IsA( TYPE(SbxMethod) );
+ sal_Bool bByVal = v->IsA( TYPE(SbxMethod) );
SbxDataType t = v->GetType();
if( p )
{
- bByVal |= BOOL( ( p->eType & SbxBYREF ) == 0 );
+ bByVal |= sal_Bool( ( p->eType & SbxBYREF ) == 0 );
t = (SbxDataType) ( p->eType & 0x0FFF );
if( !bByVal && t != SbxVARIANT &&
(!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) )
- bByVal = TRUE;
+ bByVal = sal_True;
}
if( bByVal )
{
@@ -709,7 +711,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
// Einen P-Code ausfuehren
-BOOL SbiRuntime::Step()
+sal_Bool SbiRuntime::Step()
{
if( bRun )
{
@@ -732,7 +734,7 @@ BOOL SbiRuntime::Step()
}
SbiOpcode eOp = (SbiOpcode ) ( *pCode++ );
- UINT32 nOp1, nOp2;
+ sal_uInt32 nOp1, nOp2;
if( eOp <= SbOP0_END )
{
(this->*( aStep0[ eOp ] ) )();
@@ -782,7 +784,7 @@ BOOL SbiRuntime::Step()
// Im Error Handler? Dann Std-Error
if ( !bInError )
{
- bInError = TRUE;
+ bInError = sal_True;
if( !bError ) // On Error Resume Next
StepRESUME( 1 );
@@ -807,7 +809,7 @@ BOOL SbiRuntime::Step()
while( NULL != (pRt = pRt->pNext) )
{
// Gibt es einen Error-Handler?
- if( pRt->bError == FALSE || pRt->pError != NULL )
+ if( pRt->bError == sal_False || pRt->pError != NULL )
{
pRtErrHdl = pRt;
break;
@@ -830,7 +832,7 @@ BOOL SbiRuntime::Step()
// Fehler setzen
pRt->nError = err;
if( pRt != pRtErrHdl )
- pRt->bRun = FALSE;
+ pRt->bRun = sal_False;
// In Error-Stack eintragen
SbErrorStackEntry *pEntry = new SbErrorStackEntry
@@ -882,11 +884,12 @@ void SbiRuntime::Error( SbError _errCode, const String& _details )
{
if ( _errCode )
{
- OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
+ // Not correct for class module usage, remove for now
+ //OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
if ( pInst->pRun == this )
{
pInst->Error( _errCode, _details );
- OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
+ //OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
}
else
{
@@ -918,7 +921,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
{
// TEST, has to be vb here always
#ifdef DBG_UTIL
- SbError nTmp = StarBASIC::GetSfxFromVBError( (USHORT)nError );
+ SbError nTmp = StarBASIC::GetSfxFromVBError( (sal_uInt16)nError );
DBG_ASSERT( nTmp, "No VB error!" );
#endif
@@ -928,7 +931,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
}
// no num? most likely then it *is* really a vba err
- USHORT nVBErrorCode = StarBASIC::GetVBErrorCode( nError );
+ sal_uInt16 nVBErrorCode = StarBASIC::GetVBErrorCode( nError );
sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? nError : nVBErrorCode;
return nVBAErrorNumber;
}
@@ -989,7 +992,7 @@ SbxVariableRef SbiRuntime::PopVar()
return xVar;
}
-BOOL SbiRuntime::ClearExprStack()
+sal_Bool SbiRuntime::ClearExprStack()
{
// Achtung: Clear() reicht nicht, da Methods geloescht werden muessen
while ( nExprLvl )
@@ -997,7 +1000,7 @@ BOOL SbiRuntime::ClearExprStack()
PopVar();
}
refExprStk->Clear();
- return FALSE;
+ return sal_False;
}
// Variable auf dem Expression-Stack holen, ohne sie zu entfernen
@@ -1013,7 +1016,7 @@ SbxVariable* SbiRuntime::GetTOS( short n )
return new SbxVariable;
}
#endif
- return refExprStk->Get( (USHORT) n );
+ return refExprStk->Get( (sal_uInt16) n );
}
// Sicherstellen, dass TOS eine temporaere Variable ist
@@ -1048,7 +1051,7 @@ void SbiRuntime::TOSMakeTemp()
}
// Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
-void SbiRuntime::PushGosub( const BYTE* pc )
+void SbiRuntime::PushGosub( const sal_uInt8* pc )
{
if( ++nGosubLvl > MAXRECURSION )
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
@@ -1185,6 +1188,23 @@ void SbiRuntime::PushForEach()
p->xEnumeration = xEnumerationAccess->createEnumeration();
p->eForType = FOR_EACH_XENUMERATION;
}
+ else if ( isVBAEnabled() && pUnoObj->isNativeCOMObject() )
+ {
+ uno::Reference< script::XInvocation > xInvocation;
+ if ( ( aAny >>= xInvocation ) && xInvocation.is() )
+ {
+ try
+ {
+ p->xEnumeration = new ComEnumerationWrapper( xInvocation );
+ p->eForType = FOR_EACH_XENUMERATION;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ if ( !p->xEnumeration.is() )
+ bError_ = true;
+ }
else
{
bError_ = true;
@@ -1238,7 +1258,7 @@ void SbiRuntime::DllCall
const String& aDLLName, // Name der DLL
SbxArray* pArgs, // Parameter (ab Index 1, kann NULL sein)
SbxDataType eResType, // Returnwert
- BOOL bCDecl ) // TRUE: nach C-Konventionen
+ sal_Bool bCDecl ) // sal_True: nach C-Konventionen
{
// No DllCall for "virtual" portal users
if( needSecurityRestrictions() )
@@ -1265,13 +1285,13 @@ void SbiRuntime::DllCall
Error( nErr );
PushVar( pRes );
}
-USHORT
-SbiRuntime::GetImageFlag( USHORT n ) const
+
+sal_uInt16 SbiRuntime::GetImageFlag( sal_uInt16 n ) const
{
return pImg->GetFlag( n );
}
-USHORT
-SbiRuntime::GetBase()
+
+sal_uInt16 SbiRuntime::GetBase()
{
return pImg->GetBase();
}
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index f2f51c4406c7..40a1fa911437 100644..100755
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -68,7 +68,7 @@ struct Methods {
SbxDataType eType; // Datentyp
short nArgs; // Argumente und Flags
RtlCall pFunc; // Function Pointer
- USHORT nHash; // Hashcode
+ sal_uInt16 nHash; // Hashcode
};
struct StringHashCode
@@ -135,6 +135,10 @@ static Methods aMethods[] = {
{ "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
+{ "CallByName", SbxVARIANT, 3 | _FUNCTION, RTLNAME(CallByName),0 },
+ { "Object", SbxOBJECT, 0,NULL,0 },
+ { "ProcedureName",SbxSTRING, 0,NULL,0 },
+ { "CallType", SbxINTEGER, 0,NULL,0 },
{ "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool),0 },
{ "expression", SbxVARIANT, 0,NULL,0 },
{ "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 },
@@ -645,6 +649,10 @@ static Methods aMethods[] = {
{ "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 },
{ "String", SbxSTRING, 0,NULL,0 },
{ "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE),0 },
+#ifdef DBG_TRACE_BASIC
+{ "TraceCommand", SbxNULL, 1 | _FUNCTION, RTLNAME(TraceCommand),0 },
+ { "Command", SbxSTRING, 0,NULL,0 },
+#endif
{ "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim),0 },
{ "String", SbxSTRING, 0,NULL,0 },
{ "True", SbxBOOL, _CPROP, RTLNAME(True),0 },
@@ -780,11 +788,11 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
if( !pVar )
{
// sonst suchen
- USHORT nHash_ = SbxVariable::MakeHashCode( rName );
+ sal_uInt16 nHash_ = SbxVariable::MakeHashCode( rName );
Methods* p = aMethods;
- BOOL bFound = FALSE;
+ sal_Bool bFound = sal_False;
short nIndex = 0;
- USHORT nSrchMask = _TYPEMASK;
+ sal_uInt16 nSrchMask = _TYPEMASK;
switch( t )
{
case SbxCLASS_METHOD: nSrchMask = _METHOD; break;
@@ -799,14 +807,14 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
&& ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
{
SbiInstance* pInst = pINST;
- bFound = TRUE;
+ bFound = sal_True;
if( p->nArgs & _COMPTMASK )
{
if( !pInst || !pInst->IsCompatibility() )
- bFound = FALSE;
+ bFound = sal_False;
}
if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
- bFound = FALSE;
+ bFound = sal_False;
break;
}
nIndex += ( p->nArgs & _ARGSMASK ) + 1;
@@ -834,8 +842,8 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
return pVar;
}
-// SetModified muß bei der RTL abgklemmt werden
-void SbiStdObject::SetModified( BOOL )
+// SetModified mu� bei der RTL abgklemmt werden
+void SbiStdObject::SetModified( sal_Bool )
{
}
@@ -850,17 +858,17 @@ void SbiStdObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
SbxVariable* pVar = pHint->GetVar();
SbxArray* pPar_ = pVar->GetParameters();
- ULONG t = pHint->GetId();
- USHORT nCallId = (USHORT) pVar->GetUserData();
+ sal_uIntPtr t = pHint->GetId();
+ sal_uInt16 nCallId = (sal_uInt16) pVar->GetUserData();
if( nCallId )
{
if( t == SBX_HINT_INFOWANTED )
pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) );
else
{
- BOOL bWrite = FALSE;
+ sal_Bool bWrite = sal_False;
if( t == SBX_HINT_DATACHANGED )
- bWrite = TRUE;
+ bWrite = sal_True;
if( t == SBX_HINT_DATAWANTED || bWrite )
{
RtlCall p = (RtlCall) aMethods[ nCallId-1 ].pFunc;
@@ -895,7 +903,7 @@ SbxInfo* SbiStdObject::GetInfo( short nIdx )
{
p++;
String aName_ = String::CreateFromAscii( p->pName );
- USHORT nFlags_ = ( p->nArgs >> 8 ) & 0x03;
+ sal_uInt16 nFlags_ = ( p->nArgs >> 8 ) & 0x03;
if( p->nArgs & _OPT )
nFlags_ |= SBX_OPTIONAL;
pInfo_->AddParam( aName_, p->eType, nFlags_ );
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index 28bda15bcacc..10b4269227c9 100644..100755
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -72,7 +72,7 @@ SbxObject* SbStdFactory::CreateObject( const String& rClassName )
-void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
{
@@ -81,7 +81,7 @@ void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite )
}
GraphicType eType = aGraphic.GetType();
- INT16 nType = 0;
+ sal_Int16 nType = 0;
if( eType == GRAPHIC_BITMAP )
nType = 1;
@@ -93,7 +93,7 @@ void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite )
}
-void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
{
@@ -105,10 +105,10 @@ void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, BOOL bWrite )
aSize = GetpApp()->GetAppWindow()->LogicToPixel( aSize, aGraphic.GetPrefMapMode() );
aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
- pVar->PutInteger( (INT16)aSize.Width() );
+ pVar->PutInteger( (sal_Int16)aSize.Width() );
}
-void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
{
@@ -120,7 +120,7 @@ void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, BOOL bWrite )
aSize = GetpApp()->GetAppWindow()->LogicToPixel( aSize, aGraphic.GetPrefMapMode() );
aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
- pVar->PutInteger( (INT16)aSize.Height() );
+ pVar->PutInteger( (sal_Int16)aSize.Height() );
}
@@ -170,8 +170,8 @@ void SbStdPicture::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxVariable* pVar = pHint->GetVar();
SbxArray* pPar_ = pVar->GetParameters();
- USHORT nWhich = (USHORT)pVar->GetUserData();
- BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
+ sal_uInt16 nWhich = (sal_uInt16)pVar->GetUserData();
+ sal_Bool bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
// Propteries
switch( nWhich )
@@ -187,7 +187,7 @@ void SbStdPicture::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
//-----------------------------------------------------------------------------
-void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
SetBold( pVar->GetBool() );
@@ -195,7 +195,7 @@ void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, BOOL bWrite )
pVar->PutBool( IsBold() );
}
-void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
SetItalic( pVar->GetBool() );
@@ -203,7 +203,7 @@ void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, BOOL bWrite )
pVar->PutBool( IsItalic() );
}
-void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
SetStrikeThrough( pVar->GetBool() );
@@ -211,7 +211,7 @@ void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, BOOL bWrite )
pVar->PutBool( IsStrikeThrough() );
}
-void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
SetUnderline( pVar->GetBool() );
@@ -219,15 +219,15 @@ void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, BOOL bWrite )
pVar->PutBool( IsUnderline() );
}
-void SbStdFont::PropSize( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdFont::PropSize( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
- SetSize( (USHORT)pVar->GetInteger() );
+ SetSize( (sal_uInt16)pVar->GetInteger() );
else
- pVar->PutInteger( (INT16)GetSize() );
+ pVar->PutInteger( (sal_Int16)GetSize() );
}
-void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, BOOL bWrite )
+void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
SetFontName( pVar->GetString() );
@@ -292,8 +292,8 @@ void SbStdFont::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxVariable* pVar = pHint->GetVar();
SbxArray* pPar_ = pVar->GetParameters();
- USHORT nWhich = (USHORT)pVar->GetUserData();
- BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
+ sal_uInt16 nWhich = (sal_uInt16)pVar->GetUserData();
+ sal_Bool bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
// Propteries
switch( nWhich )
@@ -349,7 +349,7 @@ sal_Bool TransferableHelperImpl::GetData( const ::com::sun::star::datatransfer::
}
*/
-void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, sal_Bool )
{
if( pPar_ && (pPar_->Count() > 1) )
{
@@ -360,7 +360,7 @@ void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, BOOL )
//Clipboard::Clear();
}
-void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
(void)pVar;
@@ -370,7 +370,7 @@ void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
return;
}
- USHORT nFormat = pPar_->Get(1)->GetInteger();
+ sal_uInt16 nFormat = pPar_->Get(1)->GetInteger();
if( !nFormat || nFormat > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -393,7 +393,7 @@ void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
*/
}
-void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
if( !pPar_ || (pPar_->Count() != 2) )
{
@@ -401,18 +401,18 @@ void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, BOOL )
return;
}
- USHORT nFormat = pPar_->Get(1)->GetInteger();
+ sal_uInt16 nFormat = pPar_->Get(1)->GetInteger();
if( !nFormat || nFormat > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- pVar->PutBool( FALSE );
+ pVar->PutBool( sal_False );
//pVar->PutBool( Clipboard::HasFormat( nFormat ) );
}
-void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
if( pPar_ && (pPar_->Count() > 1) )
{
@@ -424,7 +424,7 @@ void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
//pVar->PutString( Clipboard::PasteString() );
}
-void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
(void)pVar;
@@ -434,7 +434,7 @@ void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
return;
}
- USHORT nFormat = pPar_->Get(2)->GetInteger();
+ sal_uInt16 nFormat = pPar_->Get(2)->GetInteger();
if( !nFormat || nFormat > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -458,7 +458,7 @@ void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
*/
}
-void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
(void)pVar;
@@ -531,8 +531,8 @@ void SbStdClipboard::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxVariable* pVar = pHint->GetVar();
SbxArray* pPar_ = pVar->GetParameters();
- USHORT nWhich = (USHORT)pVar->GetUserData();
- BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
+ sal_uInt16 nWhich = (sal_uInt16)pVar->GetUserData();
+ sal_Bool bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
// Methods
switch( nWhich )
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 156df6aa7e38..520df18ecdd5 100644..100755
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -48,6 +48,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
#include <algorithm>
+#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
@@ -121,7 +122,6 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
}
}
-#ifndef WIN
static SbxVariable* pTRUE = NULL;
static SbxVariable* pFALSE = NULL;
static SbxVariable* pNULL = NULL;
@@ -143,7 +143,7 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
if( !pTRUE )
{
pTRUE = new SbxVariable;
- pTRUE->PutBool( TRUE );
+ pTRUE->PutBool( sal_True );
pTRUE->AddRef();
}
PushVar( pTRUE );
@@ -153,22 +153,11 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
if( !pFALSE )
{
pFALSE = new SbxVariable;
- pFALSE->PutBool( FALSE );
+ pFALSE->PutBool( sal_False );
pFALSE->AddRef();
}
PushVar( pFALSE );
}
-#else
- SbxVariable* pRes = new SbxVariable;
- if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
- pRes->PutNull();
- else
- {
- BOOL bRes = p2->Compare( eOp, *p1 );
- pRes->PutBool( bRes );
- }
- PushVar( pRes );
-#endif
}
void SbiRuntime::StepEXP() { StepArith( SbxEXP ); }
@@ -327,7 +316,7 @@ void SbiRuntime::StepIS()
eType2 = refVar2->GetType();
}
- BOOL bRes = BOOL( eType1 == SbxOBJECT && eType2 == SbxOBJECT );
+ sal_Bool bRes = sal_Bool( eType1 == SbxOBJECT && eType2 == SbxOBJECT );
if ( bVBAEnabled && !bRes )
Error( SbERR_INVALID_USAGE_OBJECT );
bRes = ( bRes && refVar1->GetObject() == refVar2->GetObject() );
@@ -386,11 +375,11 @@ void SbiRuntime::StepPUT()
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
// Store auf die eigene Methode (innerhalb einer Function)?
- BOOL bFlagsChanged = FALSE;
- USHORT n = 0;
+ sal_Bool bFlagsChanged = sal_False;
+ sal_uInt16 n = 0;
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
{
- bFlagsChanged = TRUE;
+ bFlagsChanged = sal_True;
n = refVar->GetFlags();
refVar->SetFlag( SBX_WRITE );
}
@@ -426,9 +415,54 @@ void SbiRuntime::StepPUT()
}
+// VBA Dim As New behavior handling, save init object information
+struct DimAsNewRecoverItem
+{
+ String m_aObjClass;
+ String m_aObjName;
+ SbxObject* m_pObjParent;
+ SbModule* m_pClassModule;
+
+ DimAsNewRecoverItem( void )
+ : m_pObjParent( NULL )
+ , m_pClassModule( NULL )
+ {}
+
+ DimAsNewRecoverItem( const String& rObjClass, const String& rObjName,
+ SbxObject* pObjParent, SbModule* pClassModule )
+ : m_aObjClass( rObjClass )
+ , m_aObjName( rObjName )
+ , m_pObjParent( pObjParent )
+ , m_pClassModule( pClassModule )
+ {}
+
+};
+
+
+struct SbxVariablePtrHash
+{
+ size_t operator()( SbxVariable* pVar ) const
+ { return (size_t)pVar; }
+};
+
+typedef boost::unordered_map< SbxVariable*, DimAsNewRecoverItem,
+ SbxVariablePtrHash > DimAsNewRecoverHash;
+
+static DimAsNewRecoverHash GaDimAsNewRecoverHash;
+
+void removeDimAsNewRecoverItem( SbxVariable* pVar )
+{
+ DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar );
+ if( it != GaDimAsNewRecoverHash.end() )
+ GaDimAsNewRecoverHash.erase( it );
+}
+
+
// Speichern Objektvariable
// Nicht-Objekt-Variable fuehren zu Fehlern
+static const char pCollectionStr[] = "Collection";
+
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{
// #67733 Typen mit Array-Flag sind auch ok
@@ -478,11 +512,11 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
else
{
// Store auf die eigene Methode (innerhalb einer Function)?
- BOOL bFlagsChanged = FALSE;
- USHORT n = 0;
+ sal_Bool bFlagsChanged = sal_False;
+ sal_uInt16 n = 0;
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
{
- bFlagsChanged = TRUE;
+ bFlagsChanged = sal_True;
n = refVar->GetFlags();
refVar->SetFlag( SBX_WRITE );
}
@@ -531,8 +565,14 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
}
+ // Handle Dim As New
+ sal_Bool bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW );
+ SbxBaseRef xPrevVarObj;
+ if( bDimAsNew )
+ xPrevVarObj = refVar->GetObject();
+
// Handle withevents
- BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
+ sal_Bool bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents )
{
Reference< XInterface > xComListener;
@@ -549,7 +589,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
refVal->SetDeclareClassName( aDeclareClassName );
- refVal->SetComListener( xComListener ); // Hold reference
+ refVal->SetComListener( xComListener, &rBasic ); // Hold reference
}
*refVar = *refVal;
@@ -559,6 +599,68 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
*refVar = *refVal;
}
+ if ( bDimAsNew )
+ {
+ if( !refVar->ISA(SbxObject) )
+ {
+ SbxBase* pValObjBase = refVal->GetObject();
+ if( pValObjBase == NULL )
+ {
+ if( xPrevVarObj.Is() )
+ {
+ // Object is overwritten with NULL, instantiate init object
+ DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar );
+ if( it != GaDimAsNewRecoverHash.end() )
+ {
+ const DimAsNewRecoverItem& rItem = it->second;
+ if( rItem.m_pClassModule != NULL )
+ {
+ SbClassModuleObject* pNewObj = new SbClassModuleObject( rItem.m_pClassModule );
+ pNewObj->SetName( rItem.m_aObjName );
+ pNewObj->SetParent( rItem.m_pObjParent );
+ refVar->PutObject( pNewObj );
+ }
+ else if( rItem.m_aObjClass.EqualsIgnoreCaseAscii( pCollectionStr ) )
+ {
+ BasicCollection* pNewCollection = new BasicCollection( String( RTL_CONSTASCII_USTRINGPARAM(pCollectionStr) ) );
+ pNewCollection->SetName( rItem.m_aObjName );
+ pNewCollection->SetParent( rItem.m_pObjParent );
+ refVar->PutObject( pNewCollection );
+ }
+ }
+ }
+ }
+ else
+ {
+ // Does old value exist?
+ bool bFirstInit = !xPrevVarObj.Is();
+ if( bFirstInit )
+ {
+ // Store information to instantiate object later
+ SbxObject* pValObj = PTR_CAST(SbxObject,pValObjBase);
+ if( pValObj != NULL )
+ {
+ String aObjClass = pValObj->GetClassName();
+
+ SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase);
+ if( pClassModuleObj != NULL )
+ {
+ SbModule* pClassModule = pClassModuleObj->getClassModule();
+ GaDimAsNewRecoverHash[refVar] =
+ DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
+ }
+ else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
+ {
+ GaDimAsNewRecoverHash[refVar] =
+ DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL );
+ }
+ }
+ }
+ }
+ }
+ }
+
+
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
// in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY
@@ -599,14 +701,14 @@ void SbiRuntime::StepLSET()
else
{
// Store auf die eigene Methode (innerhalb einer Function)?
- USHORT n = refVar->GetFlags();
+ sal_uInt16 n = refVar->GetFlags();
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
refVar->SetFlag( SBX_WRITE );
String aRefVarString = refVar->GetString();
String aRefValString = refVal->GetString();
- USHORT nVarStrLen = aRefVarString.Len();
- USHORT nValStrLen = aRefValString.Len();
+ sal_uInt16 nVarStrLen = aRefVarString.Len();
+ sal_uInt16 nValStrLen = aRefValString.Len();
String aNewStr;
if( nVarStrLen > nValStrLen )
{
@@ -635,14 +737,14 @@ void SbiRuntime::StepRSET()
else
{
// Store auf die eigene Methode (innerhalb einer Function)?
- USHORT n = refVar->GetFlags();
+ sal_uInt16 n = refVar->GetFlags();
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
refVar->SetFlag( SBX_WRITE );
String aRefVarString = refVar->GetString();
String aRefValString = refVal->GetString();
- USHORT nPos = 0;
- USHORT nVarStrLen = aRefVarString.Len();
+ sal_uInt16 nPos = 0;
+ sal_uInt16 nVarStrLen = aRefVarString.Len();
if( nVarStrLen > aRefValString.Len() )
{
aRefVarString.Fill(nVarStrLen,' ');
@@ -703,10 +805,10 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
// AB 2.4.1996, auch Arrays ohne Dimensionsangaben zulassen (VB-komp.)
if( pDims )
{
- for( USHORT i = 1; i < pDims->Count(); )
+ for( sal_uInt16 i = 1; i < pDims->Count(); )
{
- INT32 lb = pDims->Get( i++ )->GetLong();
- INT32 ub = pDims->Get( i++ )->GetLong();
+ sal_Int32 lb = pDims->Get( i++ )->GetLong();
+ sal_Int32 ub = pDims->Get( i++ )->GetLong();
if( ub < lb )
Error( SbERR_OUT_OF_RANGE ), ub = lb;
pArray->AddDim32( lb, ub );
@@ -720,7 +822,7 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
// Uno-Sequences der Laenge 0 eine Dimension anlegen
pArray->unoAddDim( 0, -1 );
}
- USHORT nSavFlags = refVar->GetFlags();
+ sal_uInt16 nSavFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
refVar->PutObject( pArray );
refVar->SetFlags( nSavFlags );
@@ -782,7 +884,7 @@ void SbiRuntime::StepREDIMP()
short nDimsNew = pNewArray->GetDims();
short nDimsOld = pOldArray->GetDims();
short nDims = nDimsNew;
- BOOL bRangeError = FALSE;
+ sal_Bool bRangeError = sal_False;
// Store dims to use them for copying later
sal_Int32* pLowerBounds = new sal_Int32[nDims];
@@ -791,7 +893,7 @@ void SbiRuntime::StepREDIMP()
if( nDimsOld != nDimsNew )
{
- bRangeError = TRUE;
+ bRangeError = sal_True;
}
else
{
@@ -808,7 +910,7 @@ void SbiRuntime::StepREDIMP()
// All bounds but the last have to be the same
if( i < nDims && ( lBoundNew != lBoundOld || uBoundNew != uBoundOld ) )
{
- bRangeError = TRUE;
+ bRangeError = sal_True;
break;
}
else
@@ -877,7 +979,7 @@ void SbiRuntime::StepREDIMP_ERASE()
void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType )
{
- USHORT nSavFlags = refVar->GetFlags();
+ sal_uInt16 nSavFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
refVar->SetType( SbxDataType(eType & 0x0FFF) );
refVar->SetFlags( nSavFlags );
@@ -1046,7 +1148,7 @@ void SbiRuntime::StepINPUT()
// zu fuellen, dann mit einem Stringwert
if( !pVar->IsFixed() || pVar->IsNumeric() )
{
- USHORT nLen = 0;
+ sal_uInt16 nLen = 0;
if( !pVar->Scan( s, &nLen ) )
{
err = SbxBase::GetError();
@@ -1169,7 +1271,7 @@ void SbiRuntime::StepENDCASE()
void SbiRuntime::StepSTDERROR()
{
- pError = NULL; bError = TRUE;
+ pError = NULL; bError = sal_True;
pInst->aErrorMsg = String();
pInst->nErr = 0L;
pInst->nErl = 0;
@@ -1184,14 +1286,14 @@ void SbiRuntime::StepNOERROR()
pInst->nErl = 0;
nError = 0L;
SbxErrObject::getUnoErrObject()->Clear();
- bError = FALSE;
+ bError = sal_False;
}
// UP verlassen
void SbiRuntime::StepLEAVE()
{
- bRun = FALSE;
+ bRun = sal_False;
// If VBA and we are leaving an ErrorHandler then clear the error ( it's been processed )
if ( bInError && pError )
SbxErrObject::getUnoErrObject()->Clear();
@@ -1326,7 +1428,7 @@ void SbiRuntime::StepEMPTY()
void SbiRuntime::StepERROR()
{
SbxVariableRef refCode = PopVar();
- USHORT n = refCode->GetUShort();
+ sal_uInt16 n = refCode->GetUShort();
SbError error = StarBASIC::GetSfxFromVBError( n );
if ( bVBAEnabled )
pInst->Error( error );
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index e023750cc27a..659152548e53 100644..100755
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -44,14 +44,14 @@ bool checkUnoObjectType( SbUnoObject* refVal,
// Laden einer numerischen Konstanten (+ID)
-void SbiRuntime::StepLOADNC( UINT32 nOp1 )
+void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
{
SbxVariable* p = new SbxVariable( SbxDOUBLE );
// #57844 Lokalisierte Funktion benutzen
String aStr = pImg->GetString( static_cast<short>( nOp1 ) );
// Auch , zulassen !!!
- USHORT iComma = aStr.Search( ',' );
+ sal_uInt16 iComma = aStr.Search( ',' );
if( iComma != STRING_NOTFOUND )
{
String aStr1 = aStr.Copy( 0, iComma );
@@ -68,7 +68,7 @@ void SbiRuntime::StepLOADNC( UINT32 nOp1 )
// Laden einer Stringkonstanten (+ID)
-void SbiRuntime::StepLOADSC( UINT32 nOp1 )
+void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 )
{
SbxVariable* p = new SbxVariable;
p->PutString( pImg->GetString( static_cast<short>( nOp1 ) ) );
@@ -77,16 +77,16 @@ void SbiRuntime::StepLOADSC( UINT32 nOp1 )
// Immediate Load (+Wert)
-void SbiRuntime::StepLOADI( UINT32 nOp1 )
+void SbiRuntime::StepLOADI( sal_uInt32 nOp1 )
{
SbxVariable* p = new SbxVariable;
- p->PutInteger( static_cast<INT16>( nOp1 ) );
+ p->PutInteger( static_cast<sal_Int16>( nOp1 ) );
PushVar( p );
}
// Speichern eines named Arguments in Argv (+Arg-Nr ab 1!)
-void SbiRuntime::StepARGN( UINT32 nOp1 )
+void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
{
if( !refArgv )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
@@ -110,18 +110,18 @@ void SbiRuntime::StepARGN( UINT32 nOp1 )
// Konvertierung des Typs eines Arguments in Argv fuer DECLARE-Fkt. (+Typ)
-void SbiRuntime::StepARGTYP( UINT32 nOp1 )
+void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
{
if( !refArgv )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
- BOOL bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL verlangt?
+ sal_Bool bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL verlangt?
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 )
@@ -132,7 +132,7 @@ void SbiRuntime::StepARGTYP( 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
{
@@ -155,7 +155,7 @@ void SbiRuntime::StepARGTYP( UINT32 nOp1 )
// String auf feste Laenge bringen (+Laenge)
-void SbiRuntime::StepPAD( UINT32 nOp1 )
+void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
{
SbxVariable* p = GetTOS();
String& s = (String&)(const String&) *p;
@@ -167,20 +167,20 @@ void SbiRuntime::StepPAD( UINT32 nOp1 )
// Sprung (+Target)
-void SbiRuntime::StepJUMP( UINT32 nOp1 )
+void SbiRuntime::StepJUMP( sal_uInt32 nOp1 )
{
#ifdef DBG_UTIL
// #QUESTION shouln't this be
- // if( (BYTE*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() )
+ // if( (sal_uInt8*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() )
if( nOp1 >= pImg->GetCodeSize() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
#endif
- pCode = (const BYTE*) pImg->GetCode() + nOp1;
+ pCode = (const sal_uInt8*) pImg->GetCode() + nOp1;
}
// TOS auswerten, bedingter Sprung (+Target)
-void SbiRuntime::StepJUMPT( UINT32 nOp1 )
+void SbiRuntime::StepJUMPT( sal_uInt32 nOp1 )
{
SbxVariableRef p = PopVar();
if( p->GetBool() )
@@ -189,7 +189,7 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 )
// TOS auswerten, bedingter Sprung (+Target)
-void SbiRuntime::StepJUMPF( UINT32 nOp1 )
+void SbiRuntime::StepJUMPF( sal_uInt32 nOp1 )
{
SbxVariableRef p = PopVar();
// In a test e.g. If Null then
@@ -206,36 +206,36 @@ void SbiRuntime::StepJUMPF( UINT32 nOp1 )
// ...
//Falls im Operanden 0x8000 gesetzt ist, Returnadresse pushen (ON..GOSUB)
-void SbiRuntime::StepONJUMP( UINT32 nOp1 )
+void SbiRuntime::StepONJUMP( sal_uInt32 nOp1 )
{
SbxVariableRef p = PopVar();
- INT16 n = p->GetInteger();
+ sal_Int16 n = p->GetInteger();
if( nOp1 & 0x8000 )
{
nOp1 &= 0x7FFF;
//PushGosub( pCode + 3 * nOp1 );
PushGosub( pCode + 5 * nOp1 );
}
- if( n < 1 || static_cast<UINT32>(n) > nOp1 )
- n = static_cast<INT16>( nOp1 + 1 );
- //nOp1 = (UINT32) ( (const char*) pCode - pImg->GetCode() ) + 3 * --n;
- nOp1 = (UINT32) ( (const char*) pCode - pImg->GetCode() ) + 5 * --n;
+ if( n < 1 || static_cast<sal_uInt32>(n) > nOp1 )
+ n = static_cast<sal_Int16>( nOp1 + 1 );
+ //nOp1 = (sal_uInt32) ( (const char*) pCode - pImg->GetCode() ) + 3 * --n;
+ nOp1 = (sal_uInt32) ( (const char*) pCode - pImg->GetCode() ) + 5 * --n;
StepJUMP( nOp1 );
}
// UP-Aufruf (+Target)
-void SbiRuntime::StepGOSUB( UINT32 nOp1 )
+void SbiRuntime::StepGOSUB( sal_uInt32 nOp1 )
{
PushGosub( pCode );
if( nOp1 >= pImg->GetCodeSize() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
- pCode = (const BYTE*) pImg->GetCode() + nOp1;
+ pCode = (const sal_uInt8*) pImg->GetCode() + nOp1;
}
// UP-Return (+0 oder Target)
-void SbiRuntime::StepRETURN( UINT32 nOp1 )
+void SbiRuntime::StepRETURN( sal_uInt32 nOp1 )
{
PopGosub();
if( nOp1 )
@@ -244,7 +244,7 @@ void SbiRuntime::StepRETURN( UINT32 nOp1 )
// FOR-Variable testen (+Endlabel)
-void SbiRuntime::StepTESTFOR( UINT32 nOp1 )
+void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
{
if( !pForStk )
{
@@ -307,7 +307,7 @@ void SbiRuntime::StepTESTFOR( UINT32 nOp1 )
{
BasicCollection* pCollection = (BasicCollection*)(SbxVariable*)pForStk->refEnd;
SbxArrayRef xItemArray = pCollection->xItemArray;
- INT32 nCount = xItemArray->Count32();
+ sal_Int32 nCount = xItemArray->Count32();
if( pForStk->nCurCollectionIndex < nCount )
{
SbxVariable* pRes = xItemArray->Get32( pForStk->nCurCollectionIndex );
@@ -346,7 +346,7 @@ void SbiRuntime::StepTESTFOR( UINT32 nOp1 )
// Tos+1 <= Tos+2 <= Tos, 2xremove (+Target)
-void SbiRuntime::StepCASETO( UINT32 nOp1 )
+void SbiRuntime::StepCASETO( sal_uInt32 nOp1 )
{
if( !refCaseStk || !refCaseStk->Count() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
@@ -362,9 +362,9 @@ void SbiRuntime::StepCASETO( UINT32 nOp1 )
// Fehler-Handler
-void SbiRuntime::StepERRHDL( UINT32 nOp1 )
+void SbiRuntime::StepERRHDL( sal_uInt32 nOp1 )
{
- const BYTE* p = pCode;
+ const sal_uInt8* p = pCode;
StepJUMP( nOp1 );
pError = pCode;
pCode = p;
@@ -377,7 +377,7 @@ void SbiRuntime::StepERRHDL( UINT32 nOp1 )
// Resume nach Fehlern (+0=statement, 1=next or Label)
-void SbiRuntime::StepRESUME( UINT32 nOp1 )
+void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
{
// AB #32714 Resume ohne Error? -> Fehler
if( !bInError )
@@ -388,8 +388,8 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 )
if( nOp1 )
{
// Code-Zeiger auf naechstes Statement setzen
- USHORT n1, n2;
- pCode = pMod->FindNextStmnt( pErrCode, n1, n2, TRUE, pImg );
+ sal_uInt16 n1, n2;
+ pCode = pMod->FindNextStmnt( pErrCode, n1, n2, sal_True, pImg );
}
else
pCode = pErrStmnt;
@@ -402,7 +402,7 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 )
pInst->nErr = 0;
pInst->nErl = 0;
nError = 0;
- bInError = FALSE;
+ bInError = sal_False;
// Error-Stack loeschen
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
@@ -411,7 +411,7 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 )
}
// Kanal schliessen (+Kanal, 0=Alle)
-void SbiRuntime::StepCLOSE( UINT32 nOp1 )
+void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
{
SbError err;
if( !nOp1 )
@@ -430,7 +430,7 @@ void SbiRuntime::StepCLOSE( UINT32 nOp1 )
// Zeichen ausgeben (+char)
-void SbiRuntime::StepPRCHAR( UINT32 nOp1 )
+void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
{
ByteString s( (char) nOp1 );
pIosys->Write( s );
@@ -521,7 +521,7 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
return bOk;
}
-void SbiRuntime::StepSETCLASS_impl( UINT32 nOp1, bool bHandleDflt )
+void SbiRuntime::StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt )
{
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
@@ -532,17 +532,17 @@ void SbiRuntime::StepSETCLASS_impl( UINT32 nOp1, bool bHandleDflt )
StepSET_Impl( refVal, refVar, bHandleDflt ); // don't do handle dflt prop for a "proper" set
}
-void SbiRuntime::StepVBASETCLASS( UINT32 nOp1 )
+void SbiRuntime::StepVBASETCLASS( sal_uInt32 nOp1 )
{
StepSETCLASS_impl( nOp1, false );
}
-void SbiRuntime::StepSETCLASS( UINT32 nOp1 )
+void SbiRuntime::StepSETCLASS( sal_uInt32 nOp1 )
{
StepSETCLASS_impl( nOp1, true );
}
-void SbiRuntime::StepTESTCLASS( UINT32 nOp1 )
+void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
{
SbxVariableRef xObjVal = PopVar();
String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
@@ -556,7 +556,7 @@ void SbiRuntime::StepTESTCLASS( UINT32 nOp1 )
// Library fuer anschliessenden Declare-Call definieren
-void SbiRuntime::StepLIB( UINT32 nOp1 )
+void SbiRuntime::StepLIB( sal_uInt32 nOp1 )
{
aLibName = pImg->GetString( static_cast<short>( nOp1 ) );
}
@@ -565,14 +565,14 @@ void SbiRuntime::StepLIB( UINT32 nOp1 )
// Dieser Opcode wird vor DIM/REDIM-Anweisungen gepusht,
// wenn nur ein Index angegeben wurde.
-void SbiRuntime::StepBASED( UINT32 nOp1 )
+void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
{
SbxVariable* p1 = new SbxVariable;
SbxVariableRef x2 = PopVar();
// #109275 Check compatiblity mode
bool bCompatible = ((nOp1 & 0x8000) != 0);
- USHORT uBase = static_cast<USHORT>(nOp1 & 1); // Can only be 0 or 1
+ sal_uInt16 uBase = static_cast<sal_uInt16>(nOp1 & 1); // Can only be 0 or 1
p1->PutInteger( uBase );
if( !bCompatible )
x2->Compute( SbxPLUS, *p1 );
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 543c69a34b97..2b8dbc71cf03 100644..100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -57,7 +57,7 @@ SbxVariable* getVBAConstant( const String& rName );
// 0x8000 - Argv ist belegt
SbxVariable* SbiRuntime::FindElement
- ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic )
+ ( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, sal_Bool bLocal, sal_Bool bStatic )
{
bool bIsVBAInterOp = SbiRuntime::isVBAEnabled();
if( bIsVBAInterOp )
@@ -75,7 +75,7 @@ SbxVariable* SbiRuntime::FindElement
}
else
{
- BOOL bFatalError = FALSE;
+ sal_Bool bFatalError = sal_False;
SbxDataType t = (SbxDataType) nOp2;
String aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
// Hacky capture of Evaluate [] syntax
@@ -108,8 +108,8 @@ SbxVariable* SbiRuntime::FindElement
if( !pElem )
{
// Die RTL brauchen wir nicht mehr zu durchsuchen!
- BOOL bSave = rBasic.bNoRtl;
- rBasic.bNoRtl = TRUE;
+ sal_Bool bSave = rBasic.bNoRtl;
+ rBasic.bNoRtl = sal_True;
pElem = pObj->Find( aName, SbxCLASS_DONTCARE );
// #110004, #112015: Make private really private
@@ -142,15 +142,19 @@ SbxVariable* SbiRuntime::FindElement
else
pElem = VBAConstantHelper::instance().getVBAConstant( aName );
}
- // #72382 VORSICHT! Liefert jetzt wegen unbekannten
- // Modulen IMMER ein Ergebnis!
- SbUnoClass* pUnoClass = findUnoClass( aName );
- if( pUnoClass )
+
+ if( !pElem )
{
- pElem = new SbxVariable( t );
- SbxValues aRes( SbxOBJECT );
- aRes.pObj = pUnoClass;
- pElem->SbxVariable::Put( aRes );
+ // #72382 VORSICHT! Liefert jetzt wegen unbekannten
+ // Modulen IMMER ein Ergebnis!
+ SbUnoClass* pUnoClass = findUnoClass( aName );
+ if( pUnoClass )
+ {
+ pElem = new SbxVariable( t );
+ SbxValues aRes( SbxOBJECT );
+ aRes.pObj = pUnoClass;
+ pElem->SbxVariable::Put( aRes );
+ }
}
// #62939 Wenn eine Uno-Klasse gefunden wurde, muss
@@ -176,14 +180,14 @@ SbxVariable* SbiRuntime::FindElement
// Nicht da und nicht im Objekt?
// Hat das Ding Parameter, nicht einrichten!
if( nOp1 & 0x8000 )
- bFatalError = TRUE;
+ bFatalError = sal_True;
// ALT: StarBASIC::FatalError( nNotFound );
// Sonst, falls keine Parameter sind, anderen Error Code verwenden
if( !bLocal || pImg->GetFlag( SBIMG_EXPLICIT ) )
{
// #39108 Bei explizit und als ELEM immer ein Fatal Error
- bFatalError = TRUE;
+ bFatalError = sal_True;
// Falls keine Parameter sind, anderen Error Code verwenden
if( !( nOp1 & 0x8000 ) && nNotFound == SbERR_PROC_UNDEFINED )
@@ -228,19 +232,19 @@ SbxVariable* SbiRuntime::FindElement
{
// Soll der Typ konvertiert werden?
SbxDataType t2 = pElem->GetType();
- BOOL bSet = FALSE;
+ sal_Bool bSet = sal_False;
if( !( pElem->GetFlags() & SBX_FIXED ) )
{
if( t != SbxVARIANT && t != t2 &&
t >= SbxINTEGER && t <= SbxSTRING )
- pElem->SetType( t ), bSet = TRUE;
+ pElem->SetType( t ), bSet = sal_True;
}
// pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
SbxVariableRef refTemp = pElem;
// Moegliche Reste vom letzten Aufruf der SbxMethod beseitigen
// Vorher Schreiben freigeben, damit kein Error gesetzt wird.
- USHORT nSavFlags = pElem->GetFlags();
+ sal_uInt16 nSavFlags = pElem->GetFlags();
pElem->SetFlag( SBX_READWRITE | SBX_NO_BROADCAST );
pElem->SbxValue::Clear();
pElem->SetFlags( nSavFlags );
@@ -309,8 +313,8 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName )
SbxInfo* pInfo = pMeth->GetInfo();
if( pInfo && refParams )
{
- USHORT nParamCount = refParams->Count();
- USHORT j = 1;
+ sal_uInt16 nParamCount = refParams->Count();
+ sal_uInt16 j = 1;
const SbxParamInfo* pParam = pInfo->GetParam( j );
while( pParam )
{
@@ -337,8 +341,8 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName )
if( !pElem )
{
// RTL nicht durchsuchen!
- BOOL bSave = rBasic.bNoRtl;
- rBasic.bNoRtl = TRUE;
+ sal_Bool bSave = rBasic.bNoRtl;
+ rBasic.bNoRtl = sal_True;
pElem = pMod->Find( rName, SbxCLASS_DONTCARE );
rBasic.bNoRtl = bSave;
}
@@ -350,20 +354,20 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName )
// Dabei auch die Argumente umsetzen, falls benannte Parameter
// verwendet wurden
-void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
+void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
{
if( nOp1 & 0x8000 )
{
if( !refArgv )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
- BOOL bHasNamed = FALSE;
- USHORT i;
- USHORT nArgCount = refArgv->Count();
+ sal_Bool bHasNamed = sal_False;
+ sal_uInt16 i;
+ sal_uInt16 nArgCount = refArgv->Count();
for( i = 1 ; i < nArgCount ; i++ )
{
if( refArgv->GetAlias( i ).Len() )
{
- bHasNamed = TRUE; break;
+ bHasNamed = sal_True; break;
}
}
if( bHasNamed )
@@ -390,7 +394,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
{
bError_ = false;
- USHORT nCurPar = 1;
+ sal_uInt16 nCurPar = 1;
AutomationNamedArgsSbxArray* pArg =
new AutomationNamedArgsSbxArray( nArgCount );
::rtl::OUString* pNames = pArg->getNames().getArray();
@@ -406,12 +410,40 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
}
}
}
+ else if( bVBAEnabled && p->GetType() == SbxOBJECT && (!p->ISA(SbxMethod) || !p->IsBroadcaster()) )
+ {
+ // Check for default method with named parameters
+ SbxBaseRef pObj = (SbxBase*)p->GetObject();
+ if( pObj && pObj->ISA(SbUnoObject) )
+ {
+ SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
+ Any aAny = pUnoObj->getUnoAny();
+
+ if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE )
+ {
+ Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
+ Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY );
+
+ rtl::OUString sDefaultMethod;
+ if ( xDfltMethod.is() )
+ sDefaultMethod = xDfltMethod->getDefaultMethodName();
+ if ( sDefaultMethod.getLength() )
+ {
+ SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD );
+ if( meth != NULL )
+ pInfo = meth->GetInfo();
+ if( pInfo )
+ bError_ = false;
+ }
+ }
+ }
+ }
if( bError_ )
Error( SbERR_NO_NAMED_ARGS );
}
else
{
- USHORT nCurPar = 1;
+ sal_uInt16 nCurPar = 1;
SbxArray* pArg = new SbxArray;
for( i = 1 ; i < nArgCount ; i++ )
{
@@ -420,7 +452,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
if( rName.Len() )
{
// nCurPar wird auf den gefundenen Parameter gesetzt
- USHORT j = 1;
+ sal_uInt16 j = 1;
const SbxParamInfo* pParam = pInfo->GetParam( j );
while( pParam )
{
@@ -511,7 +543,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
// Haben wir Index-Access?
if( xIndexAccess.is() )
{
- UINT32 nParamCount = (UINT32)pPar->Count() - 1;
+ sal_uInt32 nParamCount = (sal_uInt32)pPar->Count() - 1;
if( nParamCount != 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -519,7 +551,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
}
// Index holen
- INT32 nIndex = pPar->Get( 1 )->GetLong();
+ sal_Int32 nIndex = pPar->Get( 1 )->GetLong();
Reference< XInterface > xRet;
try
{
@@ -588,6 +620,12 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pCol->CollItem( pPar );
}
}
+ else if( bVBAEnabled ) // !pObj
+ {
+ SbxArray* pParam = pElem->GetParameters();
+ if( pParam != NULL )
+ Error( SbERR_NO_OBJECT );
+ }
}
}
@@ -596,13 +634,13 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
// Laden eines Elements aus der Runtime-Library (+StringID+Typ)
-void SbiRuntime::StepRTL( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepRTL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, FALSE ) );
+ PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_False ) );
}
void
-SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic )
+SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, sal_Bool bLocal, sal_Bool bStatic )
{
if( !refLocals )
refLocals = new SbxArray;
@@ -610,34 +648,34 @@ SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nN
}
// Laden einer lokalen/globalen Variablen (+StringID+Typ)
-void SbiRuntime::StepFIND( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepFIND( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE );
+ StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True );
}
// Search inside a class module (CM) to enable global search in time
-void SbiRuntime::StepFIND_CM( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepFIND_CM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pMod);
if( pClassModuleObject )
pMod->SetFlag( SBX_GBLSEARCH );
- StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE );
+ StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True );
if( pClassModuleObject )
pMod->ResetFlag( SBX_GBLSEARCH );
}
-void SbiRuntime::StepFIND_STATIC( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepFIND_STATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE, TRUE );
+ StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True, sal_True );
}
// Laden eines Objekt-Elements (+StringID+Typ)
// Das Objekt liegt auf TOS
-void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
// Liegt auf dem TOS ein Objekt?
SbxVariableRef pObjVar = PopVar();
@@ -656,7 +694,7 @@ void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 )
if( pObj )
SaveRef( (SbxVariable*)pObj );
- PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, FALSE ) );
+ PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, sal_False ) );
}
// Laden eines Parameters (+Offset+Typ)
@@ -664,17 +702,17 @@ void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 )
// Der Datentyp SbxEMPTY zeigt an, daa kein Parameter angegeben ist.
// Get( 0 ) darf EMPTY sein
-void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- USHORT i = static_cast<USHORT>( nOp1 & 0x7FFF );
+ sal_uInt16 i = static_cast<sal_uInt16>( nOp1 & 0x7FFF );
SbxDataType t = (SbxDataType) nOp2;
SbxVariable* p;
// #57915 Missing sauberer loesen
- USHORT nParamCount = refParams->Count();
+ sal_uInt16 nParamCount = refParams->Count();
if( i >= nParamCount )
{
- INT16 iLoop = i;
+ sal_Int16 iLoop = i;
while( iLoop >= nParamCount )
{
p = new SbxVariable();
@@ -700,7 +738,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
//if( p->GetType() == SbxEMPTY && ( i ) )
{
// Wenn ein Parameter fehlt, kann er OPTIONAL sein
- BOOL bOpt = FALSE;
+ sal_Bool bOpt = sal_False;
if( pMeth )
{
SbxInfo* pInfo = pMeth->GetInfo();
@@ -710,7 +748,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
if( pParam && ( (pParam->nFlags & SBX_OPTIONAL) != 0 ) )
{
// Default value?
- USHORT nDefaultId = sal::static_int_cast< USHORT >(
+ sal_uInt16 nDefaultId = sal::static_int_cast< sal_uInt16 >(
pParam->nUserData & 0xffff );
if( nDefaultId > 0 )
{
@@ -719,11 +757,11 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
p->PutString( aDefaultStr );
refParams->Put( p, i );
}
- bOpt = TRUE;
+ bOpt = sal_True;
}
}
}
- if( bOpt == FALSE )
+ if( bOpt == sal_False )
Error( SbERR_NOT_OPTIONAL );
}
else if( t != SbxVARIANT && (SbxDataType)(p->GetType() & 0x0FFF ) != t )
@@ -741,7 +779,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
// Case-Test (+True-Target+Test-Opcode)
-void SbiRuntime::StepCASEIS( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( !refCaseStk || !refCaseStk->Count() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
@@ -757,13 +795,13 @@ void SbiRuntime::StepCASEIS( UINT32 nOp1, UINT32 nOp2 )
// Aufruf einer DLL-Prozedur (+StringID+Typ)
// Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist
-void SbiRuntime::StepCALL( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
SbxArray* pArgs = NULL;
if( nOp1 & 0x8000 )
pArgs = refArgv;
- DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, FALSE );
+ DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, sal_False );
aLibName = String();
if( nOp1 & 0x8000 )
PopArgv();
@@ -772,13 +810,13 @@ void SbiRuntime::StepCALL( UINT32 nOp1, UINT32 nOp2 )
// Aufruf einer DLL-Prozedur nach CDecl (+StringID+Typ)
// Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist
-void SbiRuntime::StepCALLC( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
SbxArray* pArgs = NULL;
if( nOp1 & 0x8000 )
pArgs = refArgv;
- DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, TRUE );
+ DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, sal_True );
aLibName = String();
if( nOp1 & 0x8000 )
PopArgv();
@@ -787,14 +825,14 @@ void SbiRuntime::StepCALLC( UINT32 nOp1, UINT32 nOp2 )
// Beginn eines Statements (+Line+Col)
-void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
// Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt,
// hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist!
- BOOL bFatalExpr = FALSE;
+ sal_Bool bFatalExpr = sal_False;
String sUnknownMethodName;
if( nExprLvl > 1 )
- bFatalExpr = TRUE;
+ bFatalExpr = sal_True;
else if( nExprLvl )
{
SbxVariable* p = refExprStk->Get( 0 );
@@ -802,7 +840,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
&& refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) )
{
sUnknownMethodName = p->GetName();
- bFatalExpr = TRUE;
+ bFatalExpr = sal_True;
}
}
// Der Expr-Stack ist nun nicht mehr notwendig
@@ -822,7 +860,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
return;
}
pStmnt = pCode - 9;
- USHORT nOld = nLine;
+ sal_uInt16 nOld = nLine;
nLine = static_cast<short>( nOp1 );
// #29955 & 0xFF, um for-Schleifen-Ebene wegzufiltern
@@ -834,8 +872,8 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// around the final column of this statement to set
nCol2 = 0xffff;
- USHORT n1, n2;
- const BYTE* p = pMod->FindNextStmnt( pCode, n1, n2 );
+ sal_uInt16 n1, n2;
+ const sal_uInt8* p = pMod->FindNextStmnt( pCode, n1, n2 );
if( p )
{
if( n1 == nOp1 )
@@ -848,8 +886,8 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, 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)
- USHORT nExspectedForLevel = static_cast<USHORT>( nOp2 / 0x100 );
+ // (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;
@@ -860,12 +898,12 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, 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 )
{
StarBASIC* pStepBasic = GetCurrentBasic( &rBasic );
- USHORT nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 );
+ sal_uInt16 nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 );
// Neuen BreakCallLevel ermitteln
pInst->CalcBreakCallLevel( nNewFlags );
@@ -874,10 +912,10 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// Breakpoints nur bei STMNT-Befehlen in neuer Zeile!
else if( ( nOp1 != nOld )
&& ( nFlags & SbDEBUG_BREAK )
- && pMod->IsBP( static_cast<USHORT>( nOp1 ) ) )
+ && pMod->IsBP( static_cast<sal_uInt16>( nOp1 ) ) )
{
StarBASIC* pBreakBasic = GetCurrentBasic( &rBasic );
- USHORT nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 );
+ sal_uInt16 nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 );
// Neuen BreakCallLevel ermitteln
pInst->CalcBreakCallLevel( nNewFlags );
@@ -892,7 +930,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// Kanalnummer
// Dateiname
-void SbiRuntime::StepOPEN( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
SbxVariableRef pName = PopVar();
SbxVariableRef pChan = PopVar();
@@ -907,7 +945,7 @@ void SbiRuntime::StepOPEN( UINT32 nOp1, UINT32 nOp2 )
// Objekt kreieren (+StringID+StringID)
-void SbiRuntime::StepCREATE( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
SbxObject *pObj = SbxBase::CreateObject( aClass );
@@ -925,12 +963,12 @@ void SbiRuntime::StepCREATE( UINT32 nOp1, UINT32 nOp2 )
}
}
-void SbiRuntime::StepDCREATE( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepDCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
StepDCREATE_IMPL( nOp1, nOp2 );
}
-void SbiRuntime::StepDCREATE_REDIMP( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepDCREATE_REDIMP( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
StepDCREATE_IMPL( nOp1, nOp2 );
}
@@ -957,7 +995,7 @@ void implCopyDimArray_DCREATE( SbxDimArray* pNewArray, SbxDimArray* pOldArray, s
}
// #56204 Objekt-Array kreieren (+StringID+StringID), DCREATE == Dim-Create
-void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
SbxVariableRef refVar = PopVar();
@@ -979,11 +1017,11 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 )
// Dimensionen auswerten
short nDims = pArray->GetDims();
- INT32 nTotalSize = 0;
+ sal_Int32 nTotalSize = 0;
// es muss ein eindimensionales Array sein
- INT32 nLower, nUpper, nSize;
- INT32 i;
+ sal_Int32 nLower, nUpper, nSize;
+ sal_Int32 i;
for( i = 0 ; i < nDims ; i++ )
{
pArray->GetDim32( i+1, nLower, nUpper );
@@ -1021,7 +1059,7 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 )
short nDimsNew = pArray->GetDims();
short nDimsOld = pOldArray->GetDims();
short nDims = nDimsNew;
- BOOL bRangeError = FALSE;
+ sal_Bool bRangeError = sal_False;
// Store dims to use them for copying later
sal_Int32* pLowerBounds = new sal_Int32[nDims];
@@ -1029,7 +1067,7 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 )
sal_Int32* pActualIndices = new sal_Int32[nDims];
if( nDimsOld != nDimsNew )
{
- bRangeError = TRUE;
+ bRangeError = sal_True;
}
else
{
@@ -1072,7 +1110,7 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 )
SbxObject* createUserTypeImpl( const String& rClassName ); // sb.cxx
-void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepTCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
@@ -1086,17 +1124,29 @@ void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 )
PushVar( pNew );
}
-void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 )
+void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 )
{
- USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000
- String aStr;
- aStr.Fill( nCount, 0 );
- pStrVar->PutString( aStr );
+ bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
+ if( bWithEvents )
+ pVar->SetFlag( SBX_WITH_EVENTS );
+
+ bool bDimAsNew = ((nOp2 & SBX_TYPE_DIM_AS_NEW_FLAG) != 0);
+ if( bDimAsNew )
+ pVar->SetFlag( SBX_DIM_AS_NEW );
+
+ bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
+ if( bFixedString )
+ {
+ sal_uInt16 nCount = static_cast<sal_uInt16>( nOp2 >> 17 ); // len = all bits above 0x10000
+ String aStr;
+ aStr.Fill( nCount, 0 );
+ pVar->PutString( aStr );
+ }
}
// Einrichten einer lokalen Variablen (+StringID+Typ)
-void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( !refLocals.Is() )
refLocals = new SbxArray;
@@ -1106,23 +1156,18 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
SbxVariable* p = new SbxVariable( t );
p->SetName( aName );
- bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
- if( bWithEvents )
- p->SetFlag( SBX_WITH_EVENTS );
- bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
- if( bFixedString )
- implCreateFixedString( p, nOp2 );
+ implHandleSbxFlags( p, t, nOp2 );
refLocals->Put( p, refLocals->Count() );
}
}
// Einrichten einer modulglobalen Variablen (+StringID+Typ)
-void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassModule )
+void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedForClassModule )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);;
- BOOL bFlag = pMod->IsSet( SBX_NO_MODIFY );
+ sal_Bool bFlag = pMod->IsSet( SBX_NO_MODIFY );
pMod->SetFlag( SBX_NO_MODIFY );
SbxVariableRef p = pMod->Find( aName, SbxCLASS_PROPERTY );
if( p.Is() )
@@ -1138,21 +1183,16 @@ void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassMo
// AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
pProp->SetFlag( SBX_NO_MODIFY);
- bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
- if( bWithEvents )
- pProp->SetFlag( SBX_WITH_EVENTS );
- bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
- if( bFixedString )
- implCreateFixedString( p, nOp2 );
+ implHandleSbxFlags( pProp, t, nOp2 );
}
}
-void SbiRuntime::StepPUBLIC( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepPUBLIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
StepPUBLIC_Impl( nOp1, nOp2, false );
}
-void SbiRuntime::StepPUBLIC_P( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepPUBLIC_P( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
// Creates module variable that isn't reinitialised when
// between invocations ( for VBASupport & document basic only )
@@ -1165,7 +1205,7 @@ void SbiRuntime::StepPUBLIC_P( UINT32 nOp1, UINT32 nOp2 )
// Einrichten einer globalen Variablen (+StringID+Typ)
-void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( pImg->GetFlag( SBIMG_CLASSMODULE ) )
StepPUBLIC_Impl( nOp1, nOp2, true );
@@ -1183,7 +1223,7 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
pMod->AddVarName( aName );
}
- BOOL bFlag = pStorage->IsSet( SBX_NO_MODIFY );
+ sal_Bool bFlag = pStorage->IsSet( SBX_NO_MODIFY );
rBasic.SetFlag( SBX_NO_MODIFY );
SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY );
if( p.Is() )
@@ -1203,7 +1243,7 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
// Creates global variable that isn't reinitialised when
// basic is restarted, P=PERSIST (+StringID+Typ)
-void SbiRuntime::StepGLOBAL_P( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepGLOBAL_P( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( pMod->pImage->bFirstInit )
{
@@ -1215,7 +1255,7 @@ void SbiRuntime::StepGLOBAL_P( UINT32 nOp1, UINT32 nOp2 )
// Searches for global variable, behavior depends on the fact
// if the variable is initialised for the first time
-void SbiRuntime::StepFIND_G( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepFIND_G( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( pMod->pImage->bFirstInit )
{
@@ -1253,7 +1293,7 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t )
return p;
}
// Einrichten einer statischen Variablen (+StringID+Typ)
-void SbiRuntime::StepSTATIC( UINT32 nOp1, UINT32 nOp2 )
+void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType) nOp2;
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-x86.asm b/basic/source/runtime/wnt-x86.asm
index 2a8710e34243..2a8710e34243 100644..100755
--- a/basic/source/runtime/wnt-x86.asm
+++ b/basic/source/runtime/wnt-x86.asm