summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-11-11 18:24:14 +0100
committerAndras Timar <atimar@suse.com>2012-11-11 18:24:14 +0100
commit06ec1c089519ef3249464aa09eadf03a8db93a39 (patch)
tree85b2eb6d8ba6ca95e18e1ff82151224cb14106f6 /basic
parent8e0d67bed54633d555a4601a5d79e2d5ba7ab2bb (diff)
parent3f899eae02eaad0b967de749fe09b869ba93ad6d (diff)
Merge branch 'master' into feature/killsdf
Conflicts: Repository.mk RepositoryFixes.mk connectivity/prj/build.lst extensions/prj/build.lst filter/prj/build.lst fpicker/prj/build.lst l10ntools/StaticLibrary_transex.mk saxon/build.xml shell/prj/build.lst solenv/gbuild/AllLangResTarget.mk solenv/gbuild/Configuration.mk solenv/gbuild/UI.mk ucb/source/ucp/webdav/webdavcontent.cxx
Diffstat (limited to 'basic')
-rw-r--r--basic/CppunitTest_basic_coverage.mk60
-rw-r--r--basic/Module_basic.mk1
-rw-r--r--basic/inc/basic/basmgr.hxx83
-rw-r--r--basic/inc/basic/modsizeexceeded.hxx2
-rw-r--r--basic/inc/basic/sbdef.hxx8
-rw-r--r--basic/inc/basic/sbmeth.hxx26
-rw-r--r--basic/inc/basic/sbmod.hxx78
-rw-r--r--basic/inc/basic/sbobjmod.hxx20
-rw-r--r--basic/inc/basic/sbprop.hxx4
-rw-r--r--basic/inc/basic/sbstar.hxx49
-rw-r--r--basic/inc/basic/sbstdobj.hxx36
-rw-r--r--basic/inc/basic/sbuno.hxx2
-rw-r--r--basic/inc/basic/sbx.hxx90
-rw-r--r--basic/inc/basic/sbxbase.hxx2
-rw-r--r--basic/inc/basic/sbxcore.hxx18
-rw-r--r--basic/inc/basic/sbxform.hxx92
-rw-r--r--basic/inc/basic/sbxmeth.hxx2
-rw-r--r--basic/inc/basic/sbxobj.hxx32
-rw-r--r--basic/inc/basic/sbxprop.hxx4
-rw-r--r--basic/inc/basic/sbxvar.hxx46
-rw-r--r--basic/qa/basic_coverage/string_left_01.vb25
-rw-r--r--basic/qa/basic_coverage/string_right_01.vb24
-rw-r--r--basic/qa/cppunit/basic_coverage.cxx200
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx35
-rw-r--r--basic/source/basmgr/basmgr.cxx604
-rw-r--r--basic/source/classes/errobject.cxx8
-rw-r--r--basic/source/classes/eventatt.cxx93
-rw-r--r--basic/source/classes/global.cxx2
-rw-r--r--basic/source/classes/image.cxx91
-rw-r--r--basic/source/classes/sb.cxx568
-rw-r--r--basic/source/classes/sbunoobj.cxx535
-rw-r--r--basic/source/classes/sbxmod.cxx254
-rw-r--r--basic/source/comp/buffer.cxx91
-rw-r--r--basic/source/comp/codegen.cxx126
-rw-r--r--basic/source/comp/dim.cxx291
-rw-r--r--basic/source/comp/exprgen.cxx44
-rw-r--r--basic/source/comp/exprnode.cxx51
-rw-r--r--basic/source/comp/exprtree.cxx278
-rw-r--r--basic/source/comp/loops.cxx24
-rw-r--r--basic/source/comp/parser.cxx41
-rw-r--r--basic/source/comp/sbcomp.cxx166
-rw-r--r--basic/source/comp/symtbl.cxx100
-rw-r--r--basic/source/comp/token.cxx122
-rw-r--r--basic/source/inc/buffer.hxx7
-rw-r--r--basic/source/inc/errobject.hxx4
-rw-r--r--basic/source/inc/expr.hxx18
-rw-r--r--basic/source/inc/image.hxx39
-rw-r--r--basic/source/inc/namecont.hxx174
-rw-r--r--basic/source/inc/parser.hxx4
-rw-r--r--basic/source/inc/runtime.hxx50
-rw-r--r--basic/source/inc/sbintern.hxx14
-rw-r--r--basic/source/inc/sbjsmeth.hxx2
-rw-r--r--basic/source/inc/sbjsmod.hxx2
-rw-r--r--basic/source/inc/sbunoobj.hxx72
-rw-r--r--basic/source/inc/scriptcont.hxx8
-rw-r--r--basic/source/inc/stdobj.hxx4
-rw-r--r--basic/source/inc/symtbl.hxx69
-rw-r--r--basic/source/runtime/basrdll.cxx4
-rw-r--r--basic/source/runtime/comenumwrapper.cxx6
-rw-r--r--basic/source/runtime/ddectrl.cxx55
-rw-r--r--basic/source/runtime/ddectrl.hxx17
-rw-r--r--basic/source/runtime/dllmgr-x64.cxx6
-rw-r--r--basic/source/runtime/dllmgr-x86.cxx6
-rw-r--r--basic/source/runtime/inputbox.cxx6
-rw-r--r--basic/source/runtime/iosys.cxx185
-rw-r--r--basic/source/runtime/methods.cxx1144
-rw-r--r--basic/source/runtime/methods1.cxx844
-rw-r--r--basic/source/runtime/runtime.cxx170
-rw-r--r--basic/source/runtime/sbdiagnose.cxx12
-rw-r--r--basic/source/runtime/stdobj.cxx24
-rw-r--r--basic/source/runtime/stdobj1.cxx54
-rw-r--r--basic/source/runtime/step0.cxx405
-rw-r--r--basic/source/runtime/step1.cxx59
-rw-r--r--basic/source/runtime/step2.cxx250
-rw-r--r--basic/source/sbx/sbxarray.cxx54
-rw-r--r--basic/source/sbx/sbxbool.cxx4
-rw-r--r--basic/source/sbx/sbxbyte.cxx4
-rw-r--r--basic/source/sbx/sbxchar.cxx24
-rw-r--r--basic/source/sbx/sbxcoll.cxx84
-rw-r--r--basic/source/sbx/sbxdate.cxx617
-rw-r--r--basic/source/sbx/sbxdbl.cxx2
-rw-r--r--basic/source/sbx/sbxexec.cxx90
-rw-r--r--basic/source/sbx/sbxform.cxx987
-rw-r--r--basic/source/sbx/sbxint.cxx4
-rw-r--r--basic/source/sbx/sbxlng.cxx2
-rw-r--r--basic/source/sbx/sbxobj.cxx436
-rw-r--r--basic/source/sbx/sbxscan.cxx315
-rw-r--r--basic/source/sbx/sbxsng.cxx2
-rw-r--r--basic/source/sbx/sbxstr.cxx10
-rw-r--r--basic/source/sbx/sbxuint.cxx2
-rw-r--r--basic/source/sbx/sbxulng.cxx2
-rw-r--r--basic/source/sbx/sbxvalue.cxx34
-rw-r--r--basic/source/sbx/sbxvar.cxx286
-rw-r--r--basic/source/uno/dlgcont.cxx16
-rw-r--r--basic/source/uno/namecont.cxx753
-rw-r--r--basic/source/uno/scriptcont.cxx303
96 files changed, 7502 insertions, 4671 deletions
diff --git a/basic/CppunitTest_basic_coverage.mk b/basic/CppunitTest_basic_coverage.mk
new file mode 100644
index 000000000000..e1189e5eb790
--- /dev/null
+++ b/basic/CppunitTest_basic_coverage.mk
@@ -0,0 +1,60 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,basic_coverage))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,basic_coverage, \
+ basic/qa/cppunit/basic_coverage \
+))
+
+#$(eval $(call gb_CppunitTest_use_library_objects,basic_coverage,sb))
+
+# add a list of all needed libraries here
+$(eval $(call gb_CppunitTest_use_libraries,basic_coverage, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ salhelper \
+ sb \
+ sot \
+ svl \
+ svt \
+ test \
+ tl \
+ unotest \
+ utl \
+ vcl \
+ xmlscript \
+ $(gb_UWINAPI) \
+))
+
+ifeq ($(GUI),WNT)
+$(eval $(call gb_CppunitTest_use_system_win32_libs,basic_coverage, \
+ oleaut32 \
+))
+endif
+
+$(eval $(call gb_CppunitTest_set_include,basic_coverage,\
+ -I$(SRCDIR)/basic/source/inc \
+ -I$(SRCDIR)/basic/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,basic_coverage,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,basic_coverage))
+
+$(eval $(call gb_CppunitTest_use_components,basic_coverage,\
+ configmgr/source/configmgr \
+ i18npool/util/i18npool \
+))
+$(eval $(call gb_CppunitTest_use_configuration,basic_coverage))
diff --git a/basic/Module_basic.mk b/basic/Module_basic.mk
index e60e83e7e655..a4ff822ef897 100644
--- a/basic/Module_basic.mk
+++ b/basic/Module_basic.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_Module_add_check_targets,basic,\
CppunitTest_basic_scanner \
CppunitTest_basic_enable \
CppunitTest_basic_nested_struct \
+ CppunitTest_basic_coverage \
))
endif
diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx
index 69ddb8e056a3..9c731369d1be 100644
--- a/basic/inc/basic/basmgr.hxx
+++ b/basic/inc/basic/basmgr.hxx
@@ -19,7 +19,6 @@
#ifndef _BASMGR_HXX
#define _BASMGR_HXX
-#include <tools/string.hxx>
#include <svl/brdcst.hxx>
#include <basic/sbstar.hxx>
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
@@ -49,19 +48,19 @@ class BASIC_DLLPUBLIC BasicError
private:
sal_uIntPtr nErrorId;
sal_uInt16 nReason;
- String aErrStr;
+ OUString aErrStr;
public:
BasicError( const BasicError& rErr );
- BasicError( sal_uIntPtr nId, sal_uInt16 nR, const String& rErrStr );
+ BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr );
- sal_uIntPtr GetErrorId() const { return nErrorId; }
+ sal_uIntPtr GetErrorId() const { return nErrorId; }
sal_uInt16 GetReason() const { return nReason; }
- String GetErrorStr() { return aErrStr; }
+ OUString GetErrorStr() { return aErrStr; }
void SetErrorId( sal_uIntPtr n ) { nErrorId = n; }
void SetReason( sal_uInt16 n ) { nReason = n; }
- void SetErrorStr( const String& rStr) { aErrStr = rStr; }
+ void SetErrorStr( const OUString& rStr) { aErrStr = rStr; }
};
class BasicLibs;
@@ -74,10 +73,10 @@ namespace basic { class BasicManagerCleaner; }
class BASIC_DLLPUBLIC OldBasicPassword
{
public:
- virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword ) = 0;
- virtual String getLibraryPassword( const String& rLibraryName ) = 0;
- virtual void clearLibraryPassword( const String& rLibraryName ) = 0;
- virtual sal_Bool hasLibraryPassword( const String& rLibraryName ) = 0;
+ virtual void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword ) = 0;
+ virtual OUString getLibraryPassword( const OUString& rLibraryName ) = 0;
+ virtual void clearLibraryPassword( const OUString& rLibraryName ) = 0;
+ virtual sal_Bool hasLibraryPassword( const OUString& rLibraryName ) = 0;
protected:
~OldBasicPassword() {}
@@ -122,8 +121,8 @@ private:
BasicLibs* pLibs;
std::vector<BasicError> aErrors;
- String aName;
- String maStorageName;
+ OUString aName;
+ OUString maStorageName;
bool mbDocMgr;
BasicManagerImpl* mpImpl;
@@ -131,23 +130,23 @@ private:
BASIC_DLLPRIVATE void Init();
protected:
- sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo ) const;
- sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly = sal_False );
+ sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo ) const;
+ sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly = sal_False );
void ImpCreateStdLib( StarBASIC* pParentFromStdLib );
- void ImpMgrNotLoaded( const String& rStorageName );
+ void ImpMgrNotLoaded( const OUString& rStorageName );
BasicLibInfo* CreateLibInfo();
- void LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, sal_Bool bLoadBasics = sal_True );
+ void LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL, sal_Bool bLoadBasics = sal_True );
void LoadOldBasicManager( SotStorage& rStorage );
- sal_Bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const;
- sal_Bool ImplEncryptStream( SvStream& rStream ) const;
+ sal_Bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const;
+ sal_Bool ImplEncryptStream( SvStream& rStream ) const;
BasicLibInfo* FindLibInfo( StarBASIC* pBasic ) const;
void CheckModules( StarBASIC* pBasic, sal_Bool bReference ) const;
~BasicManager();
public:
TYPEINFO();
- BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib = NULL, String* pLibPath = NULL, bool bDocMgr = false );
- BasicManager( StarBASIC* pStdLib, String* pLibPath = NULL, bool bDocMgr = false );
+ BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib = NULL, OUString* pLibPath = NULL, bool bDocMgr = false );
+ BasicManager( StarBASIC* pStdLib, OUString* pLibPath = NULL, bool bDocMgr = false );
/** deletes the given BasicManager instance
@@ -158,18 +157,18 @@ public:
*/
static void LegacyDeleteBasicManager( BasicManager*& _rpManager );
- void SetStorageName( const String& rName ) { maStorageName = rName; }
- String GetStorageName() const { return maStorageName; }
- void SetName( const String& rName ) { aName = rName; }
- String GetName() const { return aName; }
+ void SetStorageName( const OUString& rName ) { maStorageName = rName; }
+ OUString GetStorageName() const { return maStorageName; }
+ void SetName( const OUString& rName ) { aName = rName; }
+ OUString GetName() const { return aName; }
- sal_uInt16 GetLibCount() const;
+ sal_uInt16 GetLibCount() const;
StarBASIC* GetLib( sal_uInt16 nLib ) const;
- StarBASIC* GetLib( const String& rName ) const;
- sal_uInt16 GetLibId( const String& rName ) const;
+ StarBASIC* GetLib( const OUString& rName ) const;
+ sal_uInt16 GetLibId( const OUString& rName ) const;
- String GetLibName( sal_uInt16 nLib );
+ OUString GetLibName( sal_uInt16 nLib );
/** announces the library containers which belong to this BasicManager
@@ -183,11 +182,11 @@ public:
const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >&
GetScriptLibraryContainer() const;
- sal_Bool LoadLib( sal_uInt16 nLib );
- sal_Bool RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage );
+ sal_Bool LoadLib( sal_uInt16 nLib );
+ sal_Bool RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage );
// Modify-Flag will be reset only during save.
- sal_Bool IsBasicModified() const;
+ sal_Bool IsBasicModified() const;
std::vector<BasicError>& GetErrors();
@@ -207,31 +206,31 @@ public:
takes the names of modules whose size exceeds the legacy limit
*/
bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
- bool HasExeCode( const String& );
+ bool HasExeCode( const OUString& );
/// determines whether the Basic Manager has a given macro, given by fully qualified name
- bool HasMacro( String const& i_fullyQualifiedName ) const;
+ bool HasMacro( OUString const& i_fullyQualifiedName ) const;
/// executes a given macro
- ErrCode ExecuteMacro( String const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue );
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue );
/// executes a given macro
- ErrCode ExecuteMacro( String const& i_fullyQualifiedName, String const& i_commaSeparatedArgs, SbxValue* i_retValue );
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, OUString const& i_commaSeparatedArgs, SbxValue* i_retValue );
private:
BASIC_DLLPRIVATE sal_Bool IsReference( sal_uInt16 nLib );
- BASIC_DLLPRIVATE sal_Bool SetLibName( sal_uInt16 nLib, const String& rName );
+ BASIC_DLLPRIVATE sal_Bool SetLibName( sal_uInt16 nLib, const OUString& rName );
BASIC_DLLPRIVATE StarBASIC* GetStdLib() const;
- BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const String& rLibName, sal_Bool bReference );
+ BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const OUString& rLibName, sal_Bool bReference );
BASIC_DLLPRIVATE sal_Bool RemoveLib( sal_uInt16 nLib );
- BASIC_DLLPRIVATE sal_Bool HasLib( const String& rName ) const;
+ BASIC_DLLPRIVATE sal_Bool HasLib( const OUString& rName ) const;
- BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const String& rLibName,
+ BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const OUString& rLibName,
const com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >&
xScriptCont );
// For XML import/export:
- BASIC_DLLPRIVATE StarBASIC* CreateLib( const String& rLibName );
- BASIC_DLLPRIVATE StarBASIC* CreateLib( const String& rLibName, const String& Password,
- const String& LinkTargetURL );
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName );
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName, const OUString& Password,
+ const OUString& LinkTargetURL );
};
#endif //_BASMGR_HXX
diff --git a/basic/inc/basic/modsizeexceeded.hxx b/basic/inc/basic/modsizeexceeded.hxx
index 83176f0a62ee..e736348e14a6 100644
--- a/basic/inc/basic/modsizeexceeded.hxx
+++ b/basic/inc/basic/modsizeexceeded.hxx
@@ -43,7 +43,7 @@ class BASIC_DLLPUBLIC ModuleSizeExceeded : public ::cppu::WeakImplHelper1< ::com
// member
private:
- rtl::OUString m_sMods;
+ OUString m_sMods;
com::sun::star::uno::Any m_aRequest;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > m_lContinuations;
com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > m_xAbort;
diff --git a/basic/inc/basic/sbdef.hxx b/basic/inc/basic/sbdef.hxx
index 1d3409f802b6..2bc29cbb08c3 100644
--- a/basic/inc/basic/sbdef.hxx
+++ b/basic/inc/basic/sbdef.hxx
@@ -26,13 +26,13 @@
// Returns type name for Basic type, array flag is ignored
// implementation: basic/source/runtime/methods.cxx
-BASIC_DLLPUBLIC ::rtl::OUString getBasicTypeName( SbxDataType eType );
+BASIC_DLLPUBLIC OUString getBasicTypeName( SbxDataType eType );
// Returns type name for Basic objects, especially
// important for SbUnoObj instances
// implementation: basic/source/classes/sbunoobj.cxx
class SbxObject;
-BASIC_DLLPUBLIC ::rtl::OUString getBasicObjectTypeName( SbxObject* pObj );
+BASIC_DLLPUBLIC OUString getBasicObjectTypeName( SbxObject* pObj );
// Allows Basic IDE to set watch mode to suppress errors
// implementation: basic/source/runtime/runtime.cxx
@@ -52,8 +52,8 @@ BASIC_DLLPUBLIC void setBasicWatchMode( bool bOn );
#define SBXID_JSCRIPTMOD 0x6a62 // jm: JavaScript Module
#define SBXID_JSCRIPTMETH 0x6a64 // jm: JavaScript Module
-#define SBX_HINT_BASICSTART SFX_HINT_USER04
-#define SBX_HINT_BASICSTOP SFX_HINT_USER05
+#define SBX_HINT_BASICSTART SFX_HINT_USER04
+#define SBX_HINT_BASICSTOP SFX_HINT_USER05
enum PropertyMode
{
diff --git a/basic/inc/basic/sbmeth.hxx b/basic/inc/basic/sbmeth.hxx
index 6963c0db288f..9d4afbc37a24 100644
--- a/basic/inc/basic/sbmeth.hxx
+++ b/basic/inc/basic/sbmeth.hxx
@@ -37,14 +37,14 @@ class BASIC_DLLPUBLIC SbMethod : public SbxMethod
friend class SbJScriptMethod;
friend class SbIfaceMapperMethod;
- SbxVariable* mCaller; // caller
- SbModule* pMod;
+ SbxVariable* mCaller; // caller
+ SbModule* pMod;
sal_uInt16 nDebugFlags;
sal_uInt16 nLine1, nLine2;
sal_uInt32 nStart;
sal_Bool bInvalid;
- SbxArrayRef refStatics;
- BASIC_DLLPRIVATE SbMethod( const String&, SbxDataType, SbModule* );
+ SbxArrayRef refStatics;
+ BASIC_DLLPRIVATE SbMethod( const OUString&, SbxDataType, SbModule* );
BASIC_DLLPRIVATE SbMethod( const SbMethod& );
virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
virtual sal_Bool StoreData( SvStream& ) const;
@@ -54,17 +54,17 @@ public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2);
TYPEINFO();
virtual SbxInfo* GetInfo();
- SbxArray* GetStatics();
- void ClearStatics();
- SbModule* GetModule() { return pMod; }
- sal_uInt32 GetId() const { return nStart; }
- sal_uInt16 GetDebugFlags() { return nDebugFlags; }
- void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; }
- void GetLineRange( sal_uInt16&, sal_uInt16& );
+ SbxArray* GetStatics();
+ void ClearStatics();
+ SbModule* GetModule() { return pMod; }
+ sal_uInt32 GetId() const { return nStart; }
+ sal_uInt16 GetDebugFlags() { return nDebugFlags; }
+ void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; }
+ void GetLineRange( sal_uInt16&, sal_uInt16& );
// Interface to execute a method from the applications
virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
- virtual void Broadcast( sal_uIntPtr nHintId );
+ virtual void Broadcast( sal_uIntPtr nHintId );
};
SV_DECL_IMPL_REF(SbMethod)
@@ -77,7 +77,7 @@ class BASIC_DLLPUBLIC SbIfaceMapperMethod : public SbMethod
public:
TYPEINFO();
- SbIfaceMapperMethod( const String& rName, SbMethod* pImplMeth )
+ SbIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth )
: SbMethod( rName, pImplMeth->GetType(), NULL )
, mxImplMeth( pImplMeth )
{}
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index 464ebf2ca227..1ff5b11c9b8b 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -51,14 +51,14 @@ class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable
friend class StarBASIC;
friend class SbClassModuleObject;
- std::vector< String > mModuleVariableNames;
+ std::vector< OUString > mModuleVariableNames;
BASIC_DLLPRIVATE void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
protected:
com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
- ::rtl::OUString aOUSource;
- String aComment;
+ OUString aOUSource;
+ OUString aComment;
SbiImage* pImage; // the Image
SbiBreakpoints* pBreaks; // Breakpoints
SbClassData* pClassData;
@@ -69,20 +69,20 @@ protected:
static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem );
void StartDefinitions();
- SbMethod* GetMethod( const String&, SbxDataType );
- SbProperty* GetProperty( const String&, SbxDataType );
- SbProcedureProperty* GetProcedureProperty( const String&, SbxDataType );
- SbIfaceMapperMethod* GetIfaceMapperMethod( const String&, SbMethod* );
+ SbMethod* GetMethod( const OUString&, SbxDataType );
+ SbProperty* GetProperty( const OUString&, SbxDataType );
+ SbProcedureProperty* GetProcedureProperty( const OUString&, SbxDataType );
+ SbIfaceMapperMethod* GetIfaceMapperMethod( const OUString&, SbMethod* );
void EndDefinitions( sal_Bool=sal_False );
- sal_uInt16 Run( SbMethod* );
+ sal_uInt16 Run( SbMethod* );
void RunInit();
void ClearPrivateVars();
void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic );
void GlobalRunInit( bool bBasicStart ); // for all modules
void GlobalRunDeInit( void );
- const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const;
- const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&,
- sal_Bool bFollowJumps, const SbiImage* pImg=NULL ) const;
+ const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const;
+ const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&,
+ sal_Bool bFollowJumps, const SbiImage* pImg=NULL ) const;
virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
virtual sal_Bool StoreData( SvStream& ) const;
virtual sal_Bool LoadCompleted();
@@ -93,48 +93,48 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
TYPEINFO();
- SbModule( const String&, sal_Bool bCompat = sal_False );
+ SbModule( const OUString&, sal_Bool bCompat = sal_False );
virtual void SetParent( SbxObject* );
virtual void Clear();
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
- virtual const String& GetSource() const;
- const ::rtl::OUString& GetSource32() const;
- const String& GetComment() const { return aComment; }
- virtual void SetSource( const String& r );
- void SetSource32( const ::rtl::OUString& r );
+ virtual const OUString& GetSource() const;
+ const OUString& GetSource32() const;
+ const OUString& GetComment() const { return aComment; }
+ virtual void SetSource( const OUString& r );
+ void SetSource32( const OUString& r );
- virtual sal_Bool Compile();
- virtual sal_Bool IsCompiled() const;
- const SbxObject* FindType( String aTypeName ) const;
+ virtual sal_Bool Compile();
+ virtual sal_Bool IsCompiled() const;
+ const SbxObject* FindType( OUString aTypeName ) const;
- virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const;
- virtual size_t GetBPCount() const;
- virtual sal_uInt16 GetBP( size_t n ) const;
- virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
- virtual sal_Bool SetBP( sal_uInt16 nLine );
- virtual sal_Bool ClearBP( sal_uInt16 nLine );
- virtual void ClearAllBP();
+ virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const;
+ virtual size_t GetBPCount() const;
+ virtual sal_uInt16 GetBP( size_t n ) const;
+ virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
+ virtual sal_Bool SetBP( sal_uInt16 nLine );
+ virtual sal_Bool ClearBP( sal_uInt16 nLine );
+ virtual void ClearAllBP();
// Lines of Subs
virtual SbMethod* GetFunctionForLine( sal_uInt16 );
// Store only image, no source (needed for new password protection)
- sal_Bool StoreBinaryData( SvStream& );
- sal_Bool StoreBinaryData( SvStream&, sal_uInt16 nVer );
+ sal_Bool StoreBinaryData( SvStream& );
+ sal_Bool StoreBinaryData( SvStream&, sal_uInt16 nVer );
sal_Bool LoadBinaryData( SvStream&, sal_uInt16 nVer );
sal_Bool LoadBinaryData( SvStream& );
sal_Bool ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
- bool HasExeCode();
- bool IsVBACompat() const;
- void SetVBACompat( bool bCompat );
+ void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+ bool HasExeCode();
+ bool IsVBACompat() const;
+ void SetVBACompat( bool bCompat );
sal_Int32 GetModuleType() { return mnType; }
- void SetModuleType( sal_Int32 nType ) { mnType = nType; }
- bool isProxyModule() { return bIsProxyModule; }
- void AddVarName( const String& aName );
- void RemoveVars();
+ void SetModuleType( sal_Int32 nType ) { mnType = nType; }
+ bool isProxyModule() { return bIsProxyModule; }
+ void AddVarName( const OUString& aName );
+ void RemoveVars();
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
};
@@ -153,7 +153,7 @@ public:
~SbClassModuleObject();
// Overridden to support NameAccess etc.
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
virtual void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx
index b3ff31f64d7a..768a273b26c8 100644
--- a/basic/inc/basic/sbobjmod.hxx
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -40,8 +40,8 @@ protected:
public:
TYPEINFO();
- SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
- virtual SbxVariable* Find( const rtl::OUString& rName, SbxClassType t );
+ SbObjModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
@@ -59,21 +59,21 @@ class BASIC_DLLPUBLIC SbUserFormModule : public SbObjModule
::rtl::Reference< FormObjEventListenerImpl > m_DialogListener;
css::uno::Reference<css::awt::XDialog> m_xDialog;
css::uno::Reference<css::frame::XModel> m_xModel;
- String sFormName;
+ OUString sFormName;
bool mbInit;
//protected:
virtual void InitObject();
public:
TYPEINFO();
- SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+ SbUserFormModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
virtual ~SbUserFormModule();
- virtual SbxVariable* Find( const rtl::OUString& rName, SbxClassType t );
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
void ResetApiObj( bool bTriggerTerminateEvent = true );
void Unload();
void Load();
- void triggerMethod( const String& );
- void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& );
+ void triggerMethod( const OUString& );
+ void triggerMethod( const OUString&, css::uno::Sequence< css::uno::Any >& );
void triggerActivateEvent();
void triggerDeactivateEvent();
void triggerInitializeEvent();
@@ -94,11 +94,11 @@ class BASIC_DLLPUBLIC SbUserFormModuleInstance : public SbUserFormModule
SbUserFormModule* m_pParentModule;
public:
- SbUserFormModuleInstance( SbUserFormModule* pParentModule, const rtl::OUString& rName,
+ SbUserFormModuleInstance( SbUserFormModule* pParentModule, const OUString& rName,
const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
- virtual sal_Bool IsClass( const rtl::OUString& ) const;
- virtual SbxVariable* Find( const rtl::OUString& rName, SbxClassType t );
+ virtual sal_Bool IsClass( const OUString& ) const;
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
};
#endif
diff --git a/basic/inc/basic/sbprop.hxx b/basic/inc/basic/sbprop.hxx
index 3e66f7e4c855..463fd5d41c73 100644
--- a/basic/inc/basic/sbprop.hxx
+++ b/basic/inc/basic/sbprop.hxx
@@ -33,7 +33,7 @@ class BASIC_DLLPUBLIC SbProperty : public SbxProperty
friend class SbProcedureProperty;
SbModule* pMod;
sal_Bool bInvalid;
- BASIC_DLLPRIVATE SbProperty( const String&, SbxDataType, SbModule* );
+ BASIC_DLLPRIVATE SbProperty( const OUString&, SbxDataType, SbModule* );
virtual ~SbProperty();
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICPROP,1);
@@ -50,7 +50,7 @@ class BASIC_DLLPUBLIC SbProcedureProperty : public SbxProperty
virtual ~SbProcedureProperty();
public:
- SbProcedureProperty( const String& r, SbxDataType t )
+ SbProcedureProperty( const OUString& r, SbxDataType t )
: SbxProperty( r, t ) // , pMod( p )
, mbSet( false )
{}
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index cffd4ad70645..c84b62494169 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -69,17 +69,16 @@ class BASIC_DLLPUBLIC StarBASIC : public SbxObject
BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
protected:
- sal_Bool CError( SbError, const ::rtl::OUString&, xub_StrLen, xub_StrLen, xub_StrLen );
+ sal_Bool CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
private:
- BASIC_DLLPRIVATE sal_Bool RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen );
- BASIC_DLLPRIVATE sal_Bool RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen );
- BASIC_DLLPRIVATE sal_uInt16 BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
- BASIC_DLLPRIVATE sal_uInt16 StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
+ BASIC_DLLPRIVATE sal_Bool RTError( SbError, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE sal_Bool RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE sal_uInt16 BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ BASIC_DLLPRIVATE sal_uInt16 StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
virtual sal_Bool StoreData( SvStream& ) const;
protected:
-
virtual sal_Bool ErrorHdl();
virtual sal_uInt16 BreakHdl();
virtual ~StarBASIC();
@@ -107,45 +106,45 @@ public:
void SetLibInfo( BasicLibInfo* p ) { pLibInfo = p; }
// Compiler-Interface
- SbModule* MakeModule( const String& rName, const String& rSrc );
- SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
- SbModule* MakeModule32( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc );
- sal_Bool Compile( SbModule* );
+ SbModule* MakeModule( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule32( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule32( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, const OUString& rSrc );
+ sal_Bool Compile( SbModule* );
static void Stop();
static void Error( SbError );
- static void Error( SbError, const String& rMsg );
+ static void Error( SbError, const OUString& rMsg );
static void FatalError( SbError );
- static void FatalError( SbError, const String& rMsg );
+ static void FatalError( SbError, const OUString& rMsg );
static bool IsRunning();
static SbError GetErrBasic();
// #66536 make additional message accessible by RTL function Error
- static String GetErrorMsg();
- static xub_StrLen GetErl();
+ static OUString GetErrorMsg();
+ static sal_Int32 GetErl();
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
- virtual sal_Bool Call( const String&, SbxArray* = NULL );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ virtual sal_Bool Call( const OUString&, SbxArray* = NULL );
SbxArray* GetModules() { return pModules; }
SbxObject* GetRtl() { return pRtl; }
- SbModule* FindModule( const String& );
+ SbModule* FindModule( const OUString& );
// Run init code of all modules (including the inserted Doc-Basics)
void InitAllModules( StarBASIC* pBasicNotToInit = NULL );
void DeInitAllModules( void );
void ClearAllModuleVars( void );
// Calls for error and break handler
- static sal_uInt16 GetLine();
- static sal_uInt16 GetCol1();
- static sal_uInt16 GetCol2();
+ static sal_uInt16 GetLine();
+ static sal_uInt16 GetCol1();
+ static sal_uInt16 GetCol2();
static void SetErrorData( SbError nCode, sal_uInt16 nLine,
sal_uInt16 nCol1, sal_uInt16 nCol2 );
// Specific to error handler
- static void MakeErrorText( SbError, const ::rtl::OUString& aMsg );
- static const String& GetErrorText();
+ static void MakeErrorText( SbError, const OUString& aMsg );
+ static const OUString& GetErrorText();
static SbError GetErrorCode();
static bool IsCompilerError();
- static sal_uInt16 GetVBErrorCode( SbError nError );
+ static sal_uInt16 GetVBErrorCode( SbError nError );
static SbError GetSfxFromVBError( sal_uInt16 nError );
bool IsBreak() const { return bBreak; }
@@ -160,7 +159,7 @@ public:
SbxArrayRef getUnoListeners( void );
- static SbxBase* FindSBXInCurrentScope( const String& rName );
+ static SbxBase* FindSBXInCurrentScope( const OUString& rName );
static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 );
static SbModule* GetActiveModule();
void SetVBAEnabled( bool bEnabled );
@@ -168,7 +167,7 @@ public:
SbxObjectRef getRTL( void ) { return pRtl; }
bool IsDocBasic() { return bDocBasic; }
- SbxVariable* VBAFind( const rtl::OUString& rName, SbxClassType t );
+ SbxVariable* VBAFind( const OUString& rName, SbxClassType t );
bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
void QuitAndExitApplication();
bool IsQuitApplication() { return bQuit; };
diff --git a/basic/inc/basic/sbstdobj.hxx b/basic/inc/basic/sbstdobj.hxx
index cd0436416efa..75a5a6ecb452 100644
--- a/basic/inc/basic/sbstdobj.hxx
+++ b/basic/inc/basic/sbstdobj.hxx
@@ -33,7 +33,7 @@ class BASIC_DLLPUBLIC SbStdFactory : public SbxFactory
public:
SbStdFactory();
- virtual SbxObject* CreateObject( const rtl::OUString& rClassName );
+ virtual SbxObject* CreateObject( const OUString& rClassName );
};
//--------------------
@@ -56,7 +56,7 @@ public:
TYPEINFO();
SbStdPicture();
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
Graphic GetGraphic() const { return aGraphic; }
void SetGraphic( const Graphic& rGrf ) { aGraphic = rGrf; }
@@ -73,7 +73,7 @@ protected:
sal_Bool bStrikeThrough;
sal_Bool bUnderline;
sal_uInt16 nSize;
- String aName;
+ OUString aName;
~SbStdFont();
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
@@ -90,20 +90,20 @@ public:
TYPEINFO();
SbStdFont();
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
-
- void SetBold( sal_Bool bB ) { bBold = bB; }
- sal_Bool IsBold() const { return bBold; }
- void SetItalic( sal_Bool bI ) { bItalic = bI; }
- sal_Bool IsItalic() const { return bItalic; }
- void SetStrikeThrough( sal_Bool bS ) { bStrikeThrough = bS; }
- sal_Bool IsStrikeThrough() const { return bStrikeThrough; }
- void SetUnderline( sal_Bool bU ) { bUnderline = bU; }
- sal_Bool IsUnderline() const { return bUnderline; }
- void SetSize( sal_uInt16 nS ) { nSize = nS; }
- sal_uInt16 GetSize() const { return nSize; }
- void SetFontName( const String& rName ) { aName = rName; }
- String GetFontName() const { return aName; }
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ void SetBold( sal_Bool bB ) { bBold = bB; }
+ sal_Bool IsBold() const { return bBold; }
+ void SetItalic( sal_Bool bI ) { bItalic = bI; }
+ sal_Bool IsItalic() const { return bItalic; }
+ void SetStrikeThrough( sal_Bool bS ) { bStrikeThrough = bS; }
+ sal_Bool IsStrikeThrough() const { return bStrikeThrough; }
+ void SetUnderline( sal_Bool bU ) { bUnderline = bU; }
+ sal_Bool IsUnderline() const { return bUnderline; }
+ void SetSize( sal_uInt16 nS ) { nSize = nS; }
+ sal_uInt16 GetSize() const { return nSize; }
+ void SetFontName( const OUString& rName ) { aName = rName; }
+ OUString GetFontName() const { return aName; }
};
//----------------------
@@ -128,7 +128,7 @@ public:
TYPEINFO();
SbStdClipboard();
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
};
#endif
diff --git a/basic/inc/basic/sbuno.hxx b/basic/inc/basic/sbuno.hxx
index 9c3099169bfc..55d487a48b75 100644
--- a/basic/inc/basic/sbuno.hxx
+++ b/basic/inc/basic/sbuno.hxx
@@ -27,7 +27,7 @@ namespace com { namespace sun { namespace star { namespace uno { class Any; }}}}
// Returns a SbxObject that wrapps an Uno Interface
// Implementation in basic/source/classes/sbunoobj.cxx
-BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const ::rtl::OUString& aName, const com::sun::star::uno::Any& aUnoObj_ );
+BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const OUString& aName, const com::sun::star::uno::Any& aUnoObj_ );
// Force creation of all properties for debugging
BASIC_DLLPUBLIC void createAllObjectProperties( SbxObject* pObj );
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx
index 30dac56c42d1..d5fba159e510 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -33,7 +33,6 @@
#include <boost/ptr_container/ptr_vector.hpp>
-class String;
class SvStream;
class SbxBase;
class SbxVariable;
@@ -49,13 +48,13 @@ class SfxBroadcaster;
// Parameter information
struct SbxParamInfo
{
- const String aName; // Name of the parameter
- SbxBaseRef aTypeRef; // Object, if object type
- SbxDataType eType; // Data type
- sal_uInt16 nFlags; // Flag-Bits
- sal_uInt32 nUserData; // IDs etc.
- SbxParamInfo( const String& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
- : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
+ const OUString aName; // Name of the parameter
+ SbxBaseRef aTypeRef; // Object, if object type
+ SbxDataType eType; // Data type
+ sal_uInt16 nFlags; // Flag-Bits
+ sal_uInt32 nUserData; // IDs etc.
+ SbxParamInfo( const OUString& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
+ : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
~SbxParamInfo() {}
};
@@ -66,9 +65,9 @@ class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
friend class SbxVariable;
friend class SbMethod;
- String aComment;
- String aHelpFile;
- sal_uInt32 nHelpId;
+ OUString aComment;
+ OUString aHelpFile;
+ sal_uInt32 nHelpId;
SbxParams aParams;
protected:
@@ -77,16 +76,16 @@ protected:
virtual ~SbxInfo();
public:
SbxInfo();
- SbxInfo( const String&, sal_uInt32 );
+ SbxInfo( const OUString&, sal_uInt32 );
- void AddParam( const rtl::OUString&, SbxDataType, sal_uInt16=SBX_READ );
+ void AddParam( const OUString&, SbxDataType, sal_uInt16=SBX_READ );
const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
- const String& GetComment() const { return aComment; }
- const String& GetHelpFile() const { return aHelpFile; }
- sal_uInt32 GetHelpId() const { return nHelpId; }
+ const OUString& GetComment() const { return aComment; }
+ const OUString& GetHelpFile() const { return aHelpFile; }
+ sal_uInt32 GetHelpId() const { return nHelpId; }
- void SetComment( const String& r ) { aComment = r; }
- void SetHelpFile( const String& r ) { aHelpFile = r; }
+ void SetComment( const OUString& r ) { aComment = r; }
+ void SetHelpFile( const OUString& r ) { aHelpFile = r; }
void SetHelpId( sal_uInt32 nId ) { nHelpId = nId; }
};
@@ -142,28 +141,28 @@ public:
SbxArray( const SbxArray& );
SbxArray& operator=( const SbxArray& );
virtual void Clear();
- sal_uInt16 Count() const;
- virtual SbxDataType GetType() const;
+ sal_uInt16 Count() const;
+ virtual SbxDataType GetType() const;
virtual SbxClassType GetClass() const;
- SbxVariableRef& GetRef( sal_uInt16 );
- SbxVariable* Get( sal_uInt16 );
- void Put( SbxVariable*, sal_uInt16 );
- void Insert( SbxVariable*, sal_uInt16 );
- void Remove( sal_uInt16 );
- void Remove( SbxVariable* );
- void Merge( SbxArray* );
- const String& GetAlias( sal_uInt16 );
- void PutAlias( const String&, sal_uInt16 );
- SbxVariable* FindUserData( sal_uInt32 nUserData );
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ SbxVariableRef& GetRef( sal_uInt16 );
+ SbxVariable* Get( sal_uInt16 );
+ void Put( SbxVariable*, sal_uInt16 );
+ void Insert( SbxVariable*, sal_uInt16 );
+ void Remove( sal_uInt16 );
+ void Remove( SbxVariable* );
+ void Merge( SbxArray* );
+ const OUString& GetAlias( sal_uInt16 );
+ void PutAlias( const OUString&, sal_uInt16 );
+ SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
// Additional methods for 32-bit indices
- sal_uInt32 Count32() const;
- SbxVariableRef& GetRef32( sal_uInt32 );
- SbxVariable* Get32( sal_uInt32 );
- void Put32( SbxVariable*, sal_uInt32 );
- void Insert32( SbxVariable*, sal_uInt32 );
- void Remove32( sal_uInt32 );
+ sal_uInt32 Count32() const;
+ SbxVariableRef& GetRef32( sal_uInt32 );
+ SbxVariable* Get32( sal_uInt32 );
+ void Put32( SbxVariable*, sal_uInt32 );
+ void Insert32( SbxVariable*, sal_uInt32 );
+ void Remove32( sal_uInt32 );
};
// SbxDimArray is an array that can dimensioned using BASIC conventions.
@@ -209,8 +208,8 @@ public:
void AddDim32( sal_Int32, sal_Int32 );
void unoAddDim32( sal_Int32, sal_Int32 );
sal_Bool GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const;
- bool hasFixedSize() { return mbHasFixedSize; };
- void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
+ bool hasFixedSize() { return mbHasFixedSize; };
+ void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
};
class BASIC_DLLPUBLIC SbxCollection : public SbxObject
@@ -229,19 +228,19 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1);
TYPEINFO();
- SbxCollection( const String& rClassname );
+ SbxCollection( const OUString& rClassname );
SbxCollection( const SbxCollection& );
SbxCollection& operator=( const SbxCollection& );
virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
virtual void Clear();
};
class BASIC_DLLPUBLIC SbxStdCollection : public SbxCollection
{
protected:
- String aElemClass;
- sal_Bool bAddRemoveOk;
+ OUString aElemClass;
+ sal_Bool bAddRemoveOk;
virtual ~SbxStdCollection();
virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
virtual sal_Bool StoreData( SvStream& ) const;
@@ -250,12 +249,11 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1);
TYPEINFO();
- SbxStdCollection
- ( const String& rClassname, const String& rElemClass, sal_Bool=sal_True );
+ SbxStdCollection( const OUString& rClassname, const OUString& rElemClass, sal_Bool=sal_True );
SbxStdCollection( const SbxStdCollection& );
SbxStdCollection& operator=( const SbxStdCollection& );
virtual void Insert( SbxVariable* );
- const String& GetElementClass() const { return aElemClass; }
+ const OUString& GetElementClass() const { return aElemClass; }
};
SV_IMPL_REF(SbxBase)
diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx
index 37142a9c865f..7b088bedda1e 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -39,7 +39,7 @@ struct SbxAppData
SbxBasicFormater *pBasicFormater; // Pointer to Format()-Command helper class
LanguageType eBasicFormaterLangType;
- // It might be useful to store this class 'global' because some string reosurces are saved here
+ // It might be useful to store this class 'global' because some string reosurces are saved here
SbxAppData() : eSbxError( SbxERR_OK ), aFacs(), pBasicFormater( NULL ) {}
~SbxAppData();
diff --git a/basic/inc/basic/sbxcore.hxx b/basic/inc/basic/sbxcore.hxx
index e1ff9be77923..5d45d4bbc9c5 100644
--- a/basic/inc/basic/sbxcore.hxx
+++ b/basic/inc/basic/sbxcore.hxx
@@ -28,8 +28,6 @@
#include "basicdllapi.h"
class SvStream;
-class String;
-namespace rtl { class OUString; }
// The following Macro defines four (five) necessary methods within a
// SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
@@ -68,10 +66,10 @@ protected:
SBX_DECL_PERSIST(0,0,0);
public:
TYPEINFO();
- inline void SetFlags( sal_uInt16 n );
+ inline void SetFlags( sal_uInt16 n );
inline sal_uInt16 GetFlags() const;
- inline void SetFlag( sal_uInt16 n );
- inline void ResetFlag( sal_uInt16 n );
+ inline void SetFlag( sal_uInt16 n );
+ inline void ResetFlag( sal_uInt16 n );
inline sal_Bool IsSet( sal_uInt16 n ) const;
inline sal_Bool IsReset( sal_uInt16 n ) const;
inline sal_Bool CanRead() const;
@@ -81,17 +79,17 @@ public:
inline sal_Bool IsHidden() const;
inline sal_Bool IsVisible() const;
- virtual sal_Bool IsFixed() const;
- virtual void SetModified( sal_Bool );
+ virtual sal_Bool IsFixed() const;
+ virtual void SetModified( sal_Bool );
- virtual SbxDataType GetType() const;
+ virtual SbxDataType GetType() const;
virtual SbxClassType GetClass() const;
virtual void Clear();
static SbxBase* Load( SvStream& );
- static void Skip( SvStream& );
- sal_Bool Store( SvStream& );
+ static void Skip( SvStream& );
+ sal_Bool Store( SvStream& );
virtual sal_Bool LoadCompleted();
virtual sal_Bool StoreCompleted();
diff --git a/basic/inc/basic/sbxform.hxx b/basic/inc/basic/sbxform.hxx
index 42ff9d63c9c4..589f3ec24fd0 100644
--- a/basic/inc/basic/sbxform.hxx
+++ b/basic/inc/basic/sbxform.hxx
@@ -75,7 +75,8 @@
*/
#define _with_sprintf // use a)
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
#include "basicdllapi.h"
class BASIC_DLLPUBLIC SbxBasicFormater {
@@ -83,14 +84,14 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
// Constructor takes signs for decimal point, thousand separation sign
// and necessary resource strings.
SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
- String _sOnStrg,
- String _sOffStrg,
- String _sYesStrg,
- String _sNoStrg,
- String _sTrueStrg,
- String _sFalseStrg,
- String _sCurrencyStrg,
- String _sCurrencyFormatStrg );
+ OUString _sOnStrg,
+ OUString _sOffStrg,
+ OUString _sYesStrg,
+ OUString _sNoStrg,
+ OUString _sTrueStrg,
+ OUString _sFalseStrg,
+ OUString _sCurrencyStrg,
+ OUString _sCurrencyFormatStrg );
/* Basic command: Format$( number,format-string )
@@ -101,68 +102,67 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
Return value:
String containing the formatted output
*/
- String BasicFormat( double dNumber, String sFormatStrg );
- String BasicFormatNull( String sFormatStrg );
+ OUString BasicFormat( double dNumber, OUString sFormatStrg );
+ OUString BasicFormatNull( OUString sFormatStrg );
- static sal_Bool isBasicFormat( String sFormatStrg );
+ static sal_Bool isBasicFormat( OUString sFormatStrg );
private:
- BASIC_DLLPRIVATE inline void ShiftString( String& sStrg, sal_uInt16 nStartPos );
- BASIC_DLLPRIVATE inline void StrAppendChar( String& sStrg, sal_Unicode ch );
- BASIC_DLLPRIVATE void AppendDigit( String& sStrg, short nDigit );
- BASIC_DLLPRIVATE void LeftShiftDecimalPoint( String& sStrg );
- BASIC_DLLPRIVATE void StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOverflow );
- BASIC_DLLPRIVATE void StrRoundDigit( String& sStrg, short nPos );
- BASIC_DLLPRIVATE void ParseBack( String& sStrg, const String& sFormatStrg,
- short nFormatPos );
+ BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
+ BASIC_DLLPRIVATE void AppendDigit( OUStringBuffer& sStrg, short nDigit );
+ BASIC_DLLPRIVATE void LeftShiftDecimalPoint( OUStringBuffer& sStrg );
+ BASIC_DLLPRIVATE void StrRoundDigit( OUStringBuffer& sStrg, short nPos, sal_Bool& bOverflow );
+ BASIC_DLLPRIVATE void StrRoundDigit( OUStringBuffer& sStrg, short nPos );
+ BASIC_DLLPRIVATE void ParseBack( OUStringBuffer& sStrg, const OUString& sFormatStrg,
+ short nFormatPos );
#ifdef _with_sprintf
// Methods for string conversion with sprintf():
BASIC_DLLPRIVATE void InitScan( double _dNum );
BASIC_DLLPRIVATE void InitExp( double _dNewExp );
BASIC_DLLPRIVATE short GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit );
BASIC_DLLPRIVATE short GetDigitAtPosExpScan( double dNewExponent, short nPos,
- sal_Bool& bFoundFirstDigit );
+ sal_Bool& bFoundFirstDigit );
BASIC_DLLPRIVATE short GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit );
#else
// Methods for direct 'calculation' with log10() and pow():
BASIC_DLLPRIVATE short GetDigitAtPos( double dNumber, short nPos, double& dNextNumber,
- sal_Bool& bFoundFirstDigit );
+ sal_Bool& bFoundFirstDigit );
BASIC_DLLPRIVATE short RoundDigit( double dNumber );
#endif
- BASIC_DLLPRIVATE String GetPosFormatString( const String& sFormatStrg, sal_Bool & bFound );
- BASIC_DLLPRIVATE String GetNegFormatString( const String& sFormatStrg, sal_Bool & bFound );
- BASIC_DLLPRIVATE String Get0FormatString( const String& sFormatStrg, sal_Bool & bFound );
- BASIC_DLLPRIVATE String GetNullFormatString( const String& sFormatStrg, sal_Bool & bFound );
- BASIC_DLLPRIVATE short AnalyseFormatString( const String& sFormatStrg,
- short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
- short& nNoOfOptionalDigitsLeft,
- short& nNoOfExponentDigits,
- short& nNoOfOptionalExponentDigits,
- sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific,
- sal_Bool& bGenerateThousandSeparator,
- short& nMultipleThousandSeparators );
- BASIC_DLLPRIVATE void ScanFormatString( double dNumber, const String& sFormatStrg,
- String& sReturnStrg, sal_Bool bCreateSign );
+ BASIC_DLLPRIVATE OUString GetPosFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString GetNegFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString Get0FormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString GetNullFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE short AnalyseFormatString( const OUString& sFormatStrg,
+ short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
+ short& nNoOfOptionalDigitsLeft,
+ short& nNoOfExponentDigits,
+ short& nNoOfOptionalExponentDigits,
+ sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific,
+ sal_Bool& bGenerateThousandSeparator,
+ short& nMultipleThousandSeparators );
+ BASIC_DLLPRIVATE void ScanFormatString( double dNumber, const OUString& sFormatStrg,
+ OUString& sReturnStrg, sal_Bool bCreateSign );
//*** Data ***
sal_Unicode cDecPoint; // sign for the decimal point
sal_Unicode cThousandSep; // sign for thousand delimiter
// Text for output:
- String sOnStrg;
- String sOffStrg;
- String sYesStrg;
- String sNoStrg;
- String sTrueStrg;
- String sFalseStrg;
- String sCurrencyStrg;
- String sCurrencyFormatStrg;
+ OUString sOnStrg;
+ OUString sOffStrg;
+ OUString sYesStrg;
+ OUString sNoStrg;
+ OUString sTrueStrg;
+ OUString sFalseStrg;
+ OUString sCurrencyStrg;
+ OUString sCurrencyFormatStrg;
//*** temporary data for scan loop ***
//-----------------------------------------------
// String containing the number in scientific format
- String sSciNumStrg;
+ OUString sSciNumStrg;
// String containing the exponent of the number
- String sNumExpStrg;
+ OUString sNumExpStrg;
double dNum; // the number that is scanned
short nNumExp; // the exponent of the number
short nExpExp; // the number of digits in the exponent
diff --git a/basic/inc/basic/sbxmeth.hxx b/basic/inc/basic/sbxmeth.hxx
index 3bdde98d064a..227c00cbad88 100644
--- a/basic/inc/basic/sbxmeth.hxx
+++ b/basic/inc/basic/sbxmeth.hxx
@@ -28,7 +28,7 @@ class BASIC_DLLPUBLIC SbxMethod : public SbxVariable
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_METHOD,1);
TYPEINFO();
- SbxMethod( const String& r, SbxDataType t );
+ SbxMethod( const OUString& r, SbxDataType t );
SbxMethod( const SbxMethod& r );
~SbxMethod();
SbxMethod& operator=( const SbxMethod& r ) { SbxVariable::operator=( r ); return *this; }
diff --git a/basic/inc/basic/sbxobj.hxx b/basic/inc/basic/sbxobj.hxx
index 378ac20716ef..2dc4aa735513 100644
--- a/basic/inc/basic/sbxobj.hxx
+++ b/basic/inc/basic/sbxobj.hxx
@@ -35,8 +35,8 @@ protected:
SbxArrayRef pProps; // Properties
SbxArrayRef pObjs; // Objects
SbxProperty* pDfltProp; // Default-Property
- String aClassName; // Classname
- String aDfltPropName;
+ OUString aClassName; // Classname
+ OUString aDfltPropName;
virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
virtual sal_Bool StoreData( SvStream& ) const;
virtual ~SbxObject();
@@ -45,41 +45,41 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_OBJECT,1);
TYPEINFO();
- SbxObject( const String& rClassname );
+ SbxObject( const OUString& rClassname );
SbxObject( const SbxObject& );
SbxObject& operator=( const SbxObject& );
virtual SbxDataType GetType() const;
virtual SbxClassType GetClass() const;
virtual void Clear();
- virtual sal_Bool IsClass( const rtl::OUString& ) const;
- const String& GetClassName() const { return aClassName; }
- void SetClassName( const String &rNew ) { aClassName = rNew; }
+ virtual sal_Bool IsClass( const OUString& ) const;
+ const OUString& GetClassName() const { return aClassName; }
+ void SetClassName( const OUString &rNew ) { aClassName = rNew; }
// Default-Property
SbxProperty* GetDfltProperty();
- void SetDfltProperty( const String& r );
+ void SetDfltProperty( const OUString& r );
// Search for an element
virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
- SbxVariable* FindQualified( const String&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ SbxVariable* FindQualified( const OUString&, SbxClassType );
// Quick-Call-Interface for Methods
- virtual sal_Bool Call( const String&, SbxArray* = NULL );
+ virtual sal_Bool Call( const OUString&, SbxArray* = NULL );
// Execution of DDE-Commands
- SbxVariable* Execute( const String& );
+ SbxVariable* Execute( const OUString& );
// Manage elements
virtual sal_Bool GetAll( SbxClassType ) { return sal_True; }
- SbxVariable* Make( const String&, SbxClassType, SbxDataType );
- virtual SbxObject* MakeObject( const String&, const String& );
+ SbxVariable* Make( const OUString&, SbxClassType, SbxDataType );
+ virtual SbxObject* MakeObject( const OUString&, const OUString& );
virtual void Insert( SbxVariable* );
// AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
// without Broadcasts, only used in SO2/auto.cxx
void QuickInsert( SbxVariable* );
- virtual void Remove( const String&, SbxClassType );
+ virtual void Remove( const OUString&, SbxClassType );
virtual void Remove( SbxVariable* );
// Macro-Recording
- virtual String GenerateSource( const String &rLinePrefix,
- const SbxObject *pRelativeTo );
+ virtual OUString GenerateSource( const OUString &rLinePrefix,
+ const SbxObject *pRelativeTo );
// Direct access on arrays
SbxArray* GetMethods() { return pMethods; }
SbxArray* GetProperties() { return pProps; }
diff --git a/basic/inc/basic/sbxprop.hxx b/basic/inc/basic/sbxprop.hxx
index 8b3bdb90d1f8..89d774d4967f 100644
--- a/basic/inc/basic/sbxprop.hxx
+++ b/basic/inc/basic/sbxprop.hxx
@@ -28,11 +28,11 @@ class BASIC_DLLPUBLIC SbxProperty : public SbxVariable
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_PROPERTY,1);
TYPEINFO();
- SbxProperty( const String& r, SbxDataType t );
+ SbxProperty( const OUString& r, SbxDataType t );
SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {}
virtual ~SbxProperty();
SbxProperty& operator=( const SbxProperty& r )
- { SbxVariable::operator=( r ); return *this; }
+ { SbxVariable::operator=( r ); return *this; }
virtual SbxClassType GetClass() const;
};
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index 8bbd87b4871b..4d4a8b625bc3 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -21,7 +21,6 @@
#define SBXVAR_HXX
#include <rtl/ustring.hxx>
-#include <tools/string.hxx>
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <basic/sbxcore.hxx>
#include "basicdllapi.h"
@@ -46,7 +45,7 @@ struct SbxValues
float nSingle;
double nDouble;
- rtl::OUString* pOUString;
+ OUString* pOUString;
SbxDecimal* pDecimal;
SbxBase* pObj;
@@ -81,7 +80,7 @@ struct SbxValues
SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
- SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {}
+ SbxValues( const OUString* _pString ): pOUString( (OUString*)_pString ), eType(SbxSTRING) {}
SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
@@ -95,8 +94,8 @@ class BASIC_DLLPUBLIC SbxValue : public SbxBase
BASIC_DLLPRIVATE SbxValue* TheRealValue() const;
protected:
SbxValues aData; // Data
- ::rtl::OUString aPic; // Picture-String
- String aToolString; // tool string copy
+ OUString aPic; // Picture-String
+ OUString aToolString; // tool string copy
virtual void Broadcast( sal_uIntPtr ); // Broadcast-Call
virtual ~SbxValue();
@@ -160,15 +159,14 @@ public:
double GetDouble() const;
double GetDate() const;
- sal_Bool GetBool() const;
- const String& GetString() const;
- const String& GetCoreString() const;
- rtl::OUString GetOUString() const;
+ sal_Bool GetBool() const;
+ const OUString& GetCoreString() const;
+ OUString GetOUString() const;
SbxBase* GetObject() const;
sal_uInt8 GetByte() const;
- sal_uInt16 GetUShort() const;
- sal_uInt32 GetULong() const;
+ sal_uInt16 GetUShort() const;
+ sal_uInt32 GetULong() const;
sal_Bool PutInteger( sal_Int16 );
sal_Bool PutLong( sal_Int32 );
@@ -177,10 +175,10 @@ public:
sal_Bool PutDate( double );
sal_Bool PutBool( sal_Bool );
sal_Bool PutErr( sal_uInt16 );
- sal_Bool PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "sal_True"/"sal_False")
+ sal_Bool PutStringExt( const OUString& ); // with extended analysis (International, "sal_True"/"sal_False")
sal_Bool PutInt64( sal_Int64 );
sal_Bool PutUInt64( sal_uInt64 );
- sal_Bool PutString( const ::rtl::OUString& );
+ sal_Bool PutString( const OUString& );
sal_Bool PutChar( sal_Unicode );
sal_Bool PutByte( sal_uInt8 );
sal_Bool PutUShort( sal_uInt16 );
@@ -194,15 +192,15 @@ public:
sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
sal_Bool PutCurrency( const sal_Int64& );
// Interface for CDbl in Basic
- static SbxError ScanNumIntnl( const String& rSrc, double& nVal, bool bSingle = false );
+ static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
sal_Bool PutObject( SbxBase* );
virtual sal_Bool Convert( SbxDataType );
virtual sal_Bool Compute( SbxOperator, const SbxValue& );
virtual sal_Bool Compare( SbxOperator, const SbxValue& ) const;
- sal_Bool Scan( const String&, sal_uInt16* = NULL );
- void Format( String&, const String* = NULL ) const;
+ sal_Bool Scan( const OUString&, sal_uInt16* = NULL );
+ void Format( OUString&, const OUString* = NULL ) const;
// The following operators are definied for easier handling.
// TODO: Ensure error conditions (overflow, conversions)
@@ -291,9 +289,9 @@ class BASIC_DLLPUBLIC SbxVariable : public SbxValue
SbxVariableImpl* mpSbxVariableImpl; // Impl data
SfxBroadcaster* pCst; // Broadcaster, if needed
- String maName; // Name, if available
+ OUString maName; // Name, if available
SbxArrayRef mpPar; // Parameter-Array, if set
- sal_uInt16 nHash; // Hash-ID for search
+ sal_uInt16 nHash; // Hash-ID for search
BASIC_DLLPRIVATE SbxVariableImpl* getImpl( void );
@@ -314,8 +312,8 @@ public:
void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
- virtual void SetName( const String& );
- virtual const String& GetName( SbxNameType = SbxNAME_NONE ) const;
+ virtual void SetName( const OUString& );
+ virtual const OUString& GetName( SbxNameType = SbxNAME_NONE ) const;
sal_uInt16 GetHashCode() const { return nHash; }
virtual void SetModified( sal_Bool );
@@ -342,13 +340,13 @@ public:
SbxObject* GetParent();
virtual void SetParent( SbxObject* );
- const String& GetDeclareClassName( void );
- void SetDeclareClassName( const String& );
+ const OUString& GetDeclareClassName( void );
+ void SetDeclareClassName( const OUString& );
void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
- StarBASIC* pParentBasic );
+ StarBASIC* pParentBasic );
void ClearComListener( void );
- static sal_uInt16 MakeHashCode( const String& rName );
+ static sal_uInt16 MakeHashCode( const OUString& rName );
};
SV_DECL_REF(SbxVariable)
diff --git a/basic/qa/basic_coverage/string_left_01.vb b/basic/qa/basic_coverage/string_left_01.vb
new file mode 100644
index 000000000000..ef896bef1009
--- /dev/null
+++ b/basic/qa/basic_coverage/string_left_01.vb
@@ -0,0 +1,25 @@
+'
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'
+
+
+Function doUnitTest as Integer
+
+Dim s1 As String
+Dim s2 As String
+
+ s1 = "abc"
+
+ s2 = Left(s1, 2)
+
+ If s2 = "ab" Then
+ doUnitTest = 1
+ Else
+ doUnitTest = 0
+ End If
+
+End Function
diff --git a/basic/qa/basic_coverage/string_right_01.vb b/basic/qa/basic_coverage/string_right_01.vb
new file mode 100644
index 000000000000..65b16c6a8762
--- /dev/null
+++ b/basic/qa/basic_coverage/string_right_01.vb
@@ -0,0 +1,24 @@
+'
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'
+
+Function doUnitTest as Integer
+
+Dim s1 As String
+Dim s2 As String
+
+ s1 = "abc"
+
+ s2 = Right(s1, 2)
+
+ If s2 = "bc" Then
+ doUnitTest = 1
+ Else
+ doUnitTest = 0
+ End If
+
+End Function
diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx
new file mode 100644
index 000000000000..d78a28f9efc9
--- /dev/null
+++ b/basic/qa/cppunit/basic_coverage.cxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "basictest.hxx"
+#include <osl/file.hxx>
+#include "basic/sbmod.hxx"
+#include "basic/sbmeth.hxx"
+
+
+namespace
+{
+
+class Coverage : public BasicTestBase
+{
+private:
+ bool m_bError;
+ int m_nb_tests;
+ int m_nb_tests_ok;
+ int m_nb_tests_ko;
+ int m_nb_tests_skipped;
+ OUString m_sCurrentTest;
+ void process_directory(OUString sDirName);
+ void process_file(OUString sFileName);
+ void run_test(OUString sFileName, OUString sCode);
+ void test_start(OUString /* sFileName */);
+ void test_failed(void);
+ void test_success(void);
+ void print_summary() {};
+
+ DECL_LINK( CoverageErrorHdl, StarBASIC * );
+
+public:
+ Coverage();
+ ~Coverage();
+
+ void Coverage_Iterator();
+
+ // Adds code needed to register the test suite
+ CPPUNIT_TEST_SUITE(Coverage);
+
+ // Declares the method as a test to call
+ CPPUNIT_TEST(Coverage_Iterator);
+
+ // End of test suite definition
+ CPPUNIT_TEST_SUITE_END();
+};
+
+IMPL_LINK( Coverage, CoverageErrorHdl, StarBASIC *, /*pBasic*/)
+{
+ fprintf(stderr,"%s:(%d:%d)\n",
+ rtl::OUStringToOString( m_sCurrentTest, RTL_TEXTENCODING_UTF8 ).getStr(),
+ StarBASIC::GetLine(), StarBASIC::GetCol1());
+ fprintf(stderr,"Basic error: %s\n", rtl::OUStringToOString( StarBASIC::GetErrorText(), RTL_TEXTENCODING_UTF8 ).getStr() );
+ m_bError = true;
+ return 0;
+}
+
+Coverage::Coverage()
+ : m_bError(false)
+ , m_nb_tests(0)
+ , m_nb_tests_ok(0)
+ , m_nb_tests_ko(0)
+ , m_nb_tests_skipped(0)
+{
+}
+
+Coverage::~Coverage()
+{
+ fprintf(stderr,"basic coverage Summary : skipped:%d pass:%d failed:%d\n", m_nb_tests_skipped, m_nb_tests_ok, m_nb_tests_ko );
+ if(m_nb_tests_ko)
+ {
+ CPPUNIT_FAIL("");
+ }
+}
+
+void Coverage::test_start(OUString sFileName)
+{
+ m_nb_tests += 1;
+ m_sCurrentTest = sFileName;
+}
+
+void Coverage::test_failed()
+{
+ m_nb_tests_ko += 1;
+ fprintf(stderr,"%s,FAIL\n", rtl::OUStringToOString( m_sCurrentTest, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+}
+
+void Coverage::test_success()
+{
+ m_nb_tests_ok += 1;
+ fprintf(stderr,"%s,PASS\n", rtl::OUStringToOString( m_sCurrentTest, RTL_TEXTENCODING_UTF8 ).getStr() );
+}
+
+void Coverage::run_test(OUString /*sFileName*/, OUString sCode)
+{
+ bool result = false;
+ CPPUNIT_ASSERT_MESSAGE( "No resource manager", basicDLL().GetBasResMgr() != NULL );
+ StarBASICRef pBasic = new StarBASIC();
+ ResetError();
+ StarBASIC::SetGlobalErrorHdl( LINK( this, Coverage, CoverageErrorHdl ) );
+
+ SbModule* pMod = pBasic->MakeModule( rtl::OUString( "TestModule" ), sCode );
+ pMod->Compile();
+ if(!m_bError)
+ {
+ SbMethod* pMeth = static_cast<SbMethod*>(pMod->Find( rtl::OUString("doUnitTest"), SbxCLASS_METHOD ));
+ if(pMeth)
+ {
+ SbxVariableRef refTemp = pMeth;
+ // forces a broadcast
+ SbxVariableRef pNew = new SbxMethod( *((SbxMethod*)pMeth));
+ if(pNew->GetInteger() == 1 )
+ {
+ result = true;
+ }
+ }
+ }
+ if(result)
+ {
+ test_success();
+ }
+ else
+ {
+ test_failed();
+ }
+}
+
+void Coverage::process_file(OUString sFileName)
+{
+ osl::File aFile(sFileName);
+
+ test_start(sFileName);
+ if(osl::FileBase::E_None == aFile.open(osl_File_OpenFlag_Read))
+ {
+ sal_uInt64 size;
+ sal_uInt64 size_read;
+ if(osl::FileBase::E_None == aFile.getSize(size))
+ {
+ void* buffer = calloc(1, size+1);
+ CPPUNIT_ASSERT(buffer);
+ if(osl::FileBase::E_None == aFile.read( buffer, size, size_read))
+ {
+ if(size == size_read)
+ {
+ OUString sCode((sal_Char*)buffer, size, RTL_TEXTENCODING_UTF8);
+ run_test(sFileName, sCode);
+ return;
+ }
+ }
+ }
+ }
+ test_failed();
+}
+
+void Coverage::process_directory(OUString sDirName)
+{
+ osl::Directory aDir(sDirName);
+ osl::DirectoryItem aItem;
+ osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
+
+ if(osl::FileBase::E_None == aDir.open())
+ {
+ while (aDir.getNextItem(aItem) == osl::FileBase::E_None)
+ {
+ aItem.getFileStatus(aFileStatus);
+ if(aFileStatus.isRegular())
+ {
+ process_file(aFileStatus.getFileURL());
+ }
+ }
+ }
+ else
+ {
+ }
+ fprintf(stderr,"end process directory\n");
+}
+
+void Coverage::Coverage_Iterator(void)
+{
+ OUString sDirName = getURLFromSrc("/basic/qa/basic_coverage/");
+
+ CPPUNIT_ASSERT(!sDirName.isEmpty());
+ process_directory(sDirName);
+}
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(Coverage);
+
+}
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index 1bfb2f281860..5f0078d67660 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -41,6 +41,7 @@
#include <unotools/eventlisteneradapter.hxx>
#include <rtl/instance.hxx>
+#include <rtl/strbuf.hxx>
#include <map>
@@ -284,12 +285,13 @@ namespace basic
// Determine Directory
SvtPathOptions aPathCFG;
- String aAppBasicDir( aPathCFG.GetBasicPath() );
- if ( !aAppBasicDir.Len() )
+ OUString aAppBasicDir( aPathCFG.GetBasicPath() );
+ if ( aAppBasicDir.isEmpty() )
+ {
aPathCFG.SetBasicPath(rtl::OUString("$(prog)"));
-
+ }
// soffice.new search only in user dir => first dir
- String aAppFirstBasicDir = aAppBasicDir.GetToken(1);
+ OUString aAppFirstBasicDir = aAppBasicDir.getToken(1, ';');
// Create basic and load it
// AppBasicDir is now a PATH
@@ -300,8 +302,8 @@ namespace basic
setApplicationBasicManager( pBasicManager );
// The first dir in the path as destination:
- String aFileName( aAppBasic.getName() );
- aAppBasic = INetURLObject( aAppBasicDir.GetToken(1) );
+ OUString aFileName( aAppBasic.getName() );
+ aAppBasic = INetURLObject( aAppBasicDir.getToken(1, ';') );
DBG_ASSERT(aAppBasic.GetProtocol() != INET_PROT_NOT_VALID,
rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Invalid URL: \"")).
append(rtl::OUStringToOString(aAppBasicDir,
@@ -327,10 +329,8 @@ namespace basic
// StarDesktop
Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
- pBasicManager->SetGlobalUNOConstant(
- "StarDesktop",
- makeAny( xSMgr->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ) )
- );
+ pBasicManager->SetGlobalUNOConstant( "StarDesktop",
+ makeAny( xSMgr->createInstance("com.sun.star.frame.Desktop")));
// (BasicLibraries and DialogLibraries have automatically been added in SetLibraryContainerInfo)
@@ -401,12 +401,16 @@ namespace basic
try
{
// ensure there's a standard library in the basic container
- ::rtl::OUString aStdLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ OUString aStdLibName( "Standard" );
if ( !_rxBasicLibraries->hasByName( aStdLibName ) )
+ {
_rxBasicLibraries->createLibrary( aStdLibName );
+ }
// as well as in the dialog container
if ( !_rxDialogLibraries->hasByName( aStdLibName ) )
+ {
_rxDialogLibraries->createLibrary( aStdLibName );
+ }
}
catch( const Exception& )
{
@@ -422,9 +426,10 @@ namespace basic
_out_rpBasicManager = 0;
Reference< XStorage > xStorage;
if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) )
+ {
// the document is not able to provide the storage it is based on.
return;
-
+ }
Reference< XPersistentLibraryContainer > xBasicLibs;
Reference< XPersistentLibraryContainer > xDialogLibs;
if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) )
@@ -436,11 +441,11 @@ namespace basic
// load BASIC-manager
SfxErrorContext aErrContext( ERRCTX_SFX_LOADBASIC,
::comphelper::DocumentInfo::getDocumentTitle( _rxDocumentModel ) );
- String aAppBasicDir = SvtPathOptions().GetBasicPath();
+ OUString aAppBasicDir = SvtPathOptions().GetBasicPath();
// Storage and BaseURL are only needed by binary documents!
- SotStorageRef xDummyStor = new SotStorage( ::rtl::OUString() );
- _out_rpBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */,
+ SotStorageRef xDummyStor = new SotStorage( OUString() );
+ _out_rpBasicManager = new BasicManager( *xDummyStor, OUString() /* TODO/LATER: xStorage */,
pAppBasic,
&aAppBasicDir, sal_True );
if ( !_out_rpBasicManager->GetErrors().empty() )
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 3bd3a52438b2..14ffe0902826 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -143,17 +143,17 @@ typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListen
class BasMgrContainerListenerImpl: public ContainerListenerHelper
{
BasicManager* mpMgr;
- ::rtl::OUString maLibName; // empty -> no lib, but lib container
+ OUString maLibName; // empty -> no lib, but lib container
public:
- BasMgrContainerListenerImpl( BasicManager* pMgr, ::rtl::OUString aLibName )
+ BasMgrContainerListenerImpl( BasicManager* pMgr, OUString aLibName )
: mpMgr( pMgr )
, maLibName( aLibName ) {}
static void insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, BasicManager* pMgr,
- uno::Any aLibAny, ::rtl::OUString aLibName );
+ uno::Any aLibAny, OUString aLibName );
static void addLibraryModulesImpl( BasicManager* pMgr, uno::Reference< container::XNameAccess > xLibNameAccess,
- ::rtl::OUString aLibName );
+ OUString aLibName );
// XEventListener
@@ -175,7 +175,7 @@ public:
//============================================================================
void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont,
- BasicManager* pMgr, uno::Any aLibAny, ::rtl::OUString aLibName )
+ BasicManager* pMgr, uno::Any aLibAny, OUString aLibName )
{
Reference< container::XNameAccess > xLibNameAccess;
aLibAny >>= xLibNameAccess;
@@ -208,21 +208,21 @@ void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< scrip
void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
- uno::Reference< container::XNameAccess > xLibNameAccess, ::rtl::OUString aLibName )
+ uno::Reference< container::XNameAccess > xLibNameAccess, OUString aLibName )
{
- uno::Sequence< ::rtl::OUString > aModuleNames = xLibNameAccess->getElementNames();
+ uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames();
sal_Int32 nModuleCount = aModuleNames.getLength();
StarBASIC* pLib = pMgr->GetLib( aLibName );
DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::addLibraryModulesImpl: Unknown lib!");
if( pLib )
{
- const ::rtl::OUString* pNames = aModuleNames.getConstArray();
+ const OUString* pNames = aModuleNames.getConstArray();
for( sal_Int32 j = 0 ; j < nModuleCount ; j++ )
{
- ::rtl::OUString aModuleName = pNames[ j ];
+ OUString aModuleName = pNames[ j ];
uno::Any aElement = xLibNameAccess->getByName( aModuleName );
- ::rtl::OUString aMod;
+ OUString aMod;
aElement >>= aMod;
uno::Reference< vba::XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, uno::UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aModuleName ) )
@@ -257,7 +257,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const container::Con
throw( uno::RuntimeException )
{
sal_Bool bLibContainer = ( maLibName.getLength() == 0 );
- ::rtl::OUString aName;
+ OUString aName;
Event.Accessor >>= aName;
if( bLibContainer )
@@ -282,7 +282,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const container::Con
SbModule* pMod = pLib->FindModule( aName );
if( !pMod )
{
- ::rtl::OUString aMod;
+ OUString aMod;
Event.Element >>= aMod;
uno::Reference< vba::XVBAModuleInfo > xVBAModuleInfo( Event.Source, uno::UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aName ) )
@@ -303,7 +303,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const container::Con
void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const container::ContainerEvent& Event )
throw( uno::RuntimeException )
{
- ::rtl::OUString aName;
+ OUString aName;
Event.Accessor >>= aName;
// Replace not possible for library container
@@ -316,7 +316,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const container::Con
if( pLib )
{
SbModule* pMod = pLib->FindModule( aName );
- ::rtl::OUString aMod;
+ OUString aMod;
Event.Element >>= aMod;
if( pMod )
@@ -333,7 +333,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const container::Con
void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::ContainerEvent& Event )
throw( uno::RuntimeException )
{
- ::rtl::OUString aName;
+ OUString aName;
Event.Accessor >>= aName;
sal_Bool bLibContainer = ( maLibName.getLength() == 0 );
@@ -358,7 +358,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::Cont
}
}
-BasicError::BasicError( sal_uIntPtr nId, sal_uInt16 nR, const String& rErrStr ) :
+BasicError::BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr ) :
aErrStr( rErrStr )
{
nErrorId = nId;
@@ -379,10 +379,10 @@ class BasicLibInfo
{
private:
StarBASICRef xLib;
- String aLibName;
- String aStorageName; // String is sufficient, unique at runtime
- String aRelStorageName;
- String aPassword;
+ OUString aLibName;
+ OUString aStorageName; // string is sufficient, unique at runtime
+ OUString aRelStorageName;
+ OUString aPassword;
sal_Bool bDoLoad;
sal_Bool bReference;
@@ -397,13 +397,13 @@ public:
sal_Bool IsReference() const { return bReference; }
sal_Bool& IsReference() { return bReference; }
- sal_Bool IsExtern() const { return ! aStorageName.EqualsAscii(szImbedded); }
+ sal_Bool IsExtern() const { return ! aStorageName.equalsAscii(szImbedded); }
- void SetStorageName( const String& rName ) { aStorageName = rName; }
- const String& GetStorageName() const { return aStorageName; }
+ void SetStorageName( const OUString& rName ) { aStorageName = rName; }
+ const OUString& GetStorageName() const { return aStorageName; }
- void SetRelStorageName( const String& rN ) { aRelStorageName = rN; }
- const String& GetRelStorageName() const { return aRelStorageName; }
+ void SetRelStorageName( const OUString& rN ) { aRelStorageName = rN; }
+ const OUString& GetRelStorageName() const { return aRelStorageName; }
StarBASICRef GetLib() const
{
@@ -415,15 +415,15 @@ public:
StarBASICRef& GetLibRef() { return xLib; }
void SetLib( StarBASIC* pBasic ) { xLib = pBasic; }
- const String& GetLibName() const { return aLibName; }
- void SetLibName( const String& rName ) { aLibName = rName; }
+ const OUString& GetLibName() const { return aLibName; }
+ void SetLibName( const OUString& rName ) { aLibName = rName; }
// Only temporary for Load/Save
sal_Bool DoLoad() { return bDoLoad; }
- sal_Bool HasPassword() const { return aPassword.Len() != 0; }
- const String& GetPassword() const { return aPassword; }
- void SetPassword( const String& rNewPassword )
+ sal_Bool HasPassword() const { return !aPassword.isEmpty(); }
+ const OUString& GetPassword() const { return aPassword; }
+ void SetPassword( const OUString& rNewPassword )
{ aPassword = rNewPassword; }
sal_Bool IsPasswordVerified() const { return bPasswordVerified; }
void SetPasswordVerified() { bPasswordVerified = sal_True; }
@@ -447,7 +447,7 @@ private:
public:
~BasicLibs();
- String aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
+ OUString aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
BasicLibInfo* GetObject( size_t i );
BasicLibInfo* First();
BasicLibInfo* Next();
@@ -529,8 +529,8 @@ BasicLibInfo::BasicLibInfo()
bPasswordVerified = sal_False;
bDoLoad = sal_False;
mxScriptCont = NULL;
- aStorageName = rtl::OUString(szImbedded);
- aRelStorageName = rtl::OUString(szImbedded);
+ aStorageName = szImbedded;
+ aRelStorageName = szImbedded;
}
BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
@@ -554,15 +554,15 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
pInfo->bDoLoad = bDoLoad;
// The name of the lib...
- String aName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
+ OUString aName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetLibName( aName );
// Absolute path...
- String aStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
+ OUString aStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetStorageName( aStorageName );
// Relative path...
- String aRelStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
+ OUString aRelStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetRelStorageName( aRelStorageName );
if ( nVer >= 2 )
@@ -577,21 +577,22 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
return pInfo;
}
-BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib, String* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
+BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
{
DBG_CTOR( BasicManager, 0 );
Init();
if( pLibPath )
+ {
pLibs->aBasicLibPath = *pLibPath;
-
- String aStorName( rStorage.GetName() );
+ }
+ OUString aStorName( rStorage.GetName() );
maStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
// If there is no Manager Stream, no further actions are necessary
- if ( rStorage.IsStream( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)) ) )
+ if ( rStorage.IsStream( OUString(szManagerStream) ) )
{
LoadBasicManager( rStorage, rBaseURL );
// StdLib contains Parent:
@@ -606,8 +607,8 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA
pStdLibInfo = CreateLibInfo();
pStdLibInfo->SetLib( pStdLib );
StarBASICRef xStdLib = pStdLibInfo->GetLib();
- xStdLib->SetName( rtl::OUString(szStdLibName) );
- pStdLibInfo->SetLibName( rtl::OUString(szStdLibName) );
+ xStdLib->SetName( OUString(szStdLibName) );
+ pStdLibInfo->SetLibName( OUString(szStdLibName) );
xStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
xStdLib->SetModified( sal_False );
}
@@ -630,13 +631,11 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA
// #91626 Save all stream data to save it unmodified if basic isn't modified
// in an 6.0+ office. So also the old basic dialogs can be saved.
- SotStorageStreamRef xManagerStream = rStorage.OpenSotStream
- ( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)), eStreamReadMode );
+ SotStorageStreamRef xManagerStream = rStorage.OpenSotStream( OUString(szManagerStream), eStreamReadMode );
mpImpl->mpManagerStream = new SvMemoryStream();
*static_cast<SvStream*>(&xManagerStream) >> *mpImpl->mpManagerStream;
- SotStorageRef xBasicStorage = rStorage.OpenSotStorage
- ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, sal_False );
+ SotStorageRef xBasicStorage = rStorage.OpenSotStorage( OUString(szBasicStorage), eStorageReadMode, sal_False );
if( xBasicStorage.Is() && !xBasicStorage->GetError() )
{
sal_uInt16 nLibs = GetLibCount();
@@ -654,7 +653,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA
else
{
ImpCreateStdLib( pParentFromStdLib );
- if ( rStorage.IsStream( rtl::OUString(szOldManagerStream) ) )
+ if ( rStorage.IsStream( OUString(szOldManagerStream) ) )
LoadOldBasicManager( rStorage );
}
}
@@ -665,7 +664,7 @@ void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInf
if ( !xScriptCont.is() )
return;
- String aLibName = pBasic->GetName();
+ OUString aLibName = pBasic->GetName();
if( !xScriptCont->hasByName( aLibName ) )
xScriptCont->createLibrary( aLibName );
@@ -681,10 +680,10 @@ void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInf
SbModule* pModule = (SbModule*)pBasic->GetModules()->Get( nMod );
DBG_ASSERT( pModule, "Modul nicht erhalten!" );
- String aModName = pModule->GetName();
+ OUString aModName = pModule->GetName();
if( !xLib->hasByName( aModName ) )
{
- ::rtl::OUString aSource = pModule->GetSource32();
+ OUString aSource = pModule->GetSource32();
uno::Any aSourceAny;
aSourceAny <<= aSource;
xLib->insertByName( aModName, aSourceAny );
@@ -708,11 +707,11 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
uno::Reference< script::XLibraryContainer > xScriptCont( mpImpl->maContainerInfo.mxScriptCont.get() );
StarBASIC* pStdLib = GetStdLib();
- String aLibName = pStdLib->GetName();
+ OUString aLibName = pStdLib->GetName();
if( xScriptCont.is() )
{
// Register listener for lib container
- ::rtl::OUString aEmptyLibName;
+ OUString aEmptyLibName;
uno::Reference< container::XContainerListener > xLibContainerListener
= static_cast< container::XContainerListener* >
( new BasMgrContainerListenerImpl( this, aEmptyLibName ) );
@@ -720,8 +719,8 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
uno::Reference< container::XContainer> xLibContainer( xScriptCont, uno::UNO_QUERY );
xLibContainer->addContainerListener( xLibContainerListener );
- uno::Sequence< ::rtl::OUString > aScriptLibNames = xScriptCont->getElementNames();
- const ::rtl::OUString* pScriptLibName = aScriptLibNames.getConstArray();
+ uno::Sequence< OUString > aScriptLibNames = xScriptCont->getElementNames();
+ const OUString* pScriptLibName = aScriptLibNames.getConstArray();
sal_Int32 i, nNameCount = aScriptLibNames.getLength();
if( nNameCount )
@@ -774,27 +773,28 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
SetGlobalUNOConstant( "DialogLibraries", makeAny( mpImpl->maContainerInfo.mxDialogCont ) );
}
-BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
+BasicManager::BasicManager( StarBASIC* pSLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
{
DBG_CTOR( BasicManager, 0 );
Init();
DBG_ASSERT( pSLib, "BasicManager cannot be created with a NULL-Pointer!" );
if( pLibPath )
+ {
pLibs->aBasicLibPath = *pLibPath;
-
+ }
BasicLibInfo* pStdLibInfo = CreateLibInfo();
pStdLibInfo->SetLib( pSLib );
StarBASICRef xStdLib = pStdLibInfo->GetLib();
- xStdLib->SetName(rtl::OUString(szStdLibName));
- pStdLibInfo->SetLibName( rtl::OUString(szStdLibName) );
+ xStdLib->SetName(OUString(szStdLibName));
+ pStdLibInfo->SetLibName(OUString(szStdLibName) );
pSLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
// Save is only necessary if basic has changed
xStdLib->SetModified( sal_False );
}
-void BasicManager::ImpMgrNotLoaded( const String& rStorageName )
+void BasicManager::ImpMgrNotLoaded( const OUString& rStorageName )
{
// pErrInf is only destroyed if the error os processed by an
// ErrorHandler
@@ -805,8 +805,8 @@ void BasicManager::ImpMgrNotLoaded( const String& rStorageName )
BasicLibInfo* pStdLibInfo = CreateLibInfo();
pStdLibInfo->SetLib( new StarBASIC( NULL, mbDocMgr ) );
StarBASICRef xStdLib = pStdLibInfo->GetLib();
- xStdLib->SetName( rtl::OUString(szStdLibName) );
- pStdLibInfo->SetLibName( rtl::OUString(szStdLibName) );
+ xStdLib->SetName( OUString(szStdLibName) );
+ pStdLibInfo->SetLibName( OUString(szStdLibName) );
xStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
xStdLib->SetModified( sal_False );
}
@@ -817,20 +817,19 @@ void BasicManager::ImpCreateStdLib( StarBASIC* pParentFromStdLib )
BasicLibInfo* pStdLibInfo = CreateLibInfo();
StarBASIC* pStdLib = new StarBASIC( pParentFromStdLib, mbDocMgr );
pStdLibInfo->SetLib( pStdLib );
- pStdLib->SetName( rtl::OUString(szStdLibName) );
- pStdLibInfo->SetLibName( rtl::OUString(szStdLibName) );
+ pStdLib->SetName( OUString(szStdLibName) );
+ pStdLibInfo->SetLibName( OUString(szStdLibName) );
pStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
}
-void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, sal_Bool bLoadLibs )
+void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL, sal_Bool bLoadLibs )
{
DBG_CHKTHIS( BasicManager, 0 );
- SotStorageStreamRef xManagerStream = rStorage.OpenSotStream
- ( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)), eStreamReadMode );
+ SotStorageStreamRef xManagerStream = rStorage.OpenSotStream( OUString(szManagerStream), eStreamReadMode );
- String aStorName( rStorage.GetName() );
+ OUString aStorName( rStorage.GetName() );
// #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
if ( !xManagerStream.Is() || xManagerStream->GetError() || ( xManagerStream->Seek( STREAM_SEEK_TO_END ) == 0 ) )
@@ -842,13 +841,15 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
maStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
// #i13114 removed, DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name");
- String aRealStorageName = maStorageName; // for relative paths, can be modified through BaseURL
+ OUString aRealStorageName = maStorageName; // for relative paths, can be modified through BaseURL
- if ( rBaseURL.Len() )
+ if ( !rBaseURL.isEmpty() )
{
INetURLObject aObj( rBaseURL );
if ( aObj.GetProtocol() == INET_PROT_FILE )
+ {
aRealStorageName = aObj.PathToFileName();
+ }
}
xManagerStream->SetBufferSize( 1024 );
@@ -871,7 +872,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
// Correct absolute pathname if relative is existing.
// Always try relative first if there are two stands on disk
- if ( pInfo->GetRelStorageName().Len() && ( ! pInfo->GetRelStorageName().EqualsAscii(szImbedded) ) )
+ if ( !pInfo->GetRelStorageName().isEmpty() && ( ! pInfo->GetRelStorageName().equalsAscii(szImbedded) ) )
{
INetURLObject aObj( aRealStorageName, INET_PROT_FILE );
aObj.removeSegment();
@@ -880,12 +881,13 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
//*** TODO: Replace if still necessary
//*** TODO-End
- if ( pLibs->aBasicLibPath.Len() )
+ if ( ! pLibs->aBasicLibPath.isEmpty() )
{
// Search lib in path
- String aSearchFile = pInfo->GetRelStorageName();
+ OUString aSearchFile = pInfo->GetRelStorageName();
+ String aSearchFileOldFormat(aSearchFile);
SvtPathOptions aPathCFG;
- if( aPathCFG.SearchFile( aSearchFile, SvtPathOptions::PATH_BASIC ) )
+ if( aPathCFG.SearchFile( aSearchFileOldFormat, SvtPathOptions::PATH_BASIC ) )
{
pInfo->SetStorageName( aSearchFile );
}
@@ -896,7 +898,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
// Libs from external files should be loaded only when necessary.
// But references are loaded at once, otherwise some big customers get into trouble
if ( bLoadLibs && pInfo->DoLoad() &&
- ( ( !pInfo->IsExtern() ) || ( pInfo->IsReference() ) ) )
+ ( !pInfo->IsExtern() || pInfo->IsReference()))
{
ImpLoadLibrary( pInfo, &rStorage );
}
@@ -912,11 +914,10 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
DBG_CHKTHIS( BasicManager, 0 );
- SotStorageStreamRef xManagerStream = rStorage.OpenSotStream
- ( rtl::OUString(szOldManagerStream), eStreamReadMode );
+ SotStorageStreamRef xManagerStream = rStorage.OpenSotStream( OUString(szOldManagerStream), eStreamReadMode );
- String aStorName( rStorage.GetName() );
- DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
+ OUString aStorName( rStorage.GetName() );
+ DBG_ASSERT( aStorName.getLength(), "No Storage Name!" );
if ( !xManagerStream.Is() || xManagerStream->GetError() || ( xManagerStream->Seek( STREAM_SEEK_TO_END ) == 0 ) )
{
@@ -940,23 +941,23 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
// and it proceeds ...
}
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
- String aLibs = xManagerStream->ReadUniOrByteString(xManagerStream->GetStreamCharSet());
+ OUString aLibs = xManagerStream->ReadUniOrByteString(xManagerStream->GetStreamCharSet());
xManagerStream->SetBufferSize( 0 );
xManagerStream.Clear(); // Close stream
- if ( aLibs.Len() )
+ if ( !aLibs.isEmpty() )
{
- String aCurStorageName( aStorName );
+ OUString aCurStorageName( aStorName );
INetURLObject aCurStorage( aCurStorageName, INET_PROT_FILE );
sal_Int32 nLibs = comphelper::string::getTokenCount(aLibs, LIB_SEP);
for ( sal_Int32 nLib = 0; nLib < nLibs; nLib++ )
{
- String aLibInfo(comphelper::string::getToken(aLibs, nLib, LIB_SEP));
+ OUString aLibInfo(comphelper::string::getToken(aLibs, nLib, LIB_SEP));
// TODO: Remove == 2
DBG_ASSERT( ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 2 ) || ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 3 ), "Ungueltige Lib-Info!" );
- String aLibName( aLibInfo.GetToken( 0, LIBINFO_SEP ) );
- String aLibAbsStorageName( aLibInfo.GetToken( 1, LIBINFO_SEP ) );
- String aLibRelStorageName( aLibInfo.GetToken( 2, LIBINFO_SEP ) );
+ OUString aLibName( aLibInfo.getToken( 0, LIBINFO_SEP ) );
+ OUString aLibAbsStorageName( aLibInfo.getToken( 1, LIBINFO_SEP ) );
+ OUString aLibRelStorageName( aLibInfo.getToken( 2, LIBINFO_SEP ) );
INetURLObject aLibAbsStorage( aLibAbsStorageName, INET_PROT_FILE );
INetURLObject aLibRelStorage( aStorName );
@@ -966,8 +967,10 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
DBG_ASSERT(!bWasAbsolute, "RelStorageName was absolute!" );
SotStorageRef xStorageRef;
- if ( ( aLibAbsStorage == aCurStorage ) || ( aLibRelStorageName.EqualsAscii(szImbedded) ) )
+ if ( ( aLibAbsStorage == aCurStorage ) || ( aLibRelStorageName.equalsAscii(szImbedded) ) )
+ {
xStorageRef = &rStorage;
+ }
else
{
xStorageRef = new SotStorage( sal_False, aLibAbsStorage.GetMainURL
@@ -977,7 +980,9 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
GetMainURL( INetURLObject::NO_DECODE ), eStorageReadMode, sal_True );
}
if ( xStorageRef.Is() )
+ {
AddLib( *xStorageRef, aLibName, sal_False );
+ }
else
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, ERRCODE_BUTTON_OK );
@@ -1007,7 +1012,7 @@ void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
}
-bool BasicManager::HasExeCode( const String& sLib )
+bool BasicManager::HasExeCode( const OUString& sLib )
{
StarBASIC* pLib = GetLib(sLib);
if ( pLib )
@@ -1048,15 +1053,16 @@ sal_Bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurS
DBG_ASSERT( pLibInfo, "LibInfo!?" );
- String aStorageName( pLibInfo->GetStorageName() );
- if ( !aStorageName.Len() || ( aStorageName.EqualsAscii(szImbedded) ) )
+ OUString aStorageName( pLibInfo->GetStorageName() );
+ if ( aStorageName.isEmpty() || ( aStorageName.equalsAscii(szImbedded) ) )
+ {
aStorageName = GetStorageName();
-
+ }
SotStorageRef xStorage;
// The current must not be opened again...
if ( pCurStorage )
{
- String aStorName( pCurStorage->GetName() );
+ OUString aStorName( pCurStorage->GetName() );
// #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
INetURLObject aCurStorageEntry(aStorName, INET_PROT_FILE);
@@ -1066,14 +1072,16 @@ sal_Bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurS
// #i13114 removed, DBG_ASSERT(aCurStorageEntry.GetMainURL( INetURLObject::NO_DECODE ).Len() != 0, "Bad storage name");
if ( aCurStorageEntry == aStorageEntry )
+ {
xStorage = pCurStorage;
+ }
}
if ( !xStorage.Is() )
+ {
xStorage = new SotStorage( sal_False, aStorageName, eStorageReadMode );
-
- SotStorageRef xBasicStorage = xStorage->OpenSotStorage
- ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, sal_False );
+ }
+ SotStorageRef xBasicStorage = xStorage->OpenSotStorage( OUString(szBasicStorage), eStorageReadMode, sal_False );
if ( !xBasicStorage.Is() || xBasicStorage->GetError() )
{
@@ -1097,7 +1105,9 @@ sal_Bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurS
if ( !bInfosOnly )
{
if ( !pLibInfo->GetLib().Is() )
+ {
pLibInfo->SetLib( new StarBASIC( GetStdLib(), mbDocMgr ) );
+ }
xBasicStream->SetBufferSize( 1024 );
xBasicStream->Seek( STREAM_SEEK_TO_BEGIN );
bLoaded = ImplLoadBasic( *xBasicStream, pLibInfo->GetLibRef() );
@@ -1130,11 +1140,11 @@ sal_Bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurS
*xBasicStream >> nPasswordMarker;
if ( ( nPasswordMarker == PASSWORD_MARKER ) && !xBasicStream->IsEof() )
{
- String aPassword = xBasicStream->ReadUniOrByteString(
+ OUString aPassword = xBasicStream->ReadUniOrByteString(
xBasicStream->GetStreamCharSet());
pLibInfo->SetPassword( aPassword );
}
- xBasicStream->SetCryptMaskKey(rtl::OString());
+ xBasicStream->SetCryptMaskKey(OString());
CheckModules( pLibInfo->GetLib(), pLibInfo->IsReference() );
}
return bLoaded;
@@ -1177,7 +1187,9 @@ sal_Bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic )
{
pNew->SetParent( rOldBasic->GetParent() );
if( pNew->GetParent() )
+ {
pNew->GetParent()->Insert( pNew );
+ }
pNew->SetFlag( SBX_EXTSEARCH );
}
rOldBasic = pNew;
@@ -1190,15 +1202,18 @@ sal_Bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic )
}
}
if ( bProtected )
- rStrm.SetCryptMaskKey(rtl::OString());
+ {
+ rStrm.SetCryptMaskKey(OString());
+ }
return bLoaded;
}
void BasicManager::CheckModules( StarBASIC* pLib, sal_Bool bReference ) const
{
if ( !pLib )
+ {
return;
-
+ }
sal_Bool bModified = pLib->IsModified();
for ( sal_uInt16 nMod = 0; nMod < pLib->GetModules()->Count(); nMod++ )
@@ -1206,7 +1221,9 @@ void BasicManager::CheckModules( StarBASIC* pLib, sal_Bool bReference ) const
SbModule* pModule = (SbModule*)pLib->GetModules()->Get( nMod );
DBG_ASSERT( pModule, "Modul nicht erhalten!" );
if ( !pModule->IsCompiled() && !StarBASIC::GetErrorCode() )
+ {
pLib->Compile( pModule );
+ }
}
// #67477, AB 8.12.99 On demand compile in referenced libs should not
@@ -1218,20 +1235,21 @@ void BasicManager::CheckModules( StarBASIC* pLib, sal_Bool bReference ) const
}
}
-StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, sal_Bool bReference )
+StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const OUString& rLibName, sal_Bool bReference )
{
DBG_CHKTHIS( BasicManager, 0 );
- String aStorName( rStorage.GetName() );
- DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
+ OUString aStorName( rStorage.GetName() );
+ DBG_ASSERT( !aStorName.isEmpty(), "No Storage Name!" );
- String aStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
- DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name");
+ OUString aStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
+ DBG_ASSERT(!aStorageName.isEmpty(), "Bad storage name");
- String aNewLibName( rLibName );
+ OUString aNewLibName( rLibName );
while ( HasLib( aNewLibName ) )
- aNewLibName += '_';
-
+ {
+ aNewLibName += "_";
+ }
BasicLibInfo* pLibInfo = CreateLibInfo();
// Use original name otherwise ImpLoadLibrary failes...
pLibInfo->SetLibName( rLibName );
@@ -1245,18 +1263,19 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, s
if ( bLoaded )
{
if ( aNewLibName != rLibName )
+ {
SetLibName( nLibId, aNewLibName );
-
+ }
if ( bReference )
{
pLibInfo->GetLib()->SetModified( sal_False ); // Don't save in this case
- pLibInfo->SetRelStorageName( String() );
+ pLibInfo->SetRelStorageName( OUString() );
pLibInfo->IsReference() = sal_True;
}
else
{
pLibInfo->GetLib()->SetModified( sal_True ); // Must be saved after Add!
- pLibInfo->SetStorageName( rtl::OUString(szImbedded) ); // Save in BasicManager-Storage
+ pLibInfo->SetStorageName( OUString(szImbedded) ); // Save in BasicManager-Storage
}
}
else
@@ -1265,10 +1284,8 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, s
pLibInfo = 0;
}
- if( pLibInfo )
- return &*pLibInfo->GetLib() ;
- else
- return 0;
+ return pLibInfo ? &*pLibInfo->GetLib() : 0;
+
}
sal_Bool BasicManager::IsReference( sal_uInt16 nLib )
@@ -1278,8 +1295,9 @@ sal_Bool BasicManager::IsReference( sal_uInt16 nLib )
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib?!" );
if ( pLibInfo )
+ {
return pLibInfo->IsReference();
-
+ }
return sal_False;
}
@@ -1311,14 +1329,18 @@ sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage
{
SotStorageRef xStorage;
if ( !pLibInfo->IsExtern() )
+ {
xStorage = new SotStorage( sal_False, GetStorageName() );
+ }
else
+ {
xStorage = new SotStorage( sal_False, pLibInfo->GetStorageName() );
+ }
- if ( xStorage->IsStorage( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)) ) )
+ if ( xStorage->IsStorage( OUString(szBasicStorage) ) )
{
SotStorageRef xBasicStorage = xStorage->OpenSotStorage
- ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), STREAM_STD_READWRITE, sal_False );
+ ( OUString(szBasicStorage), STREAM_STD_READWRITE, sal_False );
if ( !xBasicStorage.Is() || xBasicStorage->GetError() )
{
@@ -1337,7 +1359,7 @@ sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage
if ( aInfoList.empty() )
{
xBasicStorage.Clear();
- xStorage->Remove( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)) );
+ xStorage->Remove( OUString(szBasicStorage) );
xStorage->Commit();
// If no further Streams or SubStorages available,
// delete the Storage, too.
@@ -1345,7 +1367,7 @@ sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage
xStorage->FillInfoList( &aInfoList );
if ( aInfoList.empty() )
{
- String aName_( xStorage->GetName() );
+ OUString aName_( xStorage->GetName() );
xStorage.Clear();
//*** TODO: Replace if still necessary
//SfxContentHelper::Kill( aName );
@@ -1356,7 +1378,9 @@ sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage
}
}
if ( pLibInfo->GetLib().Is() )
+ {
GetStdLib()->Remove( pLibInfo->GetLib() );
+ }
delete pLibs->Remove( pLibInfo );
return sal_True; // Remove was successful, del unimportant
}
@@ -1373,7 +1397,9 @@ StarBASIC* BasicManager::GetLib( sal_uInt16 nLib ) const
BasicLibInfo* pInf = pLibs->GetObject( nLib );
DBG_ASSERT( pInf, "Lib existiert nicht!" );
if ( pInf )
+ {
return pInf->GetLib();
+ }
return 0;
}
@@ -1384,52 +1410,55 @@ StarBASIC* BasicManager::GetStdLib() const
return pLib;
}
-StarBASIC* BasicManager::GetLib( const String& rName ) const
+StarBASIC* BasicManager::GetLib( const OUString& rName ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
- if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL )// Check if available...
+ if ( pInf->GetLibName().equalsIgnoreAsciiCase( rName ))// Check if available...
+ {
return pInf->GetLib();
-
+ }
pInf = pLibs->Next();
}
return 0;
}
-sal_uInt16 BasicManager::GetLibId( const String& rName ) const
+sal_uInt16 BasicManager::GetLibId( const OUString& rName ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
- if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL )
+ if ( pInf->GetLibName().equalsIgnoreAsciiCase( rName ))
+ {
return (sal_uInt16)pLibs->GetCurPos();
-
+ }
pInf = pLibs->Next();
}
return LIB_NOTFOUND;
}
-sal_Bool BasicManager::HasLib( const String& rName ) const
+sal_Bool BasicManager::HasLib( const OUString& rName ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
- if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL )
+ if ( pInf->GetLibName().equalsIgnoreAsciiCase(rName))
+ {
return sal_True;
-
+ }
pInf = pLibs->Next();
}
return sal_False;
}
-sal_Bool BasicManager::SetLibName( sal_uInt16 nLib, const String& rName )
+sal_Bool BasicManager::SetLibName( sal_uInt16 nLib, const OUString& rName )
{
DBG_CHKTHIS( BasicManager, 0 );
@@ -1449,15 +1478,17 @@ sal_Bool BasicManager::SetLibName( sal_uInt16 nLib, const String& rName )
return sal_False;
}
-String BasicManager::GetLibName( sal_uInt16 nLib )
+OUString BasicManager::GetLibName( sal_uInt16 nLib )
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib?!" );
if ( pLibInfo )
+ {
return pLibInfo->GetLibName();
- return String();
+ }
+ return OUString();
}
sal_Bool BasicManager::LoadLib( sal_uInt16 nLib )
@@ -1472,7 +1503,7 @@ sal_Bool BasicManager::LoadLib( sal_uInt16 nLib )
uno::Reference< script::XLibraryContainer > xLibContainer = pLibInfo->GetLibraryContainer();
if( xLibContainer.is() )
{
- String aLibName = pLibInfo->GetLibName();
+ OUString aLibName = pLibInfo->GetLibName();
xLibContainer->loadLibrary( aLibName );
bDone = xLibContainer->isLibraryLoaded( aLibName );;
}
@@ -1489,18 +1520,19 @@ sal_Bool BasicManager::LoadLib( sal_uInt16 nLib )
}
else
{
- StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, rtl::OUString(), ERRCODE_BUTTON_OK );
- aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_LIBNOTFOUND, rtl::OUString::valueOf(static_cast<sal_Int32>(nLib))));
+ StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), ERRCODE_BUTTON_OK );
+ aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_LIBNOTFOUND, OUString::valueOf(static_cast<sal_Int32>(nLib))));
}
return bDone;
}
-StarBASIC* BasicManager::CreateLib( const String& rLibName )
+StarBASIC* BasicManager::CreateLib( const OUString& rLibName )
{
DBG_CHKTHIS( BasicManager, 0 );
if ( GetLib( rLibName ) )
+ {
return 0;
-
+ }
BasicLibInfo* pLibInfo = CreateLibInfo();
StarBASIC* pNew = new StarBASIC( GetStdLib(), mbDocMgr );
GetStdLib()->Insert( pNew );
@@ -1512,14 +1544,14 @@ StarBASIC* BasicManager::CreateLib( const String& rLibName )
}
// For XML import/export:
-StarBASIC* BasicManager::CreateLib
- ( const String& rLibName, const String& Password, const String& LinkTargetURL )
+StarBASIC* BasicManager::CreateLib( const OUString& rLibName, const OUString& Password,
+ const OUString& LinkTargetURL )
{
// Ask if lib exists because standard lib is always there
StarBASIC* pLib = GetLib( rLibName );
if( !pLib )
{
- if( LinkTargetURL.Len() != 0 )
+ if( !LinkTargetURL.isEmpty())
{
SotStorageRef xStorage = new SotStorage( sal_False, LinkTargetURL, STREAM_READ | STREAM_SHARE_DENYWRITE );
if( !xStorage->GetError() )
@@ -1532,7 +1564,7 @@ StarBASIC* BasicManager::CreateLib
else
{
pLib = CreateLib( rLibName );
- if( Password.Len() != 0 )
+ if( Password.isEmpty())
{
BasicLibInfo* pLibInfo = FindLibInfo( pLib );
pLibInfo ->SetPassword( Password );
@@ -1543,13 +1575,14 @@ StarBASIC* BasicManager::CreateLib
return pLib;
}
-StarBASIC* BasicManager::CreateLibForLibContainer( const String& rLibName,
+StarBASIC* BasicManager::CreateLibForLibContainer( const OUString& rLibName,
const uno::Reference< script::XLibraryContainer >& xScriptCont )
{
DBG_CHKTHIS( BasicManager, 0 );
if ( GetLib( rLibName ) )
+ {
return 0;
-
+ }
BasicLibInfo* pLibInfo = CreateLibInfo();
StarBASIC* pNew = new StarBASIC( GetStdLib(), mbDocMgr );
GetStdLib()->Insert( pNew );
@@ -1570,8 +1603,9 @@ BasicLibInfo* BasicManager::FindLibInfo( StarBASIC* pBasic ) const
while ( pInf )
{
if ( pInf->GetLib() == pBasic )
+ {
return pInf;
-
+ }
pInf = ((BasicManager*)this)->pLibs->Next();
}
return 0;
@@ -1586,8 +1620,9 @@ sal_Bool BasicManager::IsBasicModified() const
while ( pInf )
{
if ( pInf->GetLib().Is() && pInf->GetLib()->IsModified() )
+ {
return sal_True;
-
+ }
pInf = pLibs->Next();
}
return sal_False;
@@ -1617,7 +1652,7 @@ uno::Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const
if ( !pStandardLib )
return aOldValue;
- ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
// obtain the old value
SbxVariable* pVariable = pStandardLib->Find( sVarName, SbxCLASS_OBJECT );
@@ -1631,16 +1666,16 @@ uno::Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const
return aOldValue;
}
-bool BasicManager::LegacyPsswdBinaryLimitExceeded( uno::Sequence< rtl::OUString >& _out_rModuleNames )
+bool BasicManager::LegacyPsswdBinaryLimitExceeded( uno::Sequence< OUString >& _out_rModuleNames )
{
try
{
uno::Reference< container::XNameAccess > xScripts( GetScriptLibraryContainer(), uno::UNO_QUERY_THROW );
uno::Reference< script::XLibraryContainerPassword > xPassword( GetScriptLibraryContainer(), uno::UNO_QUERY_THROW );
- uno::Sequence< ::rtl::OUString > aNames( xScripts->getElementNames() );
- const ::rtl::OUString* pNames = aNames.getConstArray();
- const ::rtl::OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
+ uno::Sequence< OUString > aNames( xScripts->getElementNames() );
+ const OUString* pNames = aNames.getConstArray();
+ const OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
for ( ; pNames != pNamesEnd; ++pNames )
{
if( !xPassword->isLibraryPasswordProtected( *pNames ) )
@@ -1651,14 +1686,14 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( uno::Sequence< rtl::OUString
continue;
uno::Reference< container::XNameAccess > xScriptLibrary( xScripts->getByName( *pNames ), uno::UNO_QUERY_THROW );
- uno::Sequence< ::rtl::OUString > aElementNames( xScriptLibrary->getElementNames() );
+ uno::Sequence< OUString > aElementNames( xScriptLibrary->getElementNames() );
sal_Int32 nLen = aElementNames.getLength();
- uno::Sequence< ::rtl::OUString > aBigModules( nLen );
+ uno::Sequence< OUString > aBigModules( nLen );
sal_Int32 nBigModules = 0;
- const ::rtl::OUString* pElementNames = aElementNames.getConstArray();
- const ::rtl::OUString* pElementNamesEnd = aElementNames.getConstArray() + aElementNames.getLength();
+ const OUString* pElementNames = aElementNames.getConstArray();
+ const OUString* pElementNamesEnd = aElementNames.getConstArray() + aElementNames.getLength();
for ( ; pElementNames != pElementNamesEnd; ++pElementNames )
{
SbModule* pMod = pBasicLib->FindModule( *pElementNames );
@@ -1684,13 +1719,21 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( uno::Sequence< rtl::OUString
namespace
{
- SbMethod* lcl_queryMacro( BasicManager* i_manager, String const& i_fullyQualifiedName )
+ SbMethod* lcl_queryMacro( BasicManager* i_manager, OUString const& i_fullyQualifiedName )
{
- sal_uInt16 nLast = 0;
- String sMacro = i_fullyQualifiedName;
- String sLibName = sMacro.GetToken( 0, '.', nLast );
- String sModule = sMacro.GetToken( 0, '.', nLast );
- sMacro.Erase( 0, nLast );
+ sal_Int32 nLast = 0;
+ const OUString sParse = i_fullyQualifiedName;
+ OUString sLibName = sParse.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast );
+ OUString sModule = sParse.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast );
+ OUString sMacro;
+ if(nLast >= 0)
+ {
+ sMacro = OUString(sParse.getStr() + nLast, sParse.getLength() - nLast );
+ }
+ else
+ {
+ sMacro = sParse;
+ }
utl::TransliterationWrapper& rTransliteration = SbGlobal::GetTransliteration();
sal_uInt16 nLibCount = i_manager->GetLibCount();
@@ -1715,7 +1758,9 @@ namespace
{
SbMethod* pMethod = (SbMethod*)pMod->Find( sMacro, SbxCLASS_METHOD );
if( pMethod )
+ {
return pMethod;
+ }
}
}
}
@@ -1725,12 +1770,12 @@ namespace
}
}
-bool BasicManager::HasMacro( String const& i_fullyQualifiedName ) const
+bool BasicManager::HasMacro( OUString const& i_fullyQualifiedName ) const
{
return ( NULL != lcl_queryMacro( const_cast< BasicManager* >( this ), i_fullyQualifiedName ) );
}
-ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue )
+ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue )
{
SbMethod* pMethod = lcl_queryMacro( this, i_fullyQualifiedName );
ErrCode nError = 0;
@@ -1745,50 +1790,56 @@ ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, SbxArray
return nError;
}
-ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, String const& i_commaSeparatedArgs, SbxValue* i_retValue )
+ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, OUString const& i_commaSeparatedArgs, SbxValue* i_retValue )
{
SbMethod* pMethod = lcl_queryMacro( this, i_fullyQualifiedName );
if ( !pMethod )
+ {
return ERRCODE_BASIC_PROC_UNDEFINED;
-
+ }
// arguments must be quoted
- String sQuotedArgs;
- String sArgs( i_commaSeparatedArgs );
- if ( sArgs.Len()<2 || sArgs.GetBuffer()[1] == '\"')
+ OUString sQuotedArgs;
+ OUStringBuffer sArgs( i_commaSeparatedArgs );
+ if ( sArgs.getLength()<2 || sArgs[1] == '\"')
+ {
// no args or already quoted args
- sQuotedArgs = sArgs;
+ sQuotedArgs = sArgs.makeStringAndClear();
+ }
else
{
// quote parameters
- sArgs.Erase( 0, 1 );
- sArgs.Erase( sArgs.Len()-1, 1 );
-
- sQuotedArgs = '(';
+ sArgs.remove( 0, 1 );
+ sArgs.remove( sArgs.getLength() - 1, 1 );
- sal_Int32 nCount = comphelper::string::getTokenCount(sArgs, ',');
- for (sal_Int32 n=0; n < nCount; ++n)
+ sQuotedArgs = "(";
+ OUString sArgs2 = sArgs.makeStringAndClear();
+ sal_Int32 nCount = comphelper::string::getTokenCount(sArgs2, ',');
+ for (sal_Int32 n = 0; n < nCount; ++n)
{
- sQuotedArgs += '\"';
- sQuotedArgs += comphelper::string::getToken(sArgs, n, ',');
- sQuotedArgs += '\"';
- if ( n<nCount-1 )
- sQuotedArgs += ',';
+ sQuotedArgs += "\"";
+ sQuotedArgs += comphelper::string::getToken(sArgs2, n, ',');
+ sQuotedArgs += "\"";
+ if ( n < nCount - 1 )
+ {
+ sQuotedArgs += ",";
+ }
}
- sQuotedArgs += ')';
+ sQuotedArgs += ")";
}
// add quoted arguments and do the call
- rtl::OUString sCall = rtl::OUStringBuffer().
- append('[').
- append(pMethod->GetName()).
- append(sQuotedArgs).
- append(']').
- makeStringAndClear();
+ OUString sCall;
+ sCall += "[";
+ sCall += pMethod->GetName();
+ sCall += sQuotedArgs;
+ sCall += "]";
SbxVariable* pRet = pMethod->GetParent()->Execute( sCall );
if ( pRet && ( pRet != pMethod ) )
+ {
*i_retValue = *pRet;
+ }
return SbxBase::GetError();
}
@@ -1796,20 +1847,20 @@ ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, String c
class ModuleInfo_Impl : public ModuleInfoHelper
{
- ::rtl::OUString maName;
- ::rtl::OUString maLanguage;
- ::rtl::OUString maSource;
+ OUString maName;
+ OUString maLanguage;
+ OUString maSource;
public:
- ModuleInfo_Impl( const ::rtl::OUString& aName, const ::rtl::OUString& aLanguage, const ::rtl::OUString& aSource )
+ ModuleInfo_Impl( const OUString& aName, const OUString& aLanguage, const OUString& aSource )
: maName( aName ), maLanguage( aLanguage), maSource( aSource ) {}
// Methods XStarBasicModuleInfo
- virtual ::rtl::OUString SAL_CALL getName() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getName() throw(uno::RuntimeException)
{ return maName; }
- virtual ::rtl::OUString SAL_CALL getLanguage() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getLanguage() throw(uno::RuntimeException)
{ return maLanguage; }
- virtual ::rtl::OUString SAL_CALL getSource() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getSource() throw(uno::RuntimeException)
{ return maSource; }
};
@@ -1818,15 +1869,15 @@ public:
class DialogInfo_Impl : public DialogInfoHelper
{
- ::rtl::OUString maName;
+ OUString maName;
uno::Sequence< sal_Int8 > mData;
public:
- DialogInfo_Impl( const ::rtl::OUString& aName, uno::Sequence< sal_Int8 > Data )
+ DialogInfo_Impl( const OUString& aName, uno::Sequence< sal_Int8 > Data )
: maName( aName ), mData( Data ) {}
// Methods XStarBasicDialogInfo
- virtual ::rtl::OUString SAL_CALL getName() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getName() throw(uno::RuntimeException)
{ return maName; }
virtual uno::Sequence< sal_Int8 > SAL_CALL getData() throw(uno::RuntimeException)
{ return mData; }
@@ -1837,22 +1888,22 @@ public:
class LibraryInfo_Impl : public LibraryInfoHelper
{
- ::rtl::OUString maName;
+ OUString maName;
uno::Reference< container::XNameContainer > mxModuleContainer;
uno::Reference< container::XNameContainer > mxDialogContainer;
- ::rtl::OUString maPassword;
- ::rtl::OUString maExternaleSourceURL;
- ::rtl::OUString maLinkTargetURL;
+ OUString maPassword;
+ OUString maExternaleSourceURL;
+ OUString maLinkTargetURL;
public:
LibraryInfo_Impl
(
- const ::rtl::OUString& aName,
+ const OUString& aName,
uno::Reference< container::XNameContainer > xModuleContainer,
uno::Reference< container::XNameContainer > xDialogContainer,
- const ::rtl::OUString& aPassword,
- const ::rtl::OUString& aExternaleSourceURL,
- const ::rtl::OUString& aLinkTargetURL
+ const OUString& aPassword,
+ const OUString& aExternaleSourceURL,
+ const OUString& aLinkTargetURL
)
: maName( aName )
, mxModuleContainer( xModuleContainer )
@@ -1863,17 +1914,17 @@ public:
{}
// Methods XStarBasicLibraryInfo
- virtual ::rtl::OUString SAL_CALL getName() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getName() throw(uno::RuntimeException)
{ return maName; }
virtual uno::Reference< container::XNameContainer > SAL_CALL getModuleContainer() throw(uno::RuntimeException)
{ return mxModuleContainer; }
virtual uno::Reference< container::XNameContainer > SAL_CALL getDialogContainer() throw(uno::RuntimeException)
{ return mxDialogContainer; }
- virtual ::rtl::OUString SAL_CALL getPassword() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getPassword() throw(uno::RuntimeException)
{ return maPassword; }
- virtual ::rtl::OUString SAL_CALL getExternalSourceURL() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getExternalSourceURL() throw(uno::RuntimeException)
{ return maExternaleSourceURL; }
- virtual ::rtl::OUString SAL_CALL getLinkTargetURL() throw(uno::RuntimeException)
+ virtual OUString SAL_CALL getLinkTargetURL() throw(uno::RuntimeException)
{ return maLinkTargetURL; }
};
@@ -1894,23 +1945,23 @@ public:
throw(uno::RuntimeException);
// Methods XNameAccess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ virtual uno::Any SAL_CALL getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames()
throw(uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException,
lang::WrappedTargetException, uno::RuntimeException);
// Methods XNameContainer
- virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException,
lang::WrappedTargetException, uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ virtual void SAL_CALL removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
};
@@ -1930,7 +1981,7 @@ sal_Bool ModuleContainer_Impl::hasElements()
}
// Methods XNameAccess
-uno::Any ModuleContainer_Impl::getByName( const ::rtl::OUString& aName )
+uno::Any ModuleContainer_Impl::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : NULL;
@@ -1943,22 +1994,22 @@ uno::Any ModuleContainer_Impl::getByName( const ::rtl::OUString& aName )
return aRetAny;
}
-uno::Sequence< ::rtl::OUString > ModuleContainer_Impl::getElementNames()
+uno::Sequence< OUString > ModuleContainer_Impl::getElementNames()
throw(uno::RuntimeException)
{
SbxArray* pMods = mpLib ? mpLib->GetModules() : NULL;
sal_uInt16 nMods = pMods ? pMods->Count() : 0;
- uno::Sequence< ::rtl::OUString > aRetSeq( nMods );
- ::rtl::OUString* pRetSeq = aRetSeq.getArray();
+ uno::Sequence< OUString > aRetSeq( nMods );
+ OUString* pRetSeq = aRetSeq.getArray();
for( sal_uInt16 i = 0 ; i < nMods ; i++ )
{
SbxVariable* pMod = pMods->Get( i );
- pRetSeq[i] = ::rtl::OUString( pMod->GetName() );
+ pRetSeq[i] = OUString( pMod->GetName() );
}
return aRetSeq;
}
-sal_Bool ModuleContainer_Impl::hasByName( const ::rtl::OUString& aName )
+sal_Bool ModuleContainer_Impl::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : NULL;
@@ -1968,7 +2019,7 @@ sal_Bool ModuleContainer_Impl::hasByName( const ::rtl::OUString& aName )
// Methods XNameReplace
-void ModuleContainer_Impl::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+void ModuleContainer_Impl::replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
removeByName( aName );
@@ -1977,24 +2028,28 @@ void ModuleContainer_Impl::replaceByName( const ::rtl::OUString& aName, const un
// Methods XNameContainer
-void ModuleContainer_Impl::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+void ModuleContainer_Impl::insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
uno::Type aModuleType = ::getCppuType( (const uno::Reference< script::XStarBasicModuleInfo > *)0 );
uno::Type aAnyType = aElement.getValueType();
if( aModuleType != aAnyType )
+ {
throw lang::IllegalArgumentException();
+ }
uno::Reference< script::XStarBasicModuleInfo > xMod;
aElement >>= xMod;
mpLib->MakeModule32( aName, xMod->getSource() );
}
-void ModuleContainer_Impl::removeByName( const ::rtl::OUString& Name )
+void ModuleContainer_Impl::removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
SbModule* pMod = mpLib ? mpLib->FindModule( Name ) : NULL;
if( !pMod )
+ {
throw container::NoSuchElementException();
+ }
mpLib->Remove( pMod );
}
@@ -2041,21 +2096,21 @@ public:
throw(uno::RuntimeException);
// Methods XNameAccess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ virtual uno::Any SAL_CALL getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames()
throw(uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
// Methods XNameContainer
- virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ virtual void SAL_CALL removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
};
@@ -2087,7 +2142,7 @@ sal_Bool DialogContainer_Impl::hasElements()
}
// Methods XNameAccess
-uno::Any DialogContainer_Impl::getByName( const ::rtl::OUString& aName )
+uno::Any DialogContainer_Impl::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE );
@@ -2106,13 +2161,13 @@ uno::Any DialogContainer_Impl::getByName( const ::rtl::OUString& aName )
return aRetAny;
}
-uno::Sequence< ::rtl::OUString > DialogContainer_Impl::getElementNames()
+uno::Sequence< OUString > DialogContainer_Impl::getElementNames()
throw(uno::RuntimeException)
{
mpLib->GetAll( SbxCLASS_OBJECT );
sal_Int16 nCount = mpLib->GetObjects()->Count();
- uno::Sequence< ::rtl::OUString > aRetSeq( nCount );
- ::rtl::OUString* pRetSeq = aRetSeq.getArray();
+ uno::Sequence< OUString > aRetSeq( nCount );
+ OUString* pRetSeq = aRetSeq.getArray();
sal_Int32 nDialogCounter = 0;
for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ )
@@ -2120,7 +2175,7 @@ uno::Sequence< ::rtl::OUString > DialogContainer_Impl::getElementNames()
SbxVariable* pVar = mpLib->GetObjects()->Get( nObj );
if ( pVar->ISA( SbxObject ) && ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) )
{
- pRetSeq[ nDialogCounter ] = ::rtl::OUString( pVar->GetName() );
+ pRetSeq[ nDialogCounter ] = OUString( pVar->GetName() );
nDialogCounter++;
}
}
@@ -2128,7 +2183,7 @@ uno::Sequence< ::rtl::OUString > DialogContainer_Impl::getElementNames()
return aRetSeq;
}
-sal_Bool DialogContainer_Impl::hasByName( const ::rtl::OUString& aName )
+sal_Bool DialogContainer_Impl::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
sal_Bool bRet = sal_False;
@@ -2143,7 +2198,7 @@ sal_Bool DialogContainer_Impl::hasByName( const ::rtl::OUString& aName )
// Methods XNameReplace
-void DialogContainer_Impl::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+void DialogContainer_Impl::replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
removeByName( aName );
@@ -2152,21 +2207,23 @@ void DialogContainer_Impl::replaceByName( const ::rtl::OUString& aName, const un
// Methods XNameContainer
-void DialogContainer_Impl::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+void DialogContainer_Impl::insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
(void)aName;
uno::Type aModuleType = ::getCppuType( (const uno::Reference< script::XStarBasicDialogInfo > *)0 );
uno::Type aAnyType = aElement.getValueType();
if( aModuleType != aAnyType )
+ {
throw lang::IllegalArgumentException();
+ }
uno::Reference< script::XStarBasicDialogInfo > xMod;
aElement >>= xMod;
SbxObjectRef xDialog = implCreateDialog( xMod->getData() );
mpLib->Insert( xDialog );
}
-void DialogContainer_Impl::removeByName( const ::rtl::OUString& Name )
+void DialogContainer_Impl::removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
(void)Name;
@@ -2198,21 +2255,21 @@ public:
throw(uno::RuntimeException);
// Methods XNameAccess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ virtual uno::Any SAL_CALL getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames()
throw(uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
// Methods XNameContainer
- virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ virtual void SAL_CALL removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
};
@@ -2234,7 +2291,7 @@ sal_Bool LibraryContainer_Impl::hasElements()
}
// Methods XNameAccess
-uno::Any LibraryContainer_Impl::getByName( const ::rtl::OUString& aName )
+uno::Any LibraryContainer_Impl::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
uno::Any aRetAny;
@@ -2250,16 +2307,19 @@ uno::Any LibraryContainer_Impl::getByName( const ::rtl::OUString& aName )
BasicLibInfo* pLibInfo = mpMgr->FindLibInfo( pLib );
- ::rtl::OUString aPassword = pLibInfo->GetPassword();
+ OUString aPassword = pLibInfo->GetPassword();
// TODO Only provide extern info!
- ::rtl::OUString aExternaleSourceURL;
- ::rtl::OUString aLinkTargetURL;
+ OUString aExternaleSourceURL;
+ OUString aLinkTargetURL;
if( pLibInfo->IsReference() )
+ {
aLinkTargetURL = pLibInfo->GetStorageName();
+ }
else if( pLibInfo->IsExtern() )
+ {
aExternaleSourceURL = pLibInfo->GetStorageName();
-
+ }
uno::Reference< script::XStarBasicLibraryInfo > xLibInfo = new LibraryInfo_Impl
(
aName,
@@ -2274,20 +2334,20 @@ uno::Any LibraryContainer_Impl::getByName( const ::rtl::OUString& aName )
return aRetAny;
}
-uno::Sequence< ::rtl::OUString > LibraryContainer_Impl::getElementNames()
+uno::Sequence< OUString > LibraryContainer_Impl::getElementNames()
throw(uno::RuntimeException)
{
sal_uInt16 nLibs = mpMgr->GetLibCount();
- uno::Sequence< ::rtl::OUString > aRetSeq( nLibs );
- ::rtl::OUString* pRetSeq = aRetSeq.getArray();
+ uno::Sequence< OUString > aRetSeq( nLibs );
+ OUString* pRetSeq = aRetSeq.getArray();
for( sal_uInt16 i = 0 ; i < nLibs ; i++ )
{
- pRetSeq[i] = ::rtl::OUString( mpMgr->GetLibName( i ) );
+ pRetSeq[i] = OUString( mpMgr->GetLibName( i ) );
}
return aRetSeq;
}
-sal_Bool LibraryContainer_Impl::hasByName( const ::rtl::OUString& aName )
+sal_Bool LibraryContainer_Impl::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
sal_Bool bRet = mpMgr->HasLib( aName );
@@ -2295,7 +2355,7 @@ sal_Bool LibraryContainer_Impl::hasByName( const ::rtl::OUString& aName )
}
// Methods XNameReplace
-void LibraryContainer_Impl::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+void LibraryContainer_Impl::replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
removeByName( aName );
@@ -2303,7 +2363,7 @@ void LibraryContainer_Impl::replaceByName( const ::rtl::OUString& aName, const u
}
// Methods XNameContainer
-void LibraryContainer_Impl::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+void LibraryContainer_Impl::insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
(void)aName;
@@ -2311,12 +2371,14 @@ void LibraryContainer_Impl::insertByName( const ::rtl::OUString& aName, const un
// TODO: Insert a complete Library?!
}
-void LibraryContainer_Impl::removeByName( const ::rtl::OUString& Name )
+void LibraryContainer_Impl::removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
StarBASIC* pLib = mpMgr->GetLib( Name );
if( !pLib )
+ {
throw container::NoSuchElementException();
+ }
sal_uInt16 nLibId = mpMgr->GetLibId( Name );
mpMgr->RemoveLib( nLibId );
}
@@ -2339,13 +2401,13 @@ public:
// Methods
virtual uno::Reference< container::XNameContainer > SAL_CALL getLibraryContainer()
throw(uno::RuntimeException);
- virtual void SAL_CALL createLibrary( const ::rtl::OUString& LibName, const ::rtl::OUString& Password,
- const ::rtl::OUString& ExternalSourceURL, const ::rtl::OUString& LinkTargetURL )
+ virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password,
+ const OUString& ExternalSourceURL, const OUString& LinkTargetURL )
throw(container::ElementExistException, uno::RuntimeException);
- virtual void SAL_CALL addModule( const ::rtl::OUString& LibraryName, const ::rtl::OUString& ModuleName,
- const ::rtl::OUString& Language, const ::rtl::OUString& Source )
+ virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName,
+ const OUString& Language, const OUString& Source )
throw(container::NoSuchElementException, uno::RuntimeException);
- virtual void SAL_CALL addDialog( const ::rtl::OUString& LibraryName, const ::rtl::OUString& DialogName,
+ virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName,
const uno::Sequence< sal_Int8 >& Data )
throw(container::NoSuchElementException, uno::RuntimeException);
};
@@ -2360,10 +2422,10 @@ uno::Reference< container::XNameContainer > SAL_CALL StarBasicAccess_Impl::getLi
void SAL_CALL StarBasicAccess_Impl::createLibrary
(
- const ::rtl::OUString& LibName,
- const ::rtl::OUString& Password,
- const ::rtl::OUString& ExternalSourceURL,
- const ::rtl::OUString& LinkTargetURL
+ const OUString& LibName,
+ const OUString& Password,
+ const OUString& ExternalSourceURL,
+ const OUString& LinkTargetURL
)
throw(container::ElementExistException, uno::RuntimeException)
{
@@ -2377,10 +2439,10 @@ void SAL_CALL StarBasicAccess_Impl::createLibrary
void SAL_CALL StarBasicAccess_Impl::addModule
(
- const ::rtl::OUString& LibraryName,
- const ::rtl::OUString& ModuleName,
- const ::rtl::OUString& Language,
- const ::rtl::OUString& Source
+ const OUString& LibraryName,
+ const OUString& ModuleName,
+ const OUString& Language,
+ const OUString& Source
)
throw(container::NoSuchElementException, uno::RuntimeException)
{
@@ -2388,13 +2450,15 @@ void SAL_CALL StarBasicAccess_Impl::addModule
StarBASIC* pLib = mpMgr->GetLib( LibraryName );
DBG_ASSERT( pLib, "XML Import: Lib for module unknown");
if( pLib )
+ {
pLib->MakeModule32( ModuleName, Source );
+ }
}
void SAL_CALL StarBasicAccess_Impl::addDialog
(
- const ::rtl::OUString& LibraryName,
- const ::rtl::OUString& DialogName,
+ const OUString& LibraryName,
+ const OUString& DialogName,
const uno::Sequence< sal_Int8 >& Data
)
throw(container::NoSuchElementException, uno::RuntimeException)
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
index e40809ef75fd..557295769fda 100644
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -173,7 +173,7 @@ void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const u
}
// SbxErrObject
-SbxErrObject::SbxErrObject( const String& rName, const Any& rUnoObj )
+SbxErrObject::SbxErrObject( const OUString& rName, const Any& rUnoObj )
: SbUnoObject( rName, rUnoObj )
, m_pErrObject( NULL )
{
@@ -202,15 +202,17 @@ SbxErrObject::getUnoErrObject()
SbxVariableRef
SbxErrObject::getErrObject()
{
- static SbxVariableRef pGlobErr = new SbxErrObject( String( RTL_CONSTASCII_USTRINGPARAM("Err")), uno::makeAny( uno::Reference< vba::XErrObject >( new ErrObject() ) ) );
+ static SbxVariableRef pGlobErr = new SbxErrObject( OUString("Err"), uno::makeAny( uno::Reference< vba::XErrObject >( new ErrObject() ) ) );
return pGlobErr;
}
-void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
+void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const OUString& _description )
throw (uno::RuntimeException)
{
if( m_pErrObject != NULL )
+ {
m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 79e2c3b707ee..173a3cee2ac1 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -98,13 +98,12 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere
comphelper::getProcessComponentContext() );
Reference< provider::XScriptProviderFactory > xFactory(
xContext->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ),
- UNO_QUERY );
+ OUString("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")), UNO_QUERY );
OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
if ( xFactory.is() )
{
Any aCtx;
- aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
+ aCtx <<= OUString("user");
xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
}
}
@@ -201,13 +200,13 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
if( aScriptEvent.ScriptType.compareToAscii( "StarBasic" ) == 0 )
{
// Full qualified name?
- String aMacro( aScriptEvent.ScriptCode );
- String aLibName;
- String aLocation;
+ OUString aMacro( aScriptEvent.ScriptCode );
+ OUString aLibName;
+ OUString aLocation;
if( comphelper::string::getTokenCount(aMacro, '.') == 3 )
{
- sal_uInt16 nLast = 0;
- ::rtl::OUString aFullLibName = aMacro.GetToken( 0, '.', nLast );
+ sal_Int32 nLast = 0;
+ ::rtl::OUString aFullLibName = aMacro.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast );
sal_Int32 nIndex = aFullLibName.indexOf( (sal_Unicode)':' );
if (nIndex >= 0)
@@ -216,8 +215,8 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
aLibName = aFullLibName.copy( nIndex + 1 );
}
- String aModul = aMacro.GetToken( 0, '.', nLast );
- aMacro.Erase( 0, nLast );
+ OUString aModul = aMacro.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast );
+ aMacro = aMacro.copy( nLast );
}
SbxObject* p = maBasicRef;
@@ -234,8 +233,8 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
}
else if( pParent )
{
- String aName = p->GetName();
- if( aName.EqualsAscii("Standard") )
+ OUString aName = p->GetName();
+ if( aName.equalsAscii("Standard") )
{
// Own basic is doc standard lib
xDocStandardBasic = (StarBASIC*)p;
@@ -249,13 +248,18 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
bool bSearchLib = true;
StarBASICRef xLibSearchBasic;
- if( aLocation.EqualsAscii("application") )
+ if( aLocation.equalsAscii("application") )
+ {
xLibSearchBasic = xAppStandardBasic;
- else if( aLocation.EqualsAscii("document") )
+ }
+ else if( aLocation.equalsAscii("document") )
+ {
xLibSearchBasic = xDocStandardBasic;
+ }
else
+ {
bSearchLib = false;
-
+ }
SbxVariable* pMethVar = NULL;
// Be still tolerant and make default search if no search basic exists
if( bSearchLib && xLibSearchBasic.Is() )
@@ -276,7 +280,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
}
if( pBasic )
{
- String aName = pBasic->GetName();
+ OUString aName = pBasic->GetName();
if( aName == aLibName )
{
// Search only in the lib, not automatically in application basic
@@ -292,15 +296,16 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
// Default: Be tolerant and search everywhere
if( (!pMethVar || !pMethVar->ISA(SbMethod)) && maBasicRef.Is() )
+ {
pMethVar = maBasicRef->FindQualified( aMacro, SbxCLASS_DONTCARE );
-
+ }
SbMethod* pMeth = PTR_CAST(SbMethod,pMethVar);
if( !pMeth )
+ {
return;
-
+ }
// Setup parameters
SbxArrayRef xArray;
- String aTmp;
sal_Int32 nCnt = aScriptEvent.Arguments.getLength();
if( nCnt )
{
@@ -317,18 +322,21 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
// Call method
SbxVariableRef xValue = pRet ? new SbxVariable : 0;
if( xArray.Is() )
+ {
pMeth->SetParameters( xArray );
+ }
pMeth->Call( xValue );
if( pRet )
+ {
*pRet = sbxToUnoValue( xValue );
+ }
pMeth->SetParameters( NULL );
}
- else // scripting framework script
- {
- //callBasic via scripting framework
- SFURL_firing_impl( aScriptEvent, pRet, m_xModel );
-
- }
+ else // scripting framework script
+ {
+ //callBasic via scripting framework
+ SFURL_firing_impl( aScriptEvent, pRet, m_xModel );
+ }
}
Any implFindDialogLibForDialog( const Any& rDlgAny, SbxObject* pBasic )
@@ -453,17 +461,18 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
}
// Create new uno dialog
- Reference< XNameContainer > xDialogModel( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ),
- UNO_QUERY );
+ Reference< XNameContainer > xDialogModel( xMSF->createInstance(
+ ::rtl::OUString("com.sun.star.awt.UnoControlDialogModel")), UNO_QUERY );
if( !xDialogModel.is() )
+ {
return;
-
+ }
Reference< XInputStreamProvider > xISP;
aAnyISP >>= xISP;
if( !xISP.is() )
+ {
return;
-
+ }
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
@@ -477,15 +486,15 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
bool bDecoration = true;
try
{
- ::rtl::OUString aDecorationPropName(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
+ OUString aDecorationPropName("Decoration");
Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName );
aDecorationAny >>= bDecoration;
if( !bDecoration )
{
xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) );
- ::rtl::OUString aTitlePropName(RTL_CONSTASCII_USTRINGPARAM("Title"));
- xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) );
+ OUString aTitlePropName("Title");
+ xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( OUString() ) );
}
}
catch(const UnknownPropertyException& )
@@ -501,15 +510,15 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
// If we found the dialog then it belongs to the Search basic
if ( !pFoundBasic )
{
- Reference< frame::XDesktop > xDesktop( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
- UNO_QUERY );
+ Reference< frame::XDesktop > xDesktop( xMSF->createInstance(OUString("com.sun.star.frame.Desktop")), UNO_QUERY);
Reference< container::XEnumeration > xModels;
if ( xDesktop.is() )
{
Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
if ( xComponents.is() )
+ {
xModels.set( xComponents->createEnumeration(), UNO_QUERY );
+ }
if ( xModels.is() )
{
while ( xModels->hasMoreElements() )
@@ -519,7 +528,9 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
{
BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
if ( pMgr )
+ {
aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
+ }
if ( aDlgLibAny.hasValue() )
{
bDocDialog = true;
@@ -532,14 +543,20 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
}
}
if ( pFoundBasic )
+ {
bDocDialog = pFoundBasic->IsDocBasic();
+ }
Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( GetSbData()->pInst->GetBasic(), xModel );
Sequence< Any > aArgs( 4 );
if( bDocDialog )
+ {
aArgs[ 0 ] <<= xModel;
+ }
else
+ {
aArgs[ 0 ] <<= uno::Reference< uno::XInterface >();
+ }
aArgs[ 1 ] <<= xInput;
aArgs[ 2 ] = aDlgLibAny;
aArgs[ 3 ] <<= xScriptListener;
@@ -547,8 +564,8 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
Reference< XControl > xCntrl;
try
{
- Reference< XDialogProvider > xDlgProv( xMSF->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.DialogProvider" ) ), aArgs ), UNO_QUERY );
- xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
+ Reference< XDialogProvider > xDlgProv( xMSF->createInstanceWithArguments(OUString("com.sun.star.comp.scripting.DialogProvider" ), aArgs ), UNO_QUERY );
+ xCntrl.set( xDlgProv->createDialog(OUString() ), UNO_QUERY_THROW );
// Add dialog model to dispose vector
Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
GetSbData()->pInst->getComponentVector().push_back( xDlgComponent );
diff --git a/basic/source/classes/global.cxx b/basic/source/classes/global.cxx
index 324a18a12aa7..2907b5cdb65f 100644
--- a/basic/source/classes/global.cxx
+++ b/basic/source/classes/global.cxx
@@ -42,7 +42,7 @@ namespace
public:
lclTransliterationWrapper()
: m_aTransliteration(
- comphelper::getProcessServiceFactory(),
+ comphelper::getProcessComponentContext(),
com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
{
const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 3c91470aacf9..cdc2239901c2 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -135,8 +135,9 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
r >> nSign >> nLen >> nCount;
nNext += nLen + 8;
if( r.GetError() == SVSTREAM_OK )
- switch( nSign )
{
+ switch( nSign )
+ {
case B_NAME:
aName = r.ReadUniOrByteString(eCharSet);
break;
@@ -152,8 +153,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
{
for( sal_uInt16 j = 0 ; j < nCount ; j++ )
{
- String aTmp = r.ReadUniOrByteString(eCharSet);
- aOUSource += aTmp;
+ aOUSource += r.ReadUniOrByteString(eCharSet);
}
break;
}
@@ -208,24 +208,30 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
for( short j = 0; j < nStrings; j++ )
{
sal_uInt16 nOff2 = (sal_uInt16) pStringOff[ j ];
- String aStr( pByteStrings + nOff2, eCharSet );
- memcpy( pStrings + nOff2, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( sal_Unicode ) );
+ OUString aStr( pByteStrings + nOff2, strlen(pByteStrings + nOff2), eCharSet );
+ memcpy( pStrings + nOff2, aStr.getStr(), (aStr.getLength() + 1) * sizeof( sal_Unicode ) );
}
delete[] pByteStrings;
- } break;
+ }
+ break;
case B_MODEND:
goto done;
default:
break;
+ }
}
else
+ {
break;
+ }
r.Seek( nNext );
}
done:
r.Seek( nLast );
if( !SbiGood( r ) )
+ {
bError = true;
+ }
return !bError;
}
@@ -248,25 +254,29 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
eCharSet = GetSOStoreTextEncoding( eCharSet );
if ( bLegacy )
+ {
r << (sal_Int32) B_LEGACYVERSION;
+ }
else
+ {
r << (sal_Int32) B_CURVERSION;
+ }
r << (sal_Int32) eCharSet
- << (sal_Int32) nDimBase
- << (sal_Int16) nFlags
- << (sal_Int16) 0
- << (sal_Int32) 0
- << (sal_Int32) 0;
+ << (sal_Int32) nDimBase
+ << (sal_Int16) nFlags
+ << (sal_Int16) 0
+ << (sal_Int32) 0
+ << (sal_Int32) 0;
// Name?
- if( aName.Len() && SbiGood( r ) )
+ if( !aName.isEmpty() && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, B_NAME, 1 );
r.WriteUniOrByteString( aName, eCharSet );
SbiCloseRecord( r, nPos );
}
// Comment?
- if( aComment.Len() && SbiGood( r ) )
+ if( !aComment.isEmpty() && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, B_COMMENT, 1 );
r.WriteUniOrByteString( aComment, eCharSet );
@@ -276,13 +286,17 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
if( !aOUSource.isEmpty() && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, B_SOURCE, 1 );
- String aTmp;
+ OUString aTmp;
sal_Int32 nLen = aOUSource.getLength();
const sal_Int32 nMaxUnitSize = STRING_MAXLEN - 1;
if( nLen > STRING_MAXLEN )
+ {
aTmp = aOUSource.copy( 0, nMaxUnitSize );
+ }
else
+ {
aTmp = aOUSource;
+ }
r.WriteUniOrByteString( aTmp, eCharSet );
SbiCloseRecord( r, nPos );
@@ -293,9 +307,8 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
nPos = SbiOpenRecord( r, B_EXTSOURCE, nUnitCount );
for( sal_uInt16 i = 0 ; i < nUnitCount ; i++ )
{
- sal_Int32 nCopyLen =
- (nRemainingLen > nMaxUnitSize) ? nMaxUnitSize : nRemainingLen;
- String aTmp2 = aOUSource.copy( (i+1) * nMaxUnitSize, nCopyLen );
+ sal_Int32 nCopyLen = (nRemainingLen > nMaxUnitSize) ? nMaxUnitSize : nRemainingLen;
+ OUString aTmp2 = aOUSource.copy( (i+1) * nMaxUnitSize, nCopyLen );
nRemainingLen -= nCopyLen;
r.WriteUniOrByteString( aTmp2, eCharSet );
}
@@ -313,10 +326,12 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
aNewToLegacy.convert();
pLegacyPCode = (char*)aNewToLegacy.GetBuffer();
nLegacyCodeSize = aNewToLegacy.GetSize();
- r.Write( pLegacyPCode, nLegacyCodeSize );
+ r.Write( pLegacyPCode, nLegacyCodeSize );
}
else
+ {
r.Write( pCode, nCodeSize );
+ }
SbiCloseRecord( r, nPos );
}
// String-Pool?
@@ -328,8 +343,9 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
short i;
for( i = 0; i < nStrings && SbiGood( r ); i++ )
+ {
r << (sal_uInt32) pStringOff[ i ];
-
+ }
// Then the String-Block
char* pByteStrings = new char[ nStringSize ];
for( i = 0; i < nStrings; i++ )
@@ -347,7 +363,9 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
// Set overall length
SbiCloseRecord( r, nStart );
if( !SbiGood( r ) )
+ {
bError = true;
+ }
return !bError;
}
@@ -372,27 +390,35 @@ void SbiImage::MakeStrings( short nSize )
memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) );
}
else
+ {
bError = true;
+ }
}
// Add a string to StringPool. The String buffer is dynamically
// growing in 1K-Steps
-void SbiImage::AddString( const String& r )
+void SbiImage::AddString( const OUString& r )
{
if( nStringIdx >= nStrings )
+ {
bError = true;
+ }
if( !bError )
{
- xub_StrLen len = r.Len() + 1;
+ sal_Int32 len = r.getLength() + 1;
sal_uInt32 needed = nStringOff + len;
if( needed > 0xFFFFFF00L )
+ {
bError = true; // out of mem!
+ }
else if( needed > nStringSize )
{
sal_uInt32 nNewLen = needed + 1024;
nNewLen &= 0xFFFFFC00; // trim to 1K border
if( nNewLen > 0xFFFFFF00L )
+ {
nNewLen = 0xFFFFFF00L;
+ }
sal_Unicode* p = NULL;
if( (p = new sal_Unicode[ nNewLen ]) != NULL )
{
@@ -402,16 +428,20 @@ void SbiImage::AddString( const String& r )
nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen);
}
else
+ {
bError = true;
+ }
}
if( !bError )
{
pStringOff[ nStringIdx++ ] = nStringOff;
- memcpy( pStrings + nStringOff, r.GetBuffer(), len * sizeof( sal_Unicode ) );
+ memcpy( pStrings + nStringOff, r.getStr(), len * sizeof( sal_Unicode ) );
nStringOff = nStringOff + len;
// Last String? The update the size of the buffer
if( nStringIdx >= nStrings )
+ {
nStringSize = nStringOff;
+ }
}
}
}
@@ -430,7 +460,9 @@ void SbiImage::AddCode( char* p, sal_uInt32 s )
void SbiImage::AddType(SbxObject* pObject)
{
if( !rTypes.Is() )
+ {
rTypes = new SbxArray;
+ }
SbxObject *pCopyObject = new SbxObject(*pObject);
rTypes->Insert (pCopyObject,rTypes->Count());
}
@@ -438,7 +470,9 @@ void SbiImage::AddType(SbxObject* pObject)
void SbiImage::AddEnum(SbxObject* pObject) // Register enum type
{
if( !rEnums.Is() )
+ {
rEnums = new SbxArray;
+ }
rEnums->Insert( pObject, rEnums->Count() );
}
@@ -450,7 +484,7 @@ void SbiImage::AddEnum(SbxObject* pObject) // Register enum type
**************************************************************************/
// Note: IDs start with 1
-String SbiImage::GetString( short nId ) const
+OUString SbiImage::GetString( short nId ) const
{
if( nId && nId <= nStrings )
{
@@ -465,18 +499,19 @@ String SbiImage::GetString( short nId ) const
if( nLen == 1 )
{
// Force length 1 and make char 0 afterwards
- String aNullCharStr( rtl::OUString(" ") );
- aNullCharStr.SetChar( 0, 0 );
+ OUString aNullCharStr( (sal_Unicode)0);
return aNullCharStr;
}
}
else
- return rtl::OUString(pStr);
+ {
+ return OUString(pStr);
+ }
}
- return rtl::OUString();
+ return OUString();
}
-const SbxObject* SbiImage::FindType (String aTypeName) const
+const SbxObject* SbiImage::FindType (OUString aTypeName) const
{
return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL;
}
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 6ddb5311cb57..990651568e99 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -94,7 +94,7 @@ private:
DocBasicItem::DocBasicItem( StarBASIC& rDocBasic ) :
mrDocBasic( rDocBasic ),
- mxClassModules( new SbxObject( String() ) ),
+ mxClassModules( new SbxObject( OUString() ) ),
mbDocClosed( false ),
mbDisposed( false )
{
@@ -117,7 +117,9 @@ void DocBasicItem::startListening()
Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
mbDisposed = !xCloseBC.is();
if( xCloseBC.is() )
+ {
try { xCloseBC->addCloseListener( this ); } catch(const uno::Exception& ) {}
+ }
}
void DocBasicItem::stopListening()
@@ -128,7 +130,9 @@ void DocBasicItem::stopListening()
mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp );
Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
if( xCloseBC.is() )
+ {
try { xCloseBC->removeCloseListener( this ); } catch(const uno::Exception& ) {}
+ }
}
void SAL_CALL DocBasicItem::queryClosing( const lang::EventObject& /*rSource*/, sal_Bool /*bGetsOwnership*/ ) throw (util::CloseVetoException, uno::RuntimeException)
@@ -179,7 +183,9 @@ void lclRemoveDocBasicItem( StarBASIC& rDocBasic )
}
DocBasicItemMap::iterator it_end = GaDocBasicItems::get().end();
for( it = GaDocBasicItems::get().begin(); it != it_end; ++it )
+ {
it->second->clearDependingVarsOnDelete( rDocBasic );
+ }
}
StarBASIC* lclGetDocBasicForModule( SbModule* pModule )
@@ -211,7 +217,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
if ( GetUNOConstant("ThisComponent", aThisDoc) )
{
Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY );
- if ( xDocFac.is() )
+ if ( xDocFac.is() )
{
try
{
@@ -223,7 +229,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
}
}
}
- const String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
+ const OUString aVBAHook("VBAGlobals");
pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE );
}
return pVBAGlobals;
@@ -233,13 +239,17 @@ SbxObject* StarBASIC::getVBAGlobals( )
SbxVariable* StarBASIC::VBAFind( const rtl::OUString& rName, SbxClassType t )
{
if( rName == "ThisComponent" )
+ {
return NULL;
+ }
// rename to init globals
if ( getVBAGlobals( ) )
+ {
return pVBAGlobals->Find( rName, t );
+ }
return NULL;
-
}
+
// Create array for conversion SFX <-> VB error code
struct SFX_VB_ErrorItem
{
@@ -383,40 +393,46 @@ SbxBase* SbiFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
{
if( nCreator == SBXCR_SBX )
{
- String aEmpty;
+ OUString aEmpty;
switch( nSbxId )
{
- case SBXID_BASIC:
- return new StarBASIC( NULL );
- case SBXID_BASICMOD:
- return new SbModule( aEmpty );
- case SBXID_BASICPROP:
- return new SbProperty( aEmpty, SbxVARIANT, NULL );
- case SBXID_BASICMETHOD:
- return new SbMethod( aEmpty, SbxVARIANT, NULL );
- case SBXID_JSCRIPTMOD:
- return new SbJScriptModule( aEmpty );
- case SBXID_JSCRIPTMETH:
- return new SbJScriptMethod( aEmpty, SbxVARIANT, NULL );
+ case SBXID_BASIC:
+ return new StarBASIC( NULL );
+ case SBXID_BASICMOD:
+ return new SbModule( aEmpty );
+ case SBXID_BASICPROP:
+ return new SbProperty( aEmpty, SbxVARIANT, NULL );
+ case SBXID_BASICMETHOD:
+ return new SbMethod( aEmpty, SbxVARIANT, NULL );
+ case SBXID_JSCRIPTMOD:
+ return new SbJScriptModule( aEmpty );
+ case SBXID_JSCRIPTMETH:
+ return new SbJScriptMethod( aEmpty, SbxVARIANT, NULL );
}
}
return NULL;
}
-SbxObject* SbiFactory::CreateObject( const rtl::OUString& rClass )
+SbxObject* SbiFactory::CreateObject( const OUString& rClass )
{
if( rClass.equalsIgnoreAsciiCase( "StarBASIC" ) )
+ {
return new StarBASIC( NULL );
+ }
else if( rClass.equalsIgnoreAsciiCase( "StarBASICModule" ) )
- return new SbModule( rtl::OUString() );
+ {
+ return new SbModule( OUString() );
+ }
else if( rClass.equalsIgnoreAsciiCase( "Collection" ) )
- return new BasicCollection( rtl::OUString("Collection"));
+ {
+ return new BasicCollection( OUString("Collection"));
+ }
else if( rClass.equalsIgnoreAsciiCase( "FileSystemObject" ) )
{
try
{
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW );
- ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.FileSystemObject" ) );
+ OUString aServiceName("ooo.vba.FileSystemObject");
Reference< XInterface > xInterface( xFactory->createInstance( aServiceName ), UNO_SET_THROW );
return new SbUnoObject( aServiceName, uno::makeAny( xInterface ) );
}
@@ -424,7 +440,6 @@ SbxObject* SbiFactory::CreateObject( const rtl::OUString& rClass )
{
}
}
-
return NULL;
}
@@ -434,7 +449,7 @@ class SbOLEFactory : public SbxFactory
{
public:
virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
- virtual SbxObject* CreateObject( const rtl::OUString& );
+ virtual SbxObject* CreateObject( const OUString& );
};
SbxBase* SbOLEFactory::Create( sal_uInt16, sal_uInt32 )
@@ -443,9 +458,9 @@ SbxBase* SbOLEFactory::Create( sal_uInt16, sal_uInt32 )
return NULL;
}
-SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType ); // sbunoobj.cxx
+SbUnoObject* createOLEObject_Impl( const OUString& aType ); // sbunoobj.cxx
-SbxObject* SbOLEFactory::CreateObject( const rtl::OUString& rClassName )
+SbxObject* SbOLEFactory::CreateObject( const OUString& rClassName )
{
SbxObject* pRet = createOLEObject_Impl( rClassName );
return pRet;
@@ -459,7 +474,7 @@ class SbFormFactory : public SbxFactory
{
public:
virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
- virtual SbxObject* CreateObject( const rtl::OUString& );
+ virtual SbxObject* CreateObject( const OUString& );
};
SbxBase* SbFormFactory::Create( sal_uInt16, sal_uInt32 )
@@ -468,7 +483,7 @@ SbxBase* SbFormFactory::Create( sal_uInt16, sal_uInt32 )
return NULL;
}
-SbxObject* SbFormFactory::CreateObject( const rtl::OUString& rClassName )
+SbxObject* SbFormFactory::CreateObject( const OUString& rClassName )
{
if( SbModule* pMod = GetSbData()->pMod )
{
@@ -533,8 +548,9 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
}
}
else
+ {
pDest->unoAddDim( 0, -1 ); // variant array
-
+ }
sal_uInt16 nSavFlags = pVar->GetFlags();
pNewProp->ResetFlag( SBX_FIXED );
// need to reset the FIXED flag
@@ -562,7 +578,7 @@ class SbTypeFactory : public SbxFactory
{
public:
virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
- virtual SbxObject* CreateObject( const rtl::OUString& );
+ virtual SbxObject* CreateObject( const OUString& );
};
SbxBase* SbTypeFactory::Create( sal_uInt16, sal_uInt32 )
@@ -571,7 +587,7 @@ SbxBase* SbTypeFactory::Create( sal_uInt16, sal_uInt32 )
return NULL;
}
-SbxObject* SbTypeFactory::CreateObject( const rtl::OUString& rClassName )
+SbxObject* SbTypeFactory::CreateObject( const OUString& rClassName )
{
SbxObject* pRet = NULL;
SbModule* pMod = GetSbData()->pMod;
@@ -579,12 +595,14 @@ SbxObject* SbTypeFactory::CreateObject( const rtl::OUString& rClassName )
{
const SbxObject* pObj = pMod->FindType( rClassName );
if( pObj )
+ {
pRet = cloneTypeObjectImpl( *pObj );
+ }
}
return pRet;
}
-SbxObject* createUserTypeImpl( const String& rClassName )
+SbxObject* createUserTypeImpl( const OUString& rClassName )
{
SbxObject* pRetObj = GetSbData()->pTypeFac->CreateObject( rClassName );
return pRetObj;
@@ -653,8 +671,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
}
// Search for own copy of ImplMethod
- String aImplMethodName = pImplMethod->GetName();
- SbxVariable* p = pMethods->Find( aImplMethodName, SbxCLASS_METHOD );
+ SbxVariable* p = pMethods->Find( pImplMethod->GetName(), SbxCLASS_METHOD );
SbMethod* pImplMethodCopy = p ? PTR_CAST(SbMethod,p) : NULL;
if( !pImplMethodCopy )
{
@@ -704,7 +721,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbxObject* pObj = PTR_CAST(SbxObject,pObjBase);
if( pObj != NULL )
{
- String aObjClass = pObj->GetClassName();
+ OUString aObjClass = pObj->GetClassName();
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
if( pClassModuleObj != NULL )
@@ -715,9 +732,9 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
pNewObj->SetParent( pLclClassModule->pParent );
pNewProp->PutObject( pNewObj );
}
- else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
+ else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) )
{
- String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
+ OUString aCollectionName("Collection");
BasicCollection* pNewCollection = new BasicCollection( aCollectionName );
pNewCollection->SetName( pProp->GetName() );
pNewCollection->SetParent( pClassModule->pParent );
@@ -758,7 +775,7 @@ void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType
handleProcedureProperties( rBC, rHint );
}
-SbxVariable* SbClassModuleObject::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbClassModuleObject::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pRes = SbxObject::Find( rName, t );
if( pRes )
@@ -778,12 +795,14 @@ SbxVariable* SbClassModuleObject::Find( const rtl::OUString& rName, SbxClassType
void SbClassModuleObject::triggerInitializeEvent( void )
{
if( mbInitializeEventDone )
+ {
return;
+ }
mbInitializeEventDone = true;
// Search method
- SbxVariable* pMeth = SbxObject::Find(rtl::OUString("Class_Initialize"), SbxCLASS_METHOD);
+ SbxVariable* pMeth = SbxObject::Find(OUString("Class_Initialize"), SbxCLASS_METHOD);
if( pMeth )
{
SbxValues aVals;
@@ -794,10 +813,11 @@ void SbClassModuleObject::triggerInitializeEvent( void )
void SbClassModuleObject::triggerTerminateEvent( void )
{
if( !mbInitializeEventDone || GetSbData()->bRunInit )
+ {
return;
-
+ }
// Search method
- SbxVariable* pMeth = SbxObject::Find( rtl::OUString("Class_Terminate"), SbxCLASS_METHOD );
+ SbxVariable* pMeth = SbxObject::Find(OUString("Class_Terminate"), SbxCLASS_METHOD );
if( pMeth )
{
SbxValues aVals;
@@ -819,7 +839,7 @@ void SbClassData::clear( void )
SbClassFactory::SbClassFactory( void )
{
- String aDummyName;
+ OUString aDummyName;
xClassModules = new SbxObject( aDummyName );
}
@@ -850,15 +870,20 @@ SbxBase* SbClassFactory::Create( sal_uInt16, sal_uInt32 )
return NULL;
}
-SbxObject* SbClassFactory::CreateObject( const rtl::OUString& rClassName )
+SbxObject* SbClassFactory::CreateObject( const OUString& rClassName )
{
SbxObjectRef xToUseClassModules = xClassModules;
if( SbModule* pMod = GetSbData()->pMod )
+ {
if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pMod ) )
+ {
if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
+ {
xToUseClassModules = pDocBasicItem->getClassModules();
-
+ }
+ }
+ }
SbxVariable* pVar = xToUseClassModules->Find( rClassName, SbxCLASS_OBJECT );
SbxObject* pRet = NULL;
if( pVar )
@@ -869,7 +894,7 @@ SbxObject* SbClassFactory::CreateObject( const rtl::OUString& rClassName )
return pRet;
}
-SbModule* SbClassFactory::FindClass( const String& rClassName )
+SbModule* SbClassFactory::FindClass( const OUString& rClassName )
{
SbxVariable* pVar = xClassModules->Find( rClassName, SbxCLASS_DONTCARE );
SbModule* pMod = pVar ? (SbModule*)pVar : NULL;
@@ -877,7 +902,7 @@ SbModule* SbClassFactory::FindClass( const String& rClassName )
}
StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
- : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic )
+ : SbxObject( OUString("StarBASIC") ), bDocBasic( bIsDocBasic )
{
SetParent( p );
pLibInfo = NULL;
@@ -900,14 +925,16 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
GetSbData()->pUnoFac = new SbUnoFactory;
AddFactory( GetSbData()->pUnoFac );
}
- pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
+ pRtl = new SbiStdObject(OUString(RTLNAME), this );
// Search via StarBasic is always global
SetFlag( SBX_GBLSEARCH );
pVBAGlobals = NULL;
bQuit = false;
if( bDocBasic )
+ {
lclInsertDocBasicItem( *this );
+ }
}
// #51727 Override SetModified so that the modified state
@@ -958,7 +985,9 @@ StarBASIC::~StarBASIC()
SbxBase::ResetError();
if( eOld != SbxERR_OK )
+ {
SbxBase::SetError( eOld );
+ }
}
// #100326 Set Parent NULL in registered listeners
@@ -1007,7 +1036,9 @@ void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic )
SbxVariable* pVar = pObjs->Get( nObj );
StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
if( pBasic && pBasic != pDeletedBasic )
+ {
pBasic->implClearDependingVarsOnDelete( pDeletedBasic );
+ }
}
}
@@ -1018,40 +1049,40 @@ void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic )
*
**************************************************************************/
-SbModule* StarBASIC::MakeModule( const String& rName, const String& rSrc )
+SbModule* StarBASIC::MakeModule( const OUString& rName, const OUString& rSrc )
{
return MakeModule32( rName, rSrc );
}
-SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc )
+SbModule* StarBASIC::MakeModule32( const OUString& rName, const OUString& rSrc )
{
ModuleInfo mInfo;
mInfo.ModuleType = ModuleType::NORMAL;
return MakeModule32( rName, mInfo, rSrc );
}
-SbModule* StarBASIC::MakeModule32( const String& rName, const ModuleInfo& mInfo, const rtl::OUString& rSrc )
+SbModule* StarBASIC::MakeModule32( const OUString& rName, const ModuleInfo& mInfo, const OUString& rSrc )
{
OSL_TRACE("create module %s type mInfo %d", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(), mInfo.ModuleType );
SbModule* p = NULL;
switch ( mInfo.ModuleType )
{
- case ModuleType::DOCUMENT:
- // In theory we should be able to create Object modules
- // in ordinary basic ( in vba mode thought these are create
- // by the application/basic and not by the user )
- p = new SbObjModule( rName, mInfo, isVBAEnabled() );
- break;
- case ModuleType::CLASS:
- p = new SbModule( rName, isVBAEnabled() );
- p->SetModuleType( ModuleType::CLASS );
+ case ModuleType::DOCUMENT:
+ // In theory we should be able to create Object modules
+ // in ordinary basic ( in vba mode thought these are create
+ // by the application/basic and not by the user )
+ p = new SbObjModule( rName, mInfo, isVBAEnabled() );
break;
- case ModuleType::FORM:
- p = new SbUserFormModule( rName, mInfo, isVBAEnabled() );
+ case ModuleType::CLASS:
+ p = new SbModule( rName, isVBAEnabled() );
+ p->SetModuleType( ModuleType::CLASS );
+ break;
+ case ModuleType::FORM:
+ p = new SbUserFormModule( rName, mInfo, isVBAEnabled() );
+ break;
+ default:
+ p = new SbModule( rName, isVBAEnabled() );
break;
- default:
- p = new SbModule( rName, isVBAEnabled() );
-
}
p->SetSource32( rSrc );
p->SetParent( this );
@@ -1073,7 +1104,9 @@ void StarBASIC::Insert( SbxVariable* pVar )
sal_Bool bWasModified = IsModified();
SbxObject::Insert( pVar );
if( !bWasModified && pVar->IsSet( SBX_DONTSTORE ) )
+ {
SetModified( sal_False );
+ }
}
}
@@ -1088,7 +1121,9 @@ void StarBASIC::Remove( SbxVariable* pVar )
EndListening( pVar->GetBroadcaster() );
}
else
+ {
SbxObject::Remove( pVar );
+ }
}
sal_Bool StarBASIC::Compile( SbModule* pMod )
@@ -1099,16 +1134,20 @@ sal_Bool StarBASIC::Compile( SbModule* pMod )
void StarBASIC::Clear()
{
while( pModules->Count() )
+ {
pModules->Remove( pModules->Count() - 1 );
+ }
}
-SbModule* StarBASIC::FindModule( const String& rName )
+SbModule* StarBASIC::FindModule( const OUString& rName )
{
for( sal_uInt16 i = 0; i < pModules->Count(); i++ )
{
SbModule* p = (SbModule*) pModules->Get( i );
- if( p->GetName().EqualsIgnoreCaseAscii( rName ) )
+ if( p->GetName().equalsIgnoreAsciiCase( rName ) )
+ {
return p;
+ }
}
return NULL;
}
@@ -1135,8 +1174,8 @@ struct ClassModuleRunInitItem
// Derive from unordered_map type instead of typedef
// to allow forward declaration in sbmod.hxx
class ModuleInitDependencyMap : public
- boost::unordered_map< ::rtl::OUString, ClassModuleRunInitItem,
- ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
+ boost::unordered_map< OUString, ClassModuleRunInitItem,
+ ::rtl::OUStringHash, ::std::equal_to< OUString > >
{};
void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem )
@@ -1151,7 +1190,7 @@ void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassMod
{
for( StringVector::iterator it = rReqTypes.begin() ; it != rReqTypes.end() ; ++it )
{
- String& rStr = *it;
+ OUString& rStr = *it;
// Is required type a class module?
ModuleInitDependencyMap::iterator itFind = rMap.find( rStr );
@@ -1166,7 +1205,9 @@ void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassMod
}
if( !rParentItem.m_bRunInitDone )
+ {
implProcessModuleRunInit( rMap, rParentItem );
+ }
}
}
}
@@ -1187,7 +1228,9 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
if( !pModule->IsCompiled() )
+ {
pModule->Compile();
+ }
}
// compile modules first then RunInit ( otherwise there is
// can be order dependency, e.g. classmodule A has a member
@@ -1199,9 +1242,11 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
- String aModuleName = pModule->GetName();
+ OUString aModuleName = pModule->GetName();
if( pModule->isProxyModule() )
+ {
aMIDMap[aModuleName] = ClassModuleRunInitItem( pModule );
+ }
}
ModuleInitDependencyMap::iterator it;
@@ -1216,7 +1261,9 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
if( !pModule->isProxyModule() )
+ {
pModule->RunInit();
+ }
}
// Check all objects if they are BASIC,
@@ -1226,7 +1273,9 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
SbxVariable* pVar = pObjs->Get( nObj );
StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
if( pBasic && pBasic != pBasicNotToInit )
+ {
pBasic->InitAllModules();
+ }
}
}
@@ -1239,7 +1288,9 @@ void StarBASIC::DeInitAllModules( void )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
if( pModule->pImage && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
+ {
pModule->pImage->bInit = false;
+ }
}
for ( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ )
@@ -1247,7 +1298,9 @@ void StarBASIC::DeInitAllModules( void )
SbxVariable* pVar = pObjs->Get( nObj );
StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
if( pBasic )
+ {
pBasic->DeInitAllModules();
+ }
}
}
@@ -1257,7 +1310,7 @@ void StarBASIC::DeInitAllModules( void )
// method and a module with the given name is found the search continues
// for entrypoint "Main".
// If this fails again a conventional search over objects is performend.
-SbxVariable* StarBASIC::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* StarBASIC::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pRes = NULL;
SbModule* pNamed = NULL;
@@ -1268,55 +1321,71 @@ SbxVariable* StarBASIC::Find( const rtl::OUString& rName, SbxClassType t )
if( t == SbxCLASS_DONTCARE || t == SbxCLASS_OBJECT )
{
if( rName.equalsIgnoreAsciiCase( RTLNAME ) )
+ {
pRes = pRtl;
+ }
}
if( !pRes )
+ {
pRes = ((SbiStdObject*) (SbxObject*) pRtl)->Find( rName, t );
+ }
if( pRes )
+ {
pRes->SetFlag( SBX_EXTFOUND );
+ }
}
// Search module
if( !pRes )
- for( sal_uInt16 i = 0; i < pModules->Count(); i++ )
{
- SbModule* p = (SbModule*) pModules->Get( i );
- if( p->IsVisible() )
+ for( sal_uInt16 i = 0; i < pModules->Count(); i++ )
{
- // Remember modul fpr Main() call
- // or is the name equal?!?
- if( p->GetName().EqualsIgnoreCaseAscii( rName ) )
+ SbModule* p = (SbModule*) pModules->Get( i );
+ if( p->IsVisible() )
{
- if( t == SbxCLASS_OBJECT || t == SbxCLASS_DONTCARE )
+ // Remember modul fpr Main() call
+ // or is the name equal?!?
+ if( p->GetName().equalsIgnoreAsciiCase( rName ) )
+ {
+ if( t == SbxCLASS_OBJECT || t == SbxCLASS_DONTCARE )
+ {
+ pRes = p; break;
+ }
+ pNamed = p;
+ }
+ // Only variables qualified by the Module Name e.g. Sheet1.foo
+ // should work for Documant && Class type Modules
+ sal_Int32 nType = p->GetModuleType();
+ if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
{
- pRes = p; break;
+ continue;
+ }
+ // otherwise check if the element is available
+ // unset GBLSEARCH-Flag (due to Rekursion)
+ sal_uInt16 nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
+ p->ResetFlag( SBX_GBLSEARCH );
+ pRes = p->Find( rName, t );
+ p->SetFlag( nGblFlag );
+ if( pRes )
+ {
+ break;
}
- pNamed = p;
}
- // Only variables qualified by the Module Name e.g. Sheet1.foo
- // should work for Documant && Class type Modules
- sal_Int32 nType = p->GetModuleType();
- if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
- continue;
- // otherwise check if the element is available
- // unset GBLSEARCH-Flag (due to Rekursion)
- sal_uInt16 nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
- p->ResetFlag( SBX_GBLSEARCH );
- pRes = p->Find( rName, t );
- p->SetFlag( nGblFlag );
- if( pRes )
- break;
}
}
- rtl::OUString aMainStr("Main");
+ OUString aMainStr("Main");
if( !pRes && pNamed && ( t == SbxCLASS_METHOD || t == SbxCLASS_DONTCARE ) &&
- !pNamed->GetName().EqualsIgnoreCaseAscii( aMainStr ) )
- pRes = pNamed->Find( aMainStr, SbxCLASS_METHOD );
+ !pNamed->GetName().equalsIgnoreAsciiCase( aMainStr ) )
+ {
+ pRes = pNamed->Find( aMainStr, SbxCLASS_METHOD );
+ }
if( !pRes )
+ {
pRes = SbxObject::Find( rName, t );
+ }
return pRes;
}
-sal_Bool StarBASIC::Call( const String& rName, SbxArray* pParam )
+sal_Bool StarBASIC::Call( const OUString& rName, SbxArray* pParam )
{
sal_Bool bRes = SbxObject::Call( rName, pParam );
if( !bRes )
@@ -1324,18 +1393,24 @@ sal_Bool StarBASIC::Call( const String& rName, SbxArray* pParam )
SbxError eErr = SbxBase::GetError();
SbxBase::ResetError();
if( eErr != SbxERR_OK )
+ {
RTError( (SbError)eErr, 0, 0, 0 );
+ }
}
return bRes;
}
// Find method via name (e.g. query via BASIC IDE)
-SbxBase* StarBASIC::FindSBXInCurrentScope( const String& rName )
+SbxBase* StarBASIC::FindSBXInCurrentScope( const OUString& rName )
{
if( !GetSbData()->pInst )
+ {
return NULL;
+ }
if( !GetSbData()->pInst->pRun )
+ {
return NULL;
+ }
return GetSbData()->pInst->pRun->FindElementExtern( rName );
}
@@ -1369,43 +1444,58 @@ bool StarBASIC::IsRunning()
SbMethod* StarBASIC::GetActiveMethod( sal_uInt16 nLevel )
{
if( GetSbData()->pInst )
+ {
return GetSbData()->pInst->GetCaller( nLevel );
+ }
else
+ {
return NULL;
+ }
}
SbModule* StarBASIC::GetActiveModule()
{
if( GetSbData()->pInst && !IsCompilerError() )
+ {
return GetSbData()->pInst->GetActiveModule();
+ }
else
+ {
return GetSbData()->pCompMod;
+ }
}
-sal_uInt16 StarBASIC::BreakPoint( sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
+sal_uInt16 StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
{
SetErrorData( 0, l, c1, c2 );
bBreak = true;
if( GetSbData()->aBreakHdl.IsSet() )
+ {
return (sal_uInt16) GetSbData()->aBreakHdl.Call( this );
+ }
else
+ {
return BreakHdl();
+ }
}
-sal_uInt16 StarBASIC::StepPoint( sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
+sal_uInt16 StarBASIC::StepPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
{
SetErrorData( 0, l, c1, c2 );
bBreak = false;
if( GetSbData()->aBreakHdl.IsSet() )
+ {
return (sal_uInt16) GetSbData()->aBreakHdl.Call( this );
+ }
else
+ {
return BreakHdl();
+ }
}
sal_uInt16 StarBASIC::BreakHdl()
{
- return (sal_uInt16) ( aBreakHdl.IsSet()
- ? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE );
+ return (sal_uInt16) ( aBreakHdl.IsSet() ? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE );
}
// Calls for error handler and break handler
@@ -1415,7 +1505,7 @@ sal_uInt16 StarBASIC::GetCol2() { return GetSbData()->nCol2; }
// Specific to error handler
SbError StarBASIC::GetErrorCode() { return GetSbData()->nCode; }
-const String& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; }
+const OUString& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; }
bool StarBASIC::IsCompilerError() { return GetSbData()->bCompiler; }
// From 1996-03-29:
@@ -1434,20 +1524,20 @@ sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError )
{
switch( nError )
{
- case SbERR_BASIC_ARRAY_FIX:
- return 10;
- case SbERR_BASIC_STRING_OVERFLOW:
- return 14;
- case SbERR_BASIC_EXPR_TOO_COMPLEX:
- return 16;
- case SbERR_BASIC_OPER_NOT_PERFORM:
- return 17;
- case SbERR_BASIC_TOO_MANY_DLL:
- return 47;
- case SbERR_BASIC_LOOP_NOT_INIT:
- return 92;
- default:
- nRet = 0;
+ case SbERR_BASIC_ARRAY_FIX:
+ return 10;
+ case SbERR_BASIC_STRING_OVERFLOW:
+ return 14;
+ case SbERR_BASIC_EXPR_TOO_COMPLEX:
+ return 16;
+ case SbERR_BASIC_OPER_NOT_PERFORM:
+ return 17;
+ case SbERR_BASIC_TOO_MANY_DLL:
+ return 47;
+ case SbERR_BASIC_LOOP_NOT_INIT:
+ return 92;
+ default:
+ nRet = 0;
}
}
@@ -1476,27 +1566,27 @@ SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
{
switch( nError )
{
- case 1:
- case 2:
- case 4:
- case 8:
- case 12:
- case 73:
- return 0L;
- case 10:
- return SbERR_BASIC_ARRAY_FIX;
- case 14:
- return SbERR_BASIC_STRING_OVERFLOW;
- case 16:
- return SbERR_BASIC_EXPR_TOO_COMPLEX;
- case 17:
- return SbERR_BASIC_OPER_NOT_PERFORM;
- case 47:
- return SbERR_BASIC_TOO_MANY_DLL;
- case 92:
- return SbERR_BASIC_LOOP_NOT_INIT;
- default:
- nRet = 0L;
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 12:
+ case 73:
+ return 0L;
+ case 10:
+ return SbERR_BASIC_ARRAY_FIX;
+ case 14:
+ return SbERR_BASIC_STRING_OVERFLOW;
+ case 16:
+ return SbERR_BASIC_EXPR_TOO_COMPLEX;
+ case 17:
+ return SbERR_BASIC_OPER_NOT_PERFORM;
+ case 47:
+ return SbERR_BASIC_TOO_MANY_DLL;
+ case 92:
+ return SbERR_BASIC_LOOP_NOT_INIT;
+ default:
+ nRet = 0L;
}
}
const SFX_VB_ErrorItem* pErrItem;
@@ -1510,8 +1600,9 @@ SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
break;
}
else if( pErrItem->nErrorVB > nError )
+ {
break; // couldn't found anymore
-
+ }
nIndex++;
}
while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
@@ -1519,8 +1610,8 @@ SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
}
// set Error- / Break-data
-void StarBASIC::SetErrorData
-( SbError nCode, sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 )
+void StarBASIC::SetErrorData( SbError nCode, sal_uInt16 nLine,
+ sal_uInt16 nCol1, sal_uInt16 nCol2 )
{
SbiGlobals& aGlobals = *GetSbData();
aGlobals.nCode = nCode;
@@ -1540,13 +1631,13 @@ struct BasicStringList_Impl : private Resource
: Resource( rErrIdP ),aResId(nId, *rErrIdP.GetResMgr() ){}
~BasicStringList_Impl() { FreeResource(); }
- String GetString(){ return aResId.toString(); }
+ OUString GetString(){ return aResId.toString(); }
sal_Bool IsErrorTextAvailable( void )
{ return IsAvailableRes(aResId.SetRT(RSC_STRING)); }
};
//----------------------------------------------------------------
-void StarBASIC::MakeErrorText( SbError nId, const ::rtl::OUString& aMsg )
+void StarBASIC::MakeErrorText( SbError nId, const OUString& aMsg )
{
SolarMutexGuard aSolarGuard;
sal_uInt16 nOldID = GetVBErrorCode( nId );
@@ -1558,30 +1649,32 @@ void StarBASIC::MakeErrorText( SbError nId, const ::rtl::OUString& aMsg )
if( aMyStringList.IsErrorTextAvailable() )
{
// merge message with additional text
- String aMsg1 = aMyStringList.GetString();
+ OUStringBuffer aMsg1(aMyStringList.GetString());
// replace argument placeholder with %s
- String aSrgStr( RTL_CONSTASCII_USTRINGPARAM("$(ARG1)") );
- sal_uInt16 nResult = aMsg1.Search( aSrgStr );
+ OUString aSrgStr( "$(ARG1)" );
+ sal_Int32 nResult = aMyStringList.GetString().indexOf( aSrgStr );
- if( nResult != STRING_NOTFOUND )
+ if( nResult >= 0 )
{
- aMsg1.Erase( nResult, aSrgStr.Len() );
- aMsg1.Insert( aMsg, nResult );
+ aMsg1.remove(nResult, aSrgStr.getLength());
+ aMsg1.insert(nResult, aMsg);
}
- GetSbData()->aErrMsg = aMsg1;
+ GetSbData()->aErrMsg = aMsg1.makeStringAndClear();
}
else if( nOldID != 0 )
{
- rtl::OUStringBuffer aStdMsg;
+ OUStringBuffer aStdMsg;
aStdMsg.append("Fehler ").append(static_cast<sal_Int32>(nOldID)).append(": Kein Fehlertext verfuegbar!");
GetSbData()->aErrMsg = aStdMsg.makeStringAndClear();
}
else
- GetSbData()->aErrMsg = String::EmptyString();
+ {
+ GetSbData()->aErrMsg = "";
+ }
}
-sal_Bool StarBASIC::CError
- ( SbError code, const ::rtl::OUString& rMsg, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
+sal_Bool StarBASIC::CError( SbError code, const OUString& rMsg,
+ sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
{
SolarMutexGuard aSolarGuard;
@@ -1591,8 +1684,9 @@ sal_Bool StarBASIC::CError
// #109018 Check if running Basic is affected
StarBASIC* pStartedBasic = GetSbData()->pInst->GetBasic();
if( pStartedBasic != this )
+ {
return sal_False;
-
+ }
Stop();
}
@@ -1604,36 +1698,42 @@ sal_Bool StarBASIC::CError
// Implementation of the code for the string transport to SFX-Error
if( !rMsg.isEmpty() )
+ {
code = (sal_uIntPtr)*new StringErrorInfo( code, rMsg );
-
+ }
SetErrorData( code, l, c1, c2 );
GetSbData()->bCompiler = true;
sal_Bool bRet;
if( GetSbData()->aErrHdl.IsSet() )
+ {
bRet = (sal_Bool) GetSbData()->aErrHdl.Call( this );
+ }
else
+ {
bRet = ErrorHdl();
+ }
GetSbData()->bCompiler = false; // only true for error handler
return bRet;
}
-sal_Bool StarBASIC::RTError
- ( SbError code, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
+sal_Bool StarBASIC::RTError( SbError code, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
{
- return RTError( code, String(), l, c1, c2 );
+ return RTError( code, OUString(), l, c1, c2 );
}
-sal_Bool StarBASIC::RTError( SbError code, const String& rMsg, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 )
+sal_Bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
{
SolarMutexGuard aSolarGuard;
SbError c = code;
if( (c & ERRCODE_CLASS_MASK) == ERRCODE_CLASS_COMPILER )
+ {
c = 0;
+ }
MakeErrorText( c, rMsg );
// Implementation of the code for the string transport to SFX-Error
- if( rMsg.Len() )
+ if( !rMsg.isEmpty() )
{
// very confusing, even though MakeErrorText sets up the error text
// seems that this is not used ( if rMsg already has content )
@@ -1641,68 +1741,92 @@ sal_Bool StarBASIC::RTError( SbError code, const String& rMsg, sal_uInt16 l, sal
// like vba ( adds an error number etc )
if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
{
- rtl::OUStringBuffer aTmp;
+ OUStringBuffer aTmp;
aTmp.append('\'').append(SbxErrObject::getUnoErrObject()->getNumber())
- .append("\'\n").append(GetSbData()->aErrMsg.Len() ? GetSbData()->aErrMsg : rMsg);
+ .append("\'\n").append(!GetSbData()->aErrMsg.isEmpty() ? GetSbData()->aErrMsg : rMsg);
code = (sal_uIntPtr)*new StringErrorInfo( code, aTmp.makeStringAndClear() );
}
else
- code = (sal_uIntPtr)*new StringErrorInfo( code, String(rMsg) );
+ {
+ code = (sal_uIntPtr)*new StringErrorInfo( code, rMsg );
+ }
}
SetErrorData( code, l, c1, c2 );
if( GetSbData()->aErrHdl.IsSet() )
+ {
return (sal_Bool) GetSbData()->aErrHdl.Call( this );
+ }
else
+ {
return ErrorHdl();
+ }
}
void StarBASIC::Error( SbError n )
{
- Error( n, String() );
+ Error( n, OUString() );
}
-void StarBASIC::Error( SbError n, const String& rMsg )
+void StarBASIC::Error( SbError n, const OUString& rMsg )
{
if( GetSbData()->pInst )
+ {
GetSbData()->pInst->Error( n, rMsg );
+ }
}
void StarBASIC::FatalError( SbError n )
{
if( GetSbData()->pInst )
+ {
GetSbData()->pInst->FatalError( n );
+ }
}
-void StarBASIC::FatalError( SbError _errCode, const String& _details )
+void StarBASIC::FatalError( SbError _errCode, const OUString& _details )
{
if( GetSbData()->pInst )
+ {
GetSbData()->pInst->FatalError( _errCode, _details );
+ }
}
SbError StarBASIC::GetErrBasic()
{
if( GetSbData()->pInst )
+ {
return GetSbData()->pInst->GetErr();
+ }
else
+ {
return 0;
+ }
}
// make the additional message for the RTL function error accessible
-String StarBASIC::GetErrorMsg()
+OUString StarBASIC::GetErrorMsg()
{
if( GetSbData()->pInst )
+ {
return GetSbData()->pInst->GetErrorMsg();
+ }
else
- return String();
+ {
+ return OUString();
+ }
}
-sal_uInt16 StarBASIC::GetErl()
+sal_Int32 StarBASIC::GetErl()
{
if( GetSbData()->pInst )
+ {
return GetSbData()->pInst->GetErl();
+ }
else
+ {
return 0;
+ }
}
sal_Bool StarBASIC::ErrorHdl()
@@ -1729,7 +1853,9 @@ void StarBASIC::SetGlobalBreakHdl( const Link& rLink )
SbxArrayRef StarBASIC::getUnoListeners( void )
{
if( !xUnoListeners.Is() )
+ {
xUnoListeners = new SbxArray();
+ }
return xUnoListeners;
}
@@ -1743,8 +1869,9 @@ SbxArrayRef StarBASIC::getUnoListeners( void )
sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
{
if( !SbxObject::LoadData( r, nVer ) )
+ {
return sal_False;
-
+ }
// #95459 Delete dialogs, otherwise endless recursion
// in SbxVarable::GetType() if dialogs are accessed
sal_uInt16 nObjCount = pObjs->Count();
@@ -1761,7 +1888,9 @@ sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
{
SbxVariable* pVar = ppDeleteTab[nObj];
if( pVar )
+ {
pObjs->Remove( pVar );
+ }
}
delete[] ppDeleteTab;
@@ -1772,7 +1901,9 @@ sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
{
SbModule* pMod = (SbModule*) SbxBase::Load( r );
if( !pMod )
+ {
return sal_False;
+ }
else if( pMod->ISA(SbJScriptModule) )
{
// assign Ref, so that pMod will be deleted
@@ -1785,12 +1916,16 @@ sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
}
}
// HACK for SFX-Bullshit!
- SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("FALSE") ), SbxCLASS_PROPERTY );
+ SbxVariable* p = Find( OUString("FALSE"), SbxCLASS_PROPERTY );
if( p )
+ {
Remove( p );
- p = Find( String( RTL_CONSTASCII_USTRINGPARAM("TRUE") ), SbxCLASS_PROPERTY );
+ }
+ p = Find( OUString("TRUE"), SbxCLASS_PROPERTY );
if( p )
+ {
Remove( p );
+ }
// End of the hacks!
// Search via StarBASIC is at all times global
DBG_ASSERT( IsSet( SBX_GBLSEARCH ), "Basic ohne GBLSEARCH geladen" );
@@ -1801,13 +1936,17 @@ sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
sal_Bool StarBASIC::StoreData( SvStream& r ) const
{
if( !SbxObject::StoreData( r ) )
+ {
return sal_False;
+ }
r << (sal_uInt16) pModules->Count();
for( sal_uInt16 i = 0; i < pModules->Count(); i++ )
{
SbModule* p = (SbModule*) pModules->Get( i );
if( !p->Store( r ) )
+ {
return sal_False;
+ }
}
return sal_True;
}
@@ -1815,7 +1954,7 @@ sal_Bool StarBASIC::StoreData( SvStream& r ) const
bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut )
{
bool bRes = false;
- ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ OUString sVarName( OUString::createFromAscii( _pAsciiName ) );
SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( Find( sVarName, SbxCLASS_DONTCARE ) );
if ( pGlobs )
{
@@ -1829,12 +1968,13 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
{
OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" );
if ( !pBasic )
+ {
return NULL;
-
+ }
// look for the ThisComponent variable, first in the parent (which
// might be the document's Basic), then in the parent's parent (which might be
// the application Basic)
- const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) );
+ const OUString sThisComponent( "ThisComponent");
SbxVariable* pThisComponent = NULL;
SbxObject* pLookup = pBasic->GetParent();
@@ -1857,16 +1997,18 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
// it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller.
Reference< frame::XController > xController( aThisComponentAny, UNO_QUERY );
if ( xController.is() )
+ {
xModel = xController->getModel();
+ }
}
-
if ( !xModel.is() )
+ {
return NULL;
-
+ }
#if OSL_DEBUG_LEVEL > 0
OSL_TRACE("Have model ThisComponent points to url %s",
- ::rtl::OUStringToOString( xModel->getURL(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ OUStringToOString( xModel->getURL(),
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
#endif
return xModel;
@@ -1887,15 +2029,15 @@ static sal_uInt16 nCountHash = 0, nAddHash, nItemHash, nRemoveHash;
SbxInfoRef BasicCollection::xAddInfo = NULL;
SbxInfoRef BasicCollection::xItemInfo = NULL;
-BasicCollection::BasicCollection( const rtl::OUString& rClass )
+BasicCollection::BasicCollection( const OUString& rClass )
: SbxObject( rClass )
{
if( !nCountHash )
{
- nCountHash = MakeHashCode( rtl::OUString::createFromAscii( pCountStr ) );
- nAddHash = MakeHashCode( rtl::OUString::createFromAscii( pAddStr ) );
- nItemHash = MakeHashCode( rtl::OUString::createFromAscii( pItemStr ) );
- nRemoveHash = MakeHashCode( rtl::OUString::createFromAscii( pRemoveStr ) );
+ nCountHash = MakeHashCode( OUString::createFromAscii( pCountStr ) );
+ nAddHash = MakeHashCode( OUString::createFromAscii( pAddStr ) );
+ nItemHash = MakeHashCode( OUString::createFromAscii( pItemStr ) );
+ nRemoveHash = MakeHashCode( OUString::createFromAscii( pRemoveStr ) );
}
Initialize();
@@ -1917,31 +2059,31 @@ void BasicCollection::Initialize()
SetFlag( SBX_FIXED );
ResetFlag( SBX_WRITE );
SbxVariable* p;
- p = Make( rtl::OUString::createFromAscii( pCountStr ), SbxCLASS_PROPERTY, SbxINTEGER );
+ p = Make( OUString::createFromAscii( pCountStr ), SbxCLASS_PROPERTY, SbxINTEGER );
p->ResetFlag( SBX_WRITE );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pAddStr ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString::createFromAscii( pAddStr ), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pItemStr ), SbxCLASS_METHOD, SbxVARIANT );
+ p = Make( OUString::createFromAscii( pItemStr ), SbxCLASS_METHOD, SbxVARIANT );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pRemoveStr ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString::createFromAscii( pRemoveStr ), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
if ( !xAddInfo.Is() )
{
xAddInfo = new SbxInfo;
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Item") ), SbxVARIANT, SBX_READ );
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Key") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Before") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("After") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
+ xAddInfo->AddParam( OUString( "Item" ), SbxVARIANT, SBX_READ );
+ xAddInfo->AddParam( OUString( "Key" ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
+ xAddInfo->AddParam( OUString( "Before" ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
+ xAddInfo->AddParam( OUString( "After" ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
}
if ( !xItemInfo.Is() )
{
xItemInfo = new SbxInfo;
- xItemInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Index") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL);
+ xItemInfo->AddParam( OUString( "Index" ), SbxVARIANT, SBX_READ | SBX_OPTIONAL);
}
}
-SbxVariable* BasicCollection::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* BasicCollection::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pFind = SbxObject::Find( rName, t );
return pFind;
@@ -1959,33 +2101,47 @@ void BasicCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
sal_Bool bRequestInfo = sal_Bool( nId == SBX_HINT_INFOWANTED );
SbxVariable* pVar = p->GetVar();
SbxArray* pArg = pVar->GetParameters();
- rtl::OUString aVarName( pVar->GetName() );
+ OUString aVarName( pVar->GetName() );
if( bRead || bWrite )
{
if( pVar->GetHashCode() == nCountHash
&& aVarName.equalsIgnoreAsciiCaseAscii( pCountStr ) )
+ {
pVar->PutLong( xItemArray->Count32() );
+ }
else if( pVar->GetHashCode() == nAddHash
&& aVarName.equalsIgnoreAsciiCaseAscii( pAddStr ) )
+ {
CollAdd( pArg );
+ }
else if( pVar->GetHashCode() == nItemHash
&& aVarName.equalsIgnoreAsciiCaseAscii( pItemStr ) )
+ {
CollItem( pArg );
+ }
else if( pVar->GetHashCode() == nRemoveHash
&& aVarName.equalsIgnoreAsciiCaseAscii( pRemoveStr ) )
+ {
CollRemove( pArg );
+ }
else
+ {
SbxObject::SFX_NOTIFY( rCst, rId1, rHint, rId2 );
+ }
return;
}
else if ( bRequestInfo )
{
if( pVar->GetHashCode() == nAddHash
&& aVarName.equalsIgnoreAsciiCaseAscii( pAddStr ) )
+ {
pVar->SetInfo( xAddInfo );
+ }
else if( pVar->GetHashCode() == nItemHash
&& aVarName.equalsIgnoreAsciiCaseAscii( pItemStr ) )
+ {
pVar->SetInfo( xItemInfo );
+ }
}
}
SbxObject::SFX_NOTIFY( rCst, rId1, rHint, rId2 );
@@ -1995,13 +2151,17 @@ sal_Int32 BasicCollection::implGetIndex( SbxVariable* pIndexVar )
{
sal_Int32 nIndex = -1;
if( pIndexVar->GetType() == SbxSTRING )
- nIndex = implGetIndexForName( pIndexVar->GetString() );
+ {
+ nIndex = implGetIndexForName( pIndexVar->GetOUString() );
+ }
else
+ {
nIndex = pIndexVar->GetLong() - 1;
+ }
return nIndex;
}
-sal_Int32 BasicCollection::implGetIndexForName( const String& rName )
+sal_Int32 BasicCollection::implGetIndexForName( const OUString& rName )
{
sal_Int32 nIndex = -1;
sal_Int32 nCount = xItemArray->Count32();
@@ -2010,7 +2170,7 @@ sal_Int32 BasicCollection::implGetIndexForName( const String& rName )
{
SbxVariable* pVar = xItemArray->Get32( i );
if( pVar->GetHashCode() == nNameHash &&
- pVar->GetName().EqualsIgnoreCaseAscii( rName ) )
+ pVar->GetName().equalsIgnoreAsciiCase( rName ) )
{
nIndex = i;
break;
@@ -2078,7 +2238,7 @@ void BasicCollection::CollAdd( SbxArray* pPar_ )
SetError( SbERR_BAD_ARGUMENT );
return;
}
- String aKey = pKey->GetString();
+ OUString aKey = pKey->GetOUString();
if( implGetIndexForName( aKey ) != -1 )
{
SetError( SbERR_BAD_ARGUMENT );
@@ -2108,11 +2268,17 @@ void BasicCollection::CollItem( SbxArray* pPar_ )
SbxVariable* p = pPar_->Get( 1 );
sal_Int32 nIndex = implGetIndex( p );
if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() )
+ {
pRes = xItemArray->Get32( nIndex );
+ }
if( !pRes )
+ {
SetError( SbERR_BAD_ARGUMENT );
+ }
else
+ {
*(pPar_->Get(0)) = *pRes;
+ }
}
void BasicCollection::CollRemove( SbxArray* pPar_ )
@@ -2138,12 +2304,16 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
if( pStack != NULL )
{
if( pStack->nCurCollectionIndex >= nIndex )
+ {
--pStack->nCurCollectionIndex;
+ }
}
}
}
else
+ {
SetError( SbERR_BAD_ARGUMENT );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index cd43e1b4c6bd..54d2a26e2006 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -47,6 +47,7 @@
#include <com/sun/star/beans/PropertyConcept.hpp>
#include <com/sun/star/beans/MethodConcept.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/Introspection.hpp>
#include <com/sun/star/script/BasicErrorException.hpp>
#include <com/sun/star/script/XAllListener.hpp>
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
@@ -114,7 +115,7 @@ static char const defaultNameSpace[] = "ooo.vba";
// redirection built in. The property name specifies the name
// of the default property.
-bool SbUnoObject::getDefaultPropName( SbUnoObject* pUnoObj, ::rtl::OUString& sDfltProp )
+bool SbUnoObject::getDefaultPropName( SbUnoObject* pUnoObj, OUString& sDfltProp )
{
bool result = false;
Reference< XDefaultProperty> xDefaultProp( pUnoObj->maTmpUnoObj, UNO_QUERY );
@@ -152,7 +153,7 @@ void SetSbUnoObjectDfltPropName( SbxObject* pObj )
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
if ( pUnoObj )
{
- ::rtl::OUString sDfltPropName;
+ OUString sDfltPropName;
if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
{
@@ -175,14 +176,14 @@ Reference< XIdlReflection > getCoreReflection_Impl( void )
if( xContext.is() )
{
xContext->getValueByName(
- ::rtl::OUString( "/singletons/com.sun.star.reflection.theCoreReflection" ) )
+ OUString( "/singletons/com.sun.star.reflection.theCoreReflection" ) )
>>= xCoreReflection;
OSL_ENSURE( xCoreReflection.is(), "### CoreReflection singleton not accessable!?" );
}
if( !xCoreReflection.is() )
{
throw DeploymentException(
- ::rtl::OUString( "/singletons/com.sun.star.reflection.theCoreReflection singleton not accessable" ),
+ OUString( "/singletons/com.sun.star.reflection.theCoreReflection singleton not accessable" ),
Reference< XInterface >() );
}
}
@@ -219,15 +220,14 @@ Reference< XHierarchicalNameAccess > getTypeProvider_Impl( void )
if( xContext.is() )
{
xContext->getValueByName(
- ::rtl::OUString( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) )
+ OUString( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) )
>>= xAccess;
OSL_ENSURE( xAccess.is(), "### TypeDescriptionManager singleton not accessable!?" );
}
if( !xAccess.is() )
{
throw DeploymentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM
- ("/singletons/com.sun.star.reflection.theTypeDescriptionManager singleton not accessable") ),
+ OUString("/singletons/com.sun.star.reflection.theTypeDescriptionManager singleton not accessable"),
Reference< XInterface >() );
}
}
@@ -251,8 +251,7 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
if( !xTypeConverter.is() )
{
throw DeploymentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM
- ("com.sun.star.script.Converter service not accessable") ),
+ OUString("com.sun.star.script.Converter service not accessable"),
Reference< XInterface >() );
}
}
@@ -261,7 +260,7 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
// #111851 factory function to create an OLE object
-SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType )
+SbUnoObject* createOLEObject_Impl( const OUString& aType )
{
static Reference< XMultiServiceFactory > xOLEFactory;
static bool bNeedsInit = true;
@@ -277,7 +276,7 @@ SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType )
Reference<XMultiComponentFactory> xSMgr = xContext->getServiceManager();
xOLEFactory = Reference<XMultiServiceFactory>(
xSMgr->createInstanceWithContext(
- ::rtl::OUString( "com.sun.star.bridge.OleObjectFactory"),
+ OUString( "com.sun.star.bridge.OleObjectFactory"),
xContext ), UNO_QUERY );
}
}
@@ -286,10 +285,11 @@ SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType )
if( xOLEFactory.is() )
{
// some type names available in VBA can not be directly used in COM
- ::rtl::OUString aOLEType = aType;
+ OUString aOLEType = aType;
if ( aOLEType == "SAXXMLReader30" )
- aOLEType = ::rtl::OUString( "Msxml2.SAXXMLReader.3.0" );
-
+ {
+ aOLEType = "Msxml2.SAXXMLReader.3.0";
+ }
Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aOLEType );
if( xOLEObject.is() )
{
@@ -304,14 +304,16 @@ SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType )
namespace
{
- void lcl_indent( ::rtl::OUStringBuffer& _inout_rBuffer, sal_Int32 _nLevel )
+ void lcl_indent( OUStringBuffer& _inout_rBuffer, sal_Int32 _nLevel )
{
while ( _nLevel-- > 0 )
+ {
_inout_rBuffer.appendAscii( " " );
+ }
}
}
-void implAppendExceptionMsg( ::rtl::OUStringBuffer& _inout_rBuffer, const Exception& _e, const ::rtl::OUString& _rExceptionType, sal_Int32 _nLevel )
+void implAppendExceptionMsg( OUStringBuffer& _inout_rBuffer, const Exception& _e, const OUString& _rExceptionType, sal_Int32 _nLevel )
{
_inout_rBuffer.appendAscii( "\n" );
lcl_indent( _inout_rBuffer, _nLevel );
@@ -330,19 +332,20 @@ void implAppendExceptionMsg( ::rtl::OUStringBuffer& _inout_rBuffer, const Except
}
// construct an error message for the exception
-::rtl::OUString implGetExceptionMsg( const Exception& e, const ::rtl::OUString& aExceptionType_ )
+OUString implGetExceptionMsg( const Exception& e, const OUString& aExceptionType_ )
{
- ::rtl::OUStringBuffer aMessageBuf;
+ OUStringBuffer aMessageBuf;
implAppendExceptionMsg( aMessageBuf, e, aExceptionType_, 0 );
return aMessageBuf.makeStringAndClear();
}
-::rtl::OUString implGetExceptionMsg( const Any& _rCaughtException )
+OUString implGetExceptionMsg( const Any& _rCaughtException )
{
OSL_PRECOND( _rCaughtException.getValueTypeClass() == TypeClass_EXCEPTION, "implGetExceptionMsg: illegal argument!" );
if ( _rCaughtException.getValueTypeClass() != TypeClass_EXCEPTION )
- return String();
-
+ {
+ return OUString();
+ }
return implGetExceptionMsg( *static_cast< const Exception* >( _rCaughtException.getValue() ), _rCaughtException.getValueTypeName() );
}
@@ -362,10 +365,9 @@ Any convertAny( const Any& rVal, const Type& aDestType )
}
catch( const CannotConvertException& e2 )
{
- ::rtl::OUString aCannotConvertExceptionName
- ( "com.sun.star.lang.IllegalArgumentException" );
+ OUString aCannotConvertExceptionName( "com.sun.star.lang.IllegalArgumentException");
StarBASIC::Error( ERRCODE_BASIC_EXCEPTION,
- implGetExceptionMsg( e2, aCannotConvertExceptionName ) );
+ implGetExceptionMsg( e2, aCannotConvertExceptionName ) );
return aConvertedVal;
}
return aConvertedVal;
@@ -386,7 +388,7 @@ Reference<XIdlClass> TypeToIdlClass( const Type& rType )
if( pTD )
{
- ::rtl::OUString sOWName( pTD->pTypeName );
+ OUString sOWName( pTD->pTypeName );
Reference< XIdlReflection > xRefl = getCoreReflection_Impl();
xRetClass = xRefl->forName( sOWName );
}
@@ -395,7 +397,7 @@ Reference<XIdlClass> TypeToIdlClass( const Type& rType )
// Exception type unknown
template< class EXCEPTION >
-::rtl::OUString implGetExceptionMsg( const EXCEPTION& e )
+OUString implGetExceptionMsg( const EXCEPTION& e )
{
return implGetExceptionMsg( e, ::getCppuType( &e ).getTypeName() );
}
@@ -419,7 +421,7 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
BasicErrorException aBasicError;
SbError nError( ERRCODE_BASIC_EXCEPTION );
- ::rtl::OUStringBuffer aMessageBuf;
+ OUStringBuffer aMessageBuf;
// strip any other WrappedTargetException instances, but this time preserve the error messages.
WrappedTargetException aWrapped;
@@ -659,7 +661,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
aClassAny <<= xClass;
// instantiate SbUnoObject
- ::rtl::OUString aName;
+ OUString aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aClassAny );
SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject;
@@ -747,7 +749,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
}
// instantiate a SbUnoObject
- ::rtl::OUString aName;
+ OUString aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
//If this is called externally e.g. from the scripting
//framework then there is no 'active' runtime the default property will not be set up
@@ -755,10 +757,12 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
//test seems a bit of overkill
//if ( SbiRuntime::isVBAEnabled() )
{
- ::rtl::OUString sDfltPropName;
+ OUString sDfltPropName;
if ( SbUnoObject::getDefaultPropName( pSbUnoObject, sDfltPropName ) )
- pSbUnoObject->SetDfltProperty( sDfltPropName );
+ {
+ pSbUnoObject->SetDfltProperty( sDfltPropName );
+ }
}
SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject;
@@ -836,7 +840,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
pVar->PutChar( *(sal_Unicode*)aValue.getValue() );
break;
}
- case TypeClass_STRING: { ::rtl::OUString val; aValue >>= val; pVar->PutString( val ); } break;
+ case TypeClass_STRING: { OUString val; aValue >>= val; pVar->PutString( val ); } break;
case TypeClass_FLOAT: { float val = 0; aValue >>= val; pVar->PutSingle( val ); } break;
case TypeClass_DOUBLE: { double val = 0; aValue >>= val; pVar->PutDouble( val ); } break;
case TypeClass_BYTE: { sal_Int8 val = 0; aValue >>= val; pVar->PutInteger( val ); } break;
@@ -871,7 +875,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
aRetType = ::getCppuType( (oleautomation::Date*)0 );
}
break;
- case SbxSTRING: aRetType = ::getCppuType( (::rtl::OUString*)0 ); break;
+ case SbxSTRING: aRetType = ::getCppuType( (OUString*)0 ); break;
case SbxBOOL: aRetType = ::getCppuType( (sal_Bool*)0 ); break;
case SbxVARIANT: aRetType = ::getCppuType( (Any*)0 ); break;
case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break;
@@ -950,7 +954,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
}
- ::rtl::OUStringBuffer aSeqTypeName;
+ OUStringBuffer aSeqTypeName;
aSeqTypeName.appendAscii(RTL_CONSTASCII_STRINGPARAM(aSeqLevelStr))
.append(aElementType.getTypeName());
aRetType = Type( TypeClass_SEQUENCE, aSeqTypeName.makeStringAndClear() );
@@ -989,9 +993,11 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
}
- ::rtl::OUStringBuffer aSeqTypeName;
+ OUStringBuffer aSeqTypeName;
for( short iDim = 0 ; iDim < nDims ; iDim++ )
+ {
aSeqTypeName.appendAscii(RTL_CONSTASCII_STRINGPARAM(aSeqLevelStr));
+ }
aSeqTypeName.append(aElementType.getTypeName());
aRetType = Type( TypeClass_SEQUENCE, aSeqTypeName.makeStringAndClear() );
}
@@ -1127,10 +1133,12 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
sal_Int32* pActualIndices, sal_Int32* pLowerBounds, sal_Int32* pUpperBounds )
{
sal_Int32 nSeqLevel = nMaxDimIndex - nActualDim + 1;
- ::rtl::OUStringBuffer aSeqTypeName;
+ OUStringBuffer aSeqTypeName;
sal_Int32 i;
for( i = 0 ; i < nSeqLevel ; i++ )
+ {
aSeqTypeName.appendAscii(RTL_CONSTASCII_STRINGPARAM(aSeqLevelStr));
+ }
aSeqTypeName.append(aElemType.getTypeName());
Type aSeqType( TypeClass_SEQUENCE, aSeqTypeName.makeStringAndClear() );
@@ -1189,7 +1197,7 @@ Any sbxToUnoValue( SbxVariable* pVar )
// function to find a global identifier in
// the UnoScope and to wrap it for Sbx
-static bool implGetTypeByName( const String& rName, Type& rRetType )
+static bool implGetTypeByName( const OUString& rName, Type& rRetType )
{
bool bSuccess = false;
@@ -1245,7 +1253,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
if( pVar->IsNull() && eType == TypeClass_INTERFACE )
{
Reference< XInterface > xRef;
- ::rtl::OUString aClassName = xIdlTargetClass->getName();
+ OUString aClassName = xIdlTargetClass->getName();
Type aClassType( xIdlTargetClass->getTypeClass(), aClassName.getStr() );
aRetVal.setValue( &xRef, aClassType );
}
@@ -1315,19 +1323,20 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
if( xIdlClass.is() )
{
- ::rtl::OUString aClassName = xIdlClass->getName();
+ OUString aClassName = xIdlClass->getName();
Type aType( xIdlClass->getTypeClass(), aClassName.getStr() );
aRetVal <<= aType;
}
}
else if( eBaseType == SbxSTRING )
{
- // String representing type?
- String aTypeName = pVar->GetString();
+ OUString aTypeName = pVar->GetOUString();
Type aType;
bool bSuccess = implGetTypeByName( aTypeName, aType );
if( bSuccess )
+ {
aRetVal <<= aType;
+ }
}
}
break;
@@ -1362,7 +1371,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
xArray->realloc( aRetVal, nSeqSize );
// Element-Type
- ::rtl::OUString aClassName = xIdlTargetClass->getName();
+ OUString aClassName = xIdlTargetClass->getName();
typelib_TypeDescription * pSeqTD = 0;
typelib_typedescription_getByName( &pSeqTD, aClassName.pData );
OSL_ASSERT( pSeqTD );
@@ -1403,7 +1412,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
Type aElemType;
do
{
- ::rtl::OUString aTypeName = aCurType.getTypeName();
+ OUString aTypeName = aCurType.getTypeName();
typelib_typedescription_getByName( &pSeqTD, aTypeName.pData );
OSL_ASSERT( pSeqTD );
if( pSeqTD->eTypeClass == typelib_TypeClass_SEQUENCE )
@@ -1515,8 +1524,8 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL
sal_uInt32 i = 0;
if( pArgNamesArray )
{
- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
- ::rtl::OUString* pNames = rNameSeq.getArray();
+ Sequence< OUString >& rNameSeq = pArgNamesArray->getNames();
+ OUString* pNames = rNameSeq.getArray();
Any aValAny;
for( i = 0 ; i < nParamCount ; i++ )
{
@@ -1525,7 +1534,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL
aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
bBlockConversionToSmallestType );
- ::rtl::OUString aParamName = pNames[iSbx];
+ OUString aParamName = pNames[iSbx];
if( !aParamName.isEmpty() )
{
oleautomation::NamedArgument aNamedArgument;
@@ -1555,7 +1564,7 @@ enum INVOKETYPE
SetProp,
Func
};
-Any invokeAutomationMethod( const rtl::OUString& Name, Sequence< Any >& args, SbxArray* pParams, sal_uInt32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
+Any invokeAutomationMethod( const OUString& Name, Sequence< Any >& args, SbxArray* pParams, sal_uInt32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
{
Sequence< sal_Int16 > OutParamIndex;
Sequence< Any > OutParam;
@@ -1599,16 +1608,16 @@ Any invokeAutomationMethod( const rtl::OUString& Name, Sequence< Any >& args, Sb
}
// Debugging help method to readout the imlemented interfaces of an object
-rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, sal_uInt16 nRekLevel )
+OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, sal_uInt16 nRekLevel )
{
Type aIfaceType = ::getCppuType( (const Reference< XInterface > *)0 );
static Reference< XIdlClass > xIfaceClass = TypeToIdlClass( aIfaceType );
- rtl::OUStringBuffer aRetStr;
+ OUStringBuffer aRetStr;
for( sal_uInt16 i = 0 ; i < nRekLevel ; i++ )
aRetStr.appendAscii( " " );
aRetStr.append( xClass->getName() );
- ::rtl::OUString aClassName = xClass->getName();
+ OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
// checking if the interface is realy supported
@@ -1635,9 +1644,9 @@ rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Ref
return aRetStr.makeStringAndClear();
}
-::rtl::OUString getDbgObjectNameImpl( SbUnoObject* pUnoObj )
+OUString getDbgObjectNameImpl( SbUnoObject* pUnoObj )
{
- ::rtl::OUString aName;
+ OUString aName;
if( pUnoObj )
{
aName = pUnoObj->GetClassName();
@@ -1659,24 +1668,26 @@ rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Ref
return aName;
}
-::rtl::OUString getDbgObjectName( SbUnoObject* pUnoObj )
+OUString getDbgObjectName( SbUnoObject* pUnoObj )
{
- ::rtl::OUString aName = getDbgObjectNameImpl( pUnoObj );
+ OUString aName = getDbgObjectNameImpl( pUnoObj );
if( aName.isEmpty() )
aName += ::rtl::OUString("Unknown");
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
if( aName.getLength() > 20 )
+ {
aRet.appendAscii( "\n" );
+ }
aRet.appendAscii( "\"" );
aRet.append( aName );
aRet.appendAscii( "\":" );
return aRet.makeStringAndClear();
}
-::rtl::OUString getBasicObjectTypeName( SbxObject* pObj )
+OUString getBasicObjectTypeName( SbxObject* pObj )
{
- ::rtl::OUString aName;
+ OUString aName;
if( pObj )
{
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pObj);
@@ -1689,19 +1700,22 @@ rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Ref
return aName;
}
-bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
+bool checkUnoObjectType( SbUnoObject* pUnoObj, const OUString& rClass )
{
Any aToInspectObj = pUnoObj->getUnoAny();
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
if( eType != TypeClass_INTERFACE )
+ {
return false;
+ }
const Reference< XInterface > x = *(Reference< XInterface >*)aToInspectObj.getValue();
// Return true for XInvocation based objects as interface type names don't count then
Reference< XInvocation > xInvocation( x, UNO_QUERY );
if( xInvocation.is() )
+ {
return true;
-
+ }
bool result = false;
Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
if( xTypeProvider.is() )
@@ -1714,13 +1728,16 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
which matches the interface names 'ooo.vba.excel.XWorkbooks' or
'ooo.vba.msforms.XLabel'.
*/
- ::rtl::OUString aClassName( sal_Unicode( '.' ) );
+ OUString aClassName( sal_Unicode( '.' ) );
sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
if( nClassNameDot >= 0 )
- aClassName += rClass.copy( 0, nClassNameDot + 1 ) + ::rtl::OUString( sal_Unicode( 'X' ) ) + rClass.copy( nClassNameDot + 1 );
+ {
+ aClassName += rClass.copy( 0, nClassNameDot + 1 ) + OUString( sal_Unicode( 'X' ) ) + rClass.copy( nClassNameDot + 1 );
+ }
else
+ {
aClassName += ::rtl::OUString( sal_Unicode( 'X' ) ) + rClass;
-
+ }
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
const Type* pTypeArray = aTypeSeq.getConstArray();
sal_uInt32 nIfaceCount = aTypeSeq.getLength();
@@ -1734,7 +1751,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
OSL_FAIL("failed to get XIdlClass for type");
break;
}
- ::rtl::OUString aInterfaceName = xClass->getName();
+ OUString aInterfaceName = xClass->getName();
if ( aInterfaceName == "com.sun.star.bridge.oleautomation.XAutomationObject" )
{
// there is a hack in the extensions/source/ole/oleobj.cxx to return the typename of the automation object, lets check if it
@@ -1742,13 +1759,17 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
Reference< XInvocation > xInv( aToInspectObj, UNO_QUERY );
if ( xInv.is() )
{
- rtl::OUString sTypeName;
- xInv->getValue( rtl::OUString( "$GetTypeName" ) ) >>= sTypeName;
+ OUString sTypeName;
+ xInv->getValue( OUString( "$GetTypeName" ) ) >>= sTypeName;
if ( sTypeName.isEmpty() || sTypeName == "IDispatch" )
+ {
// can't check type, leave it pass
result = true;
+ }
else
+ {
result = sTypeName.equals( rClass );
+ }
}
break; // finished checking automation object
}
@@ -1767,13 +1788,13 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
}
// Debugging help method to readout the imlemented interfaces of an object
-::rtl::OUString Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
+OUString Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
{
Any aToInspectObj = pUnoObj->getUnoAny();
// allow only TypeClass interface
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
if( eType != TypeClass_INTERFACE )
{
aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM(ID_DBG_SUPPORTEDINTERFACES) );
@@ -1822,9 +1843,9 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
// Debugging help method SbxDataType -> String
-::rtl::OUString Dbg_SbxDataType2String( SbxDataType eType )
+OUString Dbg_SbxDataType2String( SbxDataType eType )
{
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
switch( +eType )
{
case SbxEMPTY: aRet.appendAscii("SbxEMPTY"); break;
@@ -1866,9 +1887,9 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
}
// Debugging help method to display the properties of a SbUnoObjects
-::rtl::OUString Impl_DumpProperties( SbUnoObject* pUnoObj )
+OUString Impl_DumpProperties( SbUnoObject* pUnoObj )
{
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
aRet.appendAscii("Properties of object ");
aRet.append( getDbgObjectName( pUnoObj ) );
@@ -1898,7 +1919,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
SbxVariable* pVar = pProps->Get( i );
if( pVar )
{
- ::rtl::OUStringBuffer aPropStr;
+ OUStringBuffer aPropStr;
if( (i % nPropsPerLine) == 0 )
aPropStr.appendAscii( "\n" );
@@ -1943,9 +1964,9 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
}
// Debugging help method to display the methods of an SbUnoObjects
-::rtl::OUString Impl_DumpMethods( SbUnoObject* pUnoObj )
+OUString Impl_DumpMethods( SbUnoObject* pUnoObj )
{
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
aRet.appendAscii("Methods of object ");
aRet.append( getDbgObjectName( pUnoObj ) );
@@ -2055,7 +2076,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
// Id == -1: Display implemented interfaces according the ClassProvider
if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES"
{
- ::rtl::OUString aRetStr = Impl_GetSupportedInterfaces( this );
+ OUString aRetStr = Impl_GetSupportedInterfaces( this );
pVar->PutString( aRetStr );
}
// Id == -2: output properties
@@ -2063,7 +2084,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
// by now all properties must be established
implCreateAll();
- ::rtl::OUString aRetStr = Impl_DumpProperties( this );
+ OUString aRetStr = Impl_DumpProperties( this );
pVar->PutString( aRetStr );
}
// Id == -3: output the methods
@@ -2071,7 +2092,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
// y now all properties must be established
implCreateAll();
- ::rtl::OUString aRetStr = Impl_DumpMethods( this );
+ OUString aRetStr = Impl_DumpMethods( this );
pVar->PutString( aRetStr );
}
return;
@@ -2313,7 +2334,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
-SbUnoObject::SbUnoObject( const rtl::OUString& aName_, const Any& aUnoObj_ )
+SbUnoObject::SbUnoObject( const OUString& aName_, const Any& aUnoObj_ )
: SbxObject( aName_ )
, bNeedIntrospection( true )
, bNativeCOMObject( false )
@@ -2321,8 +2342,8 @@ SbUnoObject::SbUnoObject( const rtl::OUString& aName_, const Any& aUnoObj_ )
static Reference< XIntrospection > xIntrospection;
// beat out again the default properties of Sbx
- Remove( rtl::OUString("Name"), SbxCLASS_DONTCARE );
- Remove( rtl::OUString("Parent"), SbxCLASS_DONTCARE );
+ Remove( OUString("Name"), SbxCLASS_DONTCARE );
+ Remove( OUString("Parent"), SbxCLASS_DONTCARE );
// check the type of the ojekts
TypeClass eType = aUnoObj_.getValueType().getTypeClass();
@@ -2369,7 +2390,7 @@ SbUnoObject::SbUnoObject( const rtl::OUString& aName_, const Any& aUnoObj_ )
// Is it an interface or a struct?
sal_Bool bSetClassName = sal_False;
- rtl::OUString aClassName_;
+ OUString aClassName_;
if( eType == TypeClass_STRUCT || eType == TypeClass_EXCEPTION )
{
// Struct is Ok
@@ -2421,18 +2442,8 @@ void SbUnoObject::doIntrospection( void )
if( !xIntrospection.is() )
{
// get the introspection service
- Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
- if ( xFactory.is() )
- {
- Reference< XInterface > xI = xFactory->createInstance( rtl::OUString("com.sun.star.beans.Introspection") );
- if (xI.is())
- xIntrospection = Reference< XIntrospection >::query( xI );
- }
- }
- if( !xIntrospection.is() )
- {
- StarBASIC::FatalError( ERRCODE_BASIC_EXCEPTION );
- return;
+ Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ xIntrospection = Introspection::create( xContext );
}
// pass the introspection
@@ -2518,7 +2529,7 @@ void clearUnoMethods( void )
SbUnoMethod::SbUnoMethod
(
- const rtl::OUString& aName_,
+ const OUString& aName_,
SbxDataType eSbxType,
Reference< XIdlMethod > xUnoMethod_,
bool bInvocation,
@@ -2567,7 +2578,7 @@ SbxInfo* SbUnoMethod::GetInfo()
for( sal_uInt32 i = 0 ; i < nParamCount ; i++ )
{
const ParamInfo& rInfo = pParamInfos[i];
- ::rtl::OUString aParamName = rInfo.aName;
+ OUString aParamName = rInfo.aName;
SbxDataType t = SbxVARIANT;
sal_uInt16 nFlags_ = SBX_READ;
@@ -2590,7 +2601,7 @@ const Sequence<ParamInfo>& SbUnoMethod::getParamInfos( void )
SbUnoProperty::SbUnoProperty
(
- const rtl::OUString& aName_,
+ const OUString& aName_,
SbxDataType eSbxType,
SbxDataType eRealSbxType,
const Property& aUnoProp_,
@@ -2615,7 +2626,7 @@ SbUnoProperty::~SbUnoProperty()
{}
-SbxVariable* SbUnoObject::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t )
{
static Reference< XIdlMethod > xDummyMethod;
static Property aDummyProp;
@@ -2629,14 +2640,16 @@ SbxVariable* SbUnoObject::Find( const rtl::OUString& rName, SbxClassType t )
// if a property or a method of the required name exist
if( !pRes )
{
- ::rtl::OUString aUName( rName );
+ OUString aUName( rName );
if( mxUnoAccess.is() && !bNativeCOMObject )
{
if( mxExactName.is() )
{
- ::rtl::OUString aUExactName = mxExactName->getExactName( aUName );
+ OUString aUExactName = mxExactName->getExactName( aUName );
if( !aUExactName.isEmpty() )
+ {
aUName = aUExactName;
+ }
}
if( mxUnoAccess->hasProperty( aUName, PropertyConcept::ALL - PropertyConcept::DANGEROUS ) )
{
@@ -2677,7 +2690,7 @@ SbxVariable* SbUnoObject::Find( const rtl::OUString& rName, SbxClassType t )
try
{
Reference< XNameAccess > xNameAccess( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY );
- ::rtl::OUString aUName2( rName );
+ OUString aUName2( rName );
if( xNameAccess.is() && xNameAccess->hasByName( aUName2 ) )
{
@@ -2712,9 +2725,11 @@ SbxVariable* SbUnoObject::Find( const rtl::OUString& rName, SbxClassType t )
{
if( mxExactNameInvocation.is() )
{
- ::rtl::OUString aUExactName = mxExactNameInvocation->getExactName( aUName );
+ OUString aUExactName = mxExactNameInvocation->getExactName( aUName );
if( !aUExactName.isEmpty() )
+ {
aUName = aUExactName;
+ }
}
try
@@ -2781,15 +2796,15 @@ void SbUnoObject::implCreateDbgProperties( void )
Property aProp;
// Id == -1: display the implemented interfaces corresponding the ClassProvider
- SbxVariableRef xVarRef = new SbUnoProperty( ::rtl::OUString(ID_DBG_SUPPORTEDINTERFACES), SbxSTRING, SbxSTRING, aProp, -1, false, false );
+ SbxVariableRef xVarRef = new SbUnoProperty( OUString(ID_DBG_SUPPORTEDINTERFACES), SbxSTRING, SbxSTRING, aProp, -1, false, false );
QuickInsert( (SbxVariable*)xVarRef );
// Id == -2: output the properties
- xVarRef = new SbUnoProperty( ::rtl::OUString(ID_DBG_PROPERTIES), SbxSTRING, SbxSTRING, aProp, -2, false, false );
+ xVarRef = new SbUnoProperty( OUString(ID_DBG_PROPERTIES), SbxSTRING, SbxSTRING, aProp, -2, false, false );
QuickInsert( (SbxVariable*)xVarRef );
// Id == -3: output the Methods
- xVarRef = new SbUnoProperty( ::rtl::OUString(ID_DBG_METHODS), SbxSTRING, SbxSTRING, aProp, -3, false, false );
+ xVarRef = new SbUnoProperty( OUString(ID_DBG_METHODS), SbxSTRING, SbxSTRING, aProp, -3, false, false );
QuickInsert( (SbxVariable*)xVarRef );
}
@@ -2870,7 +2885,7 @@ Any SbUnoObject::getUnoAny( void )
}
// help method to create an Uno-Struct per CoreReflection
-SbUnoObject* Impl_CreateUnoStruct( const ::rtl::OUString& aClassName )
+SbUnoObject* Impl_CreateUnoStruct( const OUString& aClassName )
{
// get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
@@ -2907,7 +2922,7 @@ SbxBase* SbUnoFactory::Create( sal_uInt16, sal_uInt32 )
return NULL;
}
-SbxObject* SbUnoFactory::CreateObject( const rtl::OUString& rClassName )
+SbxObject* SbUnoFactory::CreateObject( const OUString& rClassName )
{
return Impl_CreateUnoStruct( rClassName );
}
@@ -2915,7 +2930,7 @@ SbxObject* SbUnoFactory::CreateObject( const rtl::OUString& rClassName )
// Provisional interface for the UNO-Connection
// Deliver a SbxObject, that wrap an Uno-Interface
-SbxObjectRef GetSbUnoObject( const ::rtl::OUString& aName, const Any& aUnoObj_ )
+SbxObjectRef GetSbUnoObject( const OUString& aName, const Any& aUnoObj_ )
{
return new SbUnoObject( aName, aUnoObj_ );
}
@@ -2929,11 +2944,17 @@ void createAllObjectProperties( SbxObject* pObj )
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pObj);
SbUnoStructRefObject* pUnoStructObj = PTR_CAST(SbUnoStructRefObject,pObj);
if( pUnoObj )
+ {
pUnoObj->createAllProperties();
+ }
else if ( pUnoStructObj )
+ {
pUnoStructObj->createAllProperties();
+ }
else
+ {
pObj->GetAll( SbxCLASS_DONTCARE );
+ }
}
@@ -2950,13 +2971,14 @@ void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
}
// get the name of the class of the struct
- ::rtl::OUString aClassName = rPar.Get(1)->GetString();
+ OUString aClassName = rPar.Get(1)->GetOUString();
// try to create Struct with the same name
SbUnoObjectRef xUnoObj = Impl_CreateUnoStruct( aClassName );
if( !xUnoObj )
+ {
return;
-
+ }
// return the object
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( (SbUnoObject*)xUnoObj );
@@ -2975,7 +2997,7 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWri
}
// get the name of the class of the struct
- ::rtl::OUString aServiceName = rPar.Get(1)->GetString();
+ OUString aServiceName = rPar.Get(1)->GetOUString();
// search for the service and instatiate it
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
@@ -3029,7 +3051,7 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
}
// get the name of the class of the struct
- ::rtl::OUString aServiceName = rPar.Get(1)->GetString();
+ OUString aServiceName = rPar.Get(1)->GetOUString();
Any aArgAsAny = sbxToUnoValue( rPar.Get(2),
getCppuType( (Sequence<Any>*)0 ) );
Sequence< Any > aArgs;
@@ -3089,7 +3111,7 @@ void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, sal_B
aAny <<= xFactory;
// Create a SbUnoObject out of it and return it
- SbUnoObjectRef xUnoObj = new SbUnoObject( ::rtl::OUString( "ProcessServiceManager" ), aAny );
+ SbUnoObjectRef xUnoObj = new SbUnoObject( OUString( "ProcessServiceManager" ), aAny );
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
else
@@ -3118,35 +3140,42 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
// get the Uno-Object
SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject();
if( !(pObj && pObj->ISA(SbUnoObject)) )
+ {
return;
+ }
Any aAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny();
TypeClass eType = aAny.getValueType().getTypeClass();
if( eType != TypeClass_INTERFACE )
+ {
return;
-
+ }
// get the interface out of the Any
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
// get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
+ {
return;
-
+ }
for( sal_uInt16 i = 2 ; i < nParCount ; i++ )
{
// get the name of the interface of the struct
- rtl::OUString aIfaceName = rPar.Get( i )->GetString();
+ OUString aIfaceName = rPar.Get( i )->GetOUString();
// search for the class
Reference< XIdlClass > xClass = xCoreReflection->forName( aIfaceName );
if( !xClass.is() )
+ {
return;
-
+ }
// check if the interface will be supported
- ::rtl::OUString aClassName = xClass->getName();
+ OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
if( !x->queryInterface( aClassType ).hasValue() )
+ {
return;
+ }
}
// Every thing works; then return TRUE
@@ -3172,14 +3201,20 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
// get the Uno-Object
SbxVariableRef xParam = rPar.Get( 1 );
if( !xParam->IsObject() )
+ {
return;
+ }
SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject();
if( !(pObj && pObj->ISA(SbUnoObject)) )
+ {
return;
+ }
Any aAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny();
TypeClass eType = aAny.getValueType().getTypeClass();
if( eType == TypeClass_STRUCT )
+ {
refVar->PutBool( sal_True );
+ }
}
@@ -3201,32 +3236,46 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
// get the Uno-Objects
SbxVariableRef xParam1 = rPar.Get( 1 );
if( !xParam1->IsObject() )
+ {
return;
+ }
SbxBaseRef pObj1 = (SbxBase*)xParam1->GetObject();
if( !(pObj1 && pObj1->ISA(SbUnoObject)) )
+ {
return;
+ }
Any aAny1 = ((SbUnoObject*)(SbxBase*)pObj1)->getUnoAny();
TypeClass eType1 = aAny1.getValueType().getTypeClass();
if( eType1 != TypeClass_INTERFACE )
+ {
return;
+ }
Reference< XInterface > x1;
aAny1 >>= x1;
SbxVariableRef xParam2 = rPar.Get( 2 );
if( !xParam2->IsObject() )
+ {
return;
+ }
SbxBaseRef pObj2 = (SbxBase*)xParam2->GetObject();
if( !(pObj2 && pObj2->ISA(SbUnoObject)) )
+ {
return;
+ }
Any aAny2 = ((SbUnoObject*)(SbxBase*)pObj2)->getUnoAny();
TypeClass eType2 = aAny2.getValueType().getTypeClass();
if( eType2 != TypeClass_INTERFACE )
+ {
return;
+ }
Reference< XInterface > x2;
aAny2 >>= x2;
if( x1 == x2 )
+ {
refVar->PutBool( sal_True );
+ }
}
@@ -3235,9 +3284,9 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
// if it fails for whatever reason
// returned Reference<> be null e.g. .is() will be false
-Reference< XTypeDescriptionEnumeration >
-getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
- const Sequence< TypeClass >& types, TypeDescriptionSearchDepth depth )
+Reference< XTypeDescriptionEnumeration > getTypeDescriptorEnumeration( const OUString& sSearchRoot,
+ const Sequence< TypeClass >& types,
+ TypeDescriptionSearchDepth depth )
{
Reference< XTypeDescriptionEnumeration > xEnum;
Reference< XTypeDescriptionEnumerationAccess> xTypeEnumAccess( getTypeProvider_Impl(), UNO_QUERY );
@@ -3254,7 +3303,7 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
return xEnum;
}
-typedef boost::unordered_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+typedef boost::unordered_map< OUString, Any, ::rtl::OUStringHash, ::std::equal_to< OUString > > VBAConstantsHash;
VBAConstantHelper&
VBAConstantHelper::instance()
@@ -3263,29 +3312,31 @@ VBAConstantHelper::instance()
return aHelper;
}
-void
-VBAConstantHelper::init()
+void VBAConstantHelper::init()
{
if ( !isInited )
{
Sequence< TypeClass > types(1);
types[ 0 ] = TypeClass_CONSTANTS;
- Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( rtl::OUString(defaultNameSpace), types, TypeDescriptionSearchDepth_INFINITE );
+ Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( OUString(defaultNameSpace), types, TypeDescriptionSearchDepth_INFINITE );
- if ( !xEnum.is() )
+ if ( !xEnum.is())
+ {
return; //NULL;
-
+ }
while ( xEnum->hasMoreElements() )
{
Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
if ( xConstants.is() )
{
// store constant group name
- ::rtl::OUString sFullName = xConstants->getName();
+ OUString sFullName = xConstants->getName();
sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
- ::rtl::OUString sLeafName( sFullName );
+ OUString sLeafName( sFullName );
if ( indexLastDot > -1 )
+ {
sLeafName = sFullName.copy( indexLastDot + 1);
+ }
aConstCache.push_back( sLeafName ); // assume constant group names are unique
Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
@@ -3293,13 +3344,14 @@ VBAConstantHelper::init()
for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
{
// store constant member name
- Reference< XConstantTypeDescription >& rXConst =
- *pSrc;
+ Reference< XConstantTypeDescription >& rXConst = *pSrc;
sFullName = rXConst->getName();
indexLastDot = sFullName.lastIndexOf('.');
sLeafName = sFullName;
if ( indexLastDot > -1 )
+ {
sLeafName = sFullName.copy( indexLastDot + 1);
+ }
aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
}
}
@@ -3309,11 +3361,11 @@ VBAConstantHelper::init()
}
bool
-VBAConstantHelper::isVBAConstantType( const ::rtl::OUString& rName )
+VBAConstantHelper::isVBAConstantType( const OUString& rName )
{
init();
bool bConstant = false;
- ::rtl::OUString sKey( rName );
+ OUString sKey( rName );
VBAConstantsVector::const_iterator it = aConstCache.begin();
for( ; it != aConstCache.end(); ++it )
@@ -3328,12 +3380,12 @@ VBAConstantHelper::isVBAConstantType( const ::rtl::OUString& rName )
}
SbxVariable*
-VBAConstantHelper::getVBAConstant( const ::rtl::OUString& rName )
+VBAConstantHelper::getVBAConstant( const OUString& rName )
{
SbxVariable* pConst = NULL;
init();
- ::rtl::OUString sKey( rName );
+ OUString sKey( rName );
VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
@@ -3349,7 +3401,7 @@ VBAConstantHelper::getVBAConstant( const ::rtl::OUString& rName )
// Function to search for a global identifier in the
// UnoScope and to wrap it for Sbx
-SbUnoClass* findUnoClass( const ::rtl::OUString& rName )
+SbUnoClass* findUnoClass( const OUString& rName )
{
// #105550 Check if module exists
SbUnoClass* pUnoClass = NULL;
@@ -3365,13 +3417,15 @@ SbUnoClass* findUnoClass( const ::rtl::OUString& rName )
{
TypeClass eTypeClass = xTypeDesc->getTypeClass();
if( eTypeClass == TypeClass_MODULE || eTypeClass == TypeClass_CONSTANTS )
+ {
pUnoClass = new SbUnoClass( rName );
+ }
}
}
return pUnoClass;
}
-SbxVariable* SbUnoClass::Find( const rtl::OUString& rName, SbxClassType )
+SbxVariable* SbUnoClass::Find( const OUString& rName, SbxClassType )
{
SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_VARIABLE );
@@ -3406,8 +3460,8 @@ SbxVariable* SbUnoClass::Find( const rtl::OUString& rName, SbxClassType )
else
{
// expand fully qualified name
- ::rtl::OUString aNewName = GetName();
- aNewName += ::rtl::OUString(".");
+ OUString aNewName = GetName();
+ aNewName += ".";
aNewName += rName;
// get CoreReflection
@@ -3501,7 +3555,7 @@ SbxVariable* SbUnoClass::Find( const rtl::OUString& rName, SbxClassType )
}
-SbUnoService* findUnoService( const ::rtl::OUString& rName )
+SbUnoService* findUnoService( const OUString& rName )
{
SbUnoService* pSbUnoService = NULL;
@@ -3526,7 +3580,7 @@ SbUnoService* findUnoService( const ::rtl::OUString& rName )
return pSbUnoService;
}
-SbxVariable* SbUnoService::Find( const rtl::OUString& rName, SbxClassType )
+SbxVariable* SbUnoService::Find( const OUString& rName, SbxClassType )
{
SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_METHOD );
@@ -3544,11 +3598,13 @@ SbxVariable* SbUnoService::Find( const rtl::OUString& rName, SbxClassType )
{
Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i];
- ::rtl::OUString aName( xCtor->getName() );
+ OUString aName( xCtor->getName() );
if( aName.isEmpty() )
{
if( xCtor->isDefaultConstructor() )
- aName = ::rtl::OUString("create");
+ {
+ aName = OUString("create");
+ }
}
if( !aName.isEmpty() )
@@ -3558,7 +3614,6 @@ SbxVariable* SbUnoService::Find( const rtl::OUString& rName, SbxClassType )
QuickInsert( (SbxVariable*)xSbCtorRef );
}
}
-
pRes = SbxObject::Find( rName, SbxCLASS_METHOD );
}
}
@@ -3685,7 +3740,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Any aRetAny;
- ::rtl::OUString aServiceName = GetName();
+ OUString aServiceName = GetName();
Reference < XInterface > xRet;
try
{
@@ -3734,7 +3789,7 @@ void clearUnoServiceCtors( void )
}
}
-SbUnoServiceCtor::SbUnoServiceCtor( const ::rtl::OUString& aName_, Reference< XServiceConstructorDescription > xServiceCtorDesc )
+SbUnoServiceCtor::SbUnoServiceCtor( const OUString& aName_, Reference< XServiceConstructorDescription > xServiceCtorDesc )
: SbxMethod( aName_, SbxOBJECT )
, m_xServiceCtorDesc( xServiceCtorDesc )
{
@@ -3752,7 +3807,7 @@ SbxInfo* SbUnoServiceCtor::GetInfo()
}
-SbUnoSingleton* findUnoSingleton( const ::rtl::OUString& rName )
+SbUnoSingleton* findUnoSingleton( const OUString& rName )
{
SbUnoSingleton* pSbUnoSingleton = NULL;
@@ -3777,13 +3832,12 @@ SbUnoSingleton* findUnoSingleton( const ::rtl::OUString& rName )
return pSbUnoSingleton;
}
-SbUnoSingleton::SbUnoSingleton( const ::rtl::OUString& aName_,
+SbUnoSingleton::SbUnoSingleton( const OUString& aName_,
const Reference< XSingletonTypeDescription >& xSingletonTypeDesc )
: SbxObject( aName_ )
, m_xSingletonTypeDesc( xSingletonTypeDesc )
{
- SbxVariableRef xGetMethodRef =
- new SbxMethod( ::rtl::OUString( "get" ), SbxOBJECT );
+ SbxVariableRef xGetMethodRef = new SbxMethod( OUString( "get" ), SbxOBJECT );
QuickInsert( (SbxVariable*)xGetMethodRef );
}
@@ -3823,7 +3877,7 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
Any aRetAny;
if( xContextToUse.is() )
{
- ::rtl::OUString aSingletonName( "/singletons/" );
+ OUString aSingletonName( "/singletons/" );
aSingletonName += GetName();
Reference < XInterface > xRet;
xContextToUse->getValueByName( aSingletonName ) >>= xRet;
@@ -3832,7 +3886,9 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
unoToSbxValue( pVar, aRetAny );
}
else
+ {
SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ }
}
@@ -3846,9 +3902,9 @@ class BasicAllListener_Impl : public BasicAllListenerHelper
public:
SbxObjectRef xSbxObj;
- ::rtl::OUString aPrefixName;
+ OUString aPrefixName;
- BasicAllListener_Impl( const ::rtl::OUString& aPrefixName );
+ BasicAllListener_Impl( const OUString& aPrefixName );
~BasicAllListener_Impl();
// Methods of XAllListener
@@ -3861,10 +3917,7 @@ public:
//========================================================================
-BasicAllListener_Impl::BasicAllListener_Impl
-(
- const ::rtl::OUString & aPrefixName_
-)
+BasicAllListener_Impl::BasicAllListener_Impl(const OUString& aPrefixName_)
: aPrefixName( aPrefixName_ )
{
}
@@ -3882,7 +3935,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
if( xSbxObj.Is() )
{
- ::rtl::OUString aMethodName = aPrefixName;
+ OUString aMethodName = aPrefixName;
aMethodName = aMethodName + Event.MethodName;
SbxVariable * pP = xSbxObj;
@@ -3962,13 +4015,13 @@ public:
// XInvocation
virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw( RuntimeException );
- virtual Any SAL_CALL invoke(const ::rtl::OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
+ virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException );
- virtual void SAL_CALL setValue(const ::rtl::OUString& PropertyName, const Any& Value)
+ virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value)
throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException );
- virtual Any SAL_CALL getValue(const ::rtl::OUString& PropertyName) throw( UnknownPropertyException, RuntimeException );
- virtual sal_Bool SAL_CALL hasMethod(const ::rtl::OUString& Name) throw( RuntimeException );
- virtual sal_Bool SAL_CALL hasProperty(const ::rtl::OUString& Name) throw( RuntimeException );
+ virtual Any SAL_CALL getValue(const OUString& PropertyName) throw( UnknownPropertyException, RuntimeException );
+ virtual sal_Bool SAL_CALL hasMethod(const OUString& Name) throw( RuntimeException );
+ virtual sal_Bool SAL_CALL hasProperty(const OUString& Name) throw( RuntimeException );
private:
Reference< XIdlReflection > m_xCoreReflection;
@@ -4017,7 +4070,7 @@ Reference< XIntrospectionAccess > SAL_CALL InvocationToAllListenerMapper::getInt
}
//*************************************************************************
-Any SAL_CALL InvocationToAllListenerMapper::invoke(const ::rtl::OUString& FunctionName, const Sequence< Any >& Params,
+Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, const Sequence< Any >& Params,
Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
throw( IllegalArgumentException, CannotConvertException,
InvocationTargetException, RuntimeException )
@@ -4071,7 +4124,7 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const ::rtl::OUString& Functi
}
//*************************************************************************
-void SAL_CALL InvocationToAllListenerMapper::setValue(const ::rtl::OUString& PropertyName, const Any& Value)
+void SAL_CALL InvocationToAllListenerMapper::setValue(const OUString& PropertyName, const Any& Value)
throw( UnknownPropertyException, CannotConvertException,
InvocationTargetException, RuntimeException )
{
@@ -4080,7 +4133,7 @@ void SAL_CALL InvocationToAllListenerMapper::setValue(const ::rtl::OUString& Pro
}
//*************************************************************************
-Any SAL_CALL InvocationToAllListenerMapper::getValue(const ::rtl::OUString& PropertyName)
+Any SAL_CALL InvocationToAllListenerMapper::getValue(const OUString& PropertyName)
throw( UnknownPropertyException, RuntimeException )
{
(void)PropertyName;
@@ -4089,7 +4142,7 @@ Any SAL_CALL InvocationToAllListenerMapper::getValue(const ::rtl::OUString& Prop
}
//*************************************************************************
-sal_Bool SAL_CALL InvocationToAllListenerMapper::hasMethod(const ::rtl::OUString& Name)
+sal_Bool SAL_CALL InvocationToAllListenerMapper::hasMethod(const OUString& Name)
throw( RuntimeException )
{
Reference< XIdlMethod > xMethod = m_xListenerType->getMethod( Name );
@@ -4097,7 +4150,7 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasMethod(const ::rtl::OUString
}
//*************************************************************************
-sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const ::rtl::OUString& Name)
+sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const OUString& Name)
throw( RuntimeException )
{
Reference< XIdlField > xField = m_xListenerType->getField( Name );
@@ -4121,8 +4174,8 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
}
// get the name of the class of the struct
- ::rtl::OUString aPrefixName = rPar.Get(1)->GetString();
- ::rtl::OUString aListenerClassName = rPar.Get(2)->GetString();
+ OUString aPrefixName = rPar.Get(1)->GetOUString();
+ OUString aListenerClassName = rPar.Get(2)->GetOUString();
// get the CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
@@ -4141,7 +4194,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
// From 1999-11-30: get the InvocationAdapterFactory
Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = Reference< XInvocationAdapterFactory >(
- xFactory->createInstance( rtl::OUString("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY );
+ xFactory->createInstance( OUString("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY );
BasicAllListener_Impl * p;
Reference< XAllListener > xAllLst = p = new BasicAllListener_Impl( aPrefixName );
@@ -4150,7 +4203,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
if( !xLst.is() )
return;
- ::rtl::OUString aClassName = xClass->getName();
+ OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
aTmp = xLst->queryInterface( aClassType );
if( !aTmp.hasValue() )
@@ -4181,9 +4234,7 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr
Any aContextAny( comphelper::getProcessComponentContext() );
- SbUnoObjectRef xUnoObj = new SbUnoObject
- ( ::rtl::OUString( "DefaultContext" ),
- aContextAny );
+ SbUnoObjectRef xUnoObj = new SbUnoObject( OUString( "DefaultContext" ), aContextAny );
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
@@ -4195,7 +4246,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
(void)pBasic;
(void)bWrite;
- static rtl::OUString aTypeTypeString( "type" );
+ static OUString aTypeTypeString( "type" );
// 2 parameters needed
if ( rPar.Count() != 3 )
@@ -4205,16 +4256,16 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
}
// get the name of the class of the struct
- rtl::OUString aTypeName = rPar.Get(1)->GetString();
+ OUString aTypeName = rPar.Get(1)->GetOUString();
SbxVariable* pVal = rPar.Get(2);
if( aTypeName == aTypeTypeString )
{
SbxDataType eBaseType = pVal->SbxValue::GetType();
- String aValTypeName;
+ OUString aValTypeName;
if( eBaseType == SbxSTRING )
{
- aValTypeName = pVal->GetString();
+ aValTypeName = pVal->GetOUString();
}
else if( eBaseType == SbxOBJECT )
{
@@ -4229,7 +4280,9 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
}
if( xIdlClass.is() )
+ {
aValTypeName = xIdlClass->getName();
+ }
}
Type aType;
bool bSuccess = implGetTypeByName( aValTypeName, aType );
@@ -4252,8 +4305,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
}
catch( const NoSuchElementException& e1 )
{
- ::rtl::OUString aNoSuchElementExceptionName
- ( "com.sun.star.container.NoSuchElementException" );
+ OUString aNoSuchElementExceptionName( "com.sun.star.container.NoSuchElementException" );
StarBASIC::Error( ERRCODE_BASIC_EXCEPTION,
implGetExceptionMsg( e1, aNoSuchElementExceptionName ) );
return;
@@ -4268,7 +4320,6 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite
Any aVal = sbxToUnoValueImpl( pVal );
Any aConvertedVal = convertAny( aVal, aDestType );
-
SbxVariableRef refVar = rPar.Get(0);
SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aConvertedVal );
refVar->PutObject( xUnoAnyObject );
@@ -4290,27 +4341,27 @@ typedef WeakImplHelper2< XInvocation, XComponent > ModuleInvocationProxyHelper;
class ModuleInvocationProxy : public OMutexBasis,
public ModuleInvocationProxyHelper
{
- ::rtl::OUString m_aPrefix;
+ OUString m_aPrefix;
SbxObjectRef m_xScopeObj;
bool m_bProxyIsClassModuleObject;
::cppu::OInterfaceContainerHelper m_aListeners;
public:
- ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
+ ModuleInvocationProxy( const OUString& aPrefix, SbxObjectRef xScopeObj );
~ModuleInvocationProxy()
{}
// XInvocation
virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection() throw();
- virtual void SAL_CALL setValue( const ::rtl::OUString& rProperty, const Any& rValue )
+ virtual void SAL_CALL setValue( const OUString& rProperty, const Any& rValue )
throw( UnknownPropertyException );
- virtual Any SAL_CALL getValue( const ::rtl::OUString& rProperty )
+ virtual Any SAL_CALL getValue( const OUString& rProperty )
throw( UnknownPropertyException );
- virtual sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& rName ) throw();
- virtual sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& rProp ) throw();
+ virtual sal_Bool SAL_CALL hasMethod( const OUString& rName ) throw();
+ virtual sal_Bool SAL_CALL hasProperty( const OUString& rProp ) throw();
- virtual Any SAL_CALL invoke( const ::rtl::OUString& rFunction,
+ virtual Any SAL_CALL invoke( const OUString& rFunction,
const Sequence< Any >& rParams,
Sequence< sal_Int16 >& rOutParamIndex,
Sequence< Any >& rOutParam )
@@ -4322,8 +4373,8 @@ public:
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
};
-ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
- : m_aPrefix( aPrefix + ::rtl::OUString( "_" ) )
+ModuleInvocationProxy::ModuleInvocationProxy( const OUString& aPrefix, SbxObjectRef xScopeObj )
+ : m_aPrefix( aPrefix + OUString( "_" ) )
, m_xScopeObj( xScopeObj )
, m_aListeners( m_aMutex )
{
@@ -4335,14 +4386,14 @@ Reference< XIntrospectionAccess > SAL_CALL ModuleInvocationProxy::getIntrospecti
return Reference< XIntrospectionAccess >();
}
-void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty, const Any& rValue ) throw( UnknownPropertyException )
+void SAL_CALL ModuleInvocationProxy::setValue( const OUString& rProperty, const Any& rValue ) throw( UnknownPropertyException )
{
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
SolarMutexGuard guard;
- ::rtl::OUString aPropertyFunctionName( "Property Set " );
+ OUString aPropertyFunctionName( "Property Set " );
aPropertyFunctionName += m_aPrefix;
aPropertyFunctionName += rProperty;
@@ -4373,14 +4424,15 @@ void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty,
}
-Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty ) throw( UnknownPropertyException )
+Any SAL_CALL ModuleInvocationProxy::getValue( const OUString& rProperty ) throw( UnknownPropertyException )
{
if( !m_bProxyIsClassModuleObject )
+ {
throw UnknownPropertyException();
-
+ }
SolarMutexGuard guard;
- ::rtl::OUString aPropertyFunctionName( "Property Get " );
+ OUString aPropertyFunctionName( "Property Get " );
aPropertyFunctionName += m_aPrefix;
aPropertyFunctionName += rProperty;
@@ -4400,17 +4452,17 @@ Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty )
return aRet;
}
-sal_Bool SAL_CALL ModuleInvocationProxy::hasMethod( const ::rtl::OUString& ) throw()
+sal_Bool SAL_CALL ModuleInvocationProxy::hasMethod( const OUString& ) throw()
{
return sal_False;
}
-sal_Bool SAL_CALL ModuleInvocationProxy::hasProperty( const ::rtl::OUString& ) throw()
+sal_Bool SAL_CALL ModuleInvocationProxy::hasProperty( const OUString& ) throw()
{
return sal_False;
}
-Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
+Any SAL_CALL ModuleInvocationProxy::invoke( const OUString& rFunction,
const Sequence< Any >& rParams,
Sequence< sal_Int16 >&,
Sequence< Any >& )
@@ -4421,9 +4473,10 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
Any aRet;
SbxObjectRef xScopeObj = m_xScopeObj;
if( !xScopeObj.Is() )
+ {
return aRet;
-
- ::rtl::OUString aFunctionName = m_aPrefix;
+ }
+ OUString aFunctionName = m_aPrefix;
aFunctionName += rFunction;
sal_Bool bSetRescheduleBack = sal_False;
@@ -4503,8 +4556,8 @@ void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEven
}
-Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
- const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
+Reference< XInterface > createComListener( const Any& aControlAny, const OUString& aVBAType,
+ const OUString& aPrefix, SbxObjectRef xScopeObj )
{
Reference< XInterface > xRet;
@@ -4522,7 +4575,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
try
{
xRet = xServiceMgr->createInstanceWithArgumentsAndContext(
- ::rtl::OUString( "com.sun.star.custom.UnoComListener"),
+ OUString( "com.sun.star.custom.UnoComListener"),
args, xContext );
}
catch( const Exception& )
@@ -4636,7 +4689,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
Reference< XSingleServiceFactory > xComImplementsFactory
(
xServiceMgr->createInstanceWithContext(
- ::rtl::OUString( "com.sun.star.custom.ComImplementsFactory"), xContext ),
+ OUString( "com.sun.star.custom.ComImplementsFactory"), xContext ),
UNO_QUERY
);
if( !xComImplementsFactory.is() )
@@ -4649,15 +4702,16 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
for( sal_uInt16 i = 0 ; i < nCount ; ++i )
{
SbxVariable* pVar = pModIfaces->Get( i );
- ::rtl::OUString aIfaceName = pVar->GetName();
+ OUString aIfaceName = pVar->GetName();
if( !aIfaceName.isEmpty() )
{
- ::rtl::OUString aPureIfaceName = aIfaceName;
+ OUString aPureIfaceName = aIfaceName;
sal_Int32 indexLastDot = aIfaceName.lastIndexOf('.');
if ( indexLastDot > -1 )
+ {
aPureIfaceName = aIfaceName.copy( indexLastDot + 1 );
-
+ }
Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPureIfaceName, pProxyClassModuleObject );
Sequence<Any> args( 2 );
@@ -4718,7 +4772,7 @@ bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal )
// Only for native COM objects
if( pUnoObj->isNativeCOMObject() )
{
- SbxVariableRef pMeth = pObj->Find( ::rtl::OUString( "toString" ), SbxCLASS_METHOD );
+ SbxVariableRef pMeth = pObj->Find( OUString( "toString" ), SbxCLASS_METHOD );
if ( pMeth.Is() )
{
SbxValues aRes;
@@ -4753,11 +4807,13 @@ void StructRefInfo::setValue( const Any& rValue )
reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
}
-rtl::OUString StructRefInfo::getTypeName() const
+OUString StructRefInfo::getTypeName() const
{
- rtl::OUString sTypeName;
+ OUString sTypeName;
if ( mpTD )
+ {
sTypeName = mpTD->pTypeName;
+ }
return sTypeName;
}
@@ -4774,9 +4830,9 @@ TypeClass StructRefInfo::getTypeClass() const
return t;
}
-SbUnoStructRefObject::SbUnoStructRefObject( const ::rtl::OUString& aName_, const StructRefInfo& rMemberInfo ) : SbxObject( aName_ ), maMemberInfo( rMemberInfo ), mbMemberCacheInit( false )
+SbUnoStructRefObject::SbUnoStructRefObject( const OUString& aName_, const StructRefInfo& rMemberInfo ) : SbxObject( aName_ ), maMemberInfo( rMemberInfo ), mbMemberCacheInit( false )
{
- SetClassName( rtl::OUString( maMemberInfo.getTypeName() ) );
+ SetClassName( OUString( maMemberInfo.getTypeName() ) );
}
SbUnoStructRefObject::~SbUnoStructRefObject()
@@ -4807,7 +4863,7 @@ void SbUnoStructRefObject::initMemberCache()
OSL_ENSURE( pMemberTD, "### cannot get field in struct!" );
if (pMemberTD)
{
- rtl::OUString aName( ppNames[nPos] );
+ OUString aName( ppNames[nPos] );
TYPELIB_DANGER_RELEASE( pMemberTD );
maFields[ aName ] = new StructRefInfo( maMemberInfo.getRootAnyRef(), pMemberTD, maMemberInfo.getPos() + pMemberOffsets[nPos] );
}
@@ -4816,14 +4872,14 @@ void SbUnoStructRefObject::initMemberCache()
mbMemberCacheInit = true;
}
-SbxVariable* SbUnoStructRefObject::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbUnoStructRefObject::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pRes = SbxObject::Find( rName, t );
if ( !pRes )
{
if ( !mbMemberCacheInit )
initMemberCache();
- StructFieldInfo::iterator it = maFields.find( String( rName ).ToUpperAscii() );
+ StructFieldInfo::iterator it = maFields.find( OUString( rName ).toAsciiUpperCase() );
if ( it != maFields.end() )
{
SbxDataType eSbxType;
@@ -4862,15 +4918,15 @@ void SbUnoStructRefObject::implCreateDbgProperties( void )
Property aProp;
// Id == -1: display the implemented interfaces corresponding the ClassProvider
- SbxVariableRef xVarRef = new SbUnoProperty( ::rtl::OUString(ID_DBG_SUPPORTEDINTERFACES), SbxSTRING, SbxSTRING, aProp, -1, false, false );
+ SbxVariableRef xVarRef = new SbUnoProperty( OUString(ID_DBG_SUPPORTEDINTERFACES), SbxSTRING, SbxSTRING, aProp, -1, false, false );
QuickInsert( (SbxVariable*)xVarRef );
// Id == -2: output the properties
- xVarRef = new SbUnoProperty( ::rtl::OUString(ID_DBG_PROPERTIES), SbxSTRING, SbxSTRING, aProp, -2, false, false );
+ xVarRef = new SbUnoProperty( OUString(ID_DBG_PROPERTIES), SbxSTRING, SbxSTRING, aProp, -2, false, false );
QuickInsert( (SbxVariable*)xVarRef );
// Id == -3: output the Methods
- xVarRef = new SbUnoProperty( ::rtl::OUString(ID_DBG_METHODS), SbxSTRING, SbxSTRING, aProp, -3, false, false );
+ xVarRef = new SbUnoProperty( OUString(ID_DBG_METHODS), SbxSTRING, SbxSTRING, aProp, -3, false, false );
QuickInsert( (SbxVariable*)xVarRef );
}
@@ -4885,7 +4941,7 @@ void SbUnoStructRefObject::implCreateAll()
for ( StructFieldInfo::iterator it = maFields.begin(), it_end = maFields.end(); it != it_end; ++it )
{
- const rtl::OUString& rName = it->first;
+ const OUString& rName = it->first;
SbxDataType eSbxType;
eSbxType = unoToSbxType( it->second->getTypeClass() );
SbxDataType eRealSbxType = eSbxType;
@@ -4907,9 +4963,9 @@ Any SbUnoStructRefObject::getUnoAny( void )
return maMemberInfo.getValue();
}
-::rtl::OUString SbUnoStructRefObject::Impl_DumpProperties()
+OUString SbUnoStructRefObject::Impl_DumpProperties()
{
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
aRet.appendAscii("Properties of object ");
aRet.append( getDbgObjectName() );
@@ -4920,16 +4976,17 @@ Any SbUnoStructRefObject::getUnoAny( void )
SbxVariable* pVar = pProps->Get( i );
if( pVar )
{
- ::rtl::OUStringBuffer aPropStr;
+ OUStringBuffer aPropStr;
if( (i % nPropsPerLine) == 0 )
+ {
aPropStr.appendAscii( "\n" );
-
+ }
// output the type and name
// Is it in Uno a sequence?
SbxDataType eType = pVar->GetFullType();
sal_Bool bMaybeVoid = sal_False;
- rtl::OUString aName( pVar->GetName() );
+ OUString aName( pVar->GetName() );
StructFieldInfo::iterator it = maFields.find( aName );
if ( it != maFields.end() )
@@ -4939,20 +4996,27 @@ Any SbUnoStructRefObject::getUnoAny( void )
if( eType == SbxOBJECT )
{
if( rPropInfo.getTypeClass() == TypeClass_SEQUENCE )
+ {
eType = (SbxDataType) ( SbxOBJECT | SbxARRAY );
+ }
}
}
aPropStr.append( Dbg_SbxDataType2String( eType ) );
if( bMaybeVoid )
+ {
aPropStr.appendAscii( "/void" );
+ }
aPropStr.appendAscii( " " );
aPropStr.append( pVar->GetName() );
if( i == nPropCount - 1 )
+ {
aPropStr.appendAscii( "\n" );
+ }
else
+ {
aPropStr.appendAscii( "; " );
-
+ }
aRet.append( aPropStr.makeStringAndClear() );
}
}
@@ -4982,7 +5046,7 @@ void SbUnoStructRefObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCTyp
// Id == -1: Display implemented interfaces according the ClassProvider
if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES"
{
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM(ID_DBG_SUPPORTEDINTERFACES) );
aRet.appendAscii( " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" );
@@ -4993,7 +5057,7 @@ void SbUnoStructRefObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCTyp
{
// by now all properties must be established
implCreateAll();
- ::rtl::OUString aRetStr = Impl_DumpProperties();
+ OUString aRetStr = Impl_DumpProperties();
pVar->PutString( aRetStr );
}
// Id == -3: output the methods
@@ -5001,7 +5065,7 @@ void SbUnoStructRefObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCTyp
{
// by now all properties must be established
implCreateAll();
- ::rtl::OUStringBuffer aRet;
+ OUStringBuffer aRet;
aRet.appendAscii("Methods of object ");
aRet.append( getDbgObjectName() );
aRet.appendAscii( "\nNo methods found\n" );
@@ -5035,10 +5099,12 @@ void SbUnoStructRefObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCTyp
}
}
-StructRefInfo SbUnoStructRefObject::getStructMember( const rtl::OUString& rMemberName )
+StructRefInfo SbUnoStructRefObject::getStructMember( const OUString& rMemberName )
{
if (!mbMemberCacheInit)
+ {
initMemberCache();
+ }
StructFieldInfo::iterator it = maFields.find( rMemberName );
typelib_TypeDescription * pFoundTD = NULL;
@@ -5053,15 +5119,18 @@ StructRefInfo SbUnoStructRefObject::getStructMember( const rtl::OUString& rMembe
return aRet;
}
-rtl::OUString SbUnoStructRefObject::getDbgObjectName()
+OUString SbUnoStructRefObject::getDbgObjectName()
{
- ::rtl::OUString aName = GetClassName();
+ OUString aName = GetClassName();
if( aName.isEmpty() )
+ {
aName += ::rtl::OUString("Unknown");
-
- ::rtl::OUStringBuffer aRet;
+ }
+ OUStringBuffer aRet;
if( aName.getLength() > 20 )
+ {
aRet.appendAscii( "\n" );
+ }
aRet.appendAscii( "\"" );
aRet.append( aName );
aRet.appendAscii( "\":" );
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 759b9b25f74b..e577882b1c8b 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -102,9 +102,9 @@ class DocObjectWrapper : public DocObjectWrapper_BASE
Reference< XTypeProvider > m_xAggregateTypeProv;
Sequence< Type > m_Types;
SbModule* m_pMod;
- SbMethodRef getMethod( const rtl::OUString& aName ) throw (RuntimeException);
- SbPropertyRef getProperty( const rtl::OUString& aName ) throw (RuntimeException);
- String mName; // for debugging
+ SbMethodRef getMethod( const OUString& aName ) throw (RuntimeException);
+ SbPropertyRef getProperty( const OUString& aName ) throw (RuntimeException);
+ OUString mName; // for debugging
public:
DocObjectWrapper( SbModule* pMod );
@@ -122,11 +122,11 @@ public:
virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (RuntimeException);
- virtual Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
- virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
- virtual Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException);
- virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException);
- virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException);
+ virtual Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual void SAL_CALL setValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual Any SAL_CALL getValue( const OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasMethod( const OUString& aName ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasProperty( const OUString& aName ) throw (RuntimeException);
virtual Any SAL_CALL queryInterface( const Type& aType ) throw ( RuntimeException );
virtual Sequence< Type > SAL_CALL getTypes() throw ( RuntimeException );
@@ -160,7 +160,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
comphelper::getProcessComponentContext() );
Reference< XMultiComponentFactory > xMFac(
xCtx->getServiceManager() );
- Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( "com.sun.star.reflection.ProxyFactory" ), xCtx ), UNO_QUERY_THROW );
+ Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( OUString( "com.sun.star.reflection.ProxyFactory" ), xCtx ), UNO_QUERY_THROW );
m_xAggProxy = xProxyFac->createProxy( xIf );
}
catch(const Exception& )
@@ -202,7 +202,9 @@ DocObjectWrapper::release() throw ()
delete this;
}
else
+ {
OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+ }
}
DocObjectWrapper::~DocObjectWrapper()
@@ -216,15 +218,21 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
{
Sequence< Type > sTypes;
if ( m_xAggregateTypeProv.is() )
+ {
sTypes = m_xAggregateTypeProv->getTypes();
+ }
m_Types.realloc( sTypes.getLength() + 1 );
Type* pPtr = m_Types.getArray();
for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr )
{
if ( i == 0 )
+ {
*pPtr = XInvocation::static_type( NULL );
+ }
else
+ {
*pPtr = sTypes[ i - 1 ];
+ }
}
}
return m_Types;
@@ -237,7 +245,7 @@ DocObjectWrapper::getIntrospection( ) throw (RuntimeException)
}
Any SAL_CALL
-DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
+DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
return m_xAggInv->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam );
@@ -261,7 +269,7 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
sal_Int32 nSbxCount = n - 1;
if ( nParamsCount < nSbxCount - nSbxOptional )
{
- throw RuntimeException( ::rtl::OUString( "wrong number of parameters!" ), Reference< XInterface >() );
+ throw RuntimeException( OUString( "wrong number of parameters!" ), Reference< XInterface >() );
}
}
// set parameters
@@ -331,7 +339,7 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
}
void SAL_CALL
-DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
+DocObjectWrapper::setValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
return m_xAggInv->setValue( aPropertyName, aValue );
@@ -343,7 +351,7 @@ DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aVa
}
Any SAL_CALL
-DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
+DocObjectWrapper::getValue( const OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
return m_xAggInv->getValue( aPropertyName );
@@ -361,7 +369,7 @@ DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (Unknow
}
::sal_Bool SAL_CALL
-DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException)
+DocObjectWrapper::hasMethod( const OUString& aName ) throw (RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aName ) )
return sal_True;
@@ -369,7 +377,7 @@ DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeExcept
}
::sal_Bool SAL_CALL
-DocObjectWrapper::hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException)
+DocObjectWrapper::hasProperty( const OUString& aName ) throw (RuntimeException)
{
sal_Bool bRes = sal_False;
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aName ) )
@@ -389,7 +397,7 @@ Any SAL_CALL DocObjectWrapper::queryInterface( const Type& aType )
return aRet;
}
-SbMethodRef DocObjectWrapper::getMethod( const rtl::OUString& aName ) throw (RuntimeException)
+SbMethodRef DocObjectWrapper::getMethod( const OUString& aName ) throw (RuntimeException)
{
SbMethodRef pMethod = NULL;
if ( m_pMod )
@@ -404,7 +412,7 @@ SbMethodRef DocObjectWrapper::getMethod( const rtl::OUString& aName ) throw (Run
return pMethod;
}
-SbPropertyRef DocObjectWrapper::getProperty( const rtl::OUString& aName ) throw (RuntimeException)
+SbPropertyRef DocObjectWrapper::getProperty( const OUString& aName ) throw (RuntimeException)
{
SbPropertyRef pProperty = NULL;
if ( m_pMod )
@@ -446,7 +454,7 @@ uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::Referen
try
{
uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
- xVBACompat.set( xModelProps->getPropertyValue( ::rtl::OUString( "BasicLibraries" ) ), uno::UNO_QUERY );
+ xVBACompat.set( xModelProps->getPropertyValue( OUString( "BasicLibraries" ) ), uno::UNO_QUERY );
}
catch(const uno::Exception& )
{
@@ -476,7 +484,7 @@ public:
uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
if ( xFactory.is() )
{
- uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( rtl::OUString( "com.sun.star.frame.Desktop" ) ), uno::UNO_QUERY );
+ uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( OUString( "com.sun.star.frame.Desktop" ) ), uno::UNO_QUERY );
if ( xDeskTop.is() )
xDeskTop->terminate();
}
@@ -493,8 +501,8 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
// A Basic module has set EXTSEARCH, so that the elements, that the modul contains,
// could be found from other module.
-SbModule::SbModule( const String& rName, sal_Bool bVBACompat )
- : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
+SbModule::SbModule( const OUString& rName, sal_Bool bVBACompat )
+ : SbxObject( OUString("StarBASICModule") ),
pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( bVBACompat ), pDocObject( NULL ), bIsProxyModule( false )
{
SetName( rName );
@@ -502,9 +510,11 @@ SbModule::SbModule( const String& rName, sal_Bool bVBACompat )
SetModuleType( script::ModuleType::NORMAL );
// #i92642: Set name property to intitial name
- SbxVariable* pNameProp = pProps->Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY );
+ SbxVariable* pNameProp = pProps->Find( OUString("Name"), SbxCLASS_PROPERTY );
if( pNameProp != NULL )
+ {
pNameProp->PutString( GetName() );
+ }
}
SbModule::~SbModule()
@@ -531,7 +541,7 @@ sal_Bool SbModule::IsCompiled() const
return sal_Bool( pImage != 0 );
}
-const SbxObject* SbModule::FindType( String aTypeName ) const
+const SbxObject* SbModule::FindType( OUString aTypeName ) const
{
return pImage ? pImage->FindType( aTypeName ) : NULL;
}
@@ -566,12 +576,14 @@ void SbModule::StartDefinitions()
// request/create method
-SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
+SbMethod* SbModule::GetMethod( const OUString& rName, SbxDataType t )
{
SbxVariable* p = pMethods->Find( rName, SbxCLASS_METHOD );
SbMethod* pMeth = p ? PTR_CAST(SbMethod,p) : NULL;
if( p && !pMeth )
+ {
pMethods->Remove( p );
+ }
if( !pMeth )
{
pMeth = new SbMethod( rName, t, this );
@@ -588,18 +600,22 @@ SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
pMeth->SetType( t );
pMeth->ResetFlag( SBX_WRITE );
if( t != SbxVARIANT )
+ {
pMeth->SetFlag( SBX_FIXED );
+ }
return pMeth;
}
// request/create property
-SbProperty* SbModule::GetProperty( const String& rName, SbxDataType t )
+SbProperty* SbModule::GetProperty( const OUString& rName, SbxDataType t )
{
SbxVariable* p = pProps->Find( rName, SbxCLASS_PROPERTY );
SbProperty* pProp = p ? PTR_CAST(SbProperty,p) : NULL;
if( p && !pProp )
+ {
pProps->Remove( p );
+ }
if( !pProp )
{
pProp = new SbProperty( rName, t, this );
@@ -611,13 +627,14 @@ SbProperty* SbModule::GetProperty( const String& rName, SbxDataType t )
return pProp;
}
-SbProcedureProperty* SbModule::GetProcedureProperty
- ( const String& rName, SbxDataType t )
+SbProcedureProperty* SbModule::GetProcedureProperty( const OUString& rName, SbxDataType t )
{
SbxVariable* p = pProps->Find( rName, SbxCLASS_PROPERTY );
SbProcedureProperty* pProp = p ? PTR_CAST(SbProcedureProperty,p) : NULL;
if( p && !pProp )
+ {
pProps->Remove( p );
+ }
if( !pProp )
{
pProp = new SbProcedureProperty( rName, t );
@@ -629,13 +646,14 @@ SbProcedureProperty* SbModule::GetProcedureProperty
return pProp;
}
-SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod
- ( const String& rName, SbMethod* pImplMeth )
+SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth )
{
SbxVariable* p = pMethods->Find( rName, SbxCLASS_METHOD );
SbIfaceMapperMethod* pMapperMethod = p ? PTR_CAST(SbIfaceMapperMethod,p) : NULL;
if( p && !pMapperMethod )
+ {
pMethods->Remove( p );
+ }
if( !pMapperMethod )
{
pMapperMethod = new SbIfaceMapperMethod( rName, pImplMeth );
@@ -686,12 +704,14 @@ void SbModule::Clear()
}
-SbxVariable* SbModule::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbModule::Find( const OUString& rName, SbxClassType t )
{
// make sure a search in an uninstatiated class module will fail
SbxVariable* pRes = SbxObject::Find( rName, t );
if ( bIsProxyModule && !GetSbData()->bRunInit )
+ {
return NULL;
+ }
if( !pRes && pImage )
{
SbiInstance* pInst = GetSbData()->pInst;
@@ -707,14 +727,16 @@ SbxVariable* SbModule::Find( const rtl::OUString& rName, SbxClassType t )
if( pEnumObject )
{
bool bPrivate = pEnumObject->IsSet( SBX_PRIVATE );
- String aEnumName = pEnumObject->GetName();
+ OUString aEnumName = pEnumObject->GetName();
pRes = new SbxVariable( SbxOBJECT );
pRes->SetName( aEnumName );
pRes->SetParent( this );
pRes->SetFlag( SBX_READ );
if( bPrivate )
+ {
pRes->SetFlag( SBX_PRIVATE );
+ }
pRes->PutObject( pEnumObject );
}
}
@@ -723,14 +745,14 @@ SbxVariable* SbModule::Find( const rtl::OUString& rName, SbxClassType t )
return pRes;
}
-const ::rtl::OUString& SbModule::GetSource32() const
+const OUString& SbModule::GetSource32() const
{
return aOUSource;
}
-const String& SbModule::GetSource() const
+const OUString& SbModule::GetSource() const
{
- static String aRetStr;
+ static OUString aRetStr;
aRetStr = aOUSource;
return aRetStr;
}
@@ -757,8 +779,7 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
- String aProcName;
- aProcName.AppendAscii( "Property Get " );
+ OUString aProcName("Property Get ");
aProcName += pProcProperty->GetName();
SbxVariable* pMethVar = Find( aProcName, SbxCLASS_METHOD );
@@ -800,15 +821,13 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
pProcProperty->setSet( false );
- String aProcName;
- aProcName.AppendAscii( "Property Set " );
+ OUString aProcName("Property Set ");
aProcName += pProcProperty->GetName();
pMethVar = Find( aProcName, SbxCLASS_METHOD );
}
if( !pMethVar ) // Let
{
- String aProcName;
- aProcName.AppendAscii( "Property Let " );
+ OUString aProcName("Property Let " );
aProcName += pProcProperty->GetName();
pMethVar = Find( aProcName, SbxCLASS_METHOD );
}
@@ -837,8 +856,10 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
if( pMeth->bInvalid && !Compile() )
+ {
// auto compile has not worked!
StarBASIC::Error( SbERR_BAD_PROP_VALUE );
+ }
else
{
// Call of a subprogram
@@ -857,11 +878,14 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
sal_uIntPtr nId = pHint->GetId();
if( (nId == SBX_HINT_DATAWANTED || nId == SBX_HINT_DATACHANGED) &&
- pVar->GetName().EqualsIgnoreCaseAscii( "name" ) )
+ pVar->GetName().equalsIgnoreAsciiCase( "name" ) )
+ {
bForwardToSbxObject = false;
-
+ }
if( bForwardToSbxObject )
+ {
SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ }
}
}
}
@@ -869,19 +893,19 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
// The setting of the source makes the image invalid
// and scans the method definitions newly in
-void SbModule::SetSource( const String& r )
+void SbModule::SetSource( const OUString& r )
{
SetSource32( r );
}
-void SbModule::SetSource32( const ::rtl::OUString& r )
+void SbModule::SetSource32( const OUString& r )
{
// Default basic mode to library container mode, but.. allow Option VBASupport 0/1 override
SetVBACompat( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) ) );
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
- aTok.SetCompatible( IsVBACompat() );
+ aTok.SetCompatible( IsVBACompat() );
while( !aTok.IsEof() )
{
SbiToken eEndTok = NIL;
@@ -910,11 +934,13 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
{
eCurTok = aTok.Next();
if( eCurTok == COMPATIBLE )
+ {
aTok.SetCompatible( true );
+ }
else if ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) )
{
- sal_Bool bIsVBA = ( aTok.GetDbl()== 1 );
- SetVBACompat( bIsVBA );
+ sal_Bool bIsVBA = ( aTok.GetDbl()== 1 );
+ SetVBACompat( bIsVBA );
aTok.SetCompatible( bIsVBA );
}
}
@@ -928,17 +954,21 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
sal_uInt16 nLine1 = aTok.GetLine();
if( aTok.Next() == SYMBOL )
{
- String aName_( aTok.GetSym() );
+ OUString aName_( aTok.GetSym() );
SbxDataType t = aTok.GetType();
if( t == SbxVARIANT && eEndTok == ENDSUB )
+ {
t = SbxVOID;
+ }
pMeth = GetMethod( aName_, t );
pMeth->nLine1 = pMeth->nLine2 = nLine1;
// The method is for a start VALID
pMeth->bInvalid = sal_False;
}
else
+ {
eEndTok = NIL;
+ }
}
// Skip up to END SUB/END FUNCTION
if( eEndTok != NIL )
@@ -952,7 +982,9 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
}
}
if( aTok.IsEof() )
+ {
pMeth->nLine2 = aTok.GetLine();
+ }
}
}
EndDefinitions( sal_True );
@@ -1001,29 +1033,33 @@ static void SendHint( SbxObject* pObj, sal_uIntPtr nId, SbMethod* p )
void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
{
// delete the return value of CreateUnoService
- static String aName( RTL_CONSTASCII_USTRINGPARAM("CreateUnoService") );
+ static OUString aName("CreateUnoService");
SbxVariable* pVar = pBasic->GetRtl()->Find( aName, SbxCLASS_METHOD );
if( pVar )
+ {
pVar->SbxValue::Clear();
-
+ }
// delete the return value of CreateUnoDialog
- static String aName2( RTL_CONSTASCII_USTRINGPARAM("CreateUnoDialog") );
+ static OUString aName2("CreateUnoDialog");
pVar = pBasic->GetRtl()->Find( aName2, SbxCLASS_METHOD );
if( pVar )
+ {
pVar->SbxValue::Clear();
-
+ }
// delete the return value of CDec
- static String aName3( RTL_CONSTASCII_USTRINGPARAM("CDec") );
+ static OUString aName3("CDec");
pVar = pBasic->GetRtl()->Find( aName3, SbxCLASS_METHOD );
if( pVar )
+ {
pVar->SbxValue::Clear();
-
+ }
// delete return value of CreateObject
- static String aName4( RTL_CONSTASCII_USTRINGPARAM("CreateObject") );
+ static OUString aName4("CreateObject");
pVar = pBasic->GetRtl()->Find( aName4, SbxCLASS_METHOD );
if( pVar )
+ {
pVar->SbxValue::Clear();
-
+ }
// Go over all Sub-Basics
SbxArray* pObjs = pBasic->GetObjects();
sal_uInt16 nCount = pObjs->Count();
@@ -1032,7 +1068,9 @@ void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
SbxVariable* pObjVar = pObjs->Get( i );
StarBASIC* pSubBasic = PTR_CAST( StarBASIC, pObjVar );
if( pSubBasic )
+ {
ClearUnoObjectsInRTL_Impl_Rek( pSubBasic );
+ }
}
}
@@ -1067,7 +1105,7 @@ void SbModule::SetVBACompat( bool bCompat )
{
StarBASIC* pBasic = static_cast< StarBASIC* >( GetParent() );
uno::Reference< lang::XMultiServiceFactory > xFactory( getDocumentModel( pBasic ), uno::UNO_QUERY_THROW );
- xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
+ xFactory->createInstance( OUString("ooo.vba.VBAGlobals") );
}
catch( Exception& )
{
@@ -1083,7 +1121,7 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
sal_uInt16 nRes = 0;
bool bDelInst = ( GetSbData()->pInst == NULL );
- bool bQuit = false;
+ bool bQuit = false;
StarBASICRef xBasic;
uno::Reference< frame::XModel > xModel;
uno::Reference< script::vba::XVBACompatibility > xVBACompat;
@@ -1114,7 +1152,7 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
// Launcher problem
// i80726 The Find below will genarate an error in Testtool so we reset it unless there was one before already
sal_Bool bWasError = SbxBase::GetError() != 0;
- SbxVariable* pMSOMacroRuntimeLibVar = Find( rtl::OUString("Launcher"), SbxCLASS_OBJECT );
+ SbxVariable* pMSOMacroRuntimeLibVar = Find( OUString("Launcher"), SbxCLASS_OBJECT );
if ( !bWasError && (SbxBase::GetError() == SbxERR_PROC_UNDEFINED) )
SbxBase::ResetError();
if( pMSOMacroRuntimeLibVar )
@@ -1124,7 +1162,7 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
{
sal_uInt16 nGblFlag = pMSOMacroRuntimeLib->GetFlags() & SBX_GBLSEARCH;
pMSOMacroRuntimeLib->ResetFlag( SBX_GBLSEARCH );
- SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( rtl::OUString("Application"), SbxCLASS_METHOD );
+ SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( OUString("Application"), SbxCLASS_METHOD );
pMSOMacroRuntimeLib->SetFlag( nGblFlag );
if( pAppSymbol )
{
@@ -1321,11 +1359,11 @@ void SbModule::RunInit()
// Delete with private/dim declared variables
-void SbModule::AddVarName( const String& aName )
+void SbModule::AddVarName( const OUString& aName )
{
// see if the name is added allready
- std::vector< String >::iterator it_end = mModuleVariableNames.end();
- for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
+ std::vector< OUString >::iterator it_end = mModuleVariableNames.end();
+ for ( std::vector< OUString >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
{
if ( aName == *it )
return;
@@ -1335,8 +1373,8 @@ void SbModule::AddVarName( const String& aName )
void SbModule::RemoveVars()
{
- std::vector< String >::iterator it_end = mModuleVariableNames.end();
- for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
+ std::vector< OUString >::iterator it_end = mModuleVariableNames.end();
+ for ( std::vector< OUString >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
{
// We don't want a Find being called in a derived class ( e.g.
// SbUserform because it could trigger say an initialise event
@@ -1819,7 +1857,7 @@ sal_Bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
bRet = SbxObject::StoreData( rStrm );
if( bRet )
{
- pImage->aOUSource = ::rtl::OUString();
+ pImage->aOUSource = OUString();
pImage->aComment = aComment;
pImage->aName = GetName();
@@ -1841,7 +1879,7 @@ sal_Bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
sal_Bool SbModule::LoadBinaryData( SvStream& rStrm )
{
- ::rtl::OUString aKeepSource = aOUSource;
+ OUString aKeepSource = aOUSource;
bool bRet = LoadData( rStrm, 2 );
LoadCompleted();
aOUSource = aKeepSource;
@@ -1883,8 +1921,7 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
- String aProcName;
- aProcName.AppendAscii( "Property Get " );
+ OUString aProcName("Property Get ");
aProcName += pProcProperty->GetName();
SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
@@ -1926,15 +1963,13 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
{
pProcProperty->setSet( false );
- String aProcName;
- aProcName.AppendAscii( "Property Set " );
+ OUString aProcName("Property Set " );
aProcName += pProcProperty->GetName();
pMeth = Find( aProcName, SbxCLASS_METHOD );
}
if( !pMeth ) // Let
{
- String aProcName;
- aProcName.AppendAscii( "Property Let " );
+ OUString aProcName("Property Set " );
aProcName += pProcProperty->GetName();
pMeth = Find( aProcName, SbxCLASS_METHOD );
}
@@ -1961,7 +1996,7 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
// Implementation SbJScriptModule (Basic module for JavaScript source code)
-SbJScriptModule::SbJScriptModule( const String& rName )
+SbJScriptModule::SbJScriptModule( const OUString& rName )
:SbModule( rName )
{
}
@@ -1985,7 +2020,7 @@ sal_Bool SbJScriptModule::StoreData( SvStream& rStrm ) const
return sal_False;
// Write the source string
- String aTmp = aOUSource;
+ OUString aTmp = aOUSource;
rStrm.WriteUniOrByteString( aTmp, osl_getThreadTextEncoding() );
return sal_True;
}
@@ -1993,7 +2028,7 @@ sal_Bool SbJScriptModule::StoreData( SvStream& rStrm ) const
/////////////////////////////////////////////////////////////////////////
-SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
+SbMethod::SbMethod( const OUString& r, SbxDataType t, SbModule* p )
: SbxMethod( r, t ), pMod( p )
{
bInvalid = sal_True;
@@ -2161,7 +2196,7 @@ void SbMethod::Broadcast( sal_uIntPtr nHintId )
// Implementation of SbJScriptMethod (method class as a wrapper for JavaScript-functions)
-SbJScriptMethod::SbJScriptMethod( const String& r, SbxDataType t, SbModule* p )
+SbJScriptMethod::SbJScriptMethod( const OUString& r, SbxDataType t, SbModule* p )
: SbMethod( r, t, p )
{
}
@@ -2170,16 +2205,18 @@ SbJScriptMethod::~SbJScriptMethod()
{}
-SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible )
+SbObjModule::SbObjModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible )
: SbModule( rName, bIsVbaCompatible )
{
SetModuleType( mInfo.ModuleType );
if ( mInfo.ModuleType == script::ModuleType::FORM )
{
- SetClassName( rtl::OUString("Form" ) );
+ SetClassName( OUString("Form" ) );
}
else if ( mInfo.ModuleObject.is() )
+ {
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
+ }
}
SbObjModule::~SbObjModule()
@@ -2195,13 +2232,13 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException
pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( rtl::OUString("ooo.vba.excel.Worksheet" ) ) )
+ if( xServiceInfo->supportsService( OUString("ooo.vba.excel.Worksheet" ) ) )
{
- SetClassName( rtl::OUString("Worksheet" ) );
+ SetClassName( OUString("Worksheet" ) );
}
- else if( xServiceInfo->supportsService( rtl::OUString("ooo.vba.excel.Workbook" ) ) )
+ else if( xServiceInfo->supportsService( OUString("ooo.vba.excel.Workbook" ) ) )
{
- SetClassName( rtl::OUString("Workbook" ) );
+ SetClassName( OUString("Workbook" ) );
}
}
@@ -2211,7 +2248,7 @@ SbObjModule::GetObject()
return pDocObject;
}
SbxVariable*
-SbObjModule::Find( const rtl::OUString& rName, SbxClassType t )
+SbObjModule::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pVar = NULL;
if ( pDocObject)
@@ -2347,15 +2384,14 @@ public:
aParams[0] <<= nCancel;
aParams[1] <<= nCloseMode;
- mpUserForm->triggerMethod( rtl::OUString("Userform_QueryClose" ),
- aParams);
+ mpUserForm->triggerMethod( OUString("Userform_QueryClose" ), aParams);
return;
}
}
}
- mpUserForm->triggerMethod( rtl::OUString("Userform_QueryClose" ) );
+ mpUserForm->triggerMethod( OUString("Userform_QueryClose" ) );
#endif
}
@@ -2438,7 +2474,7 @@ public:
}
};
-SbUserFormModule::SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsCompat )
+SbUserFormModule::SbUserFormModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsCompat )
: SbObjModule( rName, mInfo, bIsCompat )
, m_mInfo( mInfo )
, mbInit( false )
@@ -2461,13 +2497,13 @@ void SbUserFormModule::ResetApiObj( bool bTriggerTerminateEvent )
m_xDialog = NULL;
}
-void SbUserFormModule::triggerMethod( const String& aMethodToRun )
+void SbUserFormModule::triggerMethod( const OUString& aMethodToRun )
{
Sequence< Any > aArguments;
triggerMethod( aMethodToRun, aArguments );
}
-void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments )
+void SbUserFormModule::triggerMethod( const OUString& aMethodToRun, Sequence< Any >& aArguments )
{
OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
// Search method
@@ -2511,14 +2547,14 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
void SbUserFormModule::triggerActivateEvent( void )
{
OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
- triggerMethod( rtl::OUString( "UserForm_Activate" ) );
+ triggerMethod( OUString( "UserForm_Activate" ) );
OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
}
void SbUserFormModule::triggerDeactivateEvent( void )
{
OSL_TRACE("**** SbUserFormModule::triggerDeactivate");
- triggerMethod( rtl::OUString("Userform_Deactivate" ) );
+ triggerMethod( OUString("Userform_Deactivate" ) );
}
void SbUserFormModule::triggerInitializeEvent( void )
@@ -2526,7 +2562,7 @@ void SbUserFormModule::triggerInitializeEvent( void )
if ( mbInit )
return;
OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
- static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
+ static OUString aInitMethodName( "Userform_Initialize");
triggerMethod( aInitMethodName );
mbInit = true;
}
@@ -2534,20 +2570,20 @@ void SbUserFormModule::triggerInitializeEvent( void )
void SbUserFormModule::triggerTerminateEvent( void )
{
OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
- static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
+ static OUString aTermMethodName( "Userform_Terminate" );
triggerMethod( aTermMethodName );
mbInit=false;
}
void SbUserFormModule::triggerLayoutEvent( void )
{
- static String aMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Layout") );
+ static OUString aMethodName( "Userform_Layout" );
triggerMethod( aMethodName );
}
void SbUserFormModule::triggerResizeEvent( void )
{
- static String aMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Resize") );
+ static OUString aMethodName("Userform_Resize");
triggerMethod( aMethodName );
}
@@ -2558,20 +2594,20 @@ SbUserFormModuleInstance* SbUserFormModule::CreateInstance()
}
SbUserFormModuleInstance::SbUserFormModuleInstance( SbUserFormModule* pParentModule,
- const rtl::OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat )
+ const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat )
: SbUserFormModule( rName, mInfo, bIsVBACompat )
, m_pParentModule( pParentModule )
{
}
-sal_Bool SbUserFormModuleInstance::IsClass( const rtl::OUString& rName ) const
+sal_Bool SbUserFormModuleInstance::IsClass( const OUString& rName ) const
{
- sal_Bool bParentNameMatches = m_pParentModule->GetName().EqualsIgnoreCaseAscii( rName );
+ sal_Bool bParentNameMatches = m_pParentModule->GetName().equalsIgnoreAsciiCase( rName );
sal_Bool bRet = bParentNameMatches || SbxObject::IsClass( rName );
return bRet;
}
-SbxVariable* SbUserFormModuleInstance::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbUserFormModuleInstance::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pVar = m_pParentModule->Find( rName, t );
return pVar;
@@ -2599,7 +2635,7 @@ void SbUserFormModule::Unload()
aParams[0] <<= nCancel;
aParams[1] <<= nCloseMode;
- triggerMethod( rtl::OUString("Userform_QueryClose" ), aParams);
+ triggerMethod( OUString("Userform_QueryClose" ), aParams);
aParams[0] >>= nCancel;
// basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 )
@@ -2615,7 +2651,7 @@ void SbUserFormModule::Unload()
triggerTerminateEvent();
}
// Search method
- SbxVariable* pMeth = SbObjModule::Find( rtl::OUString("UnloadObject"), SbxCLASS_METHOD );
+ SbxVariable* pMeth = SbObjModule::Find( OUString("UnloadObject"), SbxCLASS_METHOD );
if( pMeth )
{
OSL_TRACE("Attempting too run the UnloadObjectMethod");
@@ -2644,7 +2680,7 @@ void SbUserFormModule::InitObject()
{
try
{
- String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
+ OUString aHook("VBAGlobals");
SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs )
{
@@ -2656,20 +2692,20 @@ void SbUserFormModule::InitObject()
uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= m_xModel;
- rtl::OUString sDialogUrl( "vnd.sun.star.script:" );
- rtl::OUString sProjectName( "Standard" );
+ OUString sDialogUrl( "vnd.sun.star.script:" );
+ OUString sProjectName( "Standard" );
try
{
Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
- uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( "BasicLibraries" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( OUString( "BasicLibraries" ) ), uno::UNO_QUERY_THROW );
sProjectName = xVBAMode->getProjectName();
}
catch(const Exception& ) {}
- sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( "?location=document" ) );
+ sDialogUrl = sDialogUrl + sProjectName + "." + GetName() + "?location=document";
- uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( "com.sun.star.awt.DialogProvider"), aArgs ), uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( OUString( "com.sun.star.awt.DialogProvider"), aArgs ), uno::UNO_QUERY_THROW );
m_xDialog = xProvider->createDialog( sDialogUrl );
// create vba api object
@@ -2718,7 +2754,7 @@ SbUserFormModule::Find( const rtl::OUString& rName, SbxClassType t )
return SbObjModule::Find( rName, t );
}
-SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p )
+SbProperty::SbProperty( const OUString& r, SbxDataType t, SbModule* p )
: SbxProperty( r, t ), pMod( p )
{
bInvalid = sal_False;
diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx
index 6eb01f59a2f4..e3312c91e9c4 100644
--- a/basic/source/comp/buffer.cxx
+++ b/basic/source/comp/buffer.cxx
@@ -58,18 +58,33 @@ char* SbiBuffer::GetBuffer()
// Test, if the buffer can contain n Bytes.
// In case of doubt it will be enlarged
-bool SbiBuffer::Check( sal_uInt16 n )
+bool SbiBuffer::Check( sal_Int32 n )
{
- if( !n ) return true;
- if( ( static_cast<sal_uInt32>( nOff )+ n ) > static_cast<sal_uInt32>( nSize ) )
+ if( !n )
+ {
+ return true;
+ }
+ if( nOff + n > nSize )
{
if( nInc == 0 )
+ {
return false;
- sal_uInt16 nn = 0;
- while( nn < n ) nn = nn + nInc;
+ }
+
+ sal_Int32 nn = 0;
+ while( nn < n )
+ {
+ nn = nn + nInc;
+ }
char* p;
- if( ( static_cast<sal_uInt32>( nSize ) + nn ) > UP_LIMIT ) p = NULL;
- else p = new char [nSize + nn];
+ if( ( nSize + nn ) > UP_LIMIT )
+ {
+ p = NULL;
+ }
+ else
+ {
+ p = new char [nSize + nn];
+ }
if( !p )
{
pParser->Error( SbERR_PROG_TOO_LARGE );
@@ -140,16 +155,28 @@ bool SbiBuffer::operator +=( sal_Int8 n )
{
if( Check( 1 ) )
{
- *pCur++ = (char) n; nOff++; return true;
- } else return false;
+ *pCur++ = (char) n;
+ nOff += 1;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_uInt8 n )
{
if( Check( 1 ) )
{
- *pCur++ = (char) n; nOff++; return true;
- } else return false;
+ *pCur++ = (char) n;
+ nOff += 1;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_Int16 n )
@@ -158,8 +185,13 @@ bool SbiBuffer::operator +=( sal_Int16 n )
{
*pCur++ = (char) ( n & 0xFF );
*pCur++ = (char) ( n >> 8 );
- nOff += 2; return true;
- } else return false;
+ nOff += 2;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_uInt16 n )
@@ -168,8 +200,13 @@ bool SbiBuffer::operator +=( sal_uInt16 n )
{
*pCur++ = (char) ( n & 0xFF );
*pCur++ = (char) ( n >> 8 );
- nOff += 2; return true;
- } else return false;
+ nOff += 2;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_uInt32 n )
@@ -179,10 +216,15 @@ bool SbiBuffer::operator +=( sal_uInt32 n )
sal_uInt16 n1 = static_cast<sal_uInt16>( n & 0xFFFF );
sal_uInt16 n2 = static_cast<sal_uInt16>( n >> 16 );
if ( operator +=( n1 ) && operator +=( n2 ) )
+ {
return true;
+ }
return true;
}
- return false;
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_Int32 n )
@@ -191,18 +233,21 @@ bool SbiBuffer::operator +=( sal_Int32 n )
}
-bool SbiBuffer::operator +=( const String& n )
+bool SbiBuffer::operator +=( const OUString& n )
{
- sal_uInt16 l = n.Len() + 1;
- if( Check( l ) )
+ sal_uInt32 len = n.getLength() + 1;
+ if( Check( len ) )
{
rtl::OString aByteStr(rtl::OUStringToOString(n, osl_getThreadTextEncoding()));
- memcpy( pCur, aByteStr.getStr(), l );
- pCur += l;
- nOff = nOff + l;
+ memcpy( pCur, aByteStr.getStr(), len );
+ pCur += len;
+ nOff += len;
return true;
}
- else return false;
+ else
+ {
+ return false;
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 6642cb13f6f1..77542dd58ae9 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -135,7 +135,7 @@ void SbiCodeGen::Save()
{
for( int i = 0 ; i < nIfaceCount ; i++ )
{
- const String& rIfaceName = pParser->aIfaceVector[i];
+ const OUString& rIfaceName = pParser->aIfaceVector[i];
SbxVariable* pIfaceVar = new SbxVariable( SbxVARIANT );
pIfaceVar->SetName( rIfaceName );
SbxArray* pIfaces = rMod.pClassData->mxIfaces;
@@ -149,45 +149,50 @@ void SbiCodeGen::Save()
{
GetSbData()->pClassFac->RemoveClassModule( &rMod );
// Only a ClassModule can revert to Normal
- if ( rMod.mnType == com::sun::star::script::ModuleType::CLASS )
+ if ( rMod.mnType == com::sun::star::script::ModuleType::CLASS )
+ {
rMod.mnType = com::sun::star::script::ModuleType::NORMAL;
+ }
rMod.bIsProxyModule = false;
}
// GlobalCode-Flag
if( pParser->HasGlobalCode() )
+ {
p->SetFlag( SBIMG_INITCODE );
+ }
// Die Entrypoints:
for( SbiSymDef* pDef = pParser->aPublics.First(); pDef;
- pDef = pParser->aPublics.Next() )
+ pDef = pParser->aPublics.Next() )
{
SbiProcDef* pProc = pDef->GetProcDef();
if( pProc && pProc->IsDefined() )
{
- String aProcName = pProc->GetName();
- String aIfaceProcName;
- String aIfaceName;
+ OUString aProcName = pProc->GetName();
+ OUString aIfaceProcName;
+ OUString aIfaceName;
sal_uInt16 nPassCount = 1;
if( nIfaceCount )
{
- int nPropPrefixFound =
- aProcName.Search( String( RTL_CONSTASCII_USTRINGPARAM("Property ") ) );
- String aPureProcName = aProcName;
- String aPropPrefix;
+ int nPropPrefixFound = aProcName.indexOf(OUString("Property "));
+ OUString aPureProcName = aProcName;
+ OUString aPropPrefix;
if( nPropPrefixFound == 0 )
{
- aPropPrefix = aProcName.Copy( 0, 13 ); // 13 == Len( "Property ?et " )
- aPureProcName = aProcName.Copy( 13 );
+ aPropPrefix = aProcName.copy( 0, 13 ); // 13 == Len( "Property ?et " )
+ aPureProcName = aProcName.copy( 13 );
}
for( int i = 0 ; i < nIfaceCount ; i++ )
{
- const String& rIfaceName = pParser->aIfaceVector[i];
- int nFound = aPureProcName.Search( rIfaceName );
- if( nFound == 0 && '_' == aPureProcName.GetChar( rIfaceName.Len() ) )
+ const OUString& rIfaceName = pParser->aIfaceVector[i];
+ int nFound = aPureProcName.indexOf( rIfaceName );
+ if( nFound == 0 && '_' == aPureProcName[rIfaceName.getLength()] )
{
if( nPropPrefixFound == 0 )
+ {
aIfaceProcName += aPropPrefix;
- aIfaceProcName += aPureProcName.Copy( rIfaceName.Len() + 1 );
+ }
+ aIfaceProcName += aPureProcName.copy( rIfaceName.getLength() + 1 );
aIfaceName = rIfaceName;
nPassCount = 2;
break;
@@ -198,42 +203,47 @@ void SbiCodeGen::Save()
for( sal_uInt16 nPass = 0 ; nPass < nPassCount ; nPass++ )
{
if( nPass == 1 )
+ {
aProcName = aIfaceProcName;
-
+ }
PropertyMode ePropMode = pProc->getPropertyMode();
if( ePropMode != PROPERTY_MODE_NONE )
{
SbxDataType ePropType = SbxEMPTY;
switch( ePropMode )
{
- case PROPERTY_MODE_GET:
- ePropType = pProc->GetType();
- break;
- case PROPERTY_MODE_LET:
+ case PROPERTY_MODE_GET:
+ ePropType = pProc->GetType();
+ break;
+ case PROPERTY_MODE_LET:
+ {
+ // type == type of first parameter
+ ePropType = SbxVARIANT; // Default
+ SbiSymPool* pPool = &pProc->GetParams();
+ if( pPool->GetSize() > 1 )
{
- // type == type of first parameter
- ePropType = SbxVARIANT; // Default
- SbiSymPool* pPool = &pProc->GetParams();
- if( pPool->GetSize() > 1 )
+ SbiSymDef* pPar = pPool->Get( 1 );
+ if( pPar )
{
- SbiSymDef* pPar = pPool->Get( 1 );
- if( pPar )
- ePropType = pPar->GetType();
+ ePropType = pPar->GetType();
}
- break;
}
- case PROPERTY_MODE_SET:
- ePropType = SbxOBJECT;
- break;
- case PROPERTY_MODE_NONE:
- OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
- break;
+ break;
+ }
+ case PROPERTY_MODE_SET:
+ ePropType = SbxOBJECT;
+ break;
+ case PROPERTY_MODE_NONE:
+ OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
+ break;
}
- String aPropName = pProc->GetPropName();
+ OUString aPropName = pProc->GetPropName();
if( nPass == 1 )
- aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
+ {
+ aPropName = aPropName.copy( aIfaceName.getLength() + 1 );
+ }
OSL_TRACE("*** getProcedureProperty for thing %s",
- rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
rMod.GetProcedureProperty( aPropName, ePropType );
}
if( nPass == 1 )
@@ -245,18 +255,20 @@ void SbiCodeGen::Save()
pMeth = rMod.GetMethod( aProcName, pProc->GetType() );
if( !pProc->IsPublic() )
+ {
pMeth->SetFlag( SBX_PRIVATE );
-
+ }
// Declare? -> Hidden
- if( pProc->GetLib().Len() > 0 )
+ if( !pProc->GetLib().isEmpty())
+ {
pMeth->SetFlag( SBX_HIDDEN );
-
+ }
pMeth->nStart = pProc->GetAddr();
pMeth->nLine1 = pProc->GetLine1();
pMeth->nLine2 = pProc->GetLine2();
// The parameter:
SbxInfo* pInfo = pMeth->GetInfo();
- String aHelpFile, aComment;
+ OUString aHelpFile, aComment;
sal_uIntPtr nHelpId = 0;
if( pInfo )
{
@@ -275,24 +287,35 @@ void SbiCodeGen::Save()
SbiSymDef* pPar = pPool->Get( i );
SbxDataType t = pPar->GetType();
if( !pPar->IsByVal() )
+ {
t = (SbxDataType) ( t | SbxBYREF );
+ }
if( pPar->GetDims() )
+ {
t = (SbxDataType) ( t | SbxARRAY );
+ }
// #33677 hand-over an Optional-Info
- sal_uInt16 nFlags = SBX_READ;
+ sal_uInt16 nFlags = SBX_READ;
if( pPar->IsOptional() )
+ {
nFlags |= SBX_OPTIONAL;
-
+ }
pInfo->AddParam( pPar->GetName(), t, nFlags );
sal_uInt32 nUserData = 0;
sal_uInt16 nDefaultId = pPar->GetDefaultId();
if( nDefaultId )
+ {
nUserData |= nDefaultId;
+ }
if( pPar->IsParamArray() )
+ {
nUserData |= PARAM_INFO_PARAMARRAY;
+ }
if( pPar->IsWithBrackets() )
+ {
nUserData |= PARAM_INFO_WITHBRACKETS;
+ }
if( nUserData )
{
SbxParamInfo* pParam = (SbxParamInfo*)pInfo->GetParam( i );
@@ -301,7 +324,6 @@ void SbiCodeGen::Save()
}
pMeth->SetInfo( pInfo );
}
-
} // for( iPass...
}
}
@@ -314,23 +336,29 @@ void SbiCodeGen::Save()
p->MakeStrings( nSize );
sal_uInt16 i;
for( i = 1; i <= nSize; i++ )
+ {
p->AddString( pPool->Find( i ) );
-
+ }
// Insert types
sal_uInt16 nCount = pParser->rTypeArray->Count();
for (i = 0; i < nCount; i++)
+ {
p->AddType((SbxObject *)pParser->rTypeArray->Get(i));
-
+ }
// Insert enum objects
nCount = pParser->rEnumArray->Count();
for (i = 0; i < nCount; i++)
+ {
p->AddEnum((SbxObject *)pParser->rEnumArray->Get(i));
-
+ }
if( !p->IsError() )
+ {
rMod.pImage = p;
+ }
else
+ {
delete p;
-
+ }
rMod.EndDefinitions();
}
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 70d441e8003a..3a6c5c93d971 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -124,7 +124,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed )
Error( SbERR_SYNTAX );
else
{
- String aCompleteName = aSym;
+ OUString aCompleteName = aSym;
// #52709 DIM AS NEW for Uno with full-qualified name
if( Peek() == DOT )
@@ -154,7 +154,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed )
break;
}
- // Take over in the String pool
+ // Take over in the string pool
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
if( rDef.IsNew() && pProc == NULL )
@@ -390,9 +390,11 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic )
{
if( !bCompatible && !pDef->IsNew() )
{
- String aTypeName( aGblStrings.Find( pDef->GetTypeId() ) );
+ OUString aTypeName( aGblStrings.Find( pDef->GetTypeId() ) );
if( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) == NULL )
+ {
Error( SbERR_UNDEF_TYPE, aTypeName );
+ }
}
if( bConst )
@@ -595,9 +597,11 @@ void SbiParser::DefType( bool bPrivate )
if( pElem )
{
SbxArray *pTypeMembers = pType->GetProperties();
- String aElemName = pElem->GetName();
+ OUString aElemName = pElem->GetName();
if( pTypeMembers->Find( aElemName, SbxCLASS_DONTCARE) )
+ {
Error (SbERR_VAR_DEFINED);
+ }
else
{
SbxDataType eElemType = pElem->GetType();
@@ -644,7 +648,7 @@ void SbiParser::DefType( bool bPrivate )
sal_uInt16 nElemTypeId = pElem->GetTypeId();
if( nElemTypeId != 0 )
{
- String aTypeName( aGblStrings.Find( nElemTypeId ) );
+ OUString aTypeName( aGblStrings.Find( nElemTypeId ) );
SbxObject* pTypeObj = static_cast< SbxObject* >( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) );
if( pTypeObj != NULL )
{
@@ -680,7 +684,7 @@ void SbiParser::DefEnum( bool bPrivate )
if (!TestSymbol())
return;
- String aEnumName = aSym;
+ OUString aEnumName = aSym;
if( rEnumArray->Find(aEnumName,SbxCLASS_OBJECT) )
{
Error( SbERR_VAR_DEFINED, aSym );
@@ -689,8 +693,9 @@ void SbiParser::DefEnum( bool bPrivate )
SbxObject *pEnum = new SbxObject( aEnumName );
if( bPrivate )
+ {
pEnum->SetFlag( SBX_PRIVATE );
-
+ }
SbiSymDef* pElem;
SbiDimList* pDim;
bool bDone = false;
@@ -812,7 +817,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl )
bool bFunc = ( eCurTok == FUNCTION );
bool bProp = ( eCurTok == GET || eCurTok == SET || eCurTok == LET );
if( !TestSymbol() ) return NULL;
- String aName( aSym );
+ OUString aName( aSym );
SbxDataType eType = eScanType;
SbiProcDef* pDef = new SbiProcDef( this, aName, true );
pDef->SetType( eType );
@@ -824,112 +829,166 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl )
{
Next();
if( Next() == FIXSTRING )
+ {
pDef->GetLib() = aSym;
+ }
else
+ {
Error( SbERR_SYNTAX );
+ }
}
if( Peek() == ALIAS )
{
Next();
if( Next() == FIXSTRING )
+ {
pDef->GetAlias() = aSym;
+ }
else
+ {
Error( SbERR_SYNTAX );
+ }
}
if( !bDecl )
{
// CDECL, LIB and ALIAS are invalid
- if( pDef->GetLib().Len() )
+ if( !pDef->GetLib().isEmpty() )
+ {
Error( SbERR_UNEXPECTED, LIB );
- if( pDef->GetAlias().Len() )
+ }
+ if( !pDef->GetAlias().isEmpty() )
+ {
Error( SbERR_UNEXPECTED, ALIAS );
+ }
if( pDef->IsCdecl() )
+ {
Error( SbERR_UNEXPECTED, _CDECL_ );
+ }
pDef->SetCdecl( false );
- pDef->GetLib().Erase();
- pDef->GetAlias().Erase();
+ pDef->GetLib() = "";
+ pDef->GetAlias() = "";
}
- else if( !pDef->GetLib().Len() )
+ else if( pDef->GetLib().isEmpty() )
{
// ALIAS and CDECL only together with LIB
- if( pDef->GetAlias().Len() )
+ if( !pDef->GetAlias().isEmpty() )
+ {
Error( SbERR_UNEXPECTED, ALIAS );
+ }
if( pDef->IsCdecl() )
+ {
Error( SbERR_UNEXPECTED, _CDECL_ );
+ }
pDef->SetCdecl( false );
- pDef->GetAlias().Erase();
+ pDef->GetAlias() = "";
}
// Brackets?
if( Peek() == LPAREN )
{
Next();
if( Peek() == RPAREN )
+ {
Next();
+ }
else
- for(;;) {
- bool bByVal = false;
- bool bOptional = false;
- bool bParamArray = false;
- while( Peek() == BYVAL || Peek() == BYREF || Peek() == _OPTIONAL_ )
- {
- if ( Peek() == BYVAL ) Next(), bByVal = true;
- else if ( Peek() == BYREF ) Next(), bByVal = false;
- else if ( Peek() == _OPTIONAL_ ) Next(), bOptional = true;
- }
- if( bCompatible && Peek() == PARAMARRAY )
- {
- if( bByVal || bOptional )
- Error( SbERR_UNEXPECTED, PARAMARRAY );
- Next();
- bParamArray = true;
- }
- SbiSymDef* pPar = VarDecl( NULL, false, false );
- if( !pPar )
- break;
- if( bByVal )
- pPar->SetByVal();
- if( bOptional )
- pPar->SetOptional();
- if( bParamArray )
- pPar->SetParamArray();
- pDef->GetParams().Add( pPar );
- SbiToken eTok = Next();
- if( eTok != COMMA && eTok != RPAREN )
+ {
+ for(;;)
{
- bool bError2 = true;
- if( bOptional && bCompatible && eTok == EQ )
+ bool bByVal = false;
+ bool bOptional = false;
+ bool bParamArray = false;
+ while( Peek() == BYVAL || Peek() == BYREF || Peek() == _OPTIONAL_ )
{
- SbiConstExpression* pDefaultExpr = new SbiConstExpression( this );
- SbxDataType eType2 = pDefaultExpr->GetType();
-
- sal_uInt16 nStringId;
- if( eType2 == SbxSTRING )
- nStringId = aGblStrings.Add( pDefaultExpr->GetString() );
- else
- nStringId = aGblStrings.Add( pDefaultExpr->GetValue(), eType2 );
+ if( Peek() == BYVAL )
+ {
+ bByVal = true;
+ }
+ else if ( Peek() == BYREF )
+ {
+ bByVal = false;
+ }
+ else if ( Peek() == _OPTIONAL_ )
+ {
+ bOptional = true;
+ }
+ Next();
+ }
+ if( bCompatible && Peek() == PARAMARRAY )
+ {
+ if( bByVal || bOptional )
+ {
+ Error( SbERR_UNEXPECTED, PARAMARRAY );
+ }
+ Next();
+ bParamArray = true;
+ }
+ SbiSymDef* pPar = VarDecl( NULL, false, false );
+ if( !pPar )
+ {
+ break;
+ }
+ if( bByVal )
+ {
+ pPar->SetByVal();
+ }
+ if( bOptional )
+ {
+ pPar->SetOptional();
+ }
+ if( bParamArray )
+ {
+ pPar->SetParamArray();
+ }
+ pDef->GetParams().Add( pPar );
+ SbiToken eTok = Next();
+ if( eTok != COMMA && eTok != RPAREN )
+ {
+ bool bError2 = true;
+ if( bOptional && bCompatible && eTok == EQ )
+ {
+ SbiConstExpression* pDefaultExpr = new SbiConstExpression( this );
+ SbxDataType eType2 = pDefaultExpr->GetType();
- pPar->SetDefaultId( nStringId );
- delete pDefaultExpr;
+ sal_uInt16 nStringId;
+ if( eType2 == SbxSTRING )
+ {
+ nStringId = aGblStrings.Add( pDefaultExpr->GetString() );
+ }
+ else
+ {
+ nStringId = aGblStrings.Add( pDefaultExpr->GetValue(), eType2 );
+ }
+ pPar->SetDefaultId( nStringId );
+ delete pDefaultExpr;
- eTok = Next();
- if( eTok == COMMA || eTok == RPAREN )
- bError2 = false;
+ eTok = Next();
+ if( eTok == COMMA || eTok == RPAREN )
+ {
+ bError2 = false;
+ }
+ }
+ if( bError2 )
+ {
+ Error( SbERR_EXPECTED, RPAREN );
+ break;
+ }
}
- if( bError2 )
+ if( eTok == RPAREN )
{
- Error( SbERR_EXPECTED, RPAREN );
break;
}
}
- if( eTok == RPAREN )
- break;
}
}
TypeDecl( *pDef );
if( eType != SbxVARIANT && pDef->GetType() != eType )
+ {
Error( SbERR_BAD_DECLARATION, aName );
+ }
if( pDef->GetType() == SbxVARIANT && !( bFunc || bProp ) )
+ {
pDef->SetType( SbxEMPTY );
+ }
return pDef;
}
@@ -944,7 +1003,9 @@ void SbiParser::DefDeclare( bool bPrivate )
{
Next();
if( eCurTok != SUB && eCurTok != FUNCTION )
+ {
Error( SbERR_UNEXPECTED, eCurTok );
+ }
else
{
bool bFunction = (eCurTok == FUNCTION);
@@ -952,8 +1013,10 @@ void SbiParser::DefDeclare( bool bPrivate )
SbiProcDef* pDef = ProcDecl( true );
if( pDef )
{
- if( !pDef->GetLib().Len() )
+ if( pDef->GetLib().isEmpty() )
+ {
Error( SbERR_EXPECTED, LIB );
+ }
// Is it already there?
SbiSymDef* pOld = aPublics.Find( pDef->GetName() );
if( pOld )
@@ -967,17 +1030,20 @@ void SbiParser::DefDeclare( bool bPrivate )
pDef = NULL;
}
else
+ {
pDef->Match( p );
+ }
}
else
+ {
aPublics.Add( pDef );
-
+ }
if ( pDef )
{
pDef->SetPublic( !bPrivate );
// New declare handling
- if( pDef->GetLib().Len() > 0 )
+ if( !pDef->GetLib().isEmpty())
{
if( bNewGblDefs && nGblChain == 0 )
{
@@ -996,8 +1062,9 @@ void SbiParser::DefDeclare( bool bPrivate )
SbxDataType eType = pDef->GetType();
if( bFunction )
+ {
aGen.Gen( _PARAM, 0, sal::static_int_cast< sal_uInt16 >( eType ) );
-
+ }
if( nParCount > 1 )
{
aGen.Gen( _ARGC );
@@ -1025,15 +1092,20 @@ void SbiParser::DefDeclare( bool bPrivate )
SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL;
sal_uInt16 nId = pDef->GetId();
- if( pDef->GetAlias().Len() )
+ if( !pDef->GetAlias().isEmpty() )
+ {
nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() );
+ }
if( nParCount > 1 )
+ {
nId |= 0x8000;
+ }
aGen.Gen( eOp, nId, sal::static_int_cast< sal_uInt16 >( eType ) );
if( bFunction )
+ {
aGen.Gen( _PUT );
-
+ }
aGen.Gen( _LEAVE );
}
}
@@ -1047,14 +1119,19 @@ void SbiParser::Attribute()
while( Next() != EQ )
{
if( Next() != DOT)
+ {
break;
+ }
}
if( eCurTok != EQ )
+ {
Error( SbERR_SYNTAX );
+ }
else
+ {
SbiExpression aValue( this );
-
+ }
// Don't generate any code - just discard it.
}
@@ -1086,19 +1163,29 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate )
{
Next();
if( eCurTok == GET )
+ {
ePropertyMode = PROPERTY_MODE_GET;
+ }
else if( eCurTok == LET )
+ {
ePropertyMode = PROPERTY_MODE_LET;
+ }
else if( eCurTok == SET )
+ {
ePropertyMode = PROPERTY_MODE_SET;
+ }
else
+ {
Error( SbERR_EXPECTED, "Get or Let or Set" );
+ }
}
SbiToken eExit = eCurTok;
SbiProcDef* pDef = ProcDecl( false );
if( !pDef )
+ {
return;
+ }
pDef->setPropertyMode( ePropertyMode );
// Is the Proc already declared?
@@ -1137,10 +1224,13 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate )
}
}
else
+ {
aPublics.Add( pDef ), pProc = pDef;
-
+ }
if( !pProc )
+ {
return;
+ }
pProc->SetPublic( !bPrivate );
// Now we set the search hierarchy for symbols as well as the
@@ -1148,16 +1238,20 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate )
aPublics.SetProcId( pProc->GetId() );
pProc->GetParams().SetParent( &aPublics );
if( bStatic )
- {
+ {
if ( bVBASupportOn )
+ {
pProc->SetStatic( sal_True );
+ }
else
+ {
Error( SbERR_NOT_IMPLEMENTED ); // STATIC SUB ...
}
- else
+ }
+ else
{
pProc->SetStatic( sal_False );
- }
+ }
// Normal case: Local variable->parameter->global variable
pProc->GetLocals().SetParent( &pProc->GetParams() );
pPool = &pProc->GetLocals();
@@ -1186,30 +1280,35 @@ void SbiParser::Static()
void SbiParser::DefStatic( bool bPrivate )
{
+ SbiSymPool* p;
+
switch( Peek() )
{
- case SUB:
- case FUNCTION:
- case PROPERTY:
- // End global chain if necessary (not done in
- // SbiParser::Parse() under these conditions
- if( bNewGblDefs && nGblChain == 0 )
- {
- nGblChain = aGen.Gen( _JUMP, 0 );
- bNewGblDefs = false;
- }
- Next();
- DefProc( true, bPrivate );
- break;
- default: {
- if( !pProc )
- Error( SbERR_NOT_IN_SUBR );
- // Reset the Pool, so that STATIC-Declarations go into the
- // global Pool
- SbiSymPool* p = pPool; pPool = &aPublics;
- DefVar( _STATIC, true );
- pPool = p;
- } break;
+ case SUB:
+ case FUNCTION:
+ case PROPERTY:
+ // End global chain if necessary (not done in
+ // SbiParser::Parse() under these conditions
+ if( bNewGblDefs && nGblChain == 0 )
+ {
+ nGblChain = aGen.Gen( _JUMP, 0 );
+ bNewGblDefs = false;
+ }
+ Next();
+ DefProc( true, bPrivate );
+ break;
+ default:
+ if( !pProc )
+ {
+ Error( SbERR_NOT_IN_SUBR );
+ }
+ // Reset the Pool, so that STATIC-Declarations go into the
+ // global Pool
+ p = pPool;
+ pPool = &aPublics;
+ DefVar( _STATIC, true );
+ pPool = p;
+ break;
}
}
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index d752993b07fa..357809757c5a 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -57,22 +57,26 @@ static OpTable aOpTable [] = {
// Output of an element
void SbiExprNode::Gen( RecursiveMode eRecMode )
{
+ sal_uInt16 nStringId;
+
if( IsConstant() )
{
switch( GetType() )
{
- case SbxEMPTY: pGen->Gen( _EMPTY ); break;
- case SbxINTEGER: pGen->Gen( _CONST, (short) nVal ); break;
- case SbxSTRING:
- {
- sal_uInt16 nStringId = pGen->GetParser()->aGblStrings.Add( aStrVal, sal_True );
- pGen->Gen( _SCONST, nStringId ); break;
- }
- default:
- {
- sal_uInt16 nStringId = pGen->GetParser()->aGblStrings.Add( nVal, eType );
- pGen->Gen( _NUMBER, nStringId );
- }
+ case SbxEMPTY:
+ pGen->Gen( _EMPTY );
+ break;
+ case SbxINTEGER:
+ pGen->Gen( _CONST, (short) nVal );
+ break;
+ case SbxSTRING:
+ nStringId = pGen->GetParser()->aGblStrings.Add( aStrVal, sal_True );
+ pGen->Gen( _SCONST, nStringId );
+ break;
+ default:
+ nStringId = pGen->GetParser()->aGblStrings.Add( nVal, eType );
+ pGen->Gen( _NUMBER, nStringId );
+ break;
}
}
else if( IsOperand() )
@@ -92,10 +96,14 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
else if( eRecMode == UNDEFINED )
{
if( aVar.pPar && aVar.pPar->IsBracket() )
+ {
bTreatFunctionAsParam = false;
+ }
}
if( !bTreatFunctionAsParam )
+ {
eOp = aVar.pDef->IsGlobal() ? _FIND_G : _FIND;
+ }
}
}
// special treatment for WITH
@@ -114,7 +122,9 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
SbiProcDef* pProc = aVar.pDef->GetProcDef();
if ( pGen->GetParser()->bClassModule )
+ {
eOp = _FIND_CM;
+ }
else if ( aVar.pDef->IsStatic() || (pProc && pProc->IsStatic()) )
{
eOp = _FIND_STATIC;
@@ -123,7 +133,9 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
for( SbiExprNode* p = this; p; p = p->aVar.pNext )
{
if( p == this && pWithParent_ != NULL )
+ {
pWithParent_->Gen();
+ }
p->GenElement( eOp );
eOp = _ELEM;
}
@@ -141,7 +153,9 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
{
pLeft->Gen();
if( pRight )
+ {
pRight->Gen();
+ }
for( OpTable* p = aOpTable; p->eTok != NIL; p++ )
{
if( p->eTok == eTok )
@@ -202,7 +216,7 @@ void SbiExprList::Gen()
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
{
pExpr->Gen();
- if( pExpr->GetName().Len() )
+ if( !pExpr->GetName().isEmpty() )
{
// named arg
sal_uInt16 nSid = pParser->aGblStrings.Add( pExpr->GetName() );
@@ -247,12 +261,16 @@ void SbiExpression::Gen( RecursiveMode eRecMode )
// If pExpr == .-term in With, approximately Gen for Basis-Object
pExpr->Gen( eRecMode );
if( bByVal )
+ {
pParser->aGen.Gen( _BYVAL );
+ }
if( bBased )
{
sal_uInt16 uBase = pParser->nBase;
if( pParser->IsCompatible() )
+ {
uBase |= 0x8000; // #109275 Flag compatiblity
+ }
pParser->aGen.Gen( _BASED, uBase );
pParser->aGen.Gen( _ARGV );
}
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index a863413a65ba..10c98942d492 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -53,7 +53,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, double n, SbxDataType t )
nVal = n;
}
-SbiExprNode::SbiExprNode( SbiParser* p, const String& rVal )
+SbiExprNode::SbiExprNode( SbiParser* p, const OUString& rVal )
{
BaseInit( p );
@@ -256,8 +256,8 @@ void SbiExprNode::FoldConstants()
eType = SbxSTRING;
if( eType == SbxSTRING )
{
- String rl( pLeft->GetString() );
- String rr( pRight->GetString() );
+ OUString rl( pLeft->GetString() );
+ OUString rr( pRight->GetString() );
delete pLeft; pLeft = NULL;
delete pRight; pRight = NULL;
if( eTok == PLUS || eTok == CAT )
@@ -273,30 +273,31 @@ void SbiExprNode::FoldConstants()
{
eType = SbxDOUBLE;
eNodeType = SbxNUMVAL;
- StringCompare eRes = rr.CompareTo( rl );
+ int eRes = rr.compareTo( rl );
switch( eTok )
{
- case EQ:
- nVal = ( eRes == COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
- break;
- case NE:
- nVal = ( eRes != COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
- break;
- case LT:
- nVal = ( eRes == COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
- break;
- case GT:
- nVal = ( eRes == COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
- break;
- case LE:
- nVal = ( eRes != COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
- break;
- case GE:
- nVal = ( eRes != COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
- break;
- default:
- pGen->GetParser()->Error( SbERR_CONVERSION );
- bError = true;
+ case EQ:
+ nVal = ( eRes == 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case NE:
+ nVal = ( eRes != 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case LT:
+ nVal = ( eRes < 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case GT:
+ nVal = ( eRes > 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case LE:
+ nVal = ( eRes <= 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case GE:
+ nVal = ( eRes >= 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ default:
+ pGen->GetParser()->Error( SbERR_CONVERSION );
+ bError = true;
+ break;
}
}
}
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 1a4b465ded02..1037e77e190f 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -39,11 +39,17 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
pNext = NULL;
pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean();
if( t != SbSYMBOL )
+ {
pExpr->Optimize();
+ }
if( t == SbLVALUE && !pExpr->IsLvalue() )
+ {
p->Error( SbERR_LVALUE_EXPECTED );
+ }
if( t == SbOPERAND && !IsVariable() )
+ {
p->Error( SbERR_VAR_EXPECTED );
+ }
}
SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t )
@@ -82,12 +88,16 @@ SbiExpression::~SbiExpression()
static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTok )
{
if( eTok == LPAREN )
+ {
return sal_True;
+ }
// but only if similar to CALL!
if( !p->WhiteSpace() || eCurExpr != SbSYMBOL )
+ {
return sal_False;
- if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING
- || eTok == SYMBOL || eTok == COMMA || eTok == DOT || eTok == NOT || eTok == BYVAL )
+ }
+ if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING ||
+ eTok == SYMBOL || eTok == COMMA || eTok == DOT || eTok == NOT || eTok == BYVAL )
{
return sal_True;
}
@@ -97,16 +107,17 @@ static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken
// Urk the Next() / Peek() symantics are... weird
tokens.Next();
if ( tokens.Peek() == ASSIGN )
+ {
return sal_True;
+ }
}
return sal_False;
}
// definition of a new symbol
-static SbiSymDef* AddSym
- ( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr,
- const String& rName, SbxDataType eType, SbiParameters* pPar )
+static SbiSymDef* AddSym ( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr,
+ const OUString& rName, SbxDataType eType, SbiParameters* pPar )
{
SbiSymDef* pDef;
// A= is not a procedure
@@ -118,24 +129,28 @@ static SbiSymDef* AddSym
// procs must always get into a public pool
SbiSymPool* pPool = &rPool;
if( pPool->GetScope() != SbPUBLIC )
+ {
pPool = &rPool.GetParser()->aPublics;
+ }
SbiProcDef* pProc = pPool->AddProc( rName );
// special treatment for Colls like Documents(1)
if( eCurExpr == SbSTDEXPR )
+ {
bHasType = sal_True;
-
+ }
pDef = pProc;
pDef->SetType( bHasType ? eType : SbxEMPTY );
if( pPar )
{
// generate dummy parameters
- sal_uInt16 n = 1;
+ sal_Int32 n = 1;
for( short i = 0; i < pPar->GetSize(); i++ )
{
- String aPar = rtl::OUString("PAR");
- aPar += ++n;
- pProc->GetParams().AddSym( aPar );
+ n += 1;
+ OUStringBuffer aPar("PAR");
+ aPar.append(n);
+ pProc->GetParams().AddSym( aPar.makeStringAndClear() );
}
}
}
@@ -166,7 +181,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
pNd = ObjTerm( *pDef );
if( pNd )
+ {
pNd->SetWithParent( pWithVar );
+ }
}
if( !pNd )
{
@@ -179,7 +196,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok;
// memorize the parsing's begin
pParser->LockColumn();
- String aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
+ OUString aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
SbxDataType eType = (pKeywordSymbolInfo == NULL) ? pParser->GetType() : pKeywordSymbolInfo->m_eSbxDataType;
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
@@ -220,7 +237,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
while( eTok == LPAREN )
{
if( pvMoreParLcl == NULL )
+ {
pvMoreParLcl = new SbiExprListVector();
+ }
SbiParameters* pAddPar = new SbiParameters( pParser );
pvMoreParLcl->push_back( pAddPar );
bError = bError || !pAddPar->IsValid();
@@ -236,7 +255,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
bBracket = false; // Now the bracket for the first term is obsolete
if( eType == SbxVARIANT )
+ {
eType = SbxOBJECT;
+ }
else
{
// Name%. really does not work!
@@ -257,18 +278,24 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
SbModule& rMod = pParser->aGen.GetModule();
SbxArray* pModMethods = rMod.GetMethods();
if( pModMethods->Find( aSym, SbxCLASS_DONTCARE ) )
+ {
pDef = NULL;
+ }
}
if( !pDef )
{
if( bObj )
+ {
eType = SbxOBJECT;
+ }
pDef = AddSym( eTok, *pParser->pPool, eCurExpr, aSym, eType, pPar );
// Looks like this is a local ( but undefined variable )
// if it is in a static procedure then make this Symbol
// static
if ( !bObj && pParser->pProc && pParser->pProc->IsStatic() )
+ {
pDef->SetStatic();
+ }
}
else
{
@@ -277,16 +304,22 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
if( pConst )
{
if( pConst->GetType() == SbxSTRING )
+ {
return new SbiExprNode( pParser, pConst->GetString() );
+ }
else
+ {
return new SbiExprNode( pParser, pConst->GetValue(), pConst->GetType() );
+ }
}
// 0 parameters come up to ()
if( pDef->GetDims() )
{
if( pPar && pPar->GetSize() && pPar->GetSize() != pDef->GetDims() )
+ {
pParser->Error( SbERR_WRONG_DIMS );
+ }
}
if( pDef->IsDefinedAs() )
{
@@ -299,10 +332,12 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
bError = true;
}
else if ( eType == SbxVARIANT )
+ {
// if there's nothing named, take the type of the entry,
// but only if the var hasn't been defined with AS XXX
// so that we catch n% = 5 : print n
eType = eDefType;
+ }
}
// checking type of variables:
// is there named anything different in the scanner?
@@ -327,7 +362,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType );
if( !pPar )
+ {
pPar = new SbiParameters( pParser,sal_False,sal_False );
+ }
pNd->aVar.pPar = pPar;
pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
@@ -347,7 +384,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
}
if( !bError )
+ {
pNd->aVar.pNext = ObjTerm( *pDef );
+ }
}
pParser->UnlockColumn();
@@ -374,9 +413,10 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
}
if( bError )
+ {
return NULL;
-
- String aSym( pParser->GetSym() );
+ }
+ OUString aSym( pParser->GetSym() );
SbxDataType eType = pParser->GetType();
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
@@ -393,19 +433,22 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
while( eTok == LPAREN )
{
if( pvMoreParLcl == NULL )
+ {
pvMoreParLcl = new SbiExprListVector();
+ }
SbiParameters* pAddPar = new SbiParameters( pParser );
pvMoreParLcl->push_back( pAddPar );
bError = bError || !pPar->IsValid();
eTok = pParser->Peek();
}
-
}
sal_Bool bObj = sal_Bool( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() );
if( bObj )
{
if( eType == SbxVARIANT )
+ {
eType = SbxOBJECT;
+ }
else
{
// Name%. does really not work!
@@ -430,8 +473,9 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
if( bObj )
{
if( pDef->GetType() == SbxVARIANT )
+ {
pDef->SetType( SbxOBJECT );
-
+ }
if( pDef->GetType() != SbxOBJECT )
{
pParser->Error( SbERR_BAD_DECLARATION, aSym );
@@ -462,67 +506,78 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
// test operand:
switch( eTok = pParser->Peek() )
{
- case SYMBOL:
- pRes = Term();
- // process something like "IF Not r Is Nothing Then .."
- if( !bUsedForTypeOf && pParser->IsVBASupportOn() && pParser->Peek() == IS )
- {
- eTok = pParser->Next();
- pRes = new SbiExprNode( pParser, pRes, eTok, Like() );
- }
- break;
- case DOT: // .with
- pRes = Term(); break;
- case NUMBER:
+ case SYMBOL:
+ pRes = Term();
+ // process something like "IF Not r Is Nothing Then .."
+ if( !bUsedForTypeOf && pParser->IsVBASupportOn() && pParser->Peek() == IS )
+ {
+ eTok = pParser->Next();
+ pRes = new SbiExprNode( pParser, pRes, eTok, Like() );
+ }
+ break;
+ case DOT: // .with
+ pRes = Term(); break;
+ case NUMBER:
+ pParser->Next();
+ pRes = new SbiExprNode( pParser, pParser->GetDbl(), pParser->GetType() );
+ break;
+ case FIXSTRING:
+ pParser->Next();
+ pRes = new SbiExprNode( pParser, pParser->GetSym() ); break;
+ case LPAREN:
+ pParser->Next();
+ if( nParenLevel == 0 && m_eMode == EXPRMODE_LPAREN_PENDING && pParser->Peek() == RPAREN )
+ {
+ m_eMode = EXPRMODE_EMPTY_PAREN;
+ pRes = new SbiExprNode(); // Dummy node
pParser->Next();
- pRes = new SbiExprNode( pParser, pParser->GetDbl(), pParser->GetType() );
break;
- case FIXSTRING:
- pParser->Next();
- pRes = new SbiExprNode( pParser, pParser->GetSym() ); break;
- case LPAREN:
- pParser->Next();
- if( nParenLevel == 0 && m_eMode == EXPRMODE_LPAREN_PENDING && pParser->Peek() == RPAREN )
+ }
+ nParenLevel++;
+ pRes = Boolean();
+ if( pParser->Peek() != RPAREN )
+ {
+ // If there was a LPARAM, it does not belong to the expression
+ if( nParenLevel == 1 && m_eMode == EXPRMODE_LPAREN_PENDING )
{
- m_eMode = EXPRMODE_EMPTY_PAREN;
- pRes = new SbiExprNode(); // Dummy node
- pParser->Next();
- break;
+ m_eMode = EXPRMODE_LPAREN_NOT_NEEDED;
}
- nParenLevel++;
- pRes = Boolean();
- if( pParser->Peek() != RPAREN )
+ else
{
- // If there was a LPARAM, it does not belong to the expression
- if( nParenLevel == 1 && m_eMode == EXPRMODE_LPAREN_PENDING )
- m_eMode = EXPRMODE_LPAREN_NOT_NEEDED;
- else
- pParser->Error( SbERR_BAD_BRACKETS );
+ pParser->Error( SbERR_BAD_BRACKETS );
}
- else
+ }
+ else
+ {
+ pParser->Next();
+ if( nParenLevel == 1 && m_eMode == EXPRMODE_LPAREN_PENDING )
{
- pParser->Next();
- if( nParenLevel == 1 && m_eMode == EXPRMODE_LPAREN_PENDING )
+ SbiToken eTokAfterRParen = pParser->Peek();
+ if( eTokAfterRParen == EQ || eTokAfterRParen == LPAREN || eTokAfterRParen == DOT )
{
- SbiToken eTokAfterRParen = pParser->Peek();
- if( eTokAfterRParen == EQ || eTokAfterRParen == LPAREN || eTokAfterRParen == DOT )
- m_eMode = EXPRMODE_ARRAY_OR_OBJECT;
- else
- m_eMode = EXPRMODE_STANDARD;
+ m_eMode = EXPRMODE_ARRAY_OR_OBJECT;
+ }
+ else
+ {
+ m_eMode = EXPRMODE_STANDARD;
}
}
- nParenLevel--;
- break;
- default:
- // keywords here are OK at the moment!
- if( pParser->IsKwd( eTok ) )
- pRes = Term();
- else
- {
- pParser->Next();
- pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE );
- pParser->Error( SbERR_UNEXPECTED, eTok );
- }
+ }
+ nParenLevel--;
+ break;
+ default:
+ // keywords here are OK at the moment!
+ if( pParser->IsKwd( eTok ) )
+ {
+ pRes = Term();
+ }
+ else
+ {
+ pParser->Next();
+ pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE );
+ pParser->Error( SbERR_UNEXPECTED, eTok );
+ }
+ break;
}
return pRes;
}
@@ -559,7 +614,7 @@ SbiExprNode* SbiExpression::Unary()
bool bUsedForTypeOf = true;
SbiExprNode* pObjNode = Operand( bUsedForTypeOf );
pParser->TestToken( IS );
- String aDummy;
+ OUString aDummy;
SbiSymDef* pTypeDef = new SbiSymDef( aDummy );
pParser->TypeDecl( *pTypeDef, sal_True );
pNd = new SbiExprNode( pParser, pObjNode, pTypeDef->GetTypeId() );
@@ -568,7 +623,7 @@ SbiExprNode* SbiExpression::Unary()
case NEW:
{
pParser->Next();
- String aStr;
+ OUString aStr;
SbiSymDef* pTypeDef = new SbiSymDef( aStr );
pParser->TypeDecl( *pTypeDef, sal_True );
pNd = new SbiExprNode( pParser, pTypeDef->GetTypeId() );
@@ -585,7 +640,8 @@ SbiExprNode* SbiExpression::Exp()
SbiExprNode* pNd = Unary();
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
- while( pParser->Peek() == EXPON ) {
+ while( pParser->Peek() == EXPON )
+ {
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Unary() );
}
@@ -602,7 +658,9 @@ SbiExprNode* SbiExpression::MulDiv()
{
SbiToken eTok = pParser->Peek();
if( eTok != MUL && eTok != DIV )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Exp() );
}
@@ -615,7 +673,8 @@ SbiExprNode* SbiExpression::IntDiv()
SbiExprNode* pNd = MulDiv();
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
- while( pParser->Peek() == IDIV ) {
+ while( pParser->Peek() == IDIV )
+ {
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, MulDiv() );
}
@@ -628,7 +687,8 @@ SbiExprNode* SbiExpression::Mod()
SbiExprNode* pNd = IntDiv();
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
- while( pParser->Peek() == MOD ) {
+ while( pParser->Peek() == MOD )
+ {
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, IntDiv() );
}
@@ -645,7 +705,9 @@ SbiExprNode* SbiExpression::AddSub()
{
SbiToken eTok = pParser->Peek();
if( eTok != PLUS && eTok != MINUS )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Mod() );
}
@@ -662,7 +724,9 @@ SbiExprNode* SbiExpression::Cat()
{
SbiToken eTok = pParser->Peek();
if( eTok != CAT )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, AddSub() );
}
@@ -680,10 +744,14 @@ SbiExprNode* SbiExpression::Comp()
{
SbiToken eTok = pParser->Peek();
if( m_eMode == EXPRMODE_ARRAY_OR_OBJECT )
+ {
break;
- if( eTok != EQ && eTok != NE && eTok != LT
- && eTok != GT && eTok != LE && eTok != GE )
+ }
+ if( eTok != EQ && eTok != NE && eTok != LT &&
+ eTok != GT && eTok != LE && eTok != GE )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Cat() );
nCount++;
@@ -716,7 +784,8 @@ SbiExprNode* SbiExpression::Like()
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
short nCount = 0;
- while( pParser->Peek() == LIKE ) {
+ while( pParser->Peek() == LIKE )
+ {
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
@@ -738,9 +807,12 @@ SbiExprNode* SbiExpression::Boolean()
for( ;; )
{
SbiToken eTok = pParser->Peek();
- if( eTok != AND && eTok != OR && eTok != XOR
- && eTok != EQV && eTok != IMP && eTok != IS )
+ if( (eTok != AND) && (eTok != OR) &&
+ (eTok != XOR) && (eTok != EQV) &&
+ (eTok != IMP) && (eTok != IS) )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Like() );
}
@@ -778,12 +850,12 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
SbiSymDef* pVarDef = pExpr->GetVar();
sal_Bool bBoolVal = sal_False;
- if( pVarDef->GetName().EqualsIgnoreCaseAscii( "true" ) )
+ if( pVarDef->GetName().equalsIgnoreAsciiCase( "true" ) )
{
bIsBool = sal_True;
bBoolVal = sal_True;
}
- else if( pVarDef->GetName().EqualsIgnoreCaseAscii( "false" ) )
+ else if( pVarDef->GetName().equalsIgnoreAsciiCase( "false" ) )
//else if( pVarDef->GetName().ICompare( "false" ) == COMPARE_EQUAL )
{
bIsBool = sal_True;
@@ -820,10 +892,13 @@ short SbiConstExpression::GetShortValue()
{
double n = nVal;
if( n > 0 )
+ {
n += .5;
+ }
else
+ {
n -= .5;
-
+ }
if( n > SbxMAXINT )
{
n = SbxMAXINT;
@@ -872,7 +947,9 @@ SbiExpression* SbiExprList::Get( short n )
{
SbiExpression* p = pFirst;
while( n-- && p )
+ {
p = p->pNext;
+ }
return p;
}
@@ -886,8 +963,9 @@ void SbiExprList::addExpression( SbiExpression* pExpr )
SbiExpression* p = pFirst;
while( p->pNext )
+ {
p = p->pNext;
-
+ }
p->pNext = pExpr;
}
@@ -911,8 +989,9 @@ SbiParameters::SbiParameters( SbiParser* p, bool bStandaloneExpression, bool bPa
SbiExprList( p )
{
if( !bPar )
+ {
return;
-
+ }
SbiExpression *pExpr;
SbiToken eTok = pParser->Peek();
@@ -936,15 +1015,17 @@ SbiParameters::SbiParameters( SbiParser* p, bool bStandaloneExpression, bool bPa
if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
{
if( eTok == RPAREN )
+ {
pParser->Next();
+ }
return;
}
// read in parameter table and lay down in correct order!
SbiExpression* pLast = NULL;
- String aName;
+ OUString aName;
while( !bError )
{
- aName.Erase();
+ aName = "";
// missing argument
if( eTok == COMMA )
{
@@ -985,16 +1066,20 @@ SbiParameters::SbiParameters( SbiParser* p, bool bStandaloneExpression, bool bPa
bBracket = true;
delete pExpr;
if( bByVal )
+ {
pParser->Error( SbERR_LVALUE_EXPECTED );
+ }
return;
}
}
else
+ {
pExpr = new SbiExpression( pParser );
-
+ }
if( bByVal && pExpr->IsLvalue() )
+ {
pExpr->SetByVal();
-
+ }
if( !bAssumeArrayMode )
{
if( pParser->Peek() == ASSIGN )
@@ -1011,24 +1096,29 @@ SbiParameters::SbiParameters( SbiParser* p, bool bStandaloneExpression, bool bPa
}
pExpr->pNext = NULL;
if( !pLast )
+ {
pFirst = pLast = pExpr;
+ }
else
+ {
pLast->pNext = pExpr, pLast = pExpr;
+ }
nExpr++;
bError = bError || !pExpr->IsValid();
if( bAssumeArrayMode )
+ {
break;
-
+ }
// next element?
eTok = pParser->Peek();
if( eTok != COMMA )
{
if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
+ {
break;
- pParser->Error( bBracket
- ? SbERR_BAD_BRACKETS
- : SbERR_EXPECTED, COMMA );
+ }
+ pParser->Error( bBracket ? SbERR_BAD_BRACKETS : SbERR_EXPECTED, COMMA );
bError = true;
}
else
@@ -1036,7 +1126,9 @@ SbiParameters::SbiParameters( SbiParser* p, bool bStandaloneExpression, bool bPa
pParser->Next();
eTok = pParser->Peek();
if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
+ {
break;
+ }
}
}
// closing bracket
@@ -1089,9 +1181,13 @@ SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
bError = bError || !pExpr1->IsValid() || !pExpr2->IsValid();
pExpr1->pNext = pExpr2;
if( !pLast )
+ {
pFirst = pExpr1;
+ }
else
+ {
pLast->pNext = pExpr1;
+ }
pLast = pExpr2;
nExpr += 2;
}
@@ -1102,9 +1198,13 @@ SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
bConst = bConst && pExpr1->IsIntConstant();
bError = bError || !pExpr1->IsValid();
if( !pLast )
+ {
pFirst = pLast = pExpr1;
+ }
else
+ {
pLast->pNext = pExpr1, pLast = pExpr1;
+ }
nExpr++;
}
nDim++;
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index b2e7eb7736c4..388911be93c7 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -458,13 +458,21 @@ done:
void SbiParser::On()
{
SbiToken eTok = Peek();
- String aString = SbiTokenizer::Symbol(eTok);
- if (aString.EqualsIgnoreCaseAscii("ERROR"))
+ OUString aString = SbiTokenizer::Symbol(eTok);
+ if (aString.equalsIgnoreAsciiCase("ERROR"))
+ {
eTok = _ERROR_; // Error comes as SYMBOL
- if( eTok != _ERROR_ && eTok != LOCAL ) OnGoto();
+ }
+ if( eTok != _ERROR_ && eTok != LOCAL )
+ {
+ OnGoto();
+ }
else
{
- if( eTok == LOCAL ) Next();
+ if( eTok == LOCAL )
+ {
+ Next();
+ }
Next (); // no more TestToken, as there'd be an error otherwise
Next(); // get token after error
@@ -476,7 +484,9 @@ void SbiParser::On()
if( MayBeLabel() )
{
if( eCurTok == NUMBER && !nVal )
+ {
aGen.Gen( _STDERROR );
+ }
else
{
sal_uInt32 nOff = pProc->GetLabels().Reference( aSym );
@@ -487,12 +497,18 @@ void SbiParser::On()
{
Next();
if( eCurTok == NUMBER && nVal == 1 )
+ {
aGen.Gen( _STDERROR );
+ }
else
+ {
bError_ = true;
+ }
}
if( bError_ )
+ {
Error( SbERR_LABEL_EXPECTED );
+ }
}
else if( eCurTok == RESUME )
{
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index c1f175206a23..a4a4501077d9 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -155,7 +155,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
// part of the runtime-library?
-SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
+SbiSymDef* SbiParser::CheckRTLForSym( const OUString& rSym, SbxDataType eType )
{
SbxVariable* pVar = GetBasic()->GetRtl()->Find( rSym, SbxCLASS_DONTCARE );
SbiSymDef* pDef = NULL;
@@ -495,8 +495,8 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
SbiSymDef* pDef = aVar.GetRealVar();
if( bEQ && pDef && pDef->GetScope() == SbRTL )
{
- String aRtlName = pDef->GetName();
- if( aRtlName.EqualsIgnoreCaseAscii("Mid") )
+ OUString aRtlName = pDef->GetName();
+ if( aRtlName.equalsIgnoreAsciiCase("Mid") )
{
SbiExprNode* pExprNode = aVar.GetExprNode();
if( pExprNode && pExprNode->GetNodeType() == SbxVARVAL )
@@ -588,7 +588,7 @@ void SbiParser::Set()
if( eTok == NEW )
{
Next();
- String aStr;
+ OUString aStr;
SbiSymDef* pTypeDef = new SbiSymDef( aStr );
TypeDecl( *pTypeDef, sal_True );
@@ -628,11 +628,15 @@ void SbiParser::LSet()
{
SbiExpression aLvalue( this, SbLVALUE );
if( aLvalue.GetType() != SbxSTRING )
+ {
Error( SbERR_INVALID_OBJECT );
+ }
TestToken( EQ );
SbiSymDef* pDef = aLvalue.GetRealVar();
if( pDef && pDef->GetConstDef() )
+ {
Error( SbERR_DUPLICATE_DEF, pDef->GetName() );
+ }
SbiExpression aExpr( this );
aLvalue.Gen();
aExpr.Gen();
@@ -644,7 +648,9 @@ void SbiParser::RSet()
{
SbiExpression aLvalue( this, SbLVALUE );
if( aLvalue.GetType() != SbxSTRING )
+ {
Error( SbERR_INVALID_OBJECT );
+ }
TestToken( EQ );
SbiSymDef* pDef = aLvalue.GetRealVar();
if( pDef && pDef->GetConstDef() )
@@ -709,11 +715,11 @@ void SbiParser::Implements()
return;
}
- String aImplementedIface = aSym;
+ OUString aImplementedIface = aSym;
Next();
if( Peek() == DOT )
{
- rtl::OUString aDotStr( '.' );
+ OUString aDotStr( '.' );
while( Peek() == DOT )
{
aImplementedIface += aDotStr;
@@ -763,20 +769,28 @@ void SbiParser::Option()
break;
case PRIVATE:
{
- String aString = SbiTokenizer::Symbol(Next());
- if( !aString.EqualsIgnoreCaseAscii("Module") )
+ OUString aString = SbiTokenizer::Symbol(Next());
+ if( !aString.equalsIgnoreAsciiCase("Module") )
+ {
Error( SbERR_EXPECTED, "Module" );
+ }
break;
}
case COMPARE:
{
SbiToken eTok = Next();
if( eTok == BINARY )
+ {
bText = false;
+ }
else if( eTok == SYMBOL && GetSym().equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("text")) )
+ {
bText = true;
+ }
else
+ {
Error( SbERR_EXPECTED, "Text/Binary" );
+ }
break;
}
case COMPATIBLE:
@@ -794,11 +808,15 @@ void SbiParser::Option()
{
bVBASupportOn = ( nVal == 1 );
if ( bVBASupportOn )
+ {
EnableCompatibility();
+ }
// if the module setting is different
// reset it to what the Option tells us
if ( bVBASupportOn != aGen.GetModule().IsVBACompat() )
+ {
aGen.GetModule().SetVBACompat( bVBASupportOn );
+ }
break;
}
}
@@ -809,9 +827,9 @@ void SbiParser::Option()
}
}
-void addStringConst( SbiSymPool& rPool, const char* pSym, const String& rStr )
+void addStringConst( SbiSymPool& rPool, const char* pSym, const OUString& rStr )
{
- SbiConstDef* pConst = new SbiConstDef( rtl::OUString::createFromAscii( pSym ) );
+ SbiConstDef* pConst = new SbiConstDef( OUString::createFromAscii( pSym ) );
pConst->SetType( SbxSTRING );
pConst->Set( rStr );
rPool.Add( pConst );
@@ -839,8 +857,7 @@ void SbiParser::AddConstants( void )
addStringConst( aPublics, "vbVerticalTab", "\x0B" );
// Force length 1 and make char 0 afterwards
- String aNullCharStr( rtl::OUString(" ") );
- aNullCharStr.SetChar( 0, 0 );
+ OUString aNullCharStr((sal_Unicode)0);
addStringConst( aPublics, "vbNullChar", aNullCharStr );
}
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index b3ee0a18f5ec..45c94148529c 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -257,7 +257,7 @@ const char* lcl_getSpaces( int nSpaceCount )
return pSpacesEnd - nSpaceCount;
}
-static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
+static rtl::OString lcl_toOStringSkipLeadingWhites( const OUString& aStr )
{
static sal_Char Buffer[1000];
@@ -282,10 +282,11 @@ static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
String lcl_dumpMethodParameters( SbMethod* pMethod )
{
- String aStr;
+ OUString aStr;
if( pMethod == NULL )
+ {
return aStr;
-
+ }
SbxError eOld = SbxBase::GetError();
SbxArray* pParams = pMethod->GetParameters();
@@ -298,30 +299,41 @@ String lcl_dumpMethodParameters( SbMethod* pMethod )
{
SbxVariable* pVar = pParams->Get( nParam );
DBG_ASSERT( pVar, "Parameter?!" );
- if ( pVar->GetName().Len() )
+ if ( !pVar->GetName().isEmpty() )
+ {
aStr += pVar->GetName();
+ }
else if ( pInfo )
{
const SbxParamInfo* pParam = pInfo->GetParam( nParam );
if ( pParam )
+ {
aStr += pParam->aName;
+ }
}
aStr += '=';
SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ {
+ aStr += "...";
+ }
else if( eType != SbxOBJECT )
+ {
aStr += pVar->GetString();
+ }
if ( nParam < ( pParams->Count() - 1 ) )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ {
+ aStr += ", ";
+ }
}
aStr += ')';
}
SbxBase::ResetError();
if( eOld != SbxERR_OK )
+ {
SbxBase::SetError( eOld );
-
+ }
return aStr;
}
@@ -338,7 +350,7 @@ static bool GbBlockAll = false;
struct FunctionItem
{
- String m_aCompleteFunctionName;
+ OUString m_aCompleteFunctionName;
double m_dTotalTime;
double m_dNetTime;
int m_nCallCount;
@@ -386,7 +398,9 @@ void lcl_printTimeOutput( void )
{
FunctionItem* pFunctionItem = it->second;
if( pFunctionItem != NULL )
+ {
avFunctionItems.push_back( pFunctionItem );
+ }
}
std::sort( avFunctionItems.begin(), avFunctionItems.end(), compareFunctionNetTime );
@@ -397,7 +411,7 @@ void lcl_printTimeOutput( void )
FunctionItem* pFunctionItem = *itv;
if( pFunctionItem != NULL )
{
- rtl::OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
+ OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
const char* pName = OUStringToOString( aCompleteFunctionName, RTL_TEXTENCODING_ASCII_US ).getStr();
int nNameLen = aCompleteFunctionName.getLength();
@@ -407,10 +421,12 @@ void lcl_printTimeOutput( void )
double dFctNetTimePercent = 100.0 * dFctNetTime / dTotalTime;
int nSpaceCount = 30 - nNameLen;
if( nSpaceCount < 0 )
+ {
nSpaceCount = 2;
+ }
sprintf( TimeBuffer, "%s:%sCalled %d times\t%f ms (%f%%) / net %f (%f%%) ms",
- pName, lcl_getSpaces( nSpaceCount ), pFunctionItem->m_nCallCount,
- dFctTotalTime*1000.0, dFctTotalTimePercent, dFctNetTime*1000.0, dFctNetTimePercent );
+ pName, lcl_getSpaces( nSpaceCount ), pFunctionItem->m_nCallCount,
+ dFctTotalTime*1000.0, dFctTotalTimePercent, dFctNetTime*1000.0, dFctNetTimePercent );
lcl_lineOut( TimeBuffer );
}
}
@@ -427,7 +443,9 @@ void dbg_InitTrace( void )
{
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
+ {
GpTimer->continueTimer();
+ }
#endif
GpGlobalFile = fopen( GpTraceFileName, "a+" );
return;
@@ -435,15 +453,19 @@ void dbg_InitTrace( void )
GbInitTraceAlreadyCalled = true;
if( const sal_Char* pcIniFileName = ::getenv( "OOO_BASICTRACEINI" ) )
+ {
lcl_ReadIniFile( pcIniFileName );
+ }
else if( GpTraceIniFile != NULL )
+ {
lcl_ReadIniFile( GpTraceIniFile );
-
+ }
GpGlobalFile = fopen( GpTraceFileName, "w" );
GbSavTraceOn = GbTraceOn;
if( !GbTraceOn )
+ {
lcl_lineOut( "### Program started with trace off ###" );
-
+ }
#ifdef DBG_TRACE_PROFILING
GpTimer = new canvas::tools::ElapsedTime();
GdStartTime = GpTimer->getElapsedTime();
@@ -459,14 +481,19 @@ void dbg_DeInitTrace( void )
#ifdef DBG_TRACE_PROFILING
while( !GaCallEnterTimeStack.empty() )
+ {
GaCallEnterTimeStack.pop();
+ }
while( !GaFunctionItemStack.empty() )
+ {
GaFunctionItemStack.pop();
-
+ }
lcl_printTimeOutput();
for( FunctionItemMap::iterator it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
+ {
delete it->second;
+ }
GaFunctionItemMap.clear();
if( GpGlobalFile )
@@ -478,7 +505,9 @@ void dbg_DeInitTrace( void )
if( GbInitOnlyAtOfficeStart )
{
if( GbTimerOn )
+ {
GpTimer->pauseTimer();
+ }
}
else
{
@@ -489,11 +518,12 @@ void dbg_DeInitTrace( void )
static sal_Int32 GnLastCallLvl = 0;
-void dbg_tracePrint( const String& aStr, sal_Int32 nCallLvl, bool bCallLvlRelativeToCurrent )
+void dbg_tracePrint( const OUString& aStr, sal_Int32 nCallLvl, bool bCallLvlRelativeToCurrent )
{
if( bCallLvlRelativeToCurrent )
+ {
nCallLvl += GnLastCallLvl;
-
+ }
int nIndent = nCallLvl * GnIndentPerCallLevel;
lcl_lineOut( OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
}
@@ -501,12 +531,14 @@ void dbg_tracePrint( const String& aStr, sal_Int32 nCallLvl, bool bCallLvlRelati
void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
{
if( !GbTraceOn )
+ {
return;
-
+ }
#ifdef DBG_TRACE_PROFILING
if( GbBlockSteps || GbBlockAll )
+ {
return;
-
+ }
double dCurTime = 0.0;
bool bPrintTimeStamp = false;
if( GbTimerOn )
@@ -528,7 +560,7 @@ void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
pTraceMod = pClassModuleObj->getClassModule();
}
- String aModuleName = pTraceMod->GetName();
+ OUString aModuleName = pTraceMod->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
if( it == rModuleTraceMap.end() )
{
@@ -562,8 +594,9 @@ void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
bool bSTMT = false;
if( rStr_STMNT.getLength() )
+ {
bSTMT = true;
-
+ }
char TimeBuffer[200];
#ifdef DBG_TRACE_PROFILING
if( bPrintTimeStamp )
@@ -577,14 +610,16 @@ void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
if( bSTMT )
{
lcl_lineOut( rStr_STMNT.getStr(), lcl_getSpaces( nIndent ),
- (bPrintTimeStamp && !GbIncludePCodes) ? TimeBuffer : NULL );
+ (bPrintTimeStamp && !GbIncludePCodes) ? TimeBuffer : NULL );
}
if( !GbIncludePCodes )
{
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
+ {
GpTimer->continueTimer();
+ }
#endif
return;
}
@@ -594,12 +629,14 @@ void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
if( rStr_PCode.getLength() )
{
lcl_lineOut( rStr_PCode.getStr(), lcl_getSpaces( nIndent ),
- bPrintTimeStamp ? TimeBuffer : NULL );
+ bPrintTimeStamp ? TimeBuffer : NULL );
}
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
+ {
GpTimer->continueTimer();
+ }
#endif
}
@@ -609,8 +646,9 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
static const char* pSeparator = "' ================================================================================";
if( !GbTraceOn )
+ {
return;
-
+ }
#ifdef DBG_TRACE_PROFILING
double dCurTime = 0.0;
double dExecutionTime = 0.0;
@@ -631,16 +669,16 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
pTraceMod = pClassModuleObj->getClassModule();
}
- String aCompleteFunctionName = pTraceMod->GetName();
+ OUString aCompleteFunctionName = pTraceMod->GetName();
if( pMethod != NULL )
{
- aCompleteFunctionName.AppendAscii( "::" );
- String aMethodName = pMethod->GetName();
+ aCompleteFunctionName += "::";
+ OUString aMethodName = pMethod->GetName();
aCompleteFunctionName += aMethodName;
}
else
{
- aCompleteFunctionName.AppendAscii( "/RunInit" );
+ aCompleteFunctionName += "/RunInit";
}
bool bOwnBlockSteps = false;
@@ -651,8 +689,9 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
{
FunctionItemMap::iterator itFunctionItem = GaFunctionItemMap.find( aCompleteFunctionName );
if( itFunctionItem != GaFunctionItemMap.end() )
+ {
pFunctionItem = itFunctionItem->second;
-
+ }
if( pFunctionItem == NULL )
{
DBG_ASSERT( !bLeave, "No FunctionItem in leave!" );
@@ -710,13 +749,17 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
if( bOwnBlockAll )
{
if( GbTimerOn )
+ {
GpTimer->continueTimer();
+ }
return;
}
#endif
if( nCallLvl > 0 )
+ {
nCallLvl--;
+ }
int nIndent = nCallLvl * GnIndentPerCallLevel;
if( !bLeave && !bOwnBlockSteps )
{
@@ -724,31 +767,33 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
lcl_lineOut( pSeparator, lcl_getSpaces( nIndent ) );
}
- String aStr;
+ OUString aStr;
if( bLeave )
{
if( !bOwnBlockSteps )
{
lcl_lineOut( "}", lcl_getSpaces( nIndent ) );
- aStr.AppendAscii( "' Leaving " );
+ aStr = "' Leaving ";
}
}
else
{
- aStr.AppendAscii( "Entering " );
+ aStr = "Entering " ;
}
if( !bLeave || !bOwnBlockSteps )
+ {
aStr += aCompleteFunctionName;
-
+ }
if( !bOwnBlockSteps && pClassModuleObj != NULL )
{
- aStr.AppendAscii( "[this=" );
+ aStr += "[this=";
aStr += pClassModuleObj->GetName();
- aStr.AppendAscii( "]" );
+ aStr += "]" ;
}
if( !bLeave )
+ {
aStr += lcl_dumpMethodParameters( pMethod );
-
+ }
const char* pPostStr = NULL;
#ifdef DBG_TRACE_PROFILING
char TimeBuffer[200];
@@ -759,26 +804,35 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
}
#endif
lcl_lineOut( (!bLeave || !bOwnBlockSteps) ? OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr() : "}",
- lcl_getSpaces( nIndent ), pPostStr );
+ lcl_getSpaces( nIndent ), pPostStr );
if( !bLeave )
+ {
lcl_lineOut( "{", lcl_getSpaces( nIndent ) );
-
+ }
if( bLeave && !bOwnBlockSteps )
+ {
lcl_lineOut( "" );
-
+ }
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
+ {
GpTimer->continueTimer();
+ }
#endif
}
-void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, sal_Int32 nCallLvl )
+void dbg_traceNotifyError( SbError nTraceErr, const OUString& aTraceErrMsg,
+ bool bTraceErrHandled, sal_Int32 nCallLvl )
{
if( !GbTraceOn )
+ {
return;
+ }
#ifdef DBG_TRACE_PROFILING
if( GbBlockSteps || GbBlockAll )
+ {
return;
+ }
#endif
GnLastCallLvl = nCallLvl;
@@ -792,9 +846,9 @@ void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool b
}
void dbg_RegisterTraceTextForPC( SbModule* pModule, sal_uInt32 nPC,
- const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
+ const OUString& aTraceStr_STMNT, const OUString& aTraceStr_PCode )
{
- String aModuleName = pModule->GetName();
+ OUString aModuleName = pModule->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
PCToTextDataMap* pInnerMap;
if( it == rModuleTraceMap.end() )
@@ -829,21 +883,25 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
return;
}
- String aCommand = rPar.Get(1)->GetString();
+ OUString aCommand = rPar.Get(1)->GetString();
- if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) )
+ if( aCommand.equalsIngoreAsciiCase( "TraceOn" ) )
+ {
GbTraceOn = true;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "TraceOff" ) )
+ {
GbTraceOn = false;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "PCodeOn" ) )
+ {
GbIncludePCodes = true;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "PCodeOff" ) )
+ {
GbIncludePCodes = false;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "Print" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "Print" ) )
{
if ( rPar.Count() < 3 )
{
@@ -855,11 +913,11 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
if( eOld != SbxERR_OK )
SbxBase::ResetError();
- String aValStr = rPar.Get(2)->GetString();
+ OUString aValStr = rPar.Get(2)->GetString();
SbxError eErr = SbxBase::GetError();
if( eErr != SbxERR_OK )
{
- aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) );
+ aValStr = "<ERROR converting value to String>";
SbxBase::ResetError();
}
@@ -871,7 +929,9 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
lcl_lineOut( Buffer, lcl_getSpaces( nIndent ) );
if( eOld != SbxERR_OK )
+ {
SbxBase::SetError( eOld );
+ }
}
}
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 395f19aa24ca..005ae381ebcc 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -51,12 +51,12 @@ const rtl::OUString& SbiStringPool::Find( sal_uInt32 n ) const
return aData[n - 1];
}
-short SbiStringPool::Add( const rtl::OUString& rVal, bool bNoCase )
+short SbiStringPool::Add( const OUString& rVal, bool bNoCase )
{
sal_uInt32 n = aData.size();
for( sal_uInt32 i = 0; i < n; ++i )
{
- rtl::OUString& p = aData[i];
+ OUString& p = aData[i];
if( ( bNoCase && p == rVal )
|| ( !bNoCase && p.equalsIgnoreAsciiCase( rVal ) ) )
return i+1;
@@ -114,7 +114,7 @@ SbiSymDef* SbiSymPool::Next()
}
-SbiSymDef* SbiSymPool::AddSym( const String& rName )
+SbiSymDef* SbiSymPool::AddSym( const OUString& rName )
{
SbiSymDef* p = new SbiSymDef( rName );
p->nPos = aData.size();
@@ -125,7 +125,7 @@ SbiSymDef* SbiSymPool::AddSym( const String& rName )
return p;
}
-SbiProcDef* SbiSymPool::AddProc( const String& rName )
+SbiProcDef* SbiSymPool::AddProc( const OUString& rName )
{
SbiProcDef* p = new SbiProcDef( pParser, rName );
p->nPos = aData.size();
@@ -157,38 +157,46 @@ void SbiSymPool::Add( SbiSymDef* pDef )
{
// A unique name must be created in the string pool
// for static variables (Form ProcName:VarName)
- String aName( pDef->aName );
+ OUString aName( pDef->aName );
if( pDef->IsStatic() )
{
aName = pParser->aGblStrings.Find( nProcId );
- aName += ':';
+ aName += ":";
aName += pDef->aName;
}
pDef->nId = rStrings.Add( aName );
}
if( !pDef->GetProcDef() )
+ {
pDef->nProcId = nProcId;
+ }
pDef->pIn = this;
aData.insert( aData.begin() + pDef->nPos, pDef );
}
}
-SbiSymDef* SbiSymPool::Find( const String& rName ) const
+SbiSymDef* SbiSymPool::Find( const OUString& rName ) const
{
sal_uInt16 nCount = aData.size();
for( sal_uInt16 i = 0; i < nCount; i++ )
{
SbiSymDef* p = aData[ nCount - i - 1 ];
- if( ( !p->nProcId || ( p->nProcId == nProcId ) )
- && ( p->aName.EqualsIgnoreCaseAscii( rName ) ) )
+ if( ( !p->nProcId || ( p->nProcId == nProcId)) &&
+ ( p->aName.equalsIgnoreAsciiCase(rName)))
+ {
return p;
+ }
}
if( pParent )
+ {
return pParent->Find( rName );
+ }
else
+ {
return NULL;
+ }
}
@@ -198,12 +206,18 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
{
SbiSymDef* p = aData[ i ];
if( p->nId == n && ( !p->nProcId || ( p->nProcId == nProcId ) ) )
+ {
return p;
+ }
}
if( pParent )
+ {
return pParent->FindId( n );
+ }
else
+ {
return NULL;
+ }
}
// find via position (from 0)
@@ -211,28 +225,39 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const
{
if( n >= aData.size() )
+ {
return NULL;
+ }
else
+ {
return aData[ n ];
+ }
}
-sal_uInt32 SbiSymPool::Define( const String& rName )
+sal_uInt32 SbiSymPool::Define( const OUString& rName )
{
SbiSymDef* p = Find( rName );
if( p )
- { if( p->IsDefined() )
+ {
+ if( p->IsDefined() )
+ {
pParser->Error( SbERR_LABEL_DEFINED, rName );
+ }
}
else
+ {
p = AddSym( rName );
+ }
return p->Define();
}
-sal_uInt32 SbiSymPool::Reference( const String& rName )
+sal_uInt32 SbiSymPool::Reference( const OUString& rName )
{
SbiSymDef* p = Find( rName );
if( !p )
+ {
p = AddSym( rName );
+ }
// to be sure
pParser->aGen.GenStmnt();
return p->Reference();
@@ -245,7 +270,9 @@ void SbiSymPool::CheckRefs()
{
SbiSymDef* p = aData[ i ];
if( !p->IsDefined() )
+ {
pParser->Error( SbERR_UNDEF_LABEL, p->GetName() );
+ }
}
}
@@ -255,7 +282,7 @@ void SbiSymPool::CheckRefs()
|*
***************************************************************************/
-SbiSymDef::SbiSymDef( const String& rName ) : aName( rName )
+SbiSymDef::SbiSymDef( const OUString& rName ) : aName( rName )
{
eType = SbxEMPTY;
nDims = 0;
@@ -297,10 +324,12 @@ SbiConstDef* SbiSymDef::GetConstDef()
}
-const String& SbiSymDef::GetName()
+const OUString& SbiSymDef::GetName()
{
if( pIn )
+ {
aName = pIn->rStrings.Find( nId );
+ }
return aName;
}
@@ -309,15 +338,20 @@ void SbiSymDef::SetType( SbxDataType t )
{
if( t == SbxVARIANT && pIn )
{
- sal_Unicode cu = aName.GetBuffer()[0];
+ sal_Unicode cu = aName[0];
if( cu < 256 )
{
- char ch = (char)aName.GetBuffer()[0];
- if( ch == '_' ) ch = 'Z';
+ char ch = (char)cu;
+ if( ch == '_' )
+ {
+ ch = 'Z';
+ }
int ch2 = toupper( ch );
unsigned char c = (unsigned char)ch2;
if( c > 0 && c < 128 )
+ {
t = pIn->pParser->eDefTypes[ ch2 - 'A' ];
+ }
}
}
eType = t;
@@ -342,7 +376,10 @@ sal_uInt32 SbiSymDef::Define()
{
sal_uInt32 n = pIn->pParser->aGen.GetPC();
pIn->pParser->aGen.GenStmnt();
- if( nChain ) pIn->pParser->aGen.BackChain( nChain );
+ if( nChain )
+ {
+ pIn->pParser->aGen.BackChain( nChain );
+ }
nChain = n;
bChained = true;
return nChain;
@@ -354,7 +391,9 @@ sal_uInt32 SbiSymDef::Define()
SbiSymPool& SbiSymDef::GetPool()
{
if( !pPool )
+ {
pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // is dumped
+ }
return *pPool;
}
@@ -371,7 +410,7 @@ SbiSymScope SbiSymDef::GetScope() const
// 2) pPool: all local variables
// 3) aLabels: labels
-SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName,
+SbiProcDef::SbiProcDef( SbiParser* pParser, const OUString& rName,
bool bProcDecl )
: SbiSymDef( rName )
, aParams( pParser->aGblStrings, SbPARAM ) // is dumped
@@ -422,7 +461,9 @@ void SbiProcDef::Match( SbiProcDef* pOld )
// no type matching - that is done during running
// but is it maybe called with too little parameters?
if( !po && !pn->IsOptional() && !pn->IsParamArray() )
+ {
break;
+ }
po = pOld->aParams.Next();
}
@@ -453,16 +494,13 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
// CompleteProcName includes "Property xxx "
// to avoid conflicts with other symbols
- String aCompleteProcName;
- aCompleteProcName.AppendAscii( "Property " );
+ OUString aCompleteProcName = "Property ";
switch( mePropMode )
{
- case PROPERTY_MODE_GET: aCompleteProcName.AppendAscii( "Get " ); break;
- case PROPERTY_MODE_LET: aCompleteProcName.AppendAscii( "Let " ); break;
- case PROPERTY_MODE_SET: aCompleteProcName.AppendAscii( "Set " ); break;
- case PROPERTY_MODE_NONE:
- OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
- break;
+ case PROPERTY_MODE_GET: aCompleteProcName += "Get "; break;
+ case PROPERTY_MODE_LET: aCompleteProcName += "Let "; break;
+ case PROPERTY_MODE_SET: aCompleteProcName += "Set "; break;
+ case PROPERTY_MODE_NONE: OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" ); break;
}
aCompleteProcName += aName;
aName = aCompleteProcName;
@@ -471,7 +509,7 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
-SbiConstDef::SbiConstDef( const String& rName )
+SbiConstDef::SbiConstDef( const OUString& rName )
: SbiSymDef( rName )
{
nVal = 0; eType = SbxINTEGER;
@@ -479,10 +517,10 @@ SbiConstDef::SbiConstDef( const String& rName )
void SbiConstDef::Set( double n, SbxDataType t )
{
- aVal.Erase(); nVal = n; eType = t;
+ aVal = ""; nVal = n; eType = t;
}
-void SbiConstDef::Set( const String& n )
+void SbiConstDef::Set( const OUString& n )
{
aVal = n; nVal = 0; eType = SbxSTRING;
}
@@ -498,7 +536,9 @@ SbiConstDef* SbiConstDef::GetConstDef()
SbiSymbols::~SbiSymbols()
{
for( const_iterator it = begin(); it != end(); ++it )
+ {
delete *it;
+ }
};
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 0de57e6356b0..a6054c19415a 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -28,7 +28,6 @@ static short nToken; // number of tokens
static TokenTable* pTokTable;
static TokenTable aTokTable_Basic [] = {
-
{ CAT, "&" },
{ MUL, "*" },
{ PLUS, "+" },
@@ -188,16 +187,19 @@ TokenLabelInfo::TokenLabelInfo( void )
{
m_pTokenCanBeLabelTab = new bool[VBASUPPORT+1];
for( int i = 0 ; i <= VBASUPPORT ; ++i )
+ {
m_pTokenCanBeLabelTab[i] = false;
-
+ }
// Token accepted as label by VBA
SbiToken eLabelToken[] = { ACCESS, ALIAS, APPEND, BASE, BINARY, CLASSMODULE,
- COMPARE, COMPATIBLE, DEFERR, _ERROR_, EXPLICIT, LIB, LINE, LPRINT, NAME,
- TOBJECT, OUTPUT, PROPERTY, RANDOM, READ, STEP, STOP, TEXT, VBASUPPORT, NIL };
+ COMPARE, COMPATIBLE, DEFERR, _ERROR_, EXPLICIT, LIB, LINE, LPRINT, NAME,
+ TOBJECT, OUTPUT, PROPERTY, RANDOM, READ, STEP, STOP, TEXT, VBASUPPORT, NIL };
SbiToken* pTok = eLabelToken;
SbiToken eTok;
for( pTok = eLabelToken ; (eTok = *pTok) != NIL ; ++pTok )
+ {
m_pTokenCanBeLabelTab[eTok] = true;
+ }
}
TokenLabelInfo::~TokenLabelInfo()
@@ -218,7 +220,10 @@ SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb )
ePush = NIL;
bEos = bKeywords = bErrorIsSymbol = true;
if( !nToken )
- for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ ) {}
+ {
+ for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ )
+ {}
+ }
}
SbiTokenizer::~SbiTokenizer()
@@ -280,16 +285,17 @@ const ::rtl::OUString& SbiTokenizer::Symbol( SbiToken t )
}
switch( t )
{
- case NEG :
- aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
- return aSym;
- case EOS :
- aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":/CRLF"));
- return aSym;
- case EOLN :
- aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CRLF"));
- return aSym;
- default: break;
+ case NEG :
+ aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ return aSym;
+ case EOS :
+ aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":/CRLF"));
+ return aSym;
+ case EOLN :
+ aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CRLF"));
+ return aSym;
+ default:
+ break;
}
TokenTable* tp = pTokTable;
for( short i = 0; i < nToken; i++, tp++ )
@@ -302,7 +308,9 @@ const ::rtl::OUString& SbiTokenizer::Symbol( SbiToken t )
}
const sal_Unicode *p = aSym.getStr();
if (*p <= ' ')
+ {
aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("???"));
+ }
return aSym;
}
@@ -313,7 +321,10 @@ const ::rtl::OUString& SbiTokenizer::Symbol( SbiToken t )
SbiToken SbiTokenizer::Next()
{
- if (bEof) return EOLN;
+ if (bEof)
+ {
+ return EOLN;
+ }
// have read in one already?
if( ePush != NIL )
{
@@ -340,16 +351,23 @@ SbiToken SbiTokenizer::Next()
bEos = false;
if( bNumber )
+ {
return eCurTok = NUMBER;
-
+ }
else if( ( eScanType == SbxDATE || eScanType == SbxSTRING ) && !bSymbol )
+ {
return eCurTok = FIXSTRING;
+ }
// Special cases of characters that are between "Z" and "a". ICompare()
// evaluates the position of these characters in different ways.
else if( aSym[0] == '^' )
+ {
return eCurTok = EXPON;
+ }
else if( aSym[0] == '\\' )
+ {
return eCurTok = IDIV;
+ }
else
{
if( eScanType != SbxVARIANT
@@ -366,32 +384,52 @@ SbiToken SbiTokenizer::Next()
sal_Int32 res = aSym.compareToIgnoreAsciiCaseAscii( tp->s );
if( res == 0 )
+ {
goto special;
-
+ }
if( res < 0 )
{
- if ((ub - lb) == 2) ub = lb;
- else ub = ub - delta;
+ if ((ub - lb) == 2)
+ {
+ ub = lb;
+ }
+ else
+ {
+ ub = ub - delta;
+ }
}
else
{
- if ((ub -lb) == 2) lb = ub;
- else lb = lb + delta;
+ if ((ub -lb) == 2)
+ {
+ lb = ub;
+ }
+ else
+ {
+ lb = lb + delta;
+ }
}
- } while( delta );
+ }
+ while( delta );
// Symbol? if not >= token
sal_Unicode ch = aSym[0];
if( !theBasicCharClass::get().isAlpha( ch, bCompatible ) && !bSymbol )
+ {
return eCurTok = (SbiToken) (ch & 0x00FF);
+ }
return eCurTok = SYMBOL;
}
special:
// #i92642
bool bStartOfLine = (eCurTok == NIL || eCurTok == REM || eCurTok == EOLN);
if( !bStartOfLine && (tp->t == NAME || tp->t == LINE) )
+ {
return eCurTok = SYMBOL;
+ }
else if( tp->t == TEXT )
+ {
return eCurTok = SYMBOL;
+ }
// maybe we can expand this for other statements that have parameters
// that are keywords ( and those keywords are only used within such
// statements )
@@ -400,8 +438,9 @@ special:
// we just treat keyword 'append' as a normal 'SYMBOL'.
// Also we accept Dim APPEND
else if ( ( !bInStatement || eCurTok == DIM ) && tp->t == APPEND )
+ {
return eCurTok = SYMBOL;
-
+ }
// #i92642: Special LINE token handling -> SbiParser::Line()
// END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH
@@ -413,21 +452,21 @@ special:
sal_uInt16 nOldCol = nCol;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
- String aOldSym = aSym;
+ OUString aOldSym = aSym;
SaveLine(); // save pLine in the scanner
eCurTok = Peek();
switch( eCurTok )
{
- case IF: Next(); eCurTok = ENDIF; break;
- case SELECT: Next(); eCurTok = ENDSELECT; break;
- case SUB: Next(); eCurTok = ENDSUB; break;
- case FUNCTION: Next(); eCurTok = ENDFUNC; break;
- case PROPERTY: Next(); eCurTok = ENDPROPERTY; break;
- case TYPE: Next(); eCurTok = ENDTYPE; break;
- case ENUM: Next(); eCurTok = ENDENUM; break;
- case WITH: Next(); eCurTok = ENDWITH; break;
- default : eCurTok = END;
+ case IF: Next(); eCurTok = ENDIF; break;
+ case SELECT: Next(); eCurTok = ENDSELECT; break;
+ case SUB: Next(); eCurTok = ENDSUB; break;
+ case FUNCTION: Next(); eCurTok = ENDFUNC; break;
+ case PROPERTY: Next(); eCurTok = ENDPROPERTY; break;
+ case TYPE: Next(); eCurTok = ENDTYPE; break;
+ case ENUM: Next(); eCurTok = ENDENUM; break;
+ case WITH: Next(); eCurTok = ENDWITH; break;
+ default : eCurTok = END; break;
}
nCol1 = nOldCol1;
if( eCurTok == END )
@@ -447,13 +486,19 @@ special:
eCurTok = tp->t;
// AS: data types are keywords
if( tp->t == AS )
+ {
bAs = true;
+ }
else
{
if( bAs )
+ {
bAs = false;
+ }
else if( eCurTok >= DATATYPE1 && eCurTok <= DATATYPE2 && (bErrorIsSymbol || eCurTok != _ERROR_) )
+ {
eCurTok = SYMBOL;
+ }
}
// CLASSMODULE, PROPERTY, GET, ENUM token only visible in compatible mode
@@ -462,10 +507,13 @@ special:
{
// #129904 Suppress system
if( eTok == STOP && aSym.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("system")) )
+ {
eCurTok = SYMBOL;
-
+ }
if( eTok == GET && bStartOfLine )
+ {
eCurTok = SYMBOL;
+ }
}
else
{
@@ -493,11 +541,15 @@ special:
bool SbiTokenizer::MayBeLabel( bool bNeedsColon )
{
if( eCurTok == SYMBOL || m_aTokenLabelInfo.canTokenBeLabel( eCurTok ) )
+ {
return bNeedsColon ? DoesColonFollow() : true;
+ }
else
+ {
return ( eCurTok == NUMBER
&& eScanType == SbxINTEGER
&& nVal >= 0 );
+ }
}
#ifdef _MSC_VER
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx
index 08a1f2f5f2df..5ac631a71e12 100644
--- a/basic/source/inc/buffer.hxx
+++ b/basic/source/inc/buffer.hxx
@@ -19,9 +19,8 @@
#ifndef _BUFFER_HXX
#define _BUFFER_HXX
-
+#include <rtl/ustring.hxx>
#include <tools/solar.h>
-#include <tools/string.hxx>
class SbiParser;
@@ -32,13 +31,13 @@ class SbiBuffer {
sal_uInt32 nOff;
sal_uInt32 nSize;
short nInc;
- bool Check( sal_uInt16 );
+ bool Check( sal_Int32 );
public:
SbiBuffer( SbiParser*, short ); // increment
~SbiBuffer();
void Patch( sal_uInt32, sal_uInt32 );
void Chain( sal_uInt32 );
- bool operator += (const String&); // save basic-string
+ bool operator += (const OUString&); // save basic-string
bool operator += (sal_Int8); // save character
bool operator += (sal_Int16); // save integer
bool operator += (sal_uInt8); // save character
diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx
index db4433268ee9..2c59e478cd7e 100644
--- a/basic/source/inc/errobject.hxx
+++ b/basic/source/inc/errobject.hxx
@@ -28,7 +28,7 @@ class SbxErrObject : public SbUnoObject
class ErrObject* m_pErrObject;
com::sun::star::uno::Reference< ooo::vba::XErrObject > m_xErr;
- SbxErrObject( const String& aName_, const com::sun::star::uno::Any& aUnoObj_ );
+ SbxErrObject( const OUString& aName_, const com::sun::star::uno::Any& aUnoObj_ );
~SbxErrObject();
class ErrObject* getImplErrObject( void )
@@ -38,7 +38,7 @@ public:
static SbxVariableRef getErrObject();
static com::sun::star::uno::Reference< ooo::vba::XErrObject > getUnoErrObject();
- void setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
+ void setNumberAndDescription( ::sal_Int32 _number, const OUString& _description )
throw (com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index 92a67b907aed..0b9eb229a795 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -46,7 +46,7 @@ struct SbVar {
struct KeywordSymbolInfo
{
- ::rtl::OUString m_aKeywordSymbol;
+ OUString m_aKeywordSymbol;
SbxDataType m_eSbxDataType;
SbiToken m_eTok;
};
@@ -94,7 +94,7 @@ class SbiExprNode { // operators (and operands)
double nVal; // numeric value
SbVar aVar; // or variable
};
- String aStrVal; // #i59791/#i45570 Store string directly
+ OUString aStrVal; // #i59791/#i45570 Store string directly
SbiExprNode* pLeft; // right branch
SbiExprNode* pRight; // right branch (NULL for unary ops)
SbiExprNode* pWithParent; // node, whose member is "this per with"
@@ -118,7 +118,7 @@ class SbiExprNode { // operators (and operands)
public:
SbiExprNode( void );
SbiExprNode( SbiParser*, double, SbxDataType );
- SbiExprNode( SbiParser*, const String& );
+ SbiExprNode( SbiParser*, const OUString& );
SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL );
SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* );
SbiExprNode( SbiParser*, SbiExprNode*, sal_uInt16 ); // #120061 TypeOf
@@ -141,7 +141,7 @@ public:
SbiSymDef* GetRealVar(); // last variable in x.y.z
SbiExprNode* GetRealNode(); // last node in x.y.z
short GetDepth(); // compute a tree's depth
- const String& GetString() { return aStrVal; }
+ const OUString& GetString() { return aStrVal; }
short GetNumber() { return (short)nVal; }
SbiExprList* GetParameters() { return aVar.pPar; }
SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; }
@@ -156,7 +156,7 @@ class SbiExpression {
friend class SbiParameters;
friend class SbiDimList;
protected:
- String aArgName;
+ OUString aArgName;
SbiParser* pParser;
SbiExpression* pNext; // link at parameter lists
SbiExprNode* pExpr; // expression tree
@@ -187,7 +187,7 @@ public:
SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE );
SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL );
~SbiExpression();
- String& GetName() { return aArgName; }
+ OUString& GetName() { return aArgName; }
void SetBased() { bBased = true; }
bool IsBased() { return bBased; }
void SetByVal() { bByVal = true; }
@@ -198,7 +198,7 @@ public:
bool IsVariable() { return pExpr->IsVariable(); }
bool IsLvalue() { return pExpr->IsLvalue(); }
bool IsIntConstant() { return pExpr->IsIntConst(); }
- const String& GetString() { return pExpr->GetString(); }
+ const OUString& GetString() { return pExpr->GetString(); }
SbiSymDef* GetVar() { return pExpr->GetVar(); }
SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); }
SbiExprNode* GetExprNode() { return pExpr; }
@@ -209,12 +209,12 @@ public:
class SbiConstExpression : public SbiExpression {
double nVal;
- String aVal;
+ OUString aVal;
SbxDataType eType;
public: // numeric constant
SbiConstExpression( SbiParser* );
SbxDataType GetType() { return eType; }
- const String& GetString() { return aVal; }
+ const OUString& GetString() { return aVal; }
double GetValue() { return nVal; }
short GetShortValue();
};
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 96474ad78ca1..42d19f97b675 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -32,32 +32,32 @@ class SbiImage {
SbxArrayRef rTypes; // User defined types
SbxArrayRef rEnums; // Enum types
- sal_uInt32* pStringOff; // StringId-Offsets
+ sal_uInt32* pStringOff; // StringId-Offsets
sal_Unicode* pStrings; // StringPool
char* pCode; // Code-Image
char* pLegacyPCode; // Code-Image
bool bError;
- sal_uInt16 nFlags;
+ sal_uInt16 nFlags;
short nStrings;
- sal_uInt32 nStringSize;
- sal_uInt32 nCodeSize;
- sal_uInt16 nLegacyCodeSize;
- sal_uInt16 nDimBase; // OPTION BASE value
+ sal_uInt32 nStringSize;
+ sal_uInt32 nCodeSize;
+ sal_uInt16 nLegacyCodeSize;
+ sal_uInt16 nDimBase; // OPTION BASE value
rtl_TextEncoding eCharSet;
// temporary management-variable:
short nStringIdx;
- sal_uInt32 nStringOff; // current Pos in the stringbuffer
+ sal_uInt32 nStringOff; // current Pos in the stringbuffer
// routines for the compiler:
void MakeStrings( short ); // establish StringPool
- void AddString( const String& );
+ void AddString( const OUString& );
void AddCode( char*, sal_uInt32 );
void AddType(SbxObject *);
void AddEnum(SbxObject *);
public:
- String aName; // macro name
- ::rtl::OUString aOUSource; // source code
- String aComment;
+ OUString aName; // macro name
+ OUString aOUSource; // source code
+ OUString aComment;
bool bInit;
bool bFirstInit;
@@ -71,21 +71,20 @@ public:
bool IsError() { return bError; }
const char* GetCode() const { return pCode; }
- sal_uInt32 GetCodeSize() const { return nCodeSize; }
- ::rtl::OUString& GetSource32() { return aOUSource; }
- sal_uInt16 GetBase() const { return nDimBase; }
- String GetString( short nId ) const;
- const SbxObject* FindType (String aTypeName) const;
+ sal_uInt32 GetCodeSize() const { return nCodeSize; }
+ OUString& GetSource32() { return aOUSource; }
+ sal_uInt16 GetBase() const { return nDimBase; }
+ OUString GetString( short nId ) const;
+ const SbxObject* FindType (OUString aTypeName) const;
SbxArrayRef GetEnums() { return rEnums; }
void SetFlag( sal_uInt16 n ) { nFlags |= n; }
- sal_uInt16 GetFlag( sal_uInt16 n ) const { return nFlags & n; }
- sal_uInt16 CalcLegacyOffset( sal_Int32 nOffset );
- sal_uInt32 CalcNewOffset( sal_Int16 nOffset );
+ sal_uInt16 GetFlag( sal_uInt16 n ) const { return nFlags & n; }
+ sal_uInt16 CalcLegacyOffset( sal_Int32 nOffset );
+ sal_uInt32 CalcNewOffset( sal_Int16 nOffset );
void ReleaseLegacyBuffer();
bool ExceedsLegacyLimits();
-
};
#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT is active
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index bfb867d3b360..5213510493fe 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -71,10 +71,10 @@ typedef ::cppu::WeakImplHelper3<
class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
{
- typedef boost::unordered_map < ::rtl::OUString, sal_Int32, ::rtl::OUStringHash > NameContainerNameMap;
+ typedef boost::unordered_map < OUString, sal_Int32, ::rtl::OUStringHash > NameContainerNameMap;
NameContainerNameMap mHashMap;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > mNames;
+ ::com::sun::star::uno::Sequence< OUString > mNames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
sal_Int32 mnElementCount;
@@ -103,29 +103,29 @@ public:
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ virtual void SAL_CALL replaceByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XNameContainer
- virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ virtual void SAL_CALL insertByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ virtual void SAL_CALL removeByName( const OUString& Name )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
@@ -216,7 +216,7 @@ class SfxLibraryContainer : public SfxLibraryContainer_BASE, public ::utl::OEven
VBAScriptListenerContainer maVBAScriptListeners;
sal_Int32 mnRunningVBAScripts;
sal_Bool mbVBACompat;
- rtl::OUString msProjectName;
+ OUString msProjectName;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > mxSFI;
@@ -231,12 +231,12 @@ protected:
bool mbOldInfoFormat;
bool mbOasis2OOoFormat;
- ::rtl::OUString maInitialDocumentURL;
- ::rtl::OUString maInfoFileName;
- ::rtl::OUString maOldInfoFileName;
- ::rtl::OUString maLibElementFileExtension;
- ::rtl::OUString maLibraryPath;
- ::rtl::OUString maLibrariesDir;
+ OUString maInitialDocumentURL;
+ OUString maInfoFileName;
+ OUString maOldInfoFileName;
+ OUString maLibElementFileExtension;
+ OUString maLibraryPath;
+ OUString maLibrariesDir;
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > mxStorage;
BasicManager* mpBasMgr;
@@ -252,14 +252,14 @@ protected:
} meInitMode;
void implStoreLibrary( SfxLibrary* pLib,
- const ::rtl::OUString& aName,
+ const OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
// New variant for library export
void implStoreLibrary( SfxLibrary* pLib,
- const ::rtl::OUString& aName,
+ const OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
@@ -269,27 +269,27 @@ protected:
// New variant for library export
void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI );
bool implLoadLibraryIndexFile( SfxLibrary* pLib,
::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aIndexFileName );
+ const OUString& aIndexFileName );
void implImportLibDescriptor( SfxLibrary* pLib, ::xmlscript::LibDescriptor& rLib );
// Methods to distinguish between deffirent library types
- virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ) = 0;
+ virtual SfxLibrary* SAL_CALL implCreateLibrary( const OUString& aName ) = 0;
virtual SfxLibrary* SAL_CALL implCreateLibraryLink
- ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
- const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) = 0;
+ ( const OUString& aName, const OUString& aLibInfoFileURL,
+ const OUString& StorageURL, sal_Bool ReadOnly ) = 0;
virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0;
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
virtual void SAL_CALL writeLibraryElement
(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
- const ::rtl::OUString& aElementName,
+ const OUString& aElementName,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
)
throw(::com::sun::star::uno::Exception) = 0;
@@ -297,22 +297,22 @@ protected:
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
- const ::rtl::OUString& aElementName,
- const ::rtl::OUString& aFile,
+ const OUString& aElementName,
+ const OUString& aFile,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0;
- virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0;
+ virtual void SAL_CALL importFromOldStorage( const OUString& aFile ) = 0;
// Password encryption
- virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
// New variant for library export
- virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
- virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
+ virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const OUString& Name,
sal_Bool bVerifyPasswordOnly=false )
throw(::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
@@ -327,9 +327,9 @@ protected:
// Interface to get the BasicManager (Hack for password implementation)
BasicManager* getBasicManager( void );
- ::rtl::OUString createAppLibraryFolder( SfxLibrary* pLib, const ::rtl::OUString& aName );
+ OUString createAppLibraryFolder( SfxLibrary* pLib, const OUString& aName );
- void init( const ::rtl::OUString& rInitialDocumentURL,
+ void init( const OUString& rInitialDocumentURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxInitialStorage );
virtual const sal_Char* SAL_CALL getInfoFileName() const = 0;
@@ -340,21 +340,21 @@ protected:
// Handle maLibInfoFileURL and maStorageURL correctly
void checkStorageURL
(
- const ::rtl::OUString& aSourceURL,
- ::rtl::OUString& aLibInfoFileURL,
- ::rtl::OUString& aStorageURL,
- ::rtl::OUString& aUnexpandedStorageURL
+ const OUString& aSourceURL,
+ OUString& aLibInfoFileURL,
+ OUString& aStorageURL,
+ OUString& aUnexpandedStorageURL
);
- ::rtl::OUString expand_url( const ::rtl::OUString& url )
+ OUString expand_url( const OUString& url )
throw(::com::sun::star::uno::RuntimeException);
- SfxLibrary* getImplLib( const String& rLibraryName );
+ SfxLibrary* getImplLib( const OUString& rLibraryName );
void storeLibraries_Impl(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
bool bComplete );
- void SAL_CALL initializeFromDocumentURL( const ::rtl::OUString& _rInitialDocumentURL );
+ void SAL_CALL initializeFromDocumentURL( const OUString& _rInitialDocumentURL );
void SAL_CALL initializeFromDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& _rxDocument );
// OEventListenerAdapter
@@ -364,7 +364,7 @@ protected:
virtual void SAL_CALL disposing();
private:
- void init_Impl( const ::rtl::OUString& rInitialDocumentURL,
+ void init_Impl( const OUString& rInitialDocumentURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxInitialStorage );
void implScanExtensions( void );
@@ -391,13 +391,13 @@ public:
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Members XStorageBasedLibraryContainer
@@ -413,53 +413,53 @@ public:
// Methods XPersistentLibraryContainer (base of XStorageBasedLibraryContainer)
virtual ::com::sun::star::uno::Any SAL_CALL getRootLocation() throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
//Methods XLibraryContainer3
- virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name )
+ virtual OUString SAL_CALL getOriginalLibraryLinkURL( const OUString& Name )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
- virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
+ virtual sal_Bool SAL_CALL isLibraryLink( const OUString& Name )
throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name )
+ virtual OUString SAL_CALL getLibraryLinkURL( const OUString& Name )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name )
+ virtual sal_Bool SAL_CALL isLibraryReadOnly( const OUString& Name )
throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly )
+ virtual void SAL_CALL setLibraryReadOnly( const OUString& Name, sal_Bool bReadOnly )
throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName )
+ virtual void SAL_CALL renameLibrary( const OUString& Name, const OUString& NewName )
throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainer (base of XLibraryContainer2)
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL
- createLibrary( const ::rtl::OUString& Name )
+ createLibrary( const OUString& Name )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL createLibraryLink
- ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly )
+ ( const OUString& Name, const OUString& StorageURL, sal_Bool ReadOnly )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name )
+ virtual void SAL_CALL removeLibrary( const OUString& Name )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name )
+ virtual sal_Bool SAL_CALL isLibraryLoaded( const OUString& Name )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name )
+ virtual void SAL_CALL loadLibrary( const OUString& Name )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
@@ -471,19 +471,19 @@ public:
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainerPassword
- virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
+ virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const OUString& Name )
throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
+ virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const OUString& Name )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
+ virtual sal_Bool SAL_CALL verifyLibraryPassword( const OUString& Name, const OUString& Password )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
- const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
+ virtual void SAL_CALL changeLibraryPassword( const OUString& Name,
+ const OUString& OldPassword, const OUString& NewPassword )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
@@ -497,24 +497,24 @@ public:
throw (::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainerExport
- virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL,
+ virtual void SAL_CALL exportLibrary( const OUString& Name, const OUString& URL,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
throw (::com::sun::star::uno::Exception,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ virtual OUString SAL_CALL getImplementationName( )
throw (::com::sun::star::uno::RuntimeException) = 0;
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException) = 0;
// Methods XVBACompatibility
virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
- virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
+ virtual void SAL_CALL setProjectName( const OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getRunningVBAScripts()
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addVBAScriptListener(
@@ -523,7 +523,7 @@ public:
virtual void SAL_CALL removeVBAScriptListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName )
+ virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const OUString& rModuleName )
throw (::com::sun::star::uno::RuntimeException);
};
@@ -571,11 +571,11 @@ class SfxLibrary
private:
- ::rtl::OUString maLibElementFileExtension;
- ::rtl::OUString maLibInfoFileURL;
- ::rtl::OUString maStorageURL;
- ::rtl::OUString maUnexpandedStorageURL;
- ::rtl::OUString maOriginalStorageURL;
+ OUString maLibElementFileExtension;
+ OUString maLibInfoFileURL;
+ OUString maStorageURL;
+ OUString maUnexpandedStorageURL;
+ OUString maOriginalStorageURL;
sal_Bool mbLink;
sal_Bool mbReadOnly;
@@ -585,7 +585,7 @@ private:
sal_Bool mbPasswordProtected;
sal_Bool mbPasswordVerified;
bool mbDoc50Password;
- ::rtl::OUString maPassword;
+ OUString maPassword;
bool mbSharedIndexFile;
bool mbExtension;
@@ -594,8 +594,8 @@ private:
// Provide modify state including resources
virtual sal_Bool isModified( void ) = 0;
virtual void storeResources( void ) = 0;
- virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName ) = 0;
- virtual void storeResourcesToURL( const ::rtl::OUString& URL,
+ virtual void storeResourcesAsURL( const OUString& URL, const OUString& NewName ) = 0;
+ virtual void storeResourcesToURL( const OUString& URL,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) = 0;
virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage >& xStorage ) = 0;
@@ -614,7 +614,7 @@ private:
void impl_checkLoaded();
private:
- void impl_removeWithoutChecks( const ::rtl::OUString& _rElementName );
+ void impl_removeWithoutChecks( const OUString& _rElementName );
public:
SfxLibrary(
@@ -628,8 +628,8 @@ public:
const ::com::sun::star::uno::Type& aType,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
- const ::rtl::OUString& aLibInfoFileURL,
- const ::rtl::OUString&
+ const OUString& aLibInfoFileURL,
+ const OUString&
aStorageURL,
sal_Bool ReadOnly
);
@@ -646,29 +646,29 @@ public:
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ virtual void SAL_CALL replaceByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XNameContainer
- virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ virtual void SAL_CALL insertByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ virtual void SAL_CALL removeByName( const OUString& Name )
throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
@@ -697,7 +697,7 @@ public:
public:
struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } };
- void removeElementWithoutChecks( const ::rtl::OUString& _rElementName, LibraryContainerAccess )
+ void removeElementWithoutChecks( const OUString& _rElementName, LibraryContainerAccess )
{
impl_removeWithoutChecks( _rElementName );
}
@@ -736,7 +736,7 @@ class ScriptExtensionIterator
{
public:
ScriptExtensionIterator( void );
- rtl::OUString nextBasicOrDialogLibrary( bool& rbPureDialogLib );
+ OUString nextBasicOrDialogLibrary( bool& rbPureDialogLib );
protected:
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 68dd9f18f39a..d6c14a6b27ee 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -26,7 +26,7 @@
#include <vector>
-typedef ::std::vector< String > StringVector;
+typedef ::std::vector< OUString > StringVector;
struct SbiParseStack;
@@ -82,7 +82,7 @@ public:
SbiExprNode* GetWithVar();
// from 31.3.1996, search symbol in the runtime-library
- SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType );
+ SbiSymDef* CheckRTLForSym( const OUString& rSym, SbxDataType eType );
void AddConstants( void );
bool HasGlobalCode();
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index e2c795718736..fd5313775ded 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -112,7 +112,7 @@ public:
sal_Int16 nDirFlags;
short nCurDirPos;
- String sFullNameToBeChecked;
+ OUString sFullNameToBeChecked;
WildCard* pWildCard;
Sequence< ::rtl::OUString > aDirSeq;
@@ -148,10 +148,10 @@ class SbiInstance
sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
SbError nErr;
- String aErrorMsg; // last error message for $ARG
- sal_uInt16 nErl; // current error line
- sal_Bool bReschedule; // Flag: sal_True = Reschedule in main loop
- sal_Bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
+ OUString aErrorMsg; // last error message for $ARG
+ sal_Int32 nErl; // current error line
+ sal_Bool bReschedule; // Flag: sal_True = Reschedule in main loop
+ sal_Bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
ComponentVector_t ComponentVector;
public:
@@ -168,17 +168,17 @@ public:
~SbiInstance();
void Error( SbError ); // trappable Error
- void Error( SbError, const String& rMsg ); // trappable Error with message
- void ErrorVB( sal_Int32 nVBNumber, const String& rMsg );
- void setErrorVB( sal_Int32 nVBNumber, const String& rMsg );
+ void Error( SbError, const OUString& rMsg ); // trappable Error with message
+ void ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg );
+ void setErrorVB( sal_Int32 nVBNumber, const OUString& rMsg );
void FatalError( SbError ); // non-trappable Error
- void FatalError( SbError, const String& ); // non-trappable Error
+ void FatalError( SbError, const OUString& ); // non-trappable Error
void Abort(); // with current error code
void Stop();
SbError GetErr() { return nErr; }
- String GetErrorMsg() { return aErrorMsg; }
- xub_StrLen GetErl() { return nErl; }
+ OUString GetErrorMsg() { return aErrorMsg; }
+ sal_Int32 GetErl() { return nErl; }
void EnableReschedule( sal_Bool bEnable ) { bReschedule = bEnable; }
sal_Bool IsReschedule( void ) { return bReschedule; }
void EnableCompatibility( sal_Bool bEnable ) { bCompatibility = bEnable; }
@@ -257,7 +257,7 @@ class SbiRuntime
const sal_uInt8* pRestart; // restart-address
const sal_uInt8* pErrCode; // restart-adresse RESUME NEXT
const sal_uInt8* pErrStmnt; // Restart-Adresse RESUMT 0
- String aLibName; // Lib-name for declare-call
+ OUString aLibName; // Lib-name for declare-call
SbxArrayRef refParams; // current procedure parameters
SbxArrayRef refLocals; // local variable
SbxArrayRef refArgv;
@@ -329,12 +329,12 @@ class SbiRuntime
void SetParameters( SbxArray* );
// HAS TO BE IMPLEMENTED SOME TIME
- void DllCall( const String&, const String&, SbxArray*, SbxDataType, bool );
+ void DllCall( const OUString&, const OUString&, SbxArray*, SbxDataType, bool );
// #56204 swap out DIM-functionality into help method (step0.cxx)
void DimImpl( SbxVariableRef refVar );
- bool implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass );
+ bool implIsClass( SbxObject* pObj, const OUString& aClass );
void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt = false );
@@ -366,7 +366,7 @@ class SbiRuntime
void StepGOSUB( sal_uInt32 ), StepRETURN( sal_uInt32 );
void StepTESTFOR( sal_uInt32 ), StepCASETO( sal_uInt32 ), StepERRHDL( sal_uInt32 );
void StepRESUME( sal_uInt32 ), StepSETCLASS( sal_uInt32 ), StepVBASETCLASS( sal_uInt32 ), StepTESTCLASS( sal_uInt32 ), StepLIB( sal_uInt32 );
- bool checkClass_Impl( const SbxVariableRef& refVal, const ::rtl::OUString& aClass, bool bRaiseErrors, bool bDefault = true );
+ bool checkClass_Impl( const SbxVariableRef& refVal, const OUString& aClass, bool bRaiseErrors, bool bDefault = true );
void StepCLOSE( sal_uInt32 ), StepPRCHAR( sal_uInt32 ), StepARGTYP( sal_uInt32 );
// all opcodes with two operands
void StepRTL( sal_uInt32, sal_uInt32 ), StepPUBLIC( sal_uInt32, sal_uInt32 ), StepPUBLIC_P( sal_uInt32, sal_uInt32 );
@@ -377,7 +377,7 @@ class SbiRuntime
void StepPARAM( sal_uInt32, sal_uInt32), StepCREATE( sal_uInt32, sal_uInt32 );
void StepCALL( sal_uInt32, sal_uInt32 ), StepCALLC( sal_uInt32, sal_uInt32 );
void StepCASEIS( sal_uInt32, sal_uInt32 ), StepSTMNT( sal_uInt32, sal_uInt32 );
- SbxVariable* StepSTATIC_Impl( String& aName, SbxDataType& t );
+ SbxVariable* StepSTATIC_Impl( OUString& aName, SbxDataType& t );
void StepOPEN( sal_uInt32, sal_uInt32 ), StepSTATIC( sal_uInt32, sal_uInt32 );
void StepTCREATE(sal_uInt32,sal_uInt32), StepDCREATE(sal_uInt32,sal_uInt32);
void StepGLOBAL_P( sal_uInt32, sal_uInt32 ),StepFIND_G( sal_uInt32, sal_uInt32 );
@@ -389,16 +389,16 @@ public:
void SetVBAEnabled( bool bEnabled );
sal_uInt16 GetImageFlag( sal_uInt16 n ) const;
sal_uInt16 GetBase();
- xub_StrLen nLine,nCol1,nCol2;
+ sal_Int32 nLine,nCol1,nCol2;
SbiRuntime* pNext; // Stack-Chain
SbiRuntime( SbModule*, SbMethod*, sal_uInt32 );
~SbiRuntime();
void Error( SbError, bool bVBATranslationAlreadyDone = false ); // set error if != 0
- void Error( SbError, const String& ); // set error if != 0
+ void Error( SbError, const OUString& ); // set error if != 0
void FatalError( SbError ); // error handling = standard, set error
- void FatalError( SbError, const String& ); // error handling = standard, set error
- static sal_Int32 translateErrorToVba( SbError nError, String& rMsg );
+ void FatalError( SbError, const OUString& ); // error handling = standard, set error
+ static sal_Int32 translateErrorToVba( SbError nError, OUString& rMsg );
void DumpPCode();
bool Step(); // single step (one opcode)
void Stop() { bRun = false; }
@@ -413,7 +413,7 @@ public:
SbiForStack* FindForStackItemForCollection( class BasicCollection* pCollection );
- SbxBase* FindElementExtern( const String& rName );
+ SbxBase* FindElementExtern( const OUString& rName );
static bool isVBAEnabled();
};
@@ -451,20 +451,20 @@ bool hasUno( void );
// Converts possibly relative paths to absolute paths
// according to the setting done by ChDir/ChDrive
// (Implemented in methods.cxx)
-String getFullPath( const String& aRelPath );
+OUString getFullPath( const OUString& aRelPath );
// Implementation of StepRENAME with UCB
// (Implemented in methods.cxx, so step0.cxx
// has not to be infected with UNO)
-void implStepRenameUCB( const String& aSource, const String& aDest );
+void implStepRenameUCB( const OUString& aSource, const OUString& aDest );
//*** OSL file access ***
// #87427 OSL need File URLs, so map to getFullPath
-inline String getFullPathUNC( const String& aRelPath )
+inline OUString getFullPathUNC( const OUString& aRelPath )
{
return getFullPath( aRelPath );
}
-void implStepRenameOSL( const String& aSource, const String& aDest );
+void implStepRenameOSL( const OUString& aSource, const OUString& aDest );
bool IsBaseIndexOne();
#endif
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index a4ff91f6d268..7dfd011f8385 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -40,10 +40,10 @@ class SbiFactory : public SbxFactory
{
public:
virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
- virtual SbxObject* CreateObject( const rtl::OUString& );
+ virtual SbxObject* CreateObject( const OUString& );
};
-typedef ::std::vector< String > StringVector;
+typedef ::std::vector< OUString > StringVector;
struct SbClassData
{
@@ -73,9 +73,9 @@ public:
void RemoveClassModule( SbModule* pClassModule );
virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
- virtual SbxObject* CreateObject( const rtl::OUString& );
+ virtual SbxObject* CreateObject( const OUString& );
- SbModule* FindClass( const String& rClassName );
+ SbModule* FindClass( const OUString& rClassName );
};
struct SbiGlobals
@@ -93,12 +93,12 @@ struct SbiGlobals
Link aErrHdl; // global error handler
Link aBreakHdl; // global break handler
SbError nCode;
- xub_StrLen nLine;
- xub_StrLen nCol1,nCol2; // from... to...
+ sal_Int32 nLine;
+ sal_Int32 nCol1,nCol2; // from... to...
bool bCompiler; // flag for compiler error
bool bGlobalInitErr;
bool bRunInit; // true, if RunInit active from the Basic
- String aErrMsg; // buffer for GetErrorText()
+ OUString aErrMsg; // buffer for GetErrorText()
::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp
bool bBlockCompilerError;
BasicManager* pAppBasMgr;
diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx
index e53473a16b7e..acfe8aa711f0 100644
--- a/basic/source/inc/sbjsmeth.hxx
+++ b/basic/source/inc/sbjsmeth.hxx
@@ -30,7 +30,7 @@
class SbJScriptMethod : public SbMethod
{
public:
- SbJScriptMethod( const String&, SbxDataType, SbModule* );
+ SbJScriptMethod( const OUString&, SbxDataType, SbModule* );
virtual ~SbJScriptMethod();
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMETH,2);
diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
index 5149df447853..02c100aa6070 100644
--- a/basic/source/inc/sbjsmod.hxx
+++ b/basic/source/inc/sbjsmod.hxx
@@ -33,7 +33,7 @@ class SbJScriptModule : public SbModule
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMOD,1);
TYPEINFO();
- SbJScriptModule( const String& ); // hand through
+ SbJScriptModule( const OUString& ); // hand through
};
#endif
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index ab0f43901099..a90197e73409 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -49,7 +49,7 @@ public:
sal_Int32 getPos() const { return mnPos; }
typelib_TypeDescription* getTD() const { return mpTD; }
- rtl::OUString getTypeName() const;
+ OUString getTypeName() const;
com::sun::star::uno::Any& getRootAnyRef() { return maAny; };
com::sun::star::uno::TypeClass getTypeClass() const;
@@ -65,29 +65,29 @@ class SbUnoStructRefObject: public SbxObject
{
struct caseLessComp
{
- bool operator() (const ::rtl::OUString& rProp, const ::rtl::OUString& rOtherProp ) const
+ bool operator() (const OUString& rProp, const OUString& rOtherProp ) const
{
return rProp.toAsciiUpperCase().compareTo( rOtherProp.toAsciiUpperCase() ) < 0;
}
};
- typedef ::std::map< rtl::OUString, StructRefInfo*, caseLessComp > StructFieldInfo;
+ typedef ::std::map< OUString, StructRefInfo*, caseLessComp > StructFieldInfo;
StructFieldInfo maFields;
StructRefInfo maMemberInfo;
bool mbMemberCacheInit;
void implCreateAll();
void implCreateDbgProperties();
void initMemberCache();
- rtl::OUString Impl_DumpProperties();
- rtl::OUString getDbgObjectName();
+ OUString Impl_DumpProperties();
+ OUString getDbgObjectName();
public:
TYPEINFO();
- StructRefInfo getStructMember( const rtl::OUString& rMember );
+ StructRefInfo getStructMember( const OUString& rMember );
StructRefInfo getStructInfo() { return maMemberInfo; }
- SbUnoStructRefObject( const ::rtl::OUString& aName_, const StructRefInfo& rMemberInfo );
+ SbUnoStructRefObject( const OUString& aName_, const StructRefInfo& rMemberInfo );
~SbUnoStructRefObject();
// Find overloaded to support e. g. NameAccess
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
// Force creation of all properties for debugging
void createAllProperties( void )
@@ -118,16 +118,16 @@ class SbUnoObject: public SbxObject
void implCreateAll( void );
public:
- static bool getDefaultPropName( SbUnoObject* pUnoObj, ::rtl::OUString& sDfltProp );
+ static bool getDefaultPropName( SbUnoObject* pUnoObj, OUString& sDfltProp );
TYPEINFO();
- SbUnoObject( const ::rtl::OUString& aName_, const ::com::sun::star::uno::Any& aUnoObj_ );
+ SbUnoObject( const OUString& aName_, const ::com::sun::star::uno::Any& aUnoObj_ );
~SbUnoObject();
// #76470 do introspection on demand
void doIntrospection( void );
// Find overloaded to support e. g. NameAccess
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
// Force creation of all properties for debugging
void createAllProperties( void )
@@ -168,7 +168,7 @@ class SbUnoMethod : public SbxMethod
public:
TYPEINFO();
- SbUnoMethod( const rtl::OUString& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
+ SbUnoMethod( const OUString& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
bool bInvocation,
bool bDirect = false );
virtual ~SbUnoMethod();
@@ -201,7 +201,7 @@ class SbUnoProperty : public SbxProperty
public:
TYPEINFO();
- SbUnoProperty( const rtl::OUString& aName_, SbxDataType eSbxType, SbxDataType eRealSbxType,
+ SbUnoProperty( const OUString& aName_, SbxDataType eSbxType, SbxDataType eRealSbxType,
const ::com::sun::star::beans::Property& aUnoProp_, sal_Int32 nId_, bool bInvocation, bool bUnoStruct );
bool isUnoStruct() { return mbUnoStruct; }
@@ -215,7 +215,7 @@ class SbUnoFactory : public SbxFactory
{
public:
virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
- virtual SbxObject* CreateObject( const rtl::OUString& );
+ virtual SbxObject* CreateObject( const OUString& );
};
// wrapper for an uno-class
@@ -225,16 +225,16 @@ class SbUnoClass : public SbxObject
public:
TYPEINFO();
- SbUnoClass( const String& aName_ )
+ SbUnoClass( const OUString& aName_ )
: SbxObject( aName_ )
{}
- SbUnoClass( const String& aName_, const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& xClass_ )
+ SbUnoClass( const OUString& aName_, const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& xClass_ )
: SbxObject( aName_ )
, m_xClass( xClass_ )
{}
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& getUnoClass( void ) { return m_xClass; }
@@ -245,31 +245,31 @@ SV_DECL_IMPL_REF(SbUnoClass);
// function to find a global identifier in
// the UnoScope and to wrap it for Sbx
-SbUnoClass* findUnoClass( const ::rtl::OUString& rName );
+SbUnoClass* findUnoClass( const OUString& rName );
// Wrapper for UNO Service
class SbUnoService : public SbxObject
{
- const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc;
- bool m_bNeedsInit;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc;
+ bool m_bNeedsInit;
public:
TYPEINFO();
- SbUnoService( const String& aName_,
+ SbUnoService( const OUString& aName_,
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 >& xServiceTypeDesc )
: SbxObject( aName_ )
, m_xServiceTypeDesc( xServiceTypeDesc )
, m_bNeedsInit( true )
{}
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
};
SV_DECL_IMPL_REF(SbUnoService);
-SbUnoService* findUnoService( const ::rtl::OUString& rName );
+SbUnoService* findUnoService( const OUString& rName );
void clearUnoServiceCtors( void );
@@ -286,7 +286,7 @@ class SbUnoServiceCtor : public SbxMethod
public:
TYPEINFO();
- SbUnoServiceCtor( const::rtl::OUString& aName_, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > xServiceCtorDesc );
+ SbUnoServiceCtor( const OUString& aName_, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > xServiceCtorDesc );
virtual ~SbUnoServiceCtor();
virtual SbxInfo* GetInfo();
@@ -302,14 +302,14 @@ class SbUnoSingleton : public SbxObject
public:
TYPEINFO();
- SbUnoSingleton( const ::rtl::OUString& aName_,
+ SbUnoSingleton( const OUString& aName_,
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XSingletonTypeDescription >& xSingletonTypeDesc );
void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
};
SV_DECL_IMPL_REF(SbUnoSingleton);
-SbUnoSingleton* findUnoSingleton( const ::rtl::OUString& rName );
+SbUnoSingleton* findUnoSingleton( const OUString& rName );
// #105565 Special Object to wrap a strongly typed Uno Any
@@ -319,7 +319,7 @@ class SbUnoAnyObject: public SbxObject
public:
SbUnoAnyObject( const ::com::sun::star::uno::Any& rVal )
- : SbxObject( String() )
+ : SbxObject( OUString() )
, mVal( rVal )
{}
@@ -335,14 +335,14 @@ public:
class AutomationNamedArgsSbxArray : public SbxArray
{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > maNameSeq;
+ ::com::sun::star::uno::Sequence< OUString > maNameSeq;
public:
TYPEINFO();
AutomationNamedArgsSbxArray( sal_Int32 nSeqSize )
: maNameSeq( nSeqSize )
{}
- ::com::sun::star::uno::Sequence< ::rtl::OUString >& getNames( void )
+ ::com::sun::star::uno::Sequence< OUString >& getNames( void )
{ return maNameSeq; }
};
@@ -379,21 +379,21 @@ class BasicCollection : public SbxObject
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
sal_Int32 implGetIndex( SbxVariable* pIndexVar );
- sal_Int32 implGetIndexForName( const String& rName );
+ sal_Int32 implGetIndexForName( const OUString& rName );
void CollAdd( SbxArray* pPar_ );
void CollItem( SbxArray* pPar_ );
void CollRemove( SbxArray* pPar_ );
public:
TYPEINFO();
- BasicCollection( const rtl::OUString& rClassname );
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ BasicCollection( const OUString& rClassname );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
virtual void Clear();
};
-typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+typedef boost::unordered_map< OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-typedef std::vector< rtl::OUString > VBAConstantsVector;
+typedef std::vector< OUString > VBAConstantsVector;
class VBAConstantHelper
{
@@ -407,8 +407,8 @@ private:
void init();
public:
static VBAConstantHelper& instance();
- SbxVariable* getVBAConstant( const ::rtl::OUString& rName );
- bool isVBAConstantType( const ::rtl::OUString& rName );
+ SbxVariable* getVBAConstant( const OUString& rName );
+ bool isVBAConstantType( const OUString& rName );
};
#endif
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 372a298dcac4..a7bdb200444e 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -81,10 +81,10 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
// OldBasicPassword interface
- virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword );
- virtual String getLibraryPassword( const String& rLibraryName );
- virtual void clearLibraryPassword( const String& rLibraryName );
- virtual sal_Bool hasLibraryPassword( const String& rLibraryName );
+ virtual void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword );
+ virtual OUString getLibraryPassword( const OUString& rLibraryName );
+ virtual void clearLibraryPassword( const OUString& rLibraryName );
+ virtual sal_Bool hasLibraryPassword( const OUString& rLibraryName );
virtual const sal_Char* SAL_CALL getInfoFileName() const;
virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx
index 324cdf242a86..12935f78d688 100644
--- a/basic/source/inc/stdobj.hxx
+++ b/basic/source/inc/stdobj.hxx
@@ -35,8 +35,8 @@ class SbiStdObject : public SbxObject
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
public:
- SbiStdObject( const String&, StarBASIC* );
- virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
+ SbiStdObject( const OUString&, StarBASIC* );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
virtual void SetModified( sal_Bool );
};
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 87d329c99809..fa7309e0467c 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -34,8 +34,8 @@ enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL };
// makes sure that they don't exist twice.
class SbiStringPool {
- const rtl::OUString aEmpty;
- std::vector<rtl::OUString> aData;
+ const OUString aEmpty;
+ std::vector<OUString> aData;
SbiParser* pParser;
public:
SbiStringPool( SbiParser* );
@@ -43,9 +43,9 @@ public:
sal_uInt32 GetSize() const { return aData.size(); }
// From 8.4.1999: default changed to true because of #64236 -
// change it back to false when the bug is cleanly removed.
- short Add( const rtl::OUString&, bool=true );
+ short Add( const OUString&, bool=true );
short Add( double, SbxDataType );
- const rtl::OUString& Find( sal_uInt32 ) const;
+ const OUString& Find( sal_uInt32 ) const;
SbiParser* GetParser() { return pParser; }
};
@@ -78,16 +78,16 @@ public:
void SetScope( SbiSymScope s ) { eScope = s; }
SbiParser* GetParser() { return pParser; }
- SbiSymDef* AddSym( const String& );
- SbiProcDef* AddProc( const String& );
+ SbiSymDef* AddSym( const OUString& );
+ SbiProcDef* AddProc( const OUString& );
void Add( SbiSymDef* );
- SbiSymDef* Find( const String& ) const; // variable name
+ SbiSymDef* Find( const OUString& ) const; // variable name
SbiSymDef* FindId( sal_uInt16 ) const;
SbiSymDef* Get( sal_uInt16 ) const; // find variable per position
SbiSymDef* First(), *Next(); // iterators
- sal_uInt32 Define( const String& );
- sal_uInt32 Reference( const String& );
+ sal_uInt32 Define( const OUString& );
+ sal_uInt32 Reference( const OUString& );
void CheckRefs();
};
@@ -95,7 +95,7 @@ public:
class SbiSymDef { // general symbol entry
friend class SbiSymPool;
protected:
- String aName;
+ OUString aName;
SbxDataType eType;
SbiSymPool* pIn; // parent pool
SbiSymPool* pPool; // pool for sub-elements
@@ -119,21 +119,21 @@ protected:
sal_uInt16 nDefaultId; // Symbol number of default value
short nFixedStringLength; // String length in: Dim foo As String*Length
public:
- SbiSymDef( const String& );
+ SbiSymDef( const OUString& );
virtual ~SbiSymDef();
virtual SbiProcDef* GetProcDef();
virtual SbiConstDef* GetConstDef();
SbxDataType GetType() const { return eType; }
virtual void SetType( SbxDataType );
- const String& GetName();
+ const OUString& GetName();
SbiSymScope GetScope() const;
- sal_uInt16 GetProcId() const{ return nProcId; }
- sal_uInt32 GetAddr() const { return nChain; }
- sal_uInt16 GetId() const { return nId; }
- sal_uInt16 GetTypeId() const{ return nTypeId; }
+ sal_uInt16 GetProcId() const{ return nProcId; }
+ sal_uInt32 GetAddr() const { return nChain; }
+ sal_uInt16 GetId() const { return nId; }
+ sal_uInt16 GetTypeId() const{ return nTypeId; }
void SetTypeId( sal_uInt16 n ) { nTypeId = n; eType = SbxOBJECT; }
- sal_uInt16 GetPos() const { return nPos; }
+ sal_uInt16 GetPos() const { return nPos; }
void SetLen( short n ){ nLen = n; }
short GetLen() const { return nLen; }
void SetDims( short n ) { nDims = n; }
@@ -143,14 +143,13 @@ public:
void SetParamArray() { bParamArray = true; }
void SetWithEvents() { bWithEvents = true; }
void SetWithBrackets(){ bWithBrackets = true; }
- void SetByVal( bool bByVal_ = true )
- { bByVal = bByVal_; }
+ void SetByVal( bool bByVal_ = true ) { bByVal = bByVal_; }
void SetStatic( bool bAsStatic = true ) { bStatic = bAsStatic; }
void SetNew() { bNew = true; }
void SetDefinedAs() { bAs = true; }
void SetGlobal(bool b){ bGlobal = b; }
void SetDefaultId( sal_uInt16 n ) { nDefaultId = n; }
- sal_uInt16 GetDefaultId( void ) { return nDefaultId; }
+ sal_uInt16 GetDefaultId( void ) { return nDefaultId; }
bool IsOptional() const{ return bOpt; }
bool IsParamArray() const{ return bParamArray; }
bool IsWithEvents() const{ return bWithEvents; }
@@ -175,36 +174,36 @@ private:
class SbiProcDef : public SbiSymDef { // procedure definition (from basic):
SbiSymPool aParams;
SbiSymPool aLabels; // local jump targets
- String aLibName;
- String aAlias;
+ OUString aLibName;
+ OUString aAlias;
sal_uInt16 nLine1, nLine2; // line area
PropertyMode mePropMode; // Marks if this is a property procedure and which
- String maPropName; // Property name if property procedure (!= proc name)
+ OUString maPropName; // Property name if property procedure (!= proc name)
bool bCdecl : 1; // true: CDECL given
bool bPublic : 1; // true: proc is PUBLIC
bool mbProcDecl : 1; // true: instanciated by SbiParser::ProcDecl
public:
- SbiProcDef( SbiParser*, const String&, bool bProcDecl=false );
+ SbiProcDef( SbiParser*, const OUString&, bool bProcDecl=false );
virtual ~SbiProcDef();
virtual SbiProcDef* GetProcDef();
virtual void SetType( SbxDataType );
SbiSymPool& GetParams() { return aParams; }
SbiSymPool& GetLabels() { return aLabels; }
SbiSymPool& GetLocals() { return GetPool();}
- String& GetLib() { return aLibName; }
- String& GetAlias() { return aAlias; }
+ OUString& GetLib() { return aLibName; }
+ OUString& GetAlias() { return aAlias; }
void SetPublic( bool b ) { bPublic = b; }
bool IsPublic() const { return bPublic; }
void SetCdecl( bool b = true) { bCdecl = b; }
bool IsCdecl() const { return bCdecl; }
bool IsUsedForProcDecl() const { return mbProcDecl; }
- void SetLine1( sal_uInt16 n ) { nLine1 = n; }
- sal_uInt16 GetLine1() const { return nLine1; }
- void SetLine2( sal_uInt16 n ) { nLine2 = n; }
- sal_uInt16 GetLine2() const { return nLine2; }
+ void SetLine1( sal_uInt16 n ) { nLine1 = n; }
+ sal_uInt16 GetLine1() const { return nLine1; }
+ void SetLine2( sal_uInt16 n ) { nLine2 = n; }
+ sal_uInt16 GetLine2() const { return nLine2; }
PropertyMode getPropertyMode() { return mePropMode; }
void setPropertyMode( PropertyMode ePropMode );
- const String& GetPropName() { return maPropName; }
+ const OUString& GetPropName() { return maPropName; }
// Match with a forward-declaration. The parameter names are
// compared and the forward declaration is replaced by this
@@ -218,15 +217,15 @@ private:
class SbiConstDef : public SbiSymDef
{
double nVal;
- String aVal;
+ OUString aVal;
public:
- SbiConstDef( const String& );
+ SbiConstDef( const OUString& );
virtual ~SbiConstDef();
virtual SbiConstDef* GetConstDef();
void Set( double, SbxDataType );
- void Set( const String& );
+ void Set( const OUString& );
double GetValue() { return nVal; }
- const String& GetString() { return aVal; }
+ const OUString& GetString() { return aVal; }
};
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index d5d00ea3bad4..882ffc0d666c 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -52,7 +52,9 @@ void BasicDLL::EnableBreak( bool bEnable )
BasicDLL* pThis = BASIC_DLL();
DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
if ( pThis )
+ {
pThis->bBreakEnabled = bEnable;
+ }
}
void BasicDLL::SetDebugMode( bool bDebugMode )
@@ -60,7 +62,9 @@ void BasicDLL::SetDebugMode( bool bDebugMode )
BasicDLL* pThis = BASIC_DLL();
DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
if ( pThis )
+ {
pThis->bDebugMode = bDebugMode;
+ }
}
diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx
index dbc2abb2bf03..a5372ffdfe1d 100644
--- a/basic/source/runtime/comenumwrapper.cxx
+++ b/basic/source/runtime/comenumwrapper.cxx
@@ -31,9 +31,7 @@ using namespace ::com::sun::star;
if ( m_xInvocation.is() )
{
sal_Int32 nLength = 0;
- bResult =
- ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength )
- && nLength > m_nCurInd );
+ bResult = ( ( m_xInvocation->getValue( OUString("length" ) ) >>= nLength ) && nLength > m_nCurInd );
}
}
catch(const uno::Exception& )
@@ -57,7 +55,7 @@ uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
aArgs[0] <<= m_nCurInd++;
- return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ),
+ return m_xInvocation->invoke( OUString("item"),
aArgs,
aNamedParamIndex,
aNamedParam );
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 1b3adcf52861..fd942b0d3815 100644
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -52,13 +52,19 @@ static const SbError nDdeErrMap[] =
SbError SbiDdeControl::GetLastErr( DdeConnection* pConv )
{
if( !pConv )
+ {
return 0;
+ }
long nErr = pConv->GetError();
if( !nErr )
+ {
return 0;
+ }
if( nErr < DDE_FIRSTERR || nErr > DDE_LASTERR )
+ {
return SbERR_DDE_ERROR;
- return nDdeErrMap[ 2*(nErr - DDE_FIRSTERR) + 1 ];
+ }
+ return nDdeErrMap[ 2 * (nErr - DDE_FIRSTERR) + 1 ];
}
IMPL_LINK_INLINE( SbiDdeControl,Data , DdeData*, pData,
@@ -77,23 +83,25 @@ SbiDdeControl::~SbiDdeControl()
TerminateAll();
}
-sal_Int16 SbiDdeControl::GetFreeChannel()
+size_t SbiDdeControl::GetFreeChannel()
{
- sal_Int16 nChannel = 0;
- sal_Int16 nListSize = static_cast<sal_Int16>(aConvList.size());
+ size_t nChannel = 0;
+ size_t nListSize = aConvList.size();
for (; nChannel < nListSize; ++nChannel)
{
if (aConvList[nChannel] == DDE_FREECHANNEL)
+ {
return nChannel+1;
+ }
}
aConvList.push_back(DDE_FREECHANNEL);
return nChannel+1;
}
-SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic,
- sal_Int16& rnHandle )
+SbError SbiDdeControl::Initiate( const OUString& rService, const OUString& rTopic,
+ size_t& rnHandle )
{
SbError nErr;
DdeConnection* pConv = new DdeConnection( rService, rTopic );
@@ -105,23 +113,25 @@ SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic,
}
else
{
- sal_Int16 nChannel = GetFreeChannel();
+ size_t nChannel = GetFreeChannel();
aConvList[nChannel-1] = pConv;
rnHandle = nChannel;
}
return 0;
}
-SbError SbiDdeControl::Terminate( sal_uInt16 nChannel )
+SbError SbiDdeControl::Terminate( size_t nChannel )
{
if (!nChannel || nChannel > aConvList.size())
+ {
return SbERR_DDE_NO_CHANNEL;
-
+ }
DdeConnection* pConv = aConvList[nChannel-1];
if( pConv == DDE_FREECHANNEL )
+ {
return SbERR_DDE_NO_CHANNEL;
-
+ }
delete pConv;
pConv = DDE_FREECHANNEL;
@@ -131,12 +141,14 @@ SbError SbiDdeControl::Terminate( sal_uInt16 nChannel )
SbError SbiDdeControl::TerminateAll()
{
DdeConnection *conv;
- for (sal_uInt16 nChannel = 0; nChannel < aConvList.size(); ++nChannel)
+ for (size_t nChannel = 0; nChannel < aConvList.size(); ++nChannel)
{
conv = aConvList[nChannel];
if (conv != DDE_FREECHANNEL)
+ {
delete conv;
+ }
}
aConvList.clear();
@@ -144,15 +156,19 @@ SbError SbiDdeControl::TerminateAll()
return 0;
}
-SbError SbiDdeControl::Request( sal_uInt16 nChannel, const String& rItem, String& rResult )
+SbError SbiDdeControl::Request( size_t nChannel, const OUString& rItem, OUString& rResult )
{
if (!nChannel || nChannel > aConvList.size())
+ {
return SbERR_DDE_NO_CHANNEL;
+ }
DdeConnection* pConv = aConvList[nChannel-1];
if( pConv == DDE_FREECHANNEL )
+ {
return SbERR_DDE_NO_CHANNEL;
+ }
DdeRequest aRequest( *pConv, rItem, 30000 );
aRequest.SetDataHdl( LINK( this, SbiDdeControl, Data ) );
@@ -161,31 +177,36 @@ SbError SbiDdeControl::Request( sal_uInt16 nChannel, const String& rItem, String
return GetLastErr( pConv );
}
-SbError SbiDdeControl::Execute( sal_uInt16 nChannel, const String& rCommand )
+SbError SbiDdeControl::Execute( size_t nChannel, const OUString& rCommand )
{
if (!nChannel || nChannel > aConvList.size())
+ {
return SbERR_DDE_NO_CHANNEL;
+ }
DdeConnection* pConv = aConvList[nChannel-1];
if( pConv == DDE_FREECHANNEL )
+ {
return SbERR_DDE_NO_CHANNEL;
-
+ }
DdeExecute aRequest( *pConv, rCommand, 30000 );
aRequest.Execute();
return GetLastErr( pConv );
}
-SbError SbiDdeControl::Poke( sal_uInt16 nChannel, const String& rItem, const String& rData )
+SbError SbiDdeControl::Poke( size_t nChannel, const OUString& rItem, const OUString& rData )
{
if (!nChannel || nChannel > aConvList.size())
+ {
return SbERR_DDE_NO_CHANNEL;
-
+ }
DdeConnection* pConv = aConvList[nChannel-1];
if( pConv == DDE_FREECHANNEL )
+ {
return SbERR_DDE_NO_CHANNEL;
-
+ }
DdePoke aRequest( *pConv, rItem, DdeData(rData), 30000 );
aRequest.Execute();
return GetLastErr( pConv );
diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx
index 14489dfe3ff2..27be76fe0c10 100644
--- a/basic/source/runtime/ddectrl.hxx
+++ b/basic/source/runtime/ddectrl.hxx
@@ -22,7 +22,6 @@
#include <tools/link.hxx>
#include <basic/sberrors.hxx>
-#include <tools/string.hxx>
class DdeConnection;
class DdeData;
@@ -32,22 +31,22 @@ class SbiDdeControl
private:
DECL_LINK( Data, DdeData* );
SbError GetLastErr( DdeConnection* );
- sal_Int16 GetFreeChannel();
+ size_t GetFreeChannel();
std::vector<DdeConnection*> aConvList;
- String aData;
+ OUString aData;
public:
SbiDdeControl();
~SbiDdeControl();
- SbError Initiate( const String& rService, const String& rTopic,
- sal_Int16& rnHandle );
- SbError Terminate( sal_uInt16 nChannel );
+ SbError Initiate( const OUString& rService, const OUString& rTopic,
+ size_t& rnHandle );
+ SbError Terminate( size_t nChannel );
SbError TerminateAll();
- SbError Request( sal_uInt16 nChannel, const String& rItem, String& rResult );
- SbError Execute( sal_uInt16 nChannel, const String& rCommand );
- SbError Poke( sal_uInt16 nChannel, const String& rItem, const String& rData );
+ SbError Request( size_t nChannel, const OUString& rItem, OUString& rResult );
+ SbError Execute( size_t nChannel, const OUString& rCommand );
+ SbError Poke( size_t nChannel, const OUString& rItem, const OUString& rData );
};
#endif
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index c7a7729fb76a..14d782ac68be 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -185,7 +185,7 @@ SbError marshalString(
{
OSL_ASSERT(variable != 0 && buffer != 0);
rtl::OString str;
- SbError e = convert(variable->GetString(), &str);
+ SbError e = convert(variable->GetOUString(), &str);
if (e != ERRCODE_NONE) {
return e;
}
@@ -448,7 +448,7 @@ SbError unmarshalString(StringData const & data, SbxVariable & result) {
return e;
}
}
- data.variable->PutString(String(str));
+ data.variable->PutString(str);
return ERRCODE_NONE;
}
@@ -575,7 +575,7 @@ SbError call(
if (e != ERRCODE_NONE) {
return e;
}
- result.PutString(String(s2));
+ result.PutString(s2);
break;
}
case SbxOBJECT:
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index db583fa90035..1e6bec350237 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -193,7 +193,7 @@ SbError marshalString(
{
OSL_ASSERT(variable != 0 && buffer != 0);
rtl::OString str;
- SbError e = convert(variable->GetString(), &str);
+ SbError e = convert(variable->GetOUString(), &str);
if (e != ERRCODE_NONE) {
return e;
}
@@ -463,7 +463,7 @@ SbError unmarshalString(StringData const & data, SbxVariable & result) {
return e;
}
}
- data.variable->PutString(String(str));
+ data.variable->PutString(str);
return ERRCODE_NONE;
}
@@ -528,7 +528,7 @@ SbError call(
if (e != ERRCODE_NONE) {
return e;
}
- result.PutString(String(s2));
+ result.PutString(s2);
break;
}
case SbxOBJECT:
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 2bfc65e79af9..8a03001ef4f6 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -156,11 +156,11 @@ RTLFUNC(InputBox)
String aTitle;
String aDefault;
sal_Int32 nX = -1, nY = -1; // center
- const String& rPrompt = rPar.Get(1)->GetString();
+ const String& rPrompt = rPar.Get(1)->GetOUString();
if ( nArgCount > 2 && !rPar.Get(2)->IsErr() )
- aTitle = rPar.Get(2)->GetString();
+ aTitle = rPar.Get(2)->GetOUString();
if ( nArgCount > 3 && !rPar.Get(3)->IsErr() )
- aDefault = rPar.Get(3)->GetString();
+ aDefault = rPar.Get(3)->GetOUString();
if ( nArgCount > 4 )
{
if ( nArgCount != 6 )
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index d03b8a67d58d..c6cf5fad1cb5 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -71,15 +71,15 @@ class SbiInputDialog : public ModalDialog {
Edit aInput;
OKButton aOk;
CancelButton aCancel;
- String aText;
+ OUString aText;
DECL_LINK( Ok, Window * );
DECL_LINK( Cancel, Window * );
public:
- SbiInputDialog( Window*, const String& );
- const String& GetInput() { return aText; }
+ SbiInputDialog( Window*, const OUString& );
+ const OUString& GetInput() { return aText; }
};
-SbiInputDialog::SbiInputDialog( Window* pParent, const String& rPrompt )
+SbiInputDialog::SbiInputDialog( Window* pParent, const OUString& rPrompt )
:ModalDialog( pParent, WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ),
aInput( this, WB_3DLOOK | WB_LEFT | WB_BORDER ),
aOk( this ), aCancel( this )
@@ -142,32 +142,42 @@ SbiStream::~SbiStream()
void SbiStream::MapError()
{
if( pStrm )
- switch( pStrm->GetError() )
- {
+ {
+ switch( pStrm->GetError() )
+ {
case SVSTREAM_OK:
- nError = 0; break;
+ nError = 0;
+ break;
case SVSTREAM_FILE_NOT_FOUND:
- nError = SbERR_FILE_NOT_FOUND; break;
+ nError = SbERR_FILE_NOT_FOUND;
+ break;
case SVSTREAM_PATH_NOT_FOUND:
- nError = SbERR_PATH_NOT_FOUND; break;
+ nError = SbERR_PATH_NOT_FOUND;
+ break;
case SVSTREAM_TOO_MANY_OPEN_FILES:
- nError = SbERR_TOO_MANY_FILES; break;
+ nError = SbERR_TOO_MANY_FILES;
+ break;
case SVSTREAM_ACCESS_DENIED:
- nError = SbERR_ACCESS_DENIED; break;
+ nError = SbERR_ACCESS_DENIED;
+ break;
case SVSTREAM_INVALID_PARAMETER:
- nError = SbERR_BAD_ARGUMENT; break;
+ nError = SbERR_BAD_ARGUMENT;
+ break;
case SVSTREAM_OUTOFMEMORY:
- nError = SbERR_NO_MEMORY; break;
+ nError = SbERR_NO_MEMORY;
+ break;
default:
- nError = SbERR_IO_ERROR; break;
+ nError = SbERR_IO_ERROR;
+ break;
+ }
}
}
// TODO: Code is copied from daemons2/source/uno/asciiEncoder.cxx
-::rtl::OUString findUserInDescription( const ::rtl::OUString& aDescription )
+OUString findUserInDescription( const ::rtl::OUString& aDescription )
{
- ::rtl::OUString user;
+ OUString user;
sal_Int32 index;
sal_Int32 lastIndex = 0;
@@ -175,13 +185,13 @@ void SbiStream::MapError()
do
{
index = aDescription.indexOf((sal_Unicode) ',', lastIndex);
- ::rtl::OUString token = (index == -1) ? aDescription.copy(lastIndex) : aDescription.copy(lastIndex, index - lastIndex);
+ OUString token = (index == -1) ? aDescription.copy(lastIndex) : aDescription.copy(lastIndex, index - lastIndex);
lastIndex = index + 1;
sal_Int32 eindex = token.indexOf((sal_Unicode)'=');
- ::rtl::OUString left = token.copy(0, eindex).toAsciiLowerCase().trim();
- ::rtl::OUString right = INetURLObject::decode( token.copy(eindex + 1).trim(), '%',
+ OUString left = token.copy(0, eindex).toAsciiLowerCase().trim();
+ OUString right = INetURLObject::decode( token.copy(eindex + 1).trim(), '%',
INetURLObject::DECODE_WITH_CHARSET );
if( left == "user" )
@@ -206,7 +216,7 @@ bool needSecurityRestrictions( void )
// Get system user to compare to portal user
oslSecurity aSecurity = osl_getCurrentSecurity();
- ::rtl::OUString aSystemUser;
+ OUString aSystemUser;
sal_Bool bRet = osl_getUserName( aSecurity, &aSystemUser.pData );
if( !bRet )
{
@@ -234,8 +244,8 @@ bool needSecurityRestrictions( void )
for( i = 0 ; i < nBridgeCount ; i++ )
{
const Reference< XBridge >& rxBridge = pBridges[ i ];
- ::rtl::OUString aDescription = rxBridge->getDescription();
- ::rtl::OUString aPortalUser = findUserInDescription( aDescription );
+ OUString aDescription = rxBridge->getDescription();
+ OUString aPortalUser = findUserInDescription( aDescription );
if( !aPortalUser.isEmpty() )
{
// User Found, compare to system user
@@ -296,16 +306,16 @@ class OslStream : public SvStream
osl::File maFile;
public:
- OslStream( const String& rName, short nStrmMode );
- ~OslStream();
+ OslStream( const OUString& rName, short nStrmMode );
+ ~OslStream();
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( sal_uIntPtr nSize );
+ virtual void FlushData();
+ virtual void SetSize( sal_uIntPtr nSize );
};
-OslStream::OslStream( const String& rName, short nStrmMode )
+OslStream::OslStream( const OUString& rName, short nStrmMode )
: maFile( rName )
{
sal_uInt32 nFlags;
@@ -360,9 +370,13 @@ sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
{
::osl::FileBase::RC rc = ::osl::FileBase::E_None;
if( nPos == STREAM_SEEK_TO_END )
+ {
rc = maFile.setPos( osl_Pos_End, 0 );
+ }
else
+ {
rc = maFile.setPos( osl_Pos_Absolut, (sal_uInt64)nPos );
+ }
OSL_VERIFY(rc == ::osl::FileBase::E_None);
sal_uInt64 nRealPos(0);
maFile.getPos( nRealPos );
@@ -385,14 +399,14 @@ class UCBStream : public SvStream
Reference< XStream > xS;
Reference< XSeekable > xSeek;
public:
- UCBStream( Reference< XInputStream > & xIS );
- UCBStream( Reference< XStream > & xS );
- ~UCBStream();
+ UCBStream( Reference< XInputStream > & xIS );
+ UCBStream( Reference< XStream > & xS );
+ ~UCBStream();
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( sal_uIntPtr nSize );
+ virtual void FlushData();
+ virtual void SetSize( sal_uIntPtr nSize );
};
UCBStream::UCBStream( Reference< XInputStream > & rStm )
@@ -413,12 +427,16 @@ UCBStream::~UCBStream()
try
{
if( xIS.is() )
+ {
xIS->closeInput();
+ }
else if( xS.is() )
{
Reference< XInputStream > xIS_ = xS->getInputStream();
if( xIS_.is() )
+ {
xIS_->closeInput();
+ }
}
}
catch(const Exception & )
@@ -447,7 +465,9 @@ sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize )
return nSize;
}
else
+ {
SetError( ERRCODE_IO_GENERAL );
+ }
}
catch(const Exception & )
{
@@ -468,7 +488,9 @@ sal_uIntPtr UCBStream::PutData( const void* pData, sal_uIntPtr nSize )
return nSize;
}
else
+ {
SetError( ERRCODE_IO_GENERAL );
+ }
}
catch(const Exception & )
{
@@ -485,12 +507,16 @@ sal_uIntPtr UCBStream::SeekPos( sal_uIntPtr nPos )
{
sal_uIntPtr nLen = sal::static_int_cast<sal_uIntPtr>( xSeek->getLength() );
if( nPos > nLen )
+ {
nPos = nLen;
+ }
xSeek->seek( nPos );
return nPos;
}
else
+ {
SetError( ERRCODE_IO_GENERAL );
+ }
}
catch(const Exception & )
{
@@ -499,15 +525,19 @@ sal_uIntPtr UCBStream::SeekPos( sal_uIntPtr nPos )
return 0;
}
-void UCBStream::FlushData()
+void UCBStream::FlushData()
{
try
{
Reference< XOutputStream > xOSFromS;
if( xS.is() && (xOSFromS = xS->getOutputStream()).is() )
+ {
xOSFromS->flush();
+ }
else
+ {
SetError( ERRCODE_IO_GENERAL );
+ }
}
catch(const Exception & )
{
@@ -533,9 +563,11 @@ SbError SbiStream::Open
nLine = 0;
nExpandOnWriteTo = 0;
if( ( nStrmMode & ( STREAM_READ|STREAM_WRITE ) ) == STREAM_READ )
+ {
nStrmMode |= STREAM_NOCREATE;
- String aStr(rtl::OStringToOUString(rName, osl_getThreadTextEncoding()));
- String aNameStr = getFullPath( aStr );
+ }
+ OUString aStr(rtl::OStringToOUString(rName, osl_getThreadTextEncoding()));
+ OUString aNameStr = getFullPath( aStr );
if( hasUno() )
{
@@ -583,10 +615,14 @@ SbError SbiStream::Open
pStrm = new OslStream( aNameStr, nStrmMode );
}
if( IsAppend() )
+ {
pStrm->Seek( STREAM_SEEK_TO_END );
+ }
MapError();
if( nError )
+ {
delete pStrm, pStrm = NULL;
+ }
return nError;
}
@@ -613,9 +649,13 @@ SbError SbiStream::Read(rtl::OString& rBuf, sal_uInt16 n, bool bForceReadingPerB
else
{
if( !n )
+ {
n = nLen;
+ }
if( !n )
+ {
return nError = SbERR_BAD_RECORD_LENGTH;
+ }
rtl::OStringBuffer aBuffer(read_uInt8s_ToOString(*pStrm, n));
//Pad it out with ' ' to the requested length on short read
sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(n);
@@ -624,7 +664,9 @@ SbError SbiStream::Read(rtl::OString& rBuf, sal_uInt16 n, bool bForceReadingPerB
}
MapError();
if( !nError && pStrm->IsEof() )
+ {
nError = SbERR_READ_PAST_EOF;
+ }
return nError;
}
@@ -651,7 +693,9 @@ void SbiStream::ExpandFile()
sal_uIntPtr nDiff = nExpandOnWriteTo - nCur;
char c = 0;
while( nDiff-- )
+ {
*pStrm << c;
+ }
}
else
{
@@ -675,8 +719,9 @@ SbError SbiStream::Write( const rtl::OString& rBuf, sal_uInt16 n )
{
ExpandFile();
if( IsAppend() )
+ {
pStrm->Seek( STREAM_SEEK_TO_END );
-
+ }
if( IsText() )
{
aLine = aLine + rBuf;
@@ -687,7 +732,9 @@ SbError SbiStream::Write( const rtl::OString& rBuf, sal_uInt16 n )
{
aLine = aLine.copy(0, nLineLen);
if (nLineLen && aLine[--nLineLen] == 0x0D)
+ {
aLine = aLine.copy(0, nLineLen);
+ }
WriteLines(*pStrm, aLine);
aLine = rtl::OString();
}
@@ -695,9 +742,13 @@ SbError SbiStream::Write( const rtl::OString& rBuf, sal_uInt16 n )
else
{
if( !n )
+ {
n = nLen;
+ }
if( !n )
+ {
return nError = SbERR_BAD_RECORD_LENGTH;
+ }
pStrm->Write(rBuf.getStr(), n);
MapError();
}
@@ -716,7 +767,9 @@ SbiIoSystem* SbGetIoSystem()
SbiIoSystem::SbiIoSystem()
{
for( short i = 0; i < CHANNELS; i++ )
+ {
pChan[ i ] = NULL;
+ }
nChan = 0;
nError = 0;
}
@@ -736,15 +789,21 @@ void SbiIoSystem::Open(short nCh, const rtl::OString& rName, short nMode, short
{
nError = 0;
if( nCh >= CHANNELS || !nCh )
+ {
nError = SbERR_BAD_CHANNEL;
+ }
else if( pChan[ nCh ] )
+ {
nError = SbERR_FILE_ALREADY_OPEN;
+ }
else
{
pChan[ nCh ] = new SbiStream;
nError = pChan[ nCh ]->Open( nCh, rName, nMode, nFlags, nLen );
- if( nError )
+ if( nError )
+ {
delete pChan[ nCh ], pChan[ nCh ] = NULL;
+ }
}
nChan = 0;
}
@@ -753,9 +812,13 @@ void SbiIoSystem::Open(short nCh, const rtl::OString& rName, short nMode, short
void SbiIoSystem::Close()
{
if( !nChan )
+ {
nError = SbERR_BAD_CHANNEL;
+ }
else if( !pChan[ nChan ] )
+ {
nError = SbERR_BAD_CHANNEL;
+ }
else
{
nError = pChan[ nChan ]->Close();
@@ -776,7 +839,9 @@ void SbiIoSystem::Shutdown()
delete pChan[ i ];
pChan[ i ] = NULL;
if( n && !nError )
+ {
nError = n;
+ }
}
}
nChan = 0;
@@ -786,9 +851,9 @@ void SbiIoSystem::Shutdown()
rtl::OUString aOutStr(rtl::OStringToOUString(aOut, osl_getThreadTextEncoding()));
#if defined GCC
Window* pParent = Application::GetDefDialogParent();
- MessBox( pParent, WinBits( WB_OK ), String(), aOutStr ).Execute();
+ MessBox( pParent, WinBits( WB_OK ), OUString(), aOutStr ).Execute();
#else
- MessBox( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), String(), aOutStr ).Execute();
+ MessBox( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOutStr ).Execute();
#endif
}
aOut = rtl::OString();
@@ -798,11 +863,17 @@ void SbiIoSystem::Shutdown()
void SbiIoSystem::Read(rtl::OString& rBuf, short n)
{
if( !nChan )
+ {
ReadCon( rBuf );
+ }
else if( !pChan[ nChan ] )
+ {
nError = SbERR_BAD_CHANNEL;
+ }
else
+ {
nError = pChan[ nChan ]->Read( rBuf, n );
+ }
}
char SbiIoSystem::Read()
@@ -819,20 +890,30 @@ char SbiIoSystem::Read()
aIn = aIn.copy(1);
}
else if( !pChan[ nChan ] )
+ {
nError = SbERR_BAD_CHANNEL;
+ }
else
+ {
nError = pChan[ nChan ]->Read( ch );
+ }
return ch;
}
void SbiIoSystem::Write(const rtl::OString& rBuf, short n)
{
if( !nChan )
+ {
WriteCon( rBuf );
+ }
else if( !pChan[ nChan ] )
+ {
nError = SbERR_BAD_CHANNEL;
+ }
else
+ {
nError = pChan[ nChan ]->Write( rBuf, n );
+ }
}
// nChannel == 0..CHANNELS-1
@@ -841,7 +922,9 @@ SbiStream* SbiIoSystem::GetStream( short nChannel ) const
{
SbiStream* pRet = 0;
if( nChannel >= 0 && nChannel < CHANNELS )
+ {
pRet = pChan[ nChannel ];
+ }
return pRet;
}
@@ -855,7 +938,9 @@ void SbiIoSystem::CloseAll(void)
delete pChan[ i ];
pChan[ i ] = NULL;
if( n && !nError )
+ {
nError = n;
+ }
}
}
}
@@ -869,12 +954,16 @@ void SbiIoSystem::CloseAll(void)
void SbiIoSystem::ReadCon(rtl::OString& rIn)
{
- rtl::OUString aPromptStr(rtl::OStringToOUString(aPrompt, osl_getThreadTextEncoding()));
+ OUString aPromptStr(rtl::OStringToOUString(aPrompt, osl_getThreadTextEncoding()));
SbiInputDialog aDlg( NULL, aPromptStr );
if( aDlg.Execute() )
+ {
rIn = rtl::OUStringToOString(aDlg.GetInput(), osl_getThreadTextEncoding());
+ }
else
+ {
nError = SbERR_USER_ABORT;
+ }
aPrompt = rtl::OString();
}
@@ -888,22 +977,32 @@ void SbiIoSystem::WriteCon(const rtl::OString& rText)
if( n1 != -1 || n2 != -1 )
{
if( n1 == -1 )
+ {
n1 = n2;
+ }
else if( n2 == -1 )
+ {
n2 = n1;
+ }
if( n1 > n2 )
+ {
n1 = n2;
- rtl::OString s(aOut.copy(0, n1));
+ }
+ OString s(aOut.copy(0, n1));
aOut = aOut.copy(n1);
while (aOut[0] == '\n' || aOut[0] == '\r')
+ {
aOut = aOut.copy(1);
- String aStr(rtl::OStringToOUString(s, osl_getThreadTextEncoding()));
+ }
+ OUString aStr(rtl::OStringToOUString(s, osl_getThreadTextEncoding()));
{
SolarMutexGuard aSolarGuard;
if( !MessBox( GetpApp()->GetDefDialogParent(),
WinBits( WB_OK_CANCEL | WB_DEF_OK ),
- String(), aStr ).Execute() )
+ OUString(), aStr ).Execute() )
+ {
nError = SbERR_USER_ABORT;
+ }
}
}
}
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 054de265eb46..881ee8678c0e 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -107,16 +107,17 @@ SbxVariable* getDefaultProp( SbxVariable* pRef );
// from source/classes/sbxmod.cxx
uno::Reference< frame::XModel > getDocumentModel( StarBASIC* );
-static void FilterWhiteSpace( String& rStr )
+static void FilterWhiteSpace( OUString& rStr )
{
- if (!rStr.Len())
+ if (rStr.isEmpty())
+ {
return;
-
+ }
rtl::OUStringBuffer aRet;
- for (xub_StrLen i = 0; i < rStr.Len(); ++i)
+ for (sal_Int32 i = 0; i < rStr.getLength(); ++i)
{
- sal_Unicode cChar = rStr.GetChar(i);
+ sal_Unicode cChar = rStr[i];
if ((cChar != ' ') && (cChar != '\t') &&
(cChar != '\n') && (cChar != '\r'))
{
@@ -152,9 +153,9 @@ static inline bool isFolder( FileStatus::Type aType )
// Converts possibly relative paths to absolute paths
// according to the setting done by ChDir/ChDrive
-String getFullPath( const String& aRelPath )
+OUString getFullPath( const OUString& aRelPath )
{
- ::rtl::OUString aFileURL;
+ OUString aFileURL;
// #80204 Try first if it already is a valid URL
INetURLObject aURLObj( aRelPath );
@@ -178,7 +179,7 @@ static uno::Reference< ucb::XSimpleFileAccess3 > getFileAccess( void )
if( xSMgr.is() )
{
xSFI = uno::Reference< ucb::XSimpleFileAccess3 >( xSMgr->createInstance
- ( ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY );
+ ( OUString("com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY );
}
}
return xSFI;
@@ -195,7 +196,7 @@ RTLFUNC(CreateObject)
{
(void)bWrite;
- String aClass( rPar.Get( 1 )->GetString() );
+ OUString aClass( rPar.Get( 1 )->GetOUString() );
SbxObjectRef p = SbxBase::CreateObject( aClass );
if( !p )
StarBASIC::Error( SbERR_CANNOT_LOAD );
@@ -217,7 +218,7 @@ RTLFUNC(Error)
StarBASIC::Error( SbERR_INTERNAL_ERROR );
else
{
- String aErrorMsg;
+ OUString aErrorMsg;
SbError nErr = 0L;
sal_Int32 nCode = 0;
if( rPar.Count() == 1 )
@@ -229,14 +230,18 @@ RTLFUNC(Error)
{
nCode = rPar.Get( 1 )->GetLong();
if( nCode > 65535L )
+ {
StarBASIC::Error( SbERR_CONVERSION );
+ }
else
+ {
nErr = StarBASIC::GetSfxFromVBError( (sal_uInt16)nCode );
+ }
}
bool bVBA = SbiRuntime::isVBAEnabled();
- String tmpErrMsg;
- if( bVBA && aErrorMsg.Len() > 0 )
+ OUString tmpErrMsg;
+ if( bVBA && !aErrorMsg.isEmpty())
{
tmpErrMsg = aErrorMsg;
}
@@ -252,7 +257,9 @@ RTLFUNC(Error)
{
uno::Reference< ooo::vba::XErrObject > xErrObj( SbxErrObject::getUnoErrObject() );
if ( xErrObj.is() && xErrObj->getNumber() == nCode && !xErrObj->getDescription().isEmpty() )
+ {
tmpErrMsg = xErrObj->getDescription();
+ }
}
rPar.Get( 0 )->PutString( tmpErrMsg );
}
@@ -312,7 +319,9 @@ RTLFUNC(Abs)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
@@ -327,19 +336,21 @@ RTLFUNC(Asc)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
- String aStr( pArg->GetString() );
- if ( aStr.Len() == 0 )
+ OUString aStr( pArg->GetOUString() );
+ if ( aStr.isEmpty())
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
rPar.Get(0)->PutEmpty();
}
else
{
- sal_Unicode aCh = aStr.GetBuffer()[0];
+ sal_Unicode aCh = aStr[0];
rPar.Get(0)->PutLong( aCh );
}
}
@@ -348,12 +359,14 @@ RTLFUNC(Asc)
void implChr( SbxArray& rPar, bool bChrW )
{
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
- rtl::OUString aStr;
+ OUString aStr;
if( !bChrW && SbiRuntime::isVBAEnabled() )
{
sal_Char c = static_cast<sal_Char>(pArg->GetByte());
@@ -362,7 +375,7 @@ void implChr( SbxArray& rPar, bool bChrW )
else
{
sal_Unicode aCh = static_cast<sal_Unicode>(pArg->GetUShort());
- aStr = rtl::OUString(aCh);
+ aStr = OUString(aCh);
}
rPar.Get(0)->PutString( aStr );
}
@@ -406,29 +419,35 @@ RTLFUNC(CurDir)
int nCurDir = 0; // Current dir // JSM
if ( rPar.Count() == 2 )
{
- String aDrive = rPar.Get(1)->GetString();
- if ( aDrive.Len() != 1 )
+ OUString aDrive = rPar.Get(1)->GetOUString();
+ if ( aDrive.getLength() != 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
else
{
- nCurDir = (int)aDrive.GetBuffer()[0];
+ nCurDir = (int)aDrive[0];
if ( !isalpha( nCurDir ) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
else
+ {
nCurDir -= ( 'A' - 1 );
+ }
}
}
char* pBuffer = new char[ _MAX_PATH ];
if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != 0 )
+ {
rPar.Get(0)->PutString( rtl::OUString::createFromAscii( pBuffer ) );
+ }
else
+ {
StarBASIC::Error( SbERR_NO_DEVICE );
+ }
delete [] pBuffer;
#elif defined( UNX )
@@ -471,10 +490,14 @@ RTLFUNC(ChDir)
{
// VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.)
if( SbiRuntime::isVBAEnabled() )
- ::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get(1)->GetString() );
+ {
+ ::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get(1)->GetOUString() );
+ }
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(ChDrive)
@@ -484,30 +507,36 @@ RTLFUNC(ChDrive)
rPar.Get(0)->PutEmpty();
if (rPar.Count() != 2)
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
// Implementation of StepRENAME with UCB
-void implStepRenameUCB( const String& aSource, const String& aDest )
+void implStepRenameUCB( const OUString& aSource, const OUString& aDest )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
if( xSFI.is() )
{
try
{
- String aSourceFullPath = getFullPath( aSource );
+ OUString aSourceFullPath = getFullPath( aSource );
if( !xSFI->exists( aSourceFullPath ) )
{
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
return;
}
- String aDestFullPath = getFullPath( aDest );
+ OUString aDestFullPath = getFullPath( aDest );
if( xSFI->exists( aDestFullPath ) )
+ {
StarBASIC::Error( SbERR_FILE_EXISTS );
+ }
else
+ {
xSFI->move( aSourceFullPath, aDestFullPath );
+ }
}
catch(const Exception & )
{
@@ -517,7 +546,7 @@ void implStepRenameUCB( const String& aSource, const String& aDest )
}
// Implementation of StepRENAME with OSL
-void implStepRenameOSL( const String& aSource, const String& aDest )
+void implStepRenameOSL( const OUString& aSource, const OUString& aDest )
{
FileBase::RC nRet = File::move( getFullPathUNC( aSource ), getFullPathUNC( aDest ) );
if( nRet != FileBase::E_None )
@@ -534,8 +563,8 @@ RTLFUNC(FileCopy)
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 3)
{
- String aSource = rPar.Get(1)->GetString();
- String aDest = rPar.Get(2)->GetString();
+ OUString aSource = rPar.Get(1)->GetOUString();
+ OUString aDest = rPar.Get(2)->GetOUString();
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -572,14 +601,14 @@ RTLFUNC(Kill)
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
- String aFileSpec = rPar.Get(1)->GetString();
+ OUString aFileSpec = rPar.Get(1)->GetOUString();
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
if( xSFI.is() )
{
- String aFullPath = getFullPath( aFileSpec );
+ OUString aFullPath = getFullPath( aFileSpec );
if( !xSFI->exists( aFullPath ) || xSFI->isFolder( aFullPath ) )
{
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
@@ -601,7 +630,9 @@ RTLFUNC(Kill)
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(MkDir)
@@ -612,7 +643,7 @@ RTLFUNC(MkDir)
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
- String aPath = rPar.Get(1)->GetString();
+ OUString aPath = rPar.Get(1)->GetOUString();
if( hasUno() )
{
@@ -635,13 +666,15 @@ RTLFUNC(MkDir)
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
// In OSL only empty directories can be deleted
// so we have to delete all files recursively
-void implRemoveDirRecursive( const String& aDirPath )
+void implRemoveDirRecursive( const OUString& aDirPath )
{
DirectoryItem aItem;
FileBase::RC nRet = DirectoryItem::get( aDirPath, aItem );
@@ -671,12 +704,13 @@ void implRemoveDirRecursive( const String& aDirPath )
DirectoryItem aItem2;
nRet = aDir.getNextItem( aItem2 );
if( nRet != FileBase::E_None )
+ {
break;
-
+ }
// Handle flags
FileStatus aFileStatus2( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL );
nRet = aItem2.getFileStatus( aFileStatus2 );
- ::rtl::OUString aPath = aFileStatus2.getFileURL();
+ OUString aPath = aFileStatus2.getFileURL();
// Directory?
FileStatus::Type aType2 = aFileStatus2.getFileType();
@@ -704,7 +738,7 @@ RTLFUNC(RmDir)
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
- String aPath = rPar.Get(1)->GetString();
+ OUString aPath = rPar.Get(1)->GetOUString();
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -721,7 +755,7 @@ RTLFUNC(RmDir)
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
- Sequence< ::rtl::OUString > aContent = xSFI->getFolderContents( aPath, true );
+ Sequence< OUString > aContent = xSFI->getFolderContents( aPath, true );
sal_Int32 nCount = aContent.getLength();
if( nCount > 0 )
{
@@ -744,7 +778,9 @@ RTLFUNC(RmDir)
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(SendKeys)
@@ -778,11 +814,13 @@ RTLFUNC(FileLen)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
- String aStr( pArg->GetString() );
+ OUString aStr( pArg->GetOUString() );
sal_Int32 nLen = 0;
if( hasUno() )
{
@@ -818,7 +856,9 @@ RTLFUNC(Hex)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
@@ -862,18 +902,17 @@ RTLFUNC(InStr)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- sal_uInt16 nStartPos = 1;
+ sal_Int32 nStartPos = 1;
+ sal_Int32 nFirstStringPos = 1;
- sal_uInt16 nFirstStringPos = 1;
if ( nArgCount >= 3 )
{
- sal_Int32 lStartPos = rPar.Get(1)->GetLong();
- if( lStartPos <= 0 || lStartPos > 0xffff )
+ nStartPos = rPar.Get(1)->GetLong();
+ if( nStartPos <= 0 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- lStartPos = 1;
+ nStartPos = 1;
}
- nStartPos = (sal_uInt16)lStartPos;
nFirstStringPos++;
}
@@ -890,13 +929,14 @@ RTLFUNC(InStr)
bTextMode = 1;;
}
if ( nArgCount == 4 )
+ {
bTextMode = rPar.Get(4)->GetInteger();
-
- sal_uInt16 nPos;
- const String& rToken = rPar.Get(nFirstStringPos+1)->GetString();
+ }
+ sal_Int32 nPos;
+ const OUString& rToken = rPar.Get(nFirstStringPos+1)->GetOUString();
// #97545 Always find empty string
- if( !rToken.Len() )
+ if( rToken.isEmpty() )
{
nPos = nStartPos;
}
@@ -904,27 +944,18 @@ RTLFUNC(InStr)
{
if( !bTextMode )
{
- const String& rStr1 = rPar.Get(nFirstStringPos)->GetString();
-
- nPos = rStr1.Search( rToken, nStartPos-1 );
- if ( nPos == STRING_NOTFOUND )
- nPos = 0;
- else
- nPos++;
+ const OUString& rStr1 = rPar.Get(nFirstStringPos)->GetOUString();
+ nPos = rStr1.indexOf( rToken, nStartPos - 1 ) + 1;
}
else
{
- String aStr1 = rPar.Get(nFirstStringPos)->GetString();
- String aToken = rToken;
+ OUString aStr1 = rPar.Get(nFirstStringPos)->GetOUString();
+ OUString aToken = rToken;
- aStr1.ToUpperAscii();
- aToken.ToUpperAscii();
+ aStr1 = aStr1.toAsciiUpperCase();
+ aToken = aToken.toAsciiUpperCase();
- nPos = aStr1.Search( aToken, nStartPos-1 );
- if ( nPos == STRING_NOTFOUND )
- nPos = 0;
- else
- nPos++;
+ nPos = aStr1.indexOf( aToken, nStartPos-1 ) + 1;
}
}
rPar.Get(0)->PutLong( nPos );
@@ -941,20 +972,22 @@ RTLFUNC(InStrRev)
sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aStr1 = rPar.Get(1)->GetString();
- String aToken = rPar.Get(2)->GetString();
+ OUString aStr1 = rPar.Get(1)->GetOUString();
+ OUString aToken = rPar.Get(2)->GetOUString();
- sal_Int32 lStartPos = -1;
+ sal_Int32 nStartPos = -1;
if ( nArgCount >= 3 )
{
- lStartPos = rPar.Get(3)->GetLong();
- if( (lStartPos <= 0 && lStartPos != -1) || lStartPos > 0xffff )
+ nStartPos = rPar.Get(3)->GetLong();
+ if( (nStartPos <= 0 && nStartPos != -1))
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- lStartPos = -1;
+ nStartPos = -1;
}
}
@@ -971,15 +1004,19 @@ RTLFUNC(InStrRev)
bTextMode = 1;;
}
if ( nArgCount == 4 )
+ {
bTextMode = rPar.Get(4)->GetInteger();
+ }
+ sal_Int32 nStrLen = aStr1.getLength();
+ if( nStartPos == -1 )
+ {
+ nStartPos = nStrLen;
+ }
- sal_uInt16 nStrLen = aStr1.Len();
- sal_uInt16 nStartPos = lStartPos == -1 ? nStrLen : (sal_uInt16)lStartPos;
-
- sal_uInt16 nPos = 0;
+ sal_Int32 nPos = 0;
if( nStartPos <= nStrLen )
{
- sal_uInt16 nTokenLen = aToken.Len();
+ sal_Int32 nTokenLen = aToken.getLength();
if( !nTokenLen )
{
// Always find empty string
@@ -989,27 +1026,14 @@ RTLFUNC(InStrRev)
{
if( !bTextMode )
{
- ::rtl::OUString aOUStr1 ( aStr1 );
- ::rtl::OUString aOUToken( aToken );
- sal_Int32 nRet = aOUStr1.lastIndexOf( aOUToken, nStartPos );
- if( nRet == -1 )
- nPos = 0;
- else
- nPos = (sal_uInt16)nRet + 1;
+ nPos = aStr1.lastIndexOf( aToken, nStartPos ) + 1;
}
else
{
- aStr1.ToUpperAscii();
- aToken.ToUpperAscii();
-
- ::rtl::OUString aOUStr1 ( aStr1 );
- ::rtl::OUString aOUToken( aToken );
- sal_Int32 nRet = aOUStr1.lastIndexOf( aOUToken, nStartPos );
+ aStr1 = aStr1.toAsciiUpperCase();
+ aToken = aToken.toAsciiUpperCase();
- if( nRet == -1 )
- nPos = 0;
- else
- nPos = (sal_uInt16)nRet + 1;
+ nPos = aStr1.lastIndexOf( aToken, nStartPos ) + 1;
}
}
}
@@ -1073,11 +1097,13 @@ RTLFUNC(LCase)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
const CharClass& rCharClass = GetCharClass();
- String aStr( rPar.Get(1)->GetString() );
+ OUString aStr( rPar.Get(1)->GetOUString() );
aStr = rCharClass.lowercase(aStr);
rPar.Get(0)->PutString( aStr );
}
@@ -1089,21 +1115,23 @@ RTLFUNC(Left)
(void)bWrite;
if ( rPar.Count() < 3 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aStr( rPar.Get(1)->GetString() );
- sal_Int32 lResultLen = rPar.Get(2)->GetLong();
- if( lResultLen > 0xffff )
+ OUString aStr( rPar.Get(1)->GetOUString() );
+ sal_Int32 nResultLen = rPar.Get(2)->GetLong();
+ if( nResultLen < 0 )
{
- lResultLen = 0xffff;
+ nResultLen = 0;
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
- else if( lResultLen < 0 )
+ else if(nResultLen > aStr.getLength())
{
- lResultLen = 0;
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ nResultLen = aStr.getLength();
}
- aStr.Erase( (sal_uInt16)lResultLen );
+ aStr = aStr.copy(0, nResultLen );
rPar.Get(0)->PutString( aStr );
}
}
@@ -1114,7 +1142,9 @@ RTLFUNC(Log)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double aArg = rPar.Get(1)->GetDouble();
@@ -1125,7 +1155,9 @@ RTLFUNC(Log)
rPar.Get( 0 )->PutDouble( d );
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
}
@@ -1135,10 +1167,12 @@ RTLFUNC(LTrim)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- rtl::OUString aStr(comphelper::string::stripStart(rPar.Get(1)->GetString(), ' '));
+ OUString aStr(comphelper::string::stripStart(rPar.Get(1)->GetOUString(), ' '));
rPar.Get(0)->PutString(aStr);
}
}
@@ -1151,9 +1185,11 @@ RTLFUNC(Mid)
(void)pBasic;
(void)bWrite;
- sal_uIntPtr nArgCount = rPar.Count()-1;
+ int nArgCount = rPar.Count()-1;
if ( nArgCount < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
// #23178: replicate the functionality of Mid$ as a command
@@ -1161,41 +1197,46 @@ RTLFUNC(Mid)
// In contrast to the original the third parameter (nLength)
// can't be left out here. That's considered in bWrite already.
if( nArgCount == 4 )
+ {
bWrite = sal_True;
-
- String aArgStr = rPar.Get(1)->GetString();
- sal_uInt16 nStartPos = (sal_uInt16)(rPar.Get(2)->GetLong() );
+ }
+ OUString aArgStr = rPar.Get(1)->GetOUString();
+ sal_Int32 nStartPos = rPar.Get(2)->GetLong();
if ( nStartPos == 0 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
nStartPos--;
- sal_uInt16 nLen = 0xffff;
+ sal_Int32 nLen = -1;
bool bWriteNoLenParam = false;
if ( nArgCount == 3 || bWrite )
{
sal_Int32 n = rPar.Get(3)->GetLong();
if( bWrite && n == -1 )
+ {
bWriteNoLenParam = true;
- nLen = (sal_uInt16)n;
+ }
+ nLen = n;
}
- String aResultStr;
if ( bWrite )
{
+ OUStringBuffer aResultStr;
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
- sal_uInt16 nArgLen = aArgStr.Len();
+ sal_Int32 nArgLen = aArgStr.getLength();
if( nStartPos + 1 > nArgLen )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- String aReplaceStr = rPar.Get(4)->GetString();
- sal_uInt16 nReplaceStrLen = aReplaceStr.Len();
- sal_uInt16 nReplaceLen;
+ OUString aReplaceStr = rPar.Get(4)->GetOUString();
+ sal_Int32 nReplaceStrLen = aReplaceStr.getLength();
+ sal_Int32 nReplaceLen;
if( bWriteNoLenParam )
{
nReplaceLen = nReplaceStrLen;
@@ -1203,31 +1244,35 @@ RTLFUNC(Mid)
else
{
nReplaceLen = nLen;
- if( nReplaceLen > nReplaceStrLen )
+ if( nReplaceLen < 0 || nReplaceLen > nReplaceStrLen )
+ {
nReplaceLen = nReplaceStrLen;
+ }
}
- sal_uInt16 nReplaceEndPos = nStartPos + nReplaceLen;
+ sal_Int32 nReplaceEndPos = nStartPos + nReplaceLen;
if( nReplaceEndPos > nArgLen )
+ {
nReplaceLen -= (nReplaceEndPos - nArgLen);
-
+ }
aResultStr = aArgStr;
- sal_uInt16 nErase = nReplaceLen;
- aResultStr.Erase( nStartPos, nErase );
- aResultStr.Insert( aReplaceStr, 0, nReplaceLen, nStartPos );
+ sal_Int32 nErase = nReplaceLen;
+ aResultStr.remove( nStartPos, nErase );
+ aResultStr.insert( nStartPos, aReplaceStr.getStr(), nReplaceLen);
}
else
{
aResultStr = aArgStr;
- aResultStr.Erase( nStartPos, nLen );
- aResultStr.Insert(rPar.Get(4)->GetString(),0,nLen,nStartPos);
+ aResultStr.remove( nStartPos, nLen );
+ aResultStr.insert( nStartPos, rPar.Get(4)->GetOUString().getStr(), nLen);
}
- rPar.Get(1)->PutString( aResultStr );
+ rPar.Get(1)->PutString( aResultStr.makeStringAndClear() );
}
else
{
- aResultStr = aArgStr.Copy( nStartPos, nLen );
+ OUString aResultStr;
+ aResultStr = aArgStr.copy( nStartPos, nLen );
rPar.Get(0)->PutString( aResultStr );
}
}
@@ -1240,15 +1285,21 @@ RTLFUNC(Oct)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
char aBuffer[16];
SbxVariableRef pArg = rPar.Get( 1 );
if ( pArg->IsInteger() )
+ {
snprintf( aBuffer, sizeof(aBuffer), "%o", pArg->GetInteger() );
+ }
else
+ {
snprintf( aBuffer, sizeof(aBuffer), "%lo", static_cast<long unsigned int>(pArg->GetLong()) );
+ }
rPar.Get(0)->PutString( rtl::OUString::createFromAscii( aBuffer ) );
}
}
@@ -1262,19 +1313,23 @@ RTLFUNC(Replace)
sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 6 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aExpStr = rPar.Get(1)->GetString();
- String aFindStr = rPar.Get(2)->GetString();
- String aReplaceStr = rPar.Get(3)->GetString();
+ OUString aExpStr = rPar.Get(1)->GetOUString();
+ OUString aFindStr = rPar.Get(2)->GetOUString();
+ OUString aReplaceStr = rPar.Get(3)->GetOUString();
sal_Int32 lStartPos = 1;
if ( nArgCount >= 4 )
{
if( rPar.Get(4)->GetType() != SbxEMPTY )
+ {
lStartPos = rPar.Get(4)->GetLong();
- if( lStartPos < 1 || lStartPos > 0xffff )
+ }
+ if( lStartPos < 1)
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
lStartPos = 1;
@@ -1285,8 +1340,10 @@ RTLFUNC(Replace)
if( nArgCount >=5 )
{
if( rPar.Get(5)->GetType() != SbxEMPTY )
+ {
lCount = rPar.Get(5)->GetLong();
- if( lCount < -1 || lCount > 0xffff )
+ }
+ if( lCount < -1)
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
lCount = -1;
@@ -1306,28 +1363,29 @@ RTLFUNC(Replace)
bTextMode = 1;
}
if ( nArgCount == 6 )
+ {
bTextMode = rPar.Get(6)->GetInteger();
-
- sal_uInt16 nExpStrLen = aExpStr.Len();
- sal_uInt16 nFindStrLen = aFindStr.Len();
- sal_uInt16 nReplaceStrLen = aReplaceStr.Len();
+ }
+ sal_Int32 nExpStrLen = aExpStr.getLength();
+ sal_Int32 nFindStrLen = aFindStr.getLength();
+ sal_Int32 nReplaceStrLen = aReplaceStr.getLength();
if( lStartPos <= nExpStrLen )
{
- sal_uInt16 nPos = static_cast<sal_uInt16>( lStartPos - 1 );
- sal_uInt16 nCounts = 0;
+ sal_Int32 nPos = lStartPos - 1;
+ sal_Int32 nCounts = 0;
while( lCount == -1 || lCount > nCounts )
{
- String aSrcStr( aExpStr );
+ OUString aSrcStr( aExpStr );
if( bTextMode )
{
- aSrcStr.ToUpperAscii();
- aFindStr.ToUpperAscii();
+ aSrcStr = aSrcStr.toAsciiUpperCase();
+ aFindStr = aFindStr.toAsciiUpperCase();
}
- nPos = aSrcStr.Search( aFindStr, nPos );
- if( nPos != STRING_NOTFOUND )
+ nPos = aSrcStr.indexOf( aFindStr, nPos );
+ if( nPos >= 0 )
{
- aExpStr.Replace( nPos, nFindStrLen, aReplaceStr );
+ aExpStr = aExpStr.replaceAt( nPos, nFindStrLen, aReplaceStr );
nPos = nPos - nFindStrLen + nReplaceStrLen + 1;
nCounts++;
}
@@ -1337,7 +1395,7 @@ RTLFUNC(Replace)
}
}
}
- rPar.Get(0)->PutString( aExpStr.Copy( static_cast<sal_uInt16>(lStartPos - 1) ) );
+ rPar.Get(0)->PutString( aExpStr.copy( lStartPos - 1 ) );
}
}
@@ -1347,25 +1405,24 @@ RTLFUNC(Right)
(void)bWrite;
if ( rPar.Count() < 3 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- const String& rStr = rPar.Get(1)->GetString();
- sal_Int32 lResultLen = rPar.Get(2)->GetLong();
- if( lResultLen > 0xffff )
- {
- lResultLen = 0xffff;
- }
- else if( lResultLen < 0 )
+ const OUString& rStr = rPar.Get(1)->GetOUString();
+ int nResultLen = rPar.Get(2)->GetLong();
+ if( nResultLen < 0 )
{
- lResultLen = 0;
+ nResultLen = 0;
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
- sal_uInt16 nResultLen = (sal_uInt16)lResultLen;
- sal_uInt16 nStrLen = rStr.Len();
+ int nStrLen = rStr.getLength();
if ( nResultLen > nStrLen )
+ {
nResultLen = nStrLen;
- String aResultStr = rStr.Copy( nStrLen-nResultLen );
+ }
+ OUString aResultStr = rStr.copy( nStrLen - nResultLen );
rPar.Get(0)->PutString( aResultStr );
}
}
@@ -1384,10 +1441,12 @@ RTLFUNC(RTrim)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- rtl::OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetString(), ' '));
+ OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetOUString(), ' '));
rPar.Get(0)->PutString(aStr);
}
}
@@ -1398,15 +1457,21 @@ RTLFUNC(Sgn)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double aDouble = rPar.Get(1)->GetDouble();
sal_Int16 nResult = 0;
if ( aDouble > 0 )
+ {
nResult = 1;
+ }
else if ( aDouble < 0 )
+ {
nResult = -1;
+ }
rPar.Get(0)->PutInteger( nResult );
}
}
@@ -1417,12 +1482,14 @@ RTLFUNC(Space)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aStr;
- aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() ));
- rPar.Get(0)->PutString( aStr );
+ OUStringBuffer aBuf;
+ string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' ');
+ rPar.Get(0)->PutString(aBuf.makeStringAndClear());
}
}
@@ -1432,12 +1499,14 @@ RTLFUNC(Spc)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aStr;
- aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() ));
- rPar.Get(0)->PutString( aStr );
+ OUStringBuffer aBuf;
+ string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' ');
+ rPar.Get(0)->PutString(aBuf.makeStringAndClear());
}
}
@@ -1447,14 +1516,20 @@ RTLFUNC(Sqr)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double aDouble = rPar.Get(1)->GetDouble();
if ( aDouble >= 0 )
+ {
rPar.Get(0)->PutDouble( sqrt( aDouble ));
+ }
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
}
@@ -1464,10 +1539,13 @@ RTLFUNC(Str)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aStr;
+ OUString aStr;
+ OUString aStrNew("");
SbxVariableRef pArg = rPar.Get( 1 );
pArg->Format( aStr );
@@ -1475,34 +1553,47 @@ RTLFUNC(Str)
if( pArg->IsNumericRTL() )
{
// replace commas by points so that it's symmetric to Val!
- aStr.SearchAndReplace( ',', '.' );
+ aStr = aStr.replaceFirst( ",", "." );
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
- xub_StrLen nLen = aStr.Len();
+ sal_Int32 nLen = aStr.getLength();
- const sal_Unicode* pBuf = aStr.GetBuffer();
+ const sal_Unicode* pBuf = aStr.getStr();
bool bNeg = ( pBuf[0] == '-' );
- sal_uInt16 iZeroSearch = 0;
+ sal_Int32 iZeroSearch = 0;
if( bNeg )
+ {
+ aStrNew += "-";
iZeroSearch++;
-
- sal_uInt16 iNext = iZeroSearch + 1;
+ }
+ else
+ {
+ if( pBuf[0] != ' ' )
+ {
+ aStrNew += " ";
+ }
+ }
+ sal_Int32 iNext = iZeroSearch + 1;
if( pBuf[iZeroSearch] == '0' && nLen > iNext && pBuf[iNext] == '.' )
{
- aStr.Erase( iZeroSearch, 1 );
- pBuf = aStr.GetBuffer();
+ iZeroSearch += 1;
}
- if( !bNeg )
- aStr.Insert( ' ', 0 );
+ aStrNew += aStr.copy(iZeroSearch);
}
else
- aStr.Insert( ' ', 0 );
+ {
+ aStrNew = " " + aStr;
+ }
}
- rPar.Get(0)->PutString( aStr );
+ else
+ {
+ aStrNew = aStr;
+ }
+ rPar.Get(0)->PutString( aStrNew );
}
}
@@ -1517,8 +1608,8 @@ RTLFUNC(StrComp)
rPar.Get(0)->PutEmpty();
return;
}
- const String& rStr1 = rPar.Get(1)->GetString();
- const String& rStr2 = rPar.Get(2)->GetString();
+ const OUString& rStr1 = rPar.Get(1)->GetOUString();
+ const OUString& rStr2 = rPar.Get(2)->GetOUString();
SbiInstance* pInst = GetSbData()->pInst;
sal_Int16 nTextCompare;
@@ -1536,18 +1627,18 @@ RTLFUNC(StrComp)
nTextCompare = rPar.Get(3)->GetInteger();
if( !bCompatibility )
+ {
nTextCompare = !nTextCompare;
-
- StringCompare aResult;
+ }
sal_Int32 nRetValue = 0;
if( nTextCompare )
{
::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper;
if( !pTransliterationWrapper )
{
- uno::Reference< lang::XMultiServiceFactory > xSMgr = getProcessServiceFactory();
+ uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
pTransliterationWrapper = GetSbData()->pTransliterationWrapper =
- new ::utl::TransliterationWrapper( xSMgr,
+ new ::utl::TransliterationWrapper( xContext,
i18n::TransliterationModules_IGNORE_CASE |
i18n::TransliterationModules_IGNORE_KANA |
i18n::TransliterationModules_IGNORE_WIDTH );
@@ -1559,13 +1650,17 @@ RTLFUNC(StrComp)
}
else
{
- aResult = rStr1.CompareTo( rStr2 );
- if ( aResult == COMPARE_LESS )
+ sal_Int32 aResult;
+ aResult = rStr1.compareTo( rStr2 );
+ if ( aResult < 0 )
+ {
nRetValue = -1;
- else if ( aResult == COMPARE_GREATER )
+ }
+ else if ( aResult > 0)
+ {
nRetValue = 1;
+ }
}
-
rPar.Get(0)->PutInteger( sal::static_int_cast< sal_Int16 >( nRetValue ) );
}
@@ -1575,24 +1670,29 @@ RTLFUNC(String)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aStr;
sal_Unicode aFiller;
sal_Int32 lCount = rPar.Get(1)->GetLong();
if( lCount < 0 || lCount > 0xffff )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- sal_uInt16 nCount = (sal_uInt16)lCount;
+ }
if( rPar.Get(2)->GetType() == SbxINTEGER )
+ {
aFiller = (sal_Unicode)rPar.Get(2)->GetInteger();
+ }
else
{
- const String& rStr = rPar.Get(2)->GetString();
- aFiller = rStr.GetBuffer()[0];
+ const OUString& rStr = rPar.Get(2)->GetOUString();
+ aFiller = rStr[0];
}
- aStr.Fill( nCount, aFiller );
- rPar.Get(0)->PutString( aStr );
+ OUStringBuffer aBuf(lCount);
+ string::padToLength(aBuf, lCount, aFiller);
+ rPar.Get(0)->PutString(aBuf.makeStringAndClear());
}
}
@@ -1602,7 +1702,9 @@ RTLFUNC(Tan)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
@@ -1616,11 +1718,13 @@ RTLFUNC(UCase)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
const CharClass& rCharClass = GetCharClass();
- String aStr( rPar.Get(1)->GetString() );
+ OUString aStr( rPar.Get(1)->GetOUString() );
aStr = rCharClass.uppercase( aStr );
rPar.Get(0)->PutString( aStr );
}
@@ -1633,26 +1737,32 @@ RTLFUNC(Val)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double nResult = 0.0;
char* pEndPtr;
- String aStr( rPar.Get(1)->GetString() );
+ OUString aStr( rPar.Get(1)->GetOUString() );
FilterWhiteSpace( aStr );
- if ( aStr.GetBuffer()[0] == '&' && aStr.Len() > 1 )
+ if ( aStr[0] == '&' && aStr.getLength() > 1 )
{
int nRadix = 10;
- char aChar = (char)aStr.GetBuffer()[1];
+ char aChar = (char)aStr[1];
if ( aChar == 'h' || aChar == 'H' )
+ {
nRadix = 16;
+ }
else if ( aChar == 'o' || aChar == 'O' )
+ {
nRadix = 8;
+ }
if ( nRadix != 10 )
{
- rtl::OString aByteStr(rtl::OUStringToOString(aStr, osl_getThreadTextEncoding()));
+ OString aByteStr(rtl::OUStringToOString(aStr, osl_getThreadTextEncoding()));
sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.getStr()+2, &pEndPtr, nRadix);
nResult = (double)nlResult;
}
@@ -1714,11 +1824,13 @@ RTLFUNC(CDateToIso)
implGetDateYear( aDate ),
implGetDateMonth( aDate ),
implGetDateDay( aDate ) );
- String aRetStr = rtl::OUString::createFromAscii( Buffer );
+ OUString aRetStr = rtl::OUString::createFromAscii( Buffer );
rPar.Get(0)->PutString( aRetStr );
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
// Function to convert date from ISO 8601 date format
@@ -1729,21 +1841,23 @@ RTLFUNC(CDateFromIso)
if ( rPar.Count() == 2 )
{
- String aStr = rPar.Get(1)->GetString();
- 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 );
+ OUString aStr = rPar.Get(1)->GetOUString();
+ sal_Int16 iMonthStart = aStr.getLength() - 4;
+ OUString aYearStr = aStr.copy( 0, iMonthStart );
+ OUString aMonthStr = aStr.copy( iMonthStart, 2 );
+ OUString aDayStr = aStr.copy( iMonthStart+2, 2 );
double dDate;
- if( implDateSerial( (sal_Int16)aYearStr.ToInt32(),
- (sal_Int16)aMonthStr.ToInt32(), (sal_Int16)aDayStr.ToInt32(), dDate ) )
+ if( implDateSerial( (sal_Int16)aYearStr.toInt32(),
+ (sal_Int16)aMonthStr.toInt32(), (sal_Int16)aDayStr.toInt32(), dDate ) )
{
rPar.Get(0)->PutDate( dDate );
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(DateSerial)
@@ -1762,7 +1876,9 @@ RTLFUNC(DateSerial)
double dDate;
if( implDateSerial( nYear, nMonth, nDay, dDate ) )
+ {
rPar.Get(0)->PutDate( dDate );
+ }
}
RTLFUNC(TimeSerial)
@@ -1777,7 +1893,9 @@ RTLFUNC(TimeSerial)
}
sal_Int16 nHour = rPar.Get(1)->GetInteger();
if ( nHour == 24 )
+ {
nHour = 0; // because of UNO DateTimes, which go till 24 o'clock
+ }
sal_Int16 nMinute = rPar.Get(2)->GetInteger();
sal_Int16 nSecond = rPar.Get(3)->GetInteger();
if ((nHour < 0 || nHour > 23) ||
@@ -1802,13 +1920,17 @@ RTLFUNC(DateValue)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
// #39629 check GetSbData()->pInst, can be called from the URL line
SvNumberFormatter* pFormatter = NULL;
if( GetSbData()->pInst )
+ {
pFormatter = GetSbData()->pInst->GetNumberFormatter();
+ }
else
{
sal_uInt32 n; // Dummy
@@ -1817,7 +1939,7 @@ RTLFUNC(DateValue)
sal_uInt32 nIndex;
double fResult;
- String aStr( rPar.Get(1)->GetString() );
+ OUString aStr( rPar.Get(1)->GetOUString() );
sal_Bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
short nType = pFormatter->GetType( nIndex );
@@ -1842,18 +1964,25 @@ RTLFUNC(DateValue)
{
// cut time
if ( fResult > 0.0 )
+ {
fResult = floor( fResult );
+ }
else
+ {
fResult = ceil( fResult );
+ }
}
rPar.Get(0)->PutDate( fResult );
}
else
+ {
StarBASIC::Error( SbERR_CONVERSION );
-
+ }
// #39629 pFormatter can be requested itself
if( !GetSbData()->pInst )
+ {
delete pFormatter;
+ }
}
}
@@ -1863,7 +1992,9 @@ RTLFUNC(TimeValue)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SvNumberFormatter* pFormatter = NULL;
@@ -1877,21 +2008,26 @@ RTLFUNC(TimeValue)
sal_uInt32 nIndex;
double fResult;
- sal_Bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(),
+ sal_Bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetOUString(),
nIndex, fResult );
short nType = pFormatter->GetType(nIndex);
if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME))
{
if ( nType == NUMBERFORMAT_DATETIME )
+ {
// cut days
fResult = fmod( fResult, 1 );
+ }
rPar.Get(0)->PutDate( fResult );
}
else
+ {
StarBASIC::Error( SbERR_CONVERSION );
-
+ }
if( !GetSbData()->pInst )
+ {
delete pFormatter;
+ }
}
}
@@ -1901,7 +2037,9 @@ RTLFUNC(Day)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariableRef pArg = rPar.Get( 1 );
@@ -1918,7 +2056,9 @@ RTLFUNC(Year)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_Int16 nYear = implGetDateYear( rPar.Get(1)->GetDate() );
@@ -1929,7 +2069,9 @@ RTLFUNC(Year)
sal_Int16 implGetHour( double dDate )
{
if( dDate < 0.0 )
+ {
dDate *= -1.0;
+ }
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
@@ -1943,7 +2085,9 @@ RTLFUNC(Hour)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double nArg = rPar.Get(1)->GetDate();
@@ -1958,7 +2102,9 @@ RTLFUNC(Minute)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double nArg = rPar.Get(1)->GetDate();
@@ -1973,7 +2119,9 @@ RTLFUNC(Month)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_Int16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() );
@@ -1984,7 +2132,9 @@ RTLFUNC(Month)
sal_Int16 implGetSecond( double dDate )
{
if( dDate < 0.0 )
+ {
dDate *= -1.0;
+ }
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
@@ -2003,7 +2153,9 @@ RTLFUNC(Second)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double nArg = rPar.Get(1)->GetDate();
@@ -2030,8 +2182,8 @@ double Now_Impl()
RTLFUNC(Now)
{
- (void)pBasic;
- (void)bWrite;
+ (void)pBasic;
+ (void)bWrite;
rPar.Get(0)->PutDate( Now_Impl() );
}
@@ -2045,13 +2197,13 @@ RTLFUNC(Time)
{
Time aTime( Time::SYSTEM );
SbxVariable* pMeth = rPar.Get( 0 );
- String aRes;
+ OUString aRes;
if( pMeth->IsFixed() )
{
// Time$: hh:mm:ss
char buf[ 20 ];
snprintf( buf, sizeof(buf), "%02d:%02d:%02d",
- aTime.GetHour(), aTime.GetMin(), aTime.GetSec() );
+ aTime.GetHour(), aTime.GetMin(), aTime.GetSec() );
aRes = rtl::OUString::createFromAscii( buf );
}
else
@@ -2080,7 +2232,9 @@ RTLFUNC(Time)
pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol );
if( !GetSbData()->pInst )
+ {
delete pFormatter;
+ }
}
pMeth->PutString( aRes );
}
@@ -2116,7 +2270,7 @@ RTLFUNC(Date)
SbxVariable* pMeth = rPar.Get( 0 );
if( pMeth->IsString() )
{
- String aRes;
+ OUString aRes;
Color* pCol;
SvNumberFormatter* pFormatter = NULL;
@@ -2136,10 +2290,14 @@ RTLFUNC(Date)
pMeth->PutString( aRes );
if( !GetSbData()->pInst )
+ {
delete pFormatter;
+ }
}
else
+ {
pMeth->PutDate( nDays );
+ }
}
else
{
@@ -2153,9 +2311,13 @@ RTLFUNC(IsArray)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
+ {
rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? sal_True : sal_False );
+ }
}
RTLFUNC(IsObject)
@@ -2164,7 +2326,9 @@ RTLFUNC(IsObject)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariable* pVar = rPar.Get(1);
@@ -2193,7 +2357,9 @@ RTLFUNC(IsDate)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
// #46134 only string is converted, all other types result in sal_False
@@ -2228,19 +2394,25 @@ RTLFUNC(IsEmpty)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariable* pVar = NULL;
if( SbiRuntime::isVBAEnabled() )
+ {
pVar = getDefaultProp( rPar.Get(1) );
+ }
if ( pVar )
{
pVar->Broadcast( SBX_HINT_DATAWANTED );
rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
}
else
+ {
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ }
}
}
@@ -2250,23 +2422,33 @@ RTLFUNC(IsError)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxVariable* pVar =rPar.Get( 1 );
SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
- if ( !pObj )
- {
- if ( SbxBase* pBaseObj = pVar->GetObject() )
- pObj = PTR_CAST(SbUnoObject, pBaseObj );
- }
+ if ( !pObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ {
+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ }
uno::Reference< script::XErrorQuery > xError;
if ( pObj )
+ {
xError.set( pObj->getUnoAny(), uno::UNO_QUERY );
+ }
if ( xError.is() )
+ {
rPar.Get( 0 )->PutBool( xError->hasError() );
+ }
else
+ {
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ }
}
}
@@ -2276,7 +2458,9 @@ RTLFUNC(IsNull)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
// #51475 because of Uno-objects return true
@@ -2287,7 +2471,9 @@ RTLFUNC(IsNull)
{
SbxBase* pObj = pArg->GetObject();
if( !pObj )
+ {
bNull = sal_True;
+ }
}
rPar.Get( 0 )->PutBool( bNull );
}
@@ -2299,9 +2485,13 @@ RTLFUNC(IsNumeric)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
+ {
rPar.Get( 0 )->PutBool( rPar.Get( 1 )->IsNumericRTL() );
+ }
}
@@ -2312,14 +2502,18 @@ RTLFUNC(IsMissing)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
+ {
// #57915 Missing is reported by an error
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ }
}
// Function looks for wildcards, removes them and always returns the pure path
-String implSetupWildcard( const String& rFileParam, SbiRTLData* pRTLData )
+OUString implSetupWildcard( const OUString& rFileParam, SbiRTLData* pRTLData )
{
static sal_Char cDelim1 = (sal_Char)'/';
static sal_Char cDelim2 = (sal_Char)'\\';
@@ -2328,68 +2522,77 @@ String implSetupWildcard( const String& rFileParam, SbiRTLData* pRTLData )
delete pRTLData->pWildCard;
pRTLData->pWildCard = NULL;
- pRTLData->sFullNameToBeChecked = String();
-
- String aFileParam = rFileParam;
- xub_StrLen nLastWild = aFileParam.SearchBackward( cWild1 );
- if( nLastWild == STRING_NOTFOUND )
- nLastWild = aFileParam.SearchBackward( cWild2 );
- bool bHasWildcards = ( nLastWild != STRING_NOTFOUND );
+ pRTLData->sFullNameToBeChecked = OUString();
+ OUString aFileParam = rFileParam;
+ sal_Int32 nLastWild = aFileParam.lastIndexOf( cWild1 );
+ if( nLastWild < 0 )
+ {
+ nLastWild = aFileParam.lastIndexOf( cWild2 );
+ }
+ bool bHasWildcards = ( nLastWild >= 0 );
- xub_StrLen nLastDelim = aFileParam.SearchBackward( cDelim1 );
- if( nLastDelim == STRING_NOTFOUND )
- nLastDelim = aFileParam.SearchBackward( cDelim2 );
+ sal_Int32 nLastDelim = aFileParam.lastIndexOf( cDelim1 );
+ if( nLastDelim < 0 )
+ {
+ nLastDelim = aFileParam.lastIndexOf( cDelim2 );
+ }
if( bHasWildcards )
{
// Wildcards in path?
- if( nLastDelim != STRING_NOTFOUND && nLastDelim > nLastWild )
+ if( nLastDelim >= 0 && nLastDelim > nLastWild )
+ {
return aFileParam;
+ }
}
else
{
- String aPathStr = getFullPath( aFileParam );
- if( nLastDelim != aFileParam.Len() - 1 )
+ OUString aPathStr = getFullPath( aFileParam );
+ if( nLastDelim != aFileParam.getLength() - 1 )
+ {
pRTLData->sFullNameToBeChecked = aPathStr;
+ }
return aPathStr;
}
- rtl::OUString aPureFileName;
- if( nLastDelim == STRING_NOTFOUND )
+ OUString aPureFileName;
+ if( nLastDelim < 0 )
{
aPureFileName = aFileParam;
- aFileParam = String();
+ aFileParam = OUString();
}
else
{
- aPureFileName = aFileParam.Copy( nLastDelim + 1 );
- aFileParam = aFileParam.Copy( 0, nLastDelim );
+ aPureFileName = aFileParam.copy( nLastDelim + 1 );
+ aFileParam = aFileParam.copy( 0, nLastDelim );
}
// Try again to get a valid URL/UNC-path with only the path
- String aPathStr = getFullPath( aFileParam );
+ OUString aPathStr = getFullPath( aFileParam );
// Is there a pure file name left? Otherwise the path is
// invalid anyway because it was not accepted by OSL before
- if (comphelper::string::equals(aPureFileName, '*'))
+ if (string::equals(aPureFileName, '*'))
{
pRTLData->pWildCard = new WildCard( aPureFileName );
}
return aPathStr;
}
-inline sal_Bool implCheckWildcard( const String& rName, SbiRTLData* pRTLData )
+inline sal_Bool implCheckWildcard( const OUString& rName, SbiRTLData* pRTLData )
{
sal_Bool bMatch = sal_True;
if( pRTLData->pWildCard )
+ {
bMatch = pRTLData->pWildCard->Matches( rName );
+ }
return bMatch;
}
-bool isRootDir( String aDirURLStr )
+bool isRootDir( OUString aDirURLStr )
{
INetURLObject aDirURLObj( aDirURLStr );
bool bRoot = false;
@@ -2407,9 +2610,9 @@ bool isRootDir( String aDirURLStr )
// or Windows "file:///c:/" -> root
else if( nCount == 1 )
{
- ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, sal_True,
- INetURLObject::DECODE_WITH_CHARSET );
- if( aSeg1.getStr()[1] == (sal_Unicode)':' )
+ OUString aSeg1 = aDirURLObj.getName( 0, sal_True,
+ INetURLObject::DECODE_WITH_CHARSET );
+ if( aSeg1[1] == (sal_Unicode)':' )
{
bRoot = true;
}
@@ -2425,11 +2628,13 @@ RTLFUNC(Dir)
(void)pBasic;
(void)bWrite;
- String aPath;
+ OUString aPath;
sal_uInt16 nParCount = rPar.Count();
if( nParCount > 3 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbiRTLData* pRTLData = GetSbData()->pInst->GetRTLData();
@@ -2437,8 +2642,9 @@ RTLFUNC(Dir)
// #34645: can also be called from the URL line via 'macro: Dir'
// there's no pRTLDate existing in that case and the method must be left
if( !pRTLData )
+ {
return;
-
+ }
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -2446,21 +2652,21 @@ RTLFUNC(Dir)
{
if ( nParCount >= 2 )
{
- String aFileParam = rPar.Get(1)->GetString();
+ OUString aFileParam = rPar.Get(1)->GetOUString();
- String aFileURLStr = implSetupWildcard( aFileParam, pRTLData );
- if( pRTLData->sFullNameToBeChecked.Len() > 0 )
+ OUString aFileURLStr = implSetupWildcard( aFileParam, pRTLData );
+ if( !pRTLData->sFullNameToBeChecked.isEmpty())
{
sal_Bool bExists = sal_False;
try { bExists = xSFI->exists( aFileURLStr ); }
catch(const Exception & ) {}
- String aNameOnlyStr;
+ OUString aNameOnlyStr;
if( bExists )
{
INetURLObject aFileURL( aFileURLStr );
aNameOnlyStr = aFileURL.getName( INetURLObject::LAST_SEGMENT,
- true, INetURLObject::DECODE_WITH_CHARSET );
+ true, INetURLObject::DECODE_WITH_CHARSET );
}
rPar.Get(0)->PutString( aNameOnlyStr );
return;
@@ -2468,7 +2674,7 @@ RTLFUNC(Dir)
try
{
- String aDirURLStr;
+ OUString aDirURLStr;
sal_Bool bFolder = xSFI->isFolder( aFileURLStr );
if( bFolder )
@@ -2477,16 +2683,19 @@ RTLFUNC(Dir)
}
else
{
- String aEmptyStr;
+ OUString aEmptyStr;
rPar.Get(0)->PutString( aEmptyStr );
}
sal_uInt16 nFlags = 0;
if ( nParCount > 2 )
+ {
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
+ }
else
+ {
pRTLData->nDirFlags = 0;
-
+ }
// Read directory
sal_Bool bIncludeFolders = ((nFlags & Sb_ATTR_DIRECTORY) != 0);
pRTLData->aDirSeq = xSFI->getFolderContents( aDirURLStr, bIncludeFolders );
@@ -2536,12 +2745,12 @@ RTLFUNC(Dir)
else if( pRTLData->nCurDirPos >= pRTLData->aDirSeq.getLength() )
{
pRTLData->aDirSeq.realloc( 0 );
- aPath.Erase();
+ aPath = "";
break;
}
else
{
- ::rtl::OUString aFile = pRTLData->aDirSeq.getConstArray()[pRTLData->nCurDirPos++];
+ OUString aFile = pRTLData->aDirSeq.getConstArray()[pRTLData->nCurDirPos++];
if( bCompatibility )
{
@@ -2549,7 +2758,9 @@ RTLFUNC(Dir)
{
sal_Bool bFolder = xSFI->isFolder( aFile );
if( bFolder )
+ {
continue;
+ }
}
}
else
@@ -2559,19 +2770,22 @@ RTLFUNC(Dir)
{
sal_Bool bFolder = xSFI->isFolder( aFile );
if( !bFolder )
+ {
continue;
+ }
}
}
INetURLObject aURL( aFile );
aPath = aURL.getName( INetURLObject::LAST_SEGMENT, sal_True,
- INetURLObject::DECODE_WITH_CHARSET );
+ INetURLObject::DECODE_WITH_CHARSET );
}
sal_Bool bMatch = implCheckWildcard( aPath, pRTLData );
if( !bMatch )
+ {
continue;
-
+ }
break;
}
}
@@ -2583,15 +2797,19 @@ RTLFUNC(Dir)
// TODO: OSL
if ( nParCount >= 2 )
{
- String aFileParam = rPar.Get(1)->GetString();
+ OUString aFileParam = rPar.Get(1)->GetOUString();
- String aDirURL = implSetupWildcard( aFileParam, pRTLData );
+ OUString aDirURL = implSetupWildcard( aFileParam, pRTLData );
sal_uInt16 nFlags = 0;
if ( nParCount > 2 )
+ {
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
+ }
else
+ {
pRTLData->nDirFlags = 0;
+ }
// Read directory
bool bIncludeFolders = ((nFlags & Sb_ATTR_DIRECTORY) != 0);
@@ -2601,7 +2819,7 @@ RTLFUNC(Dir)
{
delete pRTLData->pDir;
pRTLData->pDir = NULL;
- rPar.Get(0)->PutString( String() );
+ rPar.Get(0)->PutString( OUString() );
return;
}
@@ -2648,7 +2866,7 @@ RTLFUNC(Dir)
{
delete pRTLData->pDir;
pRTLData->pDir = NULL;
- aPath.Erase();
+ aPath = "";
break;
}
@@ -2662,7 +2880,9 @@ RTLFUNC(Dir)
FileStatus::Type aType = aFileStatus.getFileType();
bool bFolder = isFolder( aType );
if( !bFolder )
+ {
continue;
+ }
}
aPath = aFileStatus.getFileName();
@@ -2670,8 +2890,9 @@ RTLFUNC(Dir)
sal_Bool bMatch = implCheckWildcard( aPath, pRTLData );
if( !bMatch )
+ {
continue;
-
+ }
break;
}
}
@@ -2695,22 +2916,25 @@ RTLFUNC(GetAttr)
#if defined( WNT )
if( SbiRuntime::isVBAEnabled() )
{
- DirEntry aEntry( rPar.Get(1)->GetString() );
+ DirEntry aEntry( rPar.Get(1)->GetOUString() );
aEntry.ToAbs();
// #57064 extract the real-path for virtual URLs
- rtl::OString aByteStrFullPath(rtl::OUStringToOString(aEntry.GetFull(),
- osl_getThreadTextEncoding()));
+ OString aByteStrFullPath(rtl::OUStringToOString(aEntry.GetFull(),
+ osl_getThreadTextEncoding()));
DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.getStr());
if (nRealFlags != 0xffffffff)
{
if (nRealFlags == FILE_ATTRIBUTE_NORMAL)
+ {
nRealFlags = 0;
+ }
nFlags = (sal_Int16) (nRealFlags);
}
else
+ {
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
-
+ }
rPar.Get(0)->PutInteger( nFlags );
return;
@@ -2724,7 +2948,7 @@ RTLFUNC(GetAttr)
{
try
{
- String aPath = getFullPath( rPar.Get(1)->GetString() );
+ OUString aPath = getFullPath( rPar.Get(1)->GetOUString() );
sal_Bool bExists = sal_False;
try { bExists = xSFI->exists( aPath ); }
catch(const Exception & ) {}
@@ -2738,11 +2962,17 @@ RTLFUNC(GetAttr)
sal_Bool bHidden = xSFI->isHidden( aPath );
sal_Bool bDirectory = xSFI->isFolder( aPath );
if( bReadOnly )
+ {
nFlags |= Sb_ATTR_READONLY;
+ }
if( bHidden )
+ {
nFlags |= Sb_ATTR_HIDDEN;
+ }
if( bDirectory )
+ {
nFlags |= Sb_ATTR_DIRECTORY;
+ }
}
catch(const Exception & )
{
@@ -2753,7 +2983,7 @@ RTLFUNC(GetAttr)
else
{
DirectoryItem aItem;
- DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
+ DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetOUString() ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type );
aItem.getFileStatus( aFileStatus );
sal_uInt64 nAttributes = aFileStatus.getAttributes();
@@ -2762,14 +2992,20 @@ RTLFUNC(GetAttr)
FileStatus::Type aType = aFileStatus.getFileType();
bool bDirectory = isFolder( aType );
if( bReadOnly )
+ {
nFlags |= Sb_ATTR_READONLY;
+ }
if( bDirectory )
+ {
nFlags |= Sb_ATTR_DIRECTORY;
+ }
}
rPar.Get(0)->PutInteger( nFlags );
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
@@ -2779,10 +3015,12 @@ RTLFUNC(FileDateTime)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aPath = rPar.Get(1)->GetString();
+ OUString aPath = rPar.Get(1)->GetOUString();
Time aTime( Time::EMPTY );
Date aDate( Date::EMPTY );
if( hasUno() )
@@ -2839,12 +3077,14 @@ RTLFUNC(FileDateTime)
SbiInstance::PrepareNumberFormatter( pFormatter, n, n, nIndex );
}
- String aRes;
+ OUString aRes;
pFormatter->GetOutputString( fSerial, nIndex, aRes, &pCol );
rPar.Get(0)->PutString( aRes );
if( !GetSbData()->pInst )
+ {
delete pFormatter;
+ }
}
}
@@ -2856,7 +3096,9 @@ RTLFUNC(EOF)
// No changes for UCB
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
@@ -2875,10 +3117,14 @@ RTLFUNC(EOF)
(*pSvStrm) >> cBla; // can we read another character?
bIsEof = pSvStrm->IsEof();
if ( !bIsEof )
+ {
pSvStrm->SeekRel( -1 );
+ }
}
else
+ {
bIsEof = pSvStrm->IsEof(); // for binary data!
+ }
rPar.Get(0)->PutBool( bIsEof );
}
}
@@ -2894,7 +3140,9 @@ RTLFUNC(FileAttr)
// already opened files and the name doesn't matter there.
if ( rPar.Count() != 3 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
@@ -2907,10 +3155,13 @@ RTLFUNC(FileAttr)
}
sal_Int16 nRet;
if ( rPar.Get(2)->GetInteger() == 1 )
+ {
nRet = (sal_Int16)(pSbStrm->GetMode());
+ }
else
+ {
nRet = 0; // System file handle not supported
-
+ }
rPar.Get(0)->PutInteger( nRet );
}
}
@@ -2921,7 +3172,9 @@ RTLFUNC(Loc)
// No changes for UCB
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
@@ -2941,13 +3194,21 @@ RTLFUNC(Loc)
nPos++; // block positions starting at 1
}
else if ( pSbStrm->IsText() )
+ {
nPos = pSbStrm->GetLine();
+ }
else if( pSbStrm->IsBinary() )
+ {
nPos = pSvStrm->Tell();
+ }
else if ( pSbStrm->IsSeq() )
+ {
nPos = ( pSvStrm->Tell()+1 ) / 128;
+ }
else
+ {
nPos = pSvStrm->Tell();
+ }
rPar.Get(0)->PutLong( (sal_Int32)nPos );
}
}
@@ -2959,7 +3220,9 @@ RTLFUNC(Lof)
// No changes for UCB
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
@@ -3005,7 +3268,9 @@ RTLFUNC(Seek)
{
sal_uIntPtr nPos = pStrm->Tell();
if( pSbStrm->IsRandom() )
+ {
nPos = nPos / pSbStrm->GetBlockLen();
+ }
nPos++; // Basic counts from 1
rPar.Get(0)->PutLong( (sal_Int32)nPos );
}
@@ -3020,7 +3285,9 @@ RTLFUNC(Seek)
nPos--; // Basic counts from 1, SvStreams count from 0
pSbStrm->SetExpandOnWriteTo( 0 );
if ( pSbStrm->IsRandom() )
+ {
nPos *= pSbStrm->GetBlockLen();
+ }
pStrm->Seek( (sal_uIntPtr)nPos );
pSbStrm->SetExpandOnWriteTo( nPos );
}
@@ -3033,15 +3300,19 @@ RTLFUNC(Format)
sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
if ( nArgCount < 2 || nArgCount > 3 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- String aResult;
+ OUString aResult;
if( nArgCount == 2 )
+ {
rPar.Get(1)->Format( aResult );
+ }
else
{
- String aFmt( rPar.Get(2)->GetString() );
+ OUString aFmt( rPar.Get(2)->GetOUString() );
rPar.Get(1)->Format( aResult, &aFmt );
}
rPar.Get(0)->PutString( aResult );
@@ -3054,12 +3325,18 @@ RTLFUNC(Randomize)
(void)bWrite;
if ( rPar.Count() > 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
sal_Int16 nSeed;
if( rPar.Count() == 2 )
+ {
nSeed = (sal_Int16)rPar.Get(1)->GetInteger();
+ }
else
+ {
nSeed = (sal_Int16)rand();
+ }
srand( nSeed );
}
@@ -3069,7 +3346,9 @@ RTLFUNC(Rnd)
(void)bWrite;
if ( rPar.Count() > 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double nRand = (double)rand();
@@ -3110,64 +3389,66 @@ RTLFUNC(Shell)
{
oslProcessOption nOptions = osl_Process_SEARCHPATH | osl_Process_DETACHED;
- String aCmdLine = rPar.Get(1)->GetString();
+ OUString aCmdLine = rPar.Get(1)->GetOUString();
// attach additional parameters - everything must be parsed anyway
if( nArgCount >= 4 )
{
- aCmdLine.AppendAscii( " " );
- aCmdLine += rPar.Get(3)->GetString();
+ aCmdLine += " ";
+ aCmdLine += rPar.Get(3)->GetOUString();
}
- else if( !aCmdLine.Len() )
+ else if( aCmdLine.isEmpty() )
{
// avaoid special treatment (empty list)
- aCmdLine.AppendAscii( " " );
+ aCmdLine += " ";
}
- sal_uInt16 nLen = aCmdLine.Len();
+ sal_Int32 nLen = aCmdLine.getLength();
// #55735 if there are parameters, they have to be seperated
// #72471 also seperate the single parameters
std::list<String> aTokenList;
- String aToken;
- sal_uInt16 i = 0;
+ OUString aToken;
+ sal_Int32 i = 0;
sal_Unicode c;
while( i < nLen )
{
for ( ;; ++i )
{
- c = aCmdLine.GetBuffer()[ i ];
+ c = aCmdLine[ i ];
if ( c != ' ' && c != '\t' )
+ {
break;
+ }
}
if( c == '\"' || c == '\'' )
{
- sal_uInt16 iFoundPos = aCmdLine.Search( c, i + 1 );
+ sal_Int32 iFoundPos = aCmdLine.indexOf( c, i + 1 );
- if( iFoundPos == STRING_NOTFOUND )
+ if( iFoundPos < 0 )
{
- aToken = aCmdLine.Copy( i, STRING_LEN );
+ aToken = aCmdLine.copy( i);
i = nLen;
}
else
{
- aToken = aCmdLine.Copy( i + 1, (iFoundPos - i - 1) );
+ aToken = aCmdLine.copy( i + 1, (iFoundPos - i - 1) );
i = iFoundPos + 1;
}
}
else
{
- sal_uInt16 iFoundSpacePos = aCmdLine.Search( ' ', i );
- sal_uInt16 iFoundTabPos = aCmdLine.Search( '\t', i );
- sal_uInt16 iFoundPos = Min( iFoundSpacePos, iFoundTabPos );
+ sal_Int32 iFoundSpacePos = aCmdLine.indexOf( ' ', i );
+ sal_Int32 iFoundTabPos = aCmdLine.indexOf( '\t', i );
+ sal_Int32 iFoundPos = iFoundSpacePos >= 0 ? iFoundTabPos >= 0 ? Min( iFoundSpacePos, iFoundTabPos ) : iFoundSpacePos : -1;
- if( iFoundPos == STRING_NOTFOUND )
+ if( iFoundPos < 0 )
{
- aToken = aCmdLine.Copy( i, STRING_LEN );
+ aToken = aCmdLine.copy( i );
i = nLen;
}
else
{
- aToken = aCmdLine.Copy( i, (iFoundPos - i) );
+ aToken = aCmdLine.copy( i, (iFoundPos - i) );
i = iFoundPos;
}
}
@@ -3196,29 +3477,32 @@ RTLFUNC(Shell)
sal_Bool bSync = sal_False;
if( nArgCount >= 5 )
+ {
bSync = rPar.Get(4)->GetBool();
+ }
if( bSync )
+ {
nOptions |= osl_Process_WAIT;
+ }
}
// #72471 work parameter(s) up
std::list<String>::const_iterator iter = aTokenList.begin();
- const String& rStr = *iter;
- ::rtl::OUString aOUStrProg( rStr.GetBuffer(), rStr.Len() );
- ::rtl::OUString aOUStrProgUNC = getFullPathUNC( aOUStrProg );
+ const OUString& rStr = *iter;
+ OUString aOUStrProg( rStr.getStr(), rStr.getLength() );
+ OUString aOUStrProgUNC = getFullPathUNC( aOUStrProg );
++iter;
- sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >(
- aTokenList.size() - 1 );
+ sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >(aTokenList.size() - 1 );
rtl_uString** pParamList = NULL;
if( nParamCount )
{
pParamList = new rtl_uString*[nParamCount];
for(int iList = 0; iter != aTokenList.end(); ++iList, ++iter)
{
- const String& rParamStr = (*iter);
- const ::rtl::OUString aTempStr( rParamStr.GetBuffer(), rParamStr.Len());
+ const OUString& rParamStr = (*iter);
+ const OUString aTempStr( rParamStr.getStr(), rParamStr.getLength());
pParamList[iList] = NULL;
rtl_uString_assign(&(pParamList[iList]), aTempStr.pData);
}
@@ -3244,9 +3528,13 @@ RTLFUNC(Shell)
}
if( !bSucc )
+ {
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
+ }
else
+ {
rPar.Get(0)->PutLong( 0 );
+ }
}
}
@@ -3256,7 +3544,9 @@ RTLFUNC(VarType)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxDataType eType = rPar.Get(1)->GetType();
@@ -3265,7 +3555,7 @@ RTLFUNC(VarType)
}
// Exported function
-rtl::OUString getBasicTypeName( SbxDataType eType )
+OUString getBasicTypeName( SbxDataType eType )
{
static const char* pTypeNames[] =
{
@@ -3312,25 +3602,31 @@ rtl::OUString getBasicTypeName( SbxDataType eType )
int nPos = ((int)eType) & 0x0FFF;
sal_uInt16 nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* );
if ( nPos < 0 || nPos >= nTypeNameCount )
+ {
nPos = nTypeNameCount - 1;
+ }
return rtl::OUString::createFromAscii(pTypeNames[nPos]);
}
String getObjectTypeName( SbxVariable* pVar )
{
- rtl::OUString sRet( "Object" );
+ OUString sRet( "Object" );
if ( pVar )
{
SbxBase* pObj = pVar->GetObject();
if( !pObj )
- sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
+ {
+ sRet = OUString("Nothing");
+ }
else
{
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
if ( !pUnoObj )
{
if ( SbxBase* pBaseObj = pVar->GetObject() )
+ {
pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
}
if ( pUnoObj )
{
@@ -3346,7 +3642,9 @@ String getObjectTypeName( SbxVariable* pVar )
uno::Reference< ooo::vba::XHelperInterface > xVBA( aObj, uno::UNO_QUERY );
Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
if ( sServices.getLength() )
+ {
sRet = sServices[ 0 ];
+ }
}
else
{
@@ -3368,7 +3666,9 @@ String getObjectTypeName( SbxVariable* pVar )
}
sal_Int32 nDot = sRet.lastIndexOf( '.' );
if ( nDot != -1 && nDot < sRet.getLength() )
- sRet = sRet.copy( nDot + 1 );
+ {
+ sRet = sRet.copy( nDot + 1 );
+ }
}
}
}
@@ -3381,19 +3681,27 @@ RTLFUNC(TypeName)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxDataType eType = rPar.Get(1)->GetType();
bool bIsArray = ( ( eType & SbxARRAY ) != 0 );
- String aRetStr;
+ OUString aRetStr;
if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
+ {
aRetStr = getObjectTypeName( rPar.Get(1) );
+ }
else
+ {
aRetStr = getBasicTypeName( eType );
+ }
if( bIsArray )
- aRetStr.AppendAscii( "()" );
+ {
+ aRetStr += "()";
+ }
rPar.Get(0)->PutString( aRetStr );
}
}
@@ -3404,11 +3712,13 @@ RTLFUNC(Len)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- const String& rStr = rPar.Get(1)->GetString();
- rPar.Get(0)->PutLong( (sal_Int32)rStr.Len() );
+ const OUString& rStr = rPar.Get(1)->GetOUString();
+ rPar.Get(0)->PutLong( rStr.getLength() );
}
}
@@ -3430,16 +3740,20 @@ RTLFUNC(DDEInitiate)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- const String& rApp = rPar.Get(1)->GetString();
- const String& rTopic = rPar.Get(2)->GetString();
+ const OUString& rApp = rPar.Get(1)->GetOUString();
+ const OUString& rTopic = rPar.Get(2)->GetOUString();
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
- sal_Int16 nChannel;
+ size_t nChannel;
SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel );
if( nDdeErr )
+ {
StarBASIC::Error( nDdeErr );
+ }
else
- rPar.Get(0)->PutInteger( nChannel );
+ {
+ rPar.Get(0)->PutInteger( (int)nChannel );
+ }
}
RTLFUNC(DDETerminate)
@@ -3461,11 +3775,13 @@ RTLFUNC(DDETerminate)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- sal_Int16 nChannel = rPar.Get(1)->GetInteger();
+ size_t nChannel = rPar.Get(1)->GetInteger();
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
SbError nDdeErr = pDDE->Terminate( nChannel );
if( nDdeErr )
+ {
StarBASIC::Error( nDdeErr );
+ }
}
RTLFUNC(DDETerminateAll)
@@ -3491,8 +3807,9 @@ RTLFUNC(DDETerminateAll)
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
SbError nDdeErr = pDDE->TerminateAll();
if( nDdeErr )
+ {
StarBASIC::Error( nDdeErr );
-
+ }
}
RTLFUNC(DDERequest)
@@ -3513,15 +3830,19 @@ RTLFUNC(DDERequest)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- sal_Int16 nChannel = rPar.Get(1)->GetInteger();
- const String& rItem = rPar.Get(2)->GetString();
+ size_t nChannel = rPar.Get(1)->GetInteger();
+ const OUString& rItem = rPar.Get(2)->GetOUString();
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
- String aResult;
+ OUString aResult;
SbError nDdeErr = pDDE->Request( nChannel, rItem, aResult );
if( nDdeErr )
+ {
StarBASIC::Error( nDdeErr );
+ }
else
+ {
rPar.Get(0)->PutString( aResult );
+ }
}
RTLFUNC(DDEExecute)
@@ -3543,12 +3864,14 @@ RTLFUNC(DDEExecute)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- sal_Int16 nChannel = rPar.Get(1)->GetInteger();
- const String& rCommand = rPar.Get(2)->GetString();
+ size_t nChannel = rPar.Get(1)->GetInteger();
+ const OUString& rCommand = rPar.Get(2)->GetOUString();
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
SbError nDdeErr = pDDE->Execute( nChannel, rCommand );
if( nDdeErr )
+ {
StarBASIC::Error( nDdeErr );
+ }
}
RTLFUNC(DDEPoke)
@@ -3570,13 +3893,15 @@ RTLFUNC(DDEPoke)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- sal_Int16 nChannel = rPar.Get(1)->GetInteger();
- const String& rItem = rPar.Get(2)->GetString();
- const String& rData = rPar.Get(3)->GetString();
+ size_t nChannel = rPar.Get(1)->GetInteger();
+ const OUString& rItem = rPar.Get(2)->GetOUString();
+ const OUString& rData = rPar.Get(3)->GetOUString();
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
SbError nDdeErr = pDDE->Poke( nChannel, rItem, rData );
if( nDdeErr )
+ {
StarBASIC::Error( nDdeErr );
+ }
}
@@ -3741,12 +4066,12 @@ RTLFUNC(StrConv)
return;
}
- String aOldStr = rPar.Get(1)->GetString();
+ OUString aOldStr = rPar.Get(1)->GetOUString();
sal_Int32 nConversion = rPar.Get(2)->GetLong();
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
- sal_uInt16 nOldLen = aOldStr.Len();
+ sal_Int32 nOldLen = aOldStr.getLength();
if( nOldLen == 0 )
{
// null string,return
@@ -3758,28 +4083,37 @@ RTLFUNC(StrConv)
if ( (nConversion & 0x03) == 3 ) // vbProperCase
{
const CharClass& rCharClass = GetCharClass();
- aOldStr = rCharClass.titlecase( aOldStr.ToLowerAscii(), 0, nOldLen );
+ aOldStr = rCharClass.titlecase( aOldStr.toAsciiLowerCase(), 0, nOldLen );
}
else if ( (nConversion & 0x01) == 1 ) // vbUpperCase
+ {
nType |= i18n::TransliterationModules_LOWERCASE_UPPERCASE;
+ }
else if ( (nConversion & 0x02) == 2 ) // vbLowerCase
+ {
nType |= i18n::TransliterationModules_UPPERCASE_LOWERCASE;
-
+ }
if ( (nConversion & 0x04) == 4 ) // vbWide
+ {
nType |= i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
+ }
else if ( (nConversion & 0x08) == 8 ) // vbNarrow
+ {
nType |= i18n::TransliterationModules_FULLWIDTH_HALFWIDTH;
-
+ }
if ( (nConversion & 0x10) == 16) // vbKatakana
+ {
nType |= i18n::TransliterationModules_HIRAGANA_KATAKANA;
+ }
else if ( (nConversion & 0x20) == 32 ) // vbHiragana
+ {
nType |= i18n::TransliterationModules_KATAKANA_HIRAGANA;
-
- String aNewStr( aOldStr );
+ }
+ OUString aNewStr( aOldStr );
if( nType != 0 )
{
- uno::Reference< lang::XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- ::utl::TransliterationWrapper aTransliterationWrapper( xSMgr,nType );
+ uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
+ ::utl::TransliterationWrapper aTransliterationWrapper( xContext, nType );
uno::Sequence<sal_Int32> aOffsets;
aTransliterationWrapper.loadModuleIfNeeded( nLanguage );
aNewStr = aTransliterationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets );
@@ -3788,47 +4122,52 @@ RTLFUNC(StrConv)
if ( (nConversion & 0x40) == 64 ) // vbUnicode
{
// convert the string to byte string, preserving unicode (2 bytes per character)
- sal_uInt16 nSize = aNewStr.Len()*2;
- const sal_Unicode* pSrc = aNewStr.GetBuffer();
+ sal_Int32 nSize = aNewStr.getLength()*2;
+ const sal_Unicode* pSrc = aNewStr.getStr();
sal_Char* pChar = new sal_Char[nSize+1];
- for( sal_uInt16 i=0; i < nSize; i++ )
+ for( sal_Int32 i=0; i < nSize; i++ )
{
pChar[i] = static_cast< sal_Char >( (i%2) ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff );
if( i%2 )
+ {
pSrc++;
+ }
}
pChar[nSize] = '\0';
::rtl::OString aOStr(pChar);
delete[] pChar;
// there is no concept about default codepage in unix. so it is incorrectly in unix
- ::rtl::OUString aOUStr = ::rtl::OStringToOUString(aOStr, osl_getThreadTextEncoding());
- aNewStr = String(aOUStr);
- rPar.Get(0)->PutString( aNewStr );
+ OUString aOUStr = ::rtl::OStringToOUString(aOStr, osl_getThreadTextEncoding());
+ rPar.Get(0)->PutString( aOUStr );
return;
}
else if ( (nConversion & 0x80) == 128 ) // vbFromUnicode
{
- ::rtl::OUString aOUStr(aNewStr);
+ OUString aOUStr(aNewStr);
// 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();
- sal_uInt16 nArraySize = static_cast< sal_uInt16 >( aOStr.getLength() );
+ sal_Int32 nArraySize = aOStr.getLength();
SbxDimArray* pArray = new SbxDimArray(SbxBYTE);
bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
if(nArraySize)
{
if( bIncIndex )
+ {
pArray->AddDim( 1, nArraySize );
+ }
else
+ {
pArray->AddDim( 0, nArraySize-1 );
+ }
}
else
{
pArray->unoAddDim( 0, -1 );
}
- for( sal_uInt16 i=0; i< nArraySize; i++)
+ for( sal_Int32 i=0; i< nArraySize; i++)
{
SbxVariable* pNew = new SbxVariable( SbxBYTE );
pNew->PutByte(*pChar);
@@ -3836,7 +4175,9 @@ RTLFUNC(StrConv)
pNew->SetFlag( SBX_WRITE );
short index = i;
if( bIncIndex )
+ {
++index;
+ }
pArray->Put( pNew, &index );
}
@@ -3846,9 +4187,8 @@ RTLFUNC(StrConv)
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
refVar->SetParameters( NULL );
- return;
+ return;
}
-
rPar.Get(0)->PutString(aNewStr);
}
@@ -3886,10 +4226,11 @@ RTLFUNC(Load)
}
else if( pObj->IsA( TYPE( SbxObject ) ) )
{
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD );
+ SbxVariable* pVar = ((SbxObject*)pObj)->Find( OUString("Load"), SbxCLASS_METHOD );
if( pVar )
+ {
pVar->GetInteger();
+ }
}
}
}
@@ -3917,10 +4258,11 @@ RTLFUNC(Unload)
}
else if( pObj->IsA( TYPE( SbxObject ) ) )
{
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD );
+ SbxVariable* pVar = ((SbxObject*)pObj)->Find( OUString("Unload"), SbxCLASS_METHOD );
if( pVar )
+ {
pVar->GetInteger();
+ }
}
}
}
@@ -3936,7 +4278,7 @@ RTLFUNC(LoadPicture)
return;
}
- String aFileURL = getFullPath( rPar.Get(1)->GetString() );
+ OUString aFileURL = getFullPath( rPar.Get(1)->GetOUString() );
SvStream* pStream = utl::UcbStreamHelper::CreateStream( aFileURL, STREAM_READ );
if( pStream != NULL )
{
@@ -3966,7 +4308,7 @@ RTLFUNC(SavePicture)
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
if( pObj->IsA( TYPE( SbStdPicture ) ) )
{
- SvFileStream aOStream( rPar.Get(2)->GetString(), STREAM_WRITE | STREAM_TRUNC );
+ SvFileStream aOStream( rPar.Get(2)->GetOUString(), STREAM_WRITE | STREAM_TRUNC );
Graphic aGraphic = ((SbStdPicture*)pObj)->GetGraphic();
aOStream << aGraphic;
}
@@ -4019,8 +4361,9 @@ RTLFUNC(MsgBox)
WinBits nStyle = nType;
nStyle &= 15; // delete bits 4-16
if( nStyle > 5 )
+ {
nStyle = 0;
-
+ }
nWinBits = nStyleMap[ nStyle ];
WinBits nWinDefBits;
@@ -4028,65 +4371,85 @@ RTLFUNC(MsgBox)
if( nType & 256 )
{
if( nStyle == 5 )
+ {
nWinDefBits = WB_DEF_CANCEL;
+ }
else if( nStyle == 2 )
+ {
nWinDefBits = WB_DEF_RETRY;
+ }
else
+ {
nWinDefBits = (WB_DEF_CANCEL | WB_DEF_RETRY | WB_DEF_NO);
+ }
}
else if( nType & 512 )
{
if( nStyle == 2)
+ {
nWinDefBits = WB_DEF_IGNORE;
+ }
else
+ {
nWinDefBits = WB_DEF_CANCEL;
+ }
}
else if( nStyle == 2)
+ {
nWinDefBits = WB_DEF_CANCEL;
+ }
nWinBits |= nWinDefBits;
- String aMsg = rPar.Get(1)->GetString();
- String aTitle;
+ OUString aMsg = rPar.Get(1)->GetOUString();
+ OUString aTitle;
if( nArgCount >= 4 )
- aTitle = rPar.Get(3)->GetString();
+ {
+ aTitle = rPar.Get(3)->GetOUString();
+ }
else
+ {
aTitle = GetpApp()->GetAppName();
+ }
nType &= (16+32+64);
MessBox* pBox = 0;
Window* pParent = GetpApp()->GetDefDialogParent();
switch( nType )
{
- case 16:
- pBox = new ErrorBox( pParent, nWinBits, aMsg );
- break;
- case 32:
- pBox = new QueryBox( pParent, nWinBits, aMsg );
- break;
- case 48:
- pBox = new WarningBox( pParent, nWinBits, aMsg );
- break;
- case 64:
- pBox = new InfoBox( pParent, aMsg );
- break;
- default:
- pBox = new MessBox( pParent, nWinBits, aTitle, aMsg );
+ case 16:
+ pBox = new ErrorBox( pParent, nWinBits, aMsg );
+ break;
+ case 32:
+ pBox = new QueryBox( pParent, nWinBits, aMsg );
+ break;
+ case 48:
+ pBox = new WarningBox( pParent, nWinBits, aMsg );
+ break;
+ case 64:
+ pBox = new InfoBox( pParent, aMsg );
+ break;
+ default:
+ pBox = new MessBox( pParent, nWinBits, aTitle, aMsg );
}
pBox->SetText( aTitle );
sal_uInt16 nRet = (sal_uInt16)pBox->Execute();
if( nRet == sal_True )
+ {
nRet = 1;
-
+ }
sal_Int16 nMappedRet;
if( nStyle == 2 )
{
nMappedRet = nRet;
if( nMappedRet == 0 )
+ {
nMappedRet = 3; // Abort
+ }
}
else
+ {
nMappedRet = nButtonMap[ nRet ];
-
+ }
rPar.Get(0)->PutInteger( nMappedRet );
delete pBox;
}
@@ -4099,7 +4462,7 @@ RTLFUNC(SetAttr)
rPar.Get(0)->PutEmpty();
if ( rPar.Count() == 3 )
{
- String aStr = rPar.Get(1)->GetString();
+ OUString aStr = rPar.Get(1)->GetOUString();
sal_Int16 nFlags = rPar.Get(2)->GetInteger();
if( hasUno() )
@@ -4122,7 +4485,9 @@ RTLFUNC(SetAttr)
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(Reset)
@@ -4133,7 +4498,9 @@ RTLFUNC(Reset)
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
if (pIO)
+ {
pIO->CloseAll();
+ }
}
RTLFUNC(DumpAllObjects)
@@ -4143,20 +4510,28 @@ RTLFUNC(DumpAllObjects)
sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
if( nArgCount < 2 || nArgCount > 3 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else if( !pBasic )
+ {
StarBASIC::Error( SbERR_INTERNAL_ERROR );
+ }
else
{
SbxObject* p = pBasic;
while( p->GetParent() )
+ {
p = p->GetParent();
- SvFileStream aStrm( rPar.Get( 1 )->GetString(),
+ }
+ SvFileStream aStrm( rPar.Get( 1 )->GetOUString(),
STREAM_WRITE | STREAM_TRUNC );
p->Dump( aStrm, rPar.Get( 2 )->GetBool() );
aStrm.Close();
if( aStrm.GetError() != SVSTREAM_OK )
+ {
StarBASIC::Error( SbERR_IO_ERROR );
+ }
}
}
@@ -4168,7 +4543,7 @@ RTLFUNC(FileExists)
if ( rPar.Count() == 2 )
{
- String aStr = rPar.Get(1)->GetString();
+ OUString aStr = rPar.Get(1)->GetOUString();
sal_Bool bExists = sal_False;
if( hasUno() )
@@ -4195,7 +4570,9 @@ RTLFUNC(FileExists)
rPar.Get(0)->PutBool( bExists );
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(Partition)
@@ -4227,15 +4604,15 @@ RTLFUNC(Partition)
// will be handled properly during any subsequent sort operation.
// 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 );
+ OUString aBeforeStart = ::rtl::OUString::valueOf( nStart - 1 );
+ OUString aAfterStop = ::rtl::OUString::valueOf( nStop + 1 );
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;
- ::rtl::OUString aUpperValue;
+ OUStringBuffer aRetStr( nLen * 2 + 1);
+ OUString aLowerValue;
+ OUString aUpperValue;
if( nNumber < nStart )
{
aUpperValue = aBeforeStart;
@@ -4253,7 +4630,6 @@ RTLFUNC(Partition)
nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart;
nUpperValue = nLowerValue + nInterval - 1;
}
-
aLowerValue = ::rtl::OUString::valueOf( nLowerValue );
aUpperValue = ::rtl::OUString::valueOf( nUpperValue );
}
@@ -4265,17 +4641,21 @@ RTLFUNC(Partition)
{
// appending the leading spaces for the lowervalue
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 ( sal_Int32 i= (nLen - nLen2) ; i > 0; --i )
+ {
aRetStr.appendAscii(" ");
+ }
}
aRetStr.append( aUpperValue );
- rPar.Get(0)->PutString( String(aRetStr.makeStringAndClear()) );
+ rPar.Get(0)->PutString( aRetStr.makeStringAndClear());
}
#endif
@@ -4290,7 +4670,9 @@ static long GetDayDiff( const Date& rDate )
nDiffDays *= -1;
}
else
+ {
nDiffDays = (long)(rDate - aRefDate);
+ }
nDiffDays += 2; // adjustment VisualBasic: 1.Jan.1900 == 2
return nDiffDays;
}
@@ -4309,11 +4691,17 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
{
#ifndef DISABLE_SCRIPTING
if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
+ {
nYear += 2000;
+ }
else
#endif
+ {
if ( nYear < 100 )
+ {
nYear += 1900;
+ }
+ }
Date aCurDate( nDay, nMonth, nYear );
if ((nYear < 100 || nYear > 9999) )
{
@@ -4328,7 +4716,7 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
#endif
{
if ( (nMonth < 1 || nMonth > 12 )||
- (nDay < 1 || nDay > 31 ) )
+ (nDay < 1 || nDay > 31 ) )
{
#ifndef DISABLE_SCRIPTING
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4351,7 +4739,9 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
// just modify the months directory
sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
if ( nMonth <=0 )
+ {
nYearAdj = ( ( nMonth -12 ) / 12 );
+ }
aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
}
@@ -4359,9 +4749,13 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
// e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month
// 2000, 1, 32 = 2000, 2, 1 or the first day of the following month
if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) )
+ {
aCurDate += nDay - 1;
+ }
else
+ {
aCurDate.SetDay( nDay );
+ }
}
#endif
@@ -4373,7 +4767,9 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
sal_Int16 implGetMinute( double dDate )
{
if( dDate < 0.0 )
+ {
dDate *= -1.0;
+ }
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 7072c09cb3d7..e12a69f0e94a 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -48,7 +48,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/i18n/XCalendar3.hpp>
+#include <com/sun/star/i18n/LocaleCalendar.hpp>
#include <com/sun/star/sheet/XFunctionAccess.hpp>
using namespace comphelper;
@@ -64,12 +64,8 @@ static Reference< XCalendar3 > getLocaleCalendar( void )
static Reference< XCalendar3 > xCalendar;
if( !xCalendar.is() )
{
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( xSMgr.is() )
- {
- xCalendar = Reference< XCalendar3 >( xSMgr->createInstance
- ( ::rtl::OUString("com.sun.star.i18n.LocaleCalendar" ) ), UNO_QUERY );
- }
+ Reference< XComponentContext > xContext = getProcessComponentContext();
+ xCalendar = LocaleCalendar::create(xContext);
}
static com::sun::star::lang::Locale aLastLocale;
@@ -132,7 +128,7 @@ RTLFUNC(CallByName)
}
// 2. parameter is ProcedureName
- String aNameStr = rPar.Get(2)->GetString();
+ OUString aNameStr = rPar.Get(2)->GetOUString();
// 3. parameter is CallType
sal_Int16 nCallType = rPar.Get(3)->GetInteger();
@@ -147,74 +143,76 @@ RTLFUNC(CallByName)
switch( nCallType )
{
- case vbGet:
+ 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;
- pFindVar->Get( aVals );
-
- SbxVariableRef refVar = rPar.Get(0);
- refVar->Put( aVals );
+ pValVar->Get( aVals );
+ pFindVar->Put( aVals );
}
- break;
- case vbLet:
- case vbSet:
+ else
{
- 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 = GetSbData()->pInst;
+ SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
+ if( pRT != NULL )
{
- SbxVariableRef rFindVar = pFindVar;
- SbiInstance* pInst = GetSbData()->pInst;
- SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
- if( pRT != NULL )
- pRT->StepSET_Impl( pValVar, rFindVar, false );
+ pRT->StepSET_Impl( pValVar, rFindVar, false );
}
}
- break;
- case vbMethod:
+ }
+ break;
+ case vbMethod:
+ {
+ SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar);
+ if( pMeth == NULL )
{
- SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar);
- if( pMeth == NULL )
- {
- StarBASIC::Error( SbERR_PROC_UNDEFINED );
- return;
- }
+ StarBASIC::Error( SbERR_PROC_UNDEFINED );
+ return;
+ }
- // Setup parameters
- SbxArrayRef xArray;
- sal_uInt16 nMethParamCount = nParCount - 4;
- if( nMethParamCount > 0 )
+ // Setup parameters
+ SbxArrayRef xArray;
+ sal_uInt16 nMethParamCount = nParCount - 4;
+ if( nMethParamCount > 0 )
+ {
+ xArray = new SbxArray;
+ for( sal_uInt16 i = 0 ; i < nMethParamCount ; i++ )
{
- xArray = new SbxArray;
- for( sal_uInt16 i = 0 ; i < nMethParamCount ; i++ )
- {
- SbxVariable* pPar = rPar.Get( i + 4 );
- xArray->Put( pPar, i + 1 );
- }
+ 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 );
+
+ // 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 );
}
}
@@ -230,8 +228,9 @@ RTLFUNC(CBool) // JSM
bVal = pSbxVariable->GetBool();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutBool(bVal);
}
@@ -247,8 +246,9 @@ RTLFUNC(CByte) // JSM
nByte = pSbxVariable->GetByte();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutByte(nByte);
}
@@ -264,8 +264,9 @@ RTLFUNC(CCur)
nCur = pSbxVariable->GetCurrency();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutCurrency( nCur );
}
@@ -282,8 +283,9 @@ RTLFUNC(CDec)
pDec = pSbxVariable->GetDecimal();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutDecimal( pDec );
#else
rPar.Get(0)->PutEmpty();
@@ -303,8 +305,9 @@ RTLFUNC(CDate) // JSM
nVal = pSbxVariable->GetDate();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutDate(nVal);
}
@@ -320,10 +323,12 @@ RTLFUNC(CDbl) // JSM
if( pSbxVariable->GetType() == SbxSTRING )
{
// #41690
- String aScanStr = pSbxVariable->GetString();
+ OUString aScanStr = pSbxVariable->GetOUString();
SbError Error = SbxValue::ScanNumIntnl( aScanStr, nVal );
if( Error != SbxERR_OK )
+ {
StarBASIC::Error( Error );
+ }
}
else
{
@@ -331,7 +336,9 @@ RTLFUNC(CDbl) // JSM
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
rPar.Get(0)->PutDouble(nVal);
}
@@ -348,8 +355,9 @@ RTLFUNC(CInt) // JSM
nVal = pSbxVariable->GetInteger();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutInteger(nVal);
}
@@ -365,8 +373,9 @@ RTLFUNC(CLng) // JSM
nVal = pSbxVariable->GetLong();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutLong(nVal);
}
@@ -383,10 +392,12 @@ RTLFUNC(CSng) // JSM
{
// #41690
double dVal = 0.0;
- String aScanStr = pSbxVariable->GetString();
+ OUString aScanStr = pSbxVariable->GetOUString();
SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/true );
if( SbxBase::GetError() == SbxERR_OK && Error != SbxERR_OK )
+ {
StarBASIC::Error( Error );
+ }
nVal = (float)dVal;
}
else
@@ -395,8 +406,9 @@ RTLFUNC(CSng) // JSM
}
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutSingle(nVal);
}
@@ -405,15 +417,16 @@ RTLFUNC(CStr) // JSM
(void)pBasic;
(void)bWrite;
- String aString;
+ OUString aString;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
- aString = pSbxVariable->GetString();
+ aString = pSbxVariable->GetOUString();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutString(aString);
}
@@ -429,8 +442,9 @@ RTLFUNC(CVar) // JSM
pSbxVariable->Get( aVals );
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->Put( aVals );
}
@@ -446,8 +460,9 @@ RTLFUNC(CVErr)
nErrCode = pSbxVariable->GetInteger();
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
-
+ }
rPar.Get(0)->PutErr( nErrCode );
}
@@ -459,12 +474,18 @@ RTLFUNC(Iif) // JSM
if ( rPar.Count() == 4 )
{
if (rPar.Get(1)->GetBool())
+ {
*rPar.Get(0) = *rPar.Get(2);
+ }
else
+ {
*rPar.Get(0) = *rPar.Get(3);
+ }
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(GetSystemType)
@@ -473,10 +494,14 @@ RTLFUNC(GetSystemType)
(void)bWrite;
if ( rPar.Count() != 1 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
+ {
// Removed for SRC595
rPar.Get(0)->PutInteger( -1 );
+ }
}
RTLFUNC(GetGUIType)
@@ -485,7 +510,9 @@ RTLFUNC(GetGUIType)
(void)bWrite;
if ( rPar.Count() != 1 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
// 17.7.2000 Make simple solution for testtool / fat office
@@ -505,7 +532,9 @@ RTLFUNC(Red)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong();
@@ -521,7 +550,9 @@ RTLFUNC(Green)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong();
@@ -537,7 +568,9 @@ RTLFUNC(Blue)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong();
@@ -554,8 +587,10 @@ RTLFUNC(Switch)
sal_uInt16 nCount = rPar.Count();
if( !(nCount & 0x0001 ))
+ {
// number of arguments must be odd
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
sal_uInt16 nCurExpr = 1;
while( nCurExpr < (nCount-1) )
{
@@ -587,7 +622,9 @@ void Wait_Impl( bool bDurationBased, SbxArray& rPar )
nWait = (long)( dSecs * 1000 ); // wait in thousands of sec
}
else
+ {
nWait = rPar.Get(1)->GetLong();
+ }
if( nWait < 0 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -598,7 +635,9 @@ void Wait_Impl( bool bDurationBased, SbxArray& rPar )
aTimer.SetTimeout( nWait );
aTimer.Start();
while ( aTimer.IsActive() )
+ {
Application::Yield();
+ }
}
//i#64882#
@@ -637,7 +676,9 @@ RTLFUNC(GetGUIVersion)
(void)bWrite;
if ( rPar.Count() != 1 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
// Removed for SRC595
@@ -651,7 +692,9 @@ RTLFUNC(Choose)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
sal_Int16 nIndex = rPar.Get(1)->GetInteger();
sal_uInt16 nCount = rPar.Count();
nCount--;
@@ -670,10 +713,12 @@ RTLFUNC(Trim)
(void)bWrite;
if ( rPar.Count() < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
- rtl::OUString aStr(comphelper::string::strip(rPar.Get(1)->GetString(), ' '));
+ rtl::OUString aStr(comphelper::string::strip(rPar.Get(1)->GetOUString(), ' '));
rPar.Get(0)->PutString(aStr);
}
}
@@ -727,8 +772,10 @@ RTLFUNC(FreeLibrary)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- GetSbData()->pInst->GetDllMgr()->FreeDll( rPar.Get(1)->GetString() );
+ }
+ GetSbData()->pInst->GetDllMgr()->FreeDll( rPar.Get(1)->GetOUString() );
}
bool IsBaseIndexOne()
{
@@ -737,7 +784,9 @@ bool IsBaseIndexOne()
{
sal_uInt16 res = GetSbData()->pInst->pRun->GetBase();
if ( res )
+ {
result = true;
+ }
}
return result;
}
@@ -755,9 +804,13 @@ RTLFUNC(Array)
if( nArraySize )
{
if ( bIncIndex )
+ {
pArray->AddDim( 1, nArraySize );
+ }
else
+ {
pArray->AddDim( 0, nArraySize-1 );
+ }
}
else
{
@@ -775,7 +828,9 @@ RTLFUNC(Array)
pNew->SetFlag( SBX_WRITE );
short index = static_cast< short >(i);
if ( bIncIndex )
+ {
++index;
+ }
pArray->Put( pNew, &index );
}
@@ -817,8 +872,9 @@ RTLFUNC(DimArray)
}
}
else
+ {
pArray->unoAddDim( 0, -1 );
-
+ }
SbxVariableRef refVar = rPar.Get(0);
sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
@@ -862,13 +918,14 @@ RTLFUNC(FindObject)
return;
}
- String aNameStr = rPar.Get(1)->GetString();
+ OUString aNameStr = rPar.Get(1)->GetOUString();
SbxBase* pFind = StarBASIC::FindSBXInCurrentScope( aNameStr );
SbxObject* pFindObj = NULL;
if( pFind )
+ {
pFindObj = PTR_CAST(SbxObject,pFind);
-
+ }
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( pFindObj );
}
@@ -890,14 +947,16 @@ RTLFUNC(FindPropertyObject)
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);
}
- String aNameStr = rPar.Get(2)->GetString();
+ OUString aNameStr = rPar.Get(2)->GetOUString();
SbxObject* pFindObj = NULL;
if( pObj )
@@ -906,8 +965,9 @@ RTLFUNC(FindPropertyObject)
pFindObj = PTR_CAST(SbxObject,pFindVar);
}
else
+ {
StarBASIC::Error( SbERR_BAD_PARAMETER );
-
+ }
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( pFindObj );
@@ -916,7 +976,7 @@ RTLFUNC(FindPropertyObject)
static sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
- sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray )
+ sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray )
{
sal_uIntPtr nFPos = pStrm->Tell();
@@ -925,84 +985,100 @@ static sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
switch( eType )
{
- case SbxBOOL:
- case SbxCHAR:
- case SbxBYTE:
- if( bIsVariant )
- *pStrm << (sal_uInt16)SbxBYTE; // VarType Id
- *pStrm << rVar.GetByte();
- break;
+ case SbxBOOL:
+ case SbxCHAR:
+ case SbxBYTE:
+ if( bIsVariant )
+ {
+ *pStrm << (sal_uInt16)SbxBYTE; // VarType Id
+ }
+ *pStrm << rVar.GetByte();
+ break;
+
+ case SbxEMPTY:
+ case SbxNULL:
+ case SbxVOID:
+ case SbxINTEGER:
+ case SbxUSHORT:
+ case SbxINT:
+ case SbxUINT:
+ if( bIsVariant )
+ {
+ *pStrm << (sal_uInt16)SbxINTEGER; // VarType Id
+ }
+ *pStrm << rVar.GetInteger();
+ break;
- case SbxEMPTY:
- case SbxNULL:
- case SbxVOID:
- case SbxINTEGER:
- case SbxUSHORT:
- case SbxINT:
- case SbxUINT:
- if( bIsVariant )
- *pStrm << (sal_uInt16)SbxINTEGER; // VarType Id
- *pStrm << rVar.GetInteger();
- break;
+ case SbxLONG:
+ case SbxULONG:
+ if( bIsVariant )
+ {
+ *pStrm << (sal_uInt16)SbxLONG; // VarType Id
+ }
+ *pStrm << rVar.GetLong();
+ break;
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ if( bIsVariant )
+ {
+ *pStrm << (sal_uInt16)SbxSALINT64; // VarType Id
+ }
+ *pStrm << (sal_uInt64)rVar.GetInt64();
+ break;
+ case SbxSINGLE:
+ if( bIsVariant )
+ {
+ *pStrm << (sal_uInt16)eType; // VarType Id
+ }
+ *pStrm << rVar.GetSingle();
+ break;
- case SbxLONG:
- case SbxULONG:
- if( bIsVariant )
- *pStrm << (sal_uInt16)SbxLONG; // VarType Id
- *pStrm << rVar.GetLong();
- break;
- case SbxSALINT64:
- case SbxSALUINT64:
- if( bIsVariant )
- *pStrm << (sal_uInt16)SbxSALINT64; // VarType Id
- *pStrm << (sal_uInt64)rVar.GetInt64();
- break;
- case SbxSINGLE:
- if( bIsVariant )
- *pStrm << (sal_uInt16)eType; // VarType Id
- *pStrm << rVar.GetSingle();
- break;
+ case SbxDOUBLE:
+ case SbxCURRENCY:
+ case SbxDATE:
+ if( bIsVariant )
+ {
+ *pStrm << (sal_uInt16)eType; // VarType Id
+ }
+ *pStrm << rVar.GetDouble();
+ break;
- case SbxDOUBLE:
- case SbxCURRENCY:
- case SbxDATE:
+ case SbxSTRING:
+ case SbxLPSTR:
+ {
+ const OUString& rStr = rVar.GetOUString();
+ if( !bBinary || bIsArray )
+ {
if( bIsVariant )
- *pStrm << (sal_uInt16)eType; // VarType Id
- *pStrm << rVar.GetDouble();
- break;
-
- case SbxSTRING:
- case SbxLPSTR:
{
- const String& rStr = rVar.GetString();
- if( !bBinary || bIsArray )
- {
- if( bIsVariant )
- *pStrm << (sal_uInt16)SbxSTRING;
- pStrm->WriteUniOrByteString( rStr, osl_getThreadTextEncoding() );
+ *pStrm << (sal_uInt16)SbxSTRING;
}
- else
- {
- // without any length information! without end-identifier!
- // What does that mean for Unicode?! Choosing conversion to ByteString...
- rtl::OString aByteStr(rtl::OUStringToOString(rStr, osl_getThreadTextEncoding()));
- *pStrm << (const char*)aByteStr.getStr();
- }
- }
- break;
+ pStrm->WriteUniOrByteString( rStr, osl_getThreadTextEncoding() );
+ }
+ else
+ {
+ // without any length information! without end-identifier!
+ // What does that mean for Unicode?! Choosing conversion to ByteString...
+ rtl::OString aByteStr(rtl::OUStringToOString(rStr, osl_getThreadTextEncoding()));
+ *pStrm << (const char*)aByteStr.getStr();
+ }
+ }
+ break;
- default:
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return sal_False;
+ default:
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return sal_False;
}
if( nBlockLen )
+ {
pStrm->Seek( nFPos + nBlockLen );
+ }
return pStrm->GetErrorCode() ? sal_False : sal_True;
}
static sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
- sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray )
+ sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray )
{
(void)bBinary;
(void)bIsArray;
@@ -1024,88 +1100,91 @@ static sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
switch( eSrcType )
{
- case SbxBOOL:
- case SbxCHAR:
- case SbxBYTE:
- {
- sal_uInt8 aByte;
- *pStrm >> aByte;
-
- if( bBinary && SbiRuntime::isVBAEnabled() && aByte == 1 && pStrm->IsEof() )
- aByte = 0;
-
- rVar.PutByte( aByte );
- }
- break;
+ case SbxBOOL:
+ case SbxCHAR:
+ case SbxBYTE:
+ {
+ sal_uInt8 aByte;
+ *pStrm >> aByte;
- case SbxEMPTY:
- case SbxNULL:
- case SbxVOID:
- case SbxINTEGER:
- case SbxUSHORT:
- case SbxINT:
- case SbxUINT:
- {
- sal_Int16 aInt;
- *pStrm >> aInt;
- rVar.PutInteger( aInt );
- }
- break;
+ if( bBinary && SbiRuntime::isVBAEnabled() && aByte == 1 && pStrm->IsEof() )
+ {
+ aByte = 0;
+ }
+ rVar.PutByte( aByte );
+ }
+ break;
+
+ case SbxEMPTY:
+ case SbxNULL:
+ case SbxVOID:
+ case SbxINTEGER:
+ case SbxUSHORT:
+ case SbxINT:
+ case SbxUINT:
+ {
+ sal_Int16 aInt;
+ *pStrm >> aInt;
+ rVar.PutInteger( aInt );
+ }
+ break;
- case SbxLONG:
- case SbxULONG:
- {
- sal_Int32 aInt;
- *pStrm >> aInt;
- rVar.PutLong( aInt );
- }
- break;
- case SbxSALINT64:
- case SbxSALUINT64:
- {
- sal_uInt32 aInt;
- *pStrm >> aInt;
- rVar.PutInt64( (sal_Int64)aInt );
- }
- break;
- case SbxSINGLE:
- {
- float nS;
- *pStrm >> nS;
- rVar.PutSingle( nS );
- }
- break;
+ case SbxLONG:
+ case SbxULONG:
+ {
+ sal_Int32 aInt;
+ *pStrm >> aInt;
+ rVar.PutLong( aInt );
+ }
+ break;
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ {
+ sal_uInt32 aInt;
+ *pStrm >> aInt;
+ rVar.PutInt64( (sal_Int64)aInt );
+ }
+ break;
+ case SbxSINGLE:
+ {
+ float nS;
+ *pStrm >> nS;
+ rVar.PutSingle( nS );
+ }
+ break;
- case SbxDOUBLE:
- case SbxCURRENCY:
- {
- *pStrm >> aDouble;
- rVar.PutDouble( aDouble );
- }
- break;
+ case SbxDOUBLE:
+ case SbxCURRENCY:
+ {
+ *pStrm >> aDouble;
+ rVar.PutDouble( aDouble );
+ }
+ break;
- case SbxDATE:
- {
- *pStrm >> aDouble;
- rVar.PutDate( aDouble );
- }
- break;
+ case SbxDATE:
+ {
+ *pStrm >> aDouble;
+ rVar.PutDate( aDouble );
+ }
+ break;
- case SbxSTRING:
- case SbxLPSTR:
- {
- String aStr = pStrm->ReadUniOrByteString(osl_getThreadTextEncoding());
- rVar.PutString( aStr );
- }
- break;
+ case SbxSTRING:
+ case SbxLPSTR:
+ {
+ OUString aStr = pStrm->ReadUniOrByteString(osl_getThreadTextEncoding());
+ rVar.PutString( aStr );
+ }
+ break;
- default:
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return sal_False;
+ default:
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return sal_False;
}
if( nBlockLen )
+ {
pStrm->Seek( nFPos + nBlockLen );
+ }
return pStrm->GetErrorCode() ? sal_False : sal_True;
}
@@ -1237,13 +1316,15 @@ RTLFUNC(Environ)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- String aResult;
+ OUString aResult;
// should be ANSI but that's not possible under Win16 in the DLL
- rtl::OString aByteStr(rtl::OUStringToOString(rPar.Get(1)->GetString(),
- osl_getThreadTextEncoding()));
+ rtl::OString aByteStr(rtl::OUStringToOString(rPar.Get(1)->GetOUString(),
+ osl_getThreadTextEncoding()));
const char* pEnvStr = getenv(aByteStr.getStr());
if ( pEnvStr )
+ {
aResult = rtl::OUString::createFromAscii( pEnvStr );
+ }
rPar.Get(0)->PutString( aResult );
}
@@ -1349,12 +1430,14 @@ RTLFUNC(ResolvePath)
if ( rPar.Count() == 2 )
{
- String aStr = rPar.Get(1)->GetString();
+ OUString aStr = rPar.Get(1)->GetOUString();
DirEntry aEntry( aStr );
rPar.Get(0)->PutString( aStr );
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(TypeLen)
@@ -1363,70 +1446,73 @@ RTLFUNC(TypeLen)
(void)bWrite;
if ( rPar.Count() != 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
SbxDataType eType = rPar.Get(1)->GetType();
sal_Int16 nLen = 0;
switch( eType )
{
- case SbxEMPTY:
- case SbxNULL:
- case SbxVECTOR:
- case SbxARRAY:
- case SbxBYREF:
- case SbxVOID:
- case SbxHRESULT:
- case SbxPOINTER:
- case SbxDIMARRAY:
- case SbxCARRAY:
- case SbxUSERDEF:
- nLen = 0;
- break;
+ case SbxEMPTY:
+ case SbxNULL:
+ case SbxVECTOR:
+ case SbxARRAY:
+ case SbxBYREF:
+ case SbxVOID:
+ case SbxHRESULT:
+ case SbxPOINTER:
+ case SbxDIMARRAY:
+ case SbxCARRAY:
+ case SbxUSERDEF:
+ nLen = 0;
+ break;
- case SbxINTEGER:
- case SbxERROR:
- case SbxUSHORT:
- case SbxINT:
- case SbxUINT:
- nLen = 2;
- break;
+ case SbxINTEGER:
+ case SbxERROR:
+ case SbxUSHORT:
+ case SbxINT:
+ case SbxUINT:
+ nLen = 2;
+ break;
- case SbxLONG:
- case SbxSINGLE:
- case SbxULONG:
- nLen = 4;
- break;
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxULONG:
+ nLen = 4;
+ break;
- case SbxDOUBLE:
- case SbxCURRENCY:
- case SbxDATE:
- case SbxSALINT64:
- case SbxSALUINT64:
- nLen = 8;
- break;
+ case SbxDOUBLE:
+ case SbxCURRENCY:
+ case SbxDATE:
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ nLen = 8;
+ break;
- case SbxOBJECT:
- case SbxVARIANT:
- case SbxDATAOBJECT:
- nLen = 0;
- break;
+ case SbxOBJECT:
+ case SbxVARIANT:
+ case SbxDATAOBJECT:
+ nLen = 0;
+ break;
- case SbxCHAR:
- case SbxBYTE:
- case SbxBOOL:
- nLen = 1;
+ case SbxCHAR:
+ case SbxBYTE:
+ case SbxBOOL:
+ nLen = 1;
break;
- case SbxLPSTR:
- case SbxLPWSTR:
- case SbxCoreSTRING:
- case SbxSTRING:
- nLen = (sal_Int16)rPar.Get(1)->GetString().Len();
- break;
+ case SbxLPSTR:
+ case SbxLPWSTR:
+ case SbxCoreSTRING:
+ case SbxSTRING:
+ nLen = (sal_Int16)rPar.Get(1)->GetOUString().getLength();
+ break;
- default:
- nLen = 0;
+ default:
+ nLen = 0;
+ break;
}
rPar.Get(0)->PutInteger( nLen );
}
@@ -1538,8 +1624,9 @@ RTLFUNC(GlobalScope)
SbxObject* p = pBasic;
while( p->GetParent() )
+ {
p = p->GetParent();
-
+ }
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( p );
}
@@ -1552,17 +1639,23 @@ RTLFUNC(ConvertToUrl)
if ( rPar.Count() == 2 )
{
- String aStr = rPar.Get(1)->GetString();
+ OUString aStr = rPar.Get(1)->GetOUString();
INetURLObject aURLObj( aStr, INET_PROT_FILE );
- ::rtl::OUString aFileURL = aURLObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aFileURL = aURLObj.GetMainURL( INetURLObject::NO_DECODE );
if( aFileURL.isEmpty() )
+ {
::osl::File::getFileURLFromSystemPath( aFileURL, aFileURL );
+ }
if( aFileURL.isEmpty() )
+ {
aFileURL = aStr;
- rPar.Get(0)->PutString( String(aFileURL) );
+ }
+ rPar.Get(0)->PutString(aFileURL);
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
RTLFUNC(ConvertFromUrl)
@@ -1572,15 +1665,19 @@ RTLFUNC(ConvertFromUrl)
if ( rPar.Count() == 2 )
{
- String aStr = rPar.Get(1)->GetString();
- ::rtl::OUString aSysPath;
+ OUString aStr = rPar.Get(1)->GetOUString();
+ OUString aSysPath;
::osl::File::getSystemPathFromFileURL( aStr, aSysPath );
if( aSysPath.isEmpty() )
+ {
aSysPath = aStr;
- rPar.Get(0)->PutString( String(aSysPath) );
+ }
+ rPar.Get(0)->PutString(aSysPath);
}
else
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
}
@@ -1616,28 +1713,36 @@ RTLFUNC(Join)
if( pArr )
{
if( pArr->GetDims() != 1 )
+ {
StarBASIC::Error( SbERR_WRONG_DIMS ); // Syntax Error?!
-
- String aDelim;
+ }
+ OUString aDelim;
if( nParCount == 3 )
- aDelim = rPar.Get(2)->GetString();
+ {
+ aDelim = rPar.Get(2)->GetOUString();
+ }
else
- aDelim = rtl::OUString(" ");
-
- String aRetStr;
+ {
+ aDelim = " ";
+ }
+ OUString aRetStr;
short nLower, nUpper;
pArr->GetDim( 1, nLower, nUpper );
for( short i = nLower ; i <= nUpper ; ++i )
{
- String aStr = pArr->Get( &i )->GetString();
+ OUString aStr = pArr->Get( &i )->GetOUString();
aRetStr += aStr;
if( i != nUpper )
+ {
aRetStr += aDelim;
+ }
}
rPar.Get(0)->PutString( aRetStr );
}
else
+ {
StarBASIC::Error( SbERR_MUST_HAVE_DIMS );
+ }
}
@@ -1653,50 +1758,58 @@ RTLFUNC(Split)
return;
}
- String aExpression = rPar.Get(1)->GetString();
+ OUString aExpression = rPar.Get(1)->GetOUString();
short nArraySize = 0;
StringVector vRet;
- if( aExpression.Len() )
+ if( !aExpression.isEmpty() )
{
- String aDelim;
+ OUString aDelim;
if( nParCount >= 3 )
- aDelim = rPar.Get(2)->GetString();
+ {
+ aDelim = rPar.Get(2)->GetOUString();
+ }
else
- aDelim = rtl::OUString(" ");
+ {
+ aDelim = " ";
+ }
sal_Int32 nCount = -1;
if( nParCount == 4 )
+ {
nCount = rPar.Get(3)->GetLong();
-
- xub_StrLen nDelimLen = aDelim.Len();
+ }
+ sal_Int32 nDelimLen = aDelim.getLength();
if( nDelimLen )
{
- xub_StrLen iSearch = STRING_NOTFOUND;
- xub_StrLen iStart = 0;
+ sal_Int32 iSearch = -1;
+ sal_Int32 iStart = 0;
do
{
bool bBreak = false;
if( nCount >= 0 && nArraySize == nCount - 1 )
+ {
bBreak = true;
-
- iSearch = aExpression.Search( aDelim, iStart );
- String aSubStr;
- if( iSearch != STRING_NOTFOUND && !bBreak )
+ }
+ iSearch = aExpression.indexOf( aDelim, iStart );
+ OUString aSubStr;
+ if( iSearch >= 0 && !bBreak )
{
- aSubStr = aExpression.Copy( iStart, iSearch - iStart );
+ aSubStr = aExpression.copy( iStart, iSearch - iStart );
iStart = iSearch + nDelimLen;
}
else
{
- aSubStr = aExpression.Copy( iStart );
+ aSubStr = aExpression.copy( iStart );
}
vRet.push_back( aSubStr );
nArraySize++;
if( bBreak )
+ {
break;
+ }
}
- while( iSearch != STRING_NOTFOUND );
+ while( iSearch >= 0 );
}
else
{
@@ -1761,8 +1874,8 @@ RTLFUNC(MonthName)
const CalendarItem2* pCalendarItems = aMonthSeq.getConstArray();
const CalendarItem2& rItem = pCalendarItems[nVal - 1];
- ::rtl::OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName );
- rPar.Get(0)->PutString( String(aRetStr) );
+ OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName );
+ rPar.Get(0)->PutString(aRetStr);
}
// WeekdayName(weekday, abbreviate, firstdayofweek)
@@ -1799,8 +1912,9 @@ RTLFUNC(WeekdayName)
}
}
if( nFirstDay == 0 )
+ {
nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 );
-
+ }
nDay = 1 + (nDay + nDayCount + nFirstDay - 2) % nDayCount;
if( nDay < 1 || nDay > nDayCount )
{
@@ -1813,14 +1927,16 @@ RTLFUNC(WeekdayName)
{
SbxVariable* pPar2 = rPar.Get(2);
if( !pPar2->IsErr() )
+ {
bAbbreviate = pPar2->GetBool();
+ }
}
const CalendarItem2* pCalendarItems = aDaySeq.getConstArray();
const CalendarItem2& rItem = pCalendarItems[nDay - 1];
- ::rtl::OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName );
- rPar.Get(0)->PutString( String(aRetStr) );
+ OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName );
+ rPar.Get(0)->PutString( aRetStr );
}
RTLFUNC(Weekday)
@@ -1830,7 +1946,9 @@ RTLFUNC(Weekday)
sal_uInt16 nParCount = rPar.Count();
if ( nParCount < 2 )
+ {
StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
else
{
double aDate = rPar.Get(1)->GetDate();
@@ -1866,13 +1984,13 @@ enum Interval
struct IntervalInfo
{
Interval meInterval;
- const char* mpStringCode;
+ const OUString mStringCode;
double mdValue;
bool mbSimple;
- IntervalInfo( Interval eInterval, const char* pStringCode, double dValue, bool bSimple )
+ IntervalInfo( Interval eInterval, const OUString sStringCode, double dValue, bool bSimple )
: meInterval( eInterval )
- , mpStringCode( pStringCode )
+ , mStringCode( sStringCode )
, mdValue( dValue )
, mbSimple( bSimple )
{}
@@ -1890,17 +2008,19 @@ static IntervalInfo pIntervalTable[] =
IntervalInfo( INTERVAL_H, "h", (1.0 / 24.0), true ), // Hour
IntervalInfo( INTERVAL_N, "n", (1.0 / 1440.0), true), // Minute
IntervalInfo( INTERVAL_S, "s", (1.0 / 86400.0), true ), // Second
- IntervalInfo( INTERVAL_NONE, NULL, 0.0, false )
+ IntervalInfo( INTERVAL_NONE, "", 0.0, false )
};
-IntervalInfo* getIntervalInfo( const String& rStringCode )
+IntervalInfo* getIntervalInfo( const OUString& rStringCode )
{
IntervalInfo* pInfo = NULL;
sal_Int16 i = 0;
- while( (pInfo = pIntervalTable + i)->mpStringCode != NULL )
+ while( !(pInfo = pIntervalTable + i)->mStringCode.isEmpty() )
{
- if( rStringCode.EqualsIgnoreCaseAscii( pInfo->mpStringCode ) )
+ if( rStringCode.equalsIgnoreAsciiCase( pInfo->mStringCode ) )
+ {
break;
+ }
i++;
}
return pInfo;
@@ -1916,9 +2036,13 @@ inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int1
inline sal_Int16 limitToINT16( sal_Int32 n32 )
{
if( n32 > 32767 )
+ {
n32 = 32767;
+ }
else if( n32 < -32768 )
+ {
n32 = -32768;
+ }
return (sal_Int16)n32;
}
@@ -1934,7 +2058,7 @@ RTLFUNC(DateAdd)
return;
}
- String aStringCode = rPar.Get(1)->GetString();
+ OUString aStringCode = rPar.Get(1)->GetOUString();
IntervalInfo* pInfo = getIntervalInfo( aStringCode );
if( !pInfo )
{
@@ -2059,7 +2183,7 @@ RTLFUNC(DateDiff)
return;
}
- String aStringCode = rPar.Get(1)->GetString();
+ OUString aStringCode = rPar.Get(1)->GetOUString();
IntervalInfo* pInfo = getIntervalInfo( aStringCode );
if( !pInfo )
{
@@ -2259,7 +2383,7 @@ RTLFUNC(DatePart)
return;
}
- String aStringCode = rPar.Get(1)->GetString();
+ OUString aStringCode = rPar.Get(1)->GetOUString();
IntervalInfo* pInfo = getIntervalInfo( aStringCode );
if( !pInfo )
{
@@ -2399,7 +2523,7 @@ RTLFUNC(FormatDateTime)
return;
}
- String aRetStr;
+ OUString aRetStr;
SbxVariableRef pSbxVar = new SbxVariable( SbxSTRING );
switch( nNamedFormat )
{
@@ -2410,20 +2534,22 @@ RTLFUNC(FormatDateTime)
// 12/21/2004 11:24:50 AM
// 21.12.2004 12:13:51
- case 0:
- pSbxVar->PutDate( dDate );
- aRetStr = pSbxVar->GetString();
- break;
+ case 0:
+ pSbxVar->PutDate( dDate );
+ aRetStr = pSbxVar->GetOUString();
+ break;
// LongDate: Display a date using the long date format specified
// in your computer's regional settings.
// Tuesday, December 21, 2004
// Dienstag, 21. December 2004
- case 1:
+ case 1:
{
SvNumberFormatter* pFormatter = NULL;
if( GetSbData()->pInst )
+ {
pFormatter = GetSbData()->pInst->GetNumberFormatter();
+ }
else
{
sal_uInt32 n; // Dummy
@@ -2436,35 +2562,40 @@ RTLFUNC(FormatDateTime)
pFormatter->GetOutputString( dDate, nIndex, aRetStr, &pCol );
if( !GetSbData()->pInst )
+ {
delete pFormatter;
-
+ }
break;
}
// ShortDate: Display a date using the short date format specified
// in your computer's regional settings.
// 21.12.2004
- case 2:
- pSbxVar->PutDate( floor(dDate) );
- aRetStr = pSbxVar->GetString();
- break;
+ case 2:
+ pSbxVar->PutDate( floor(dDate) );
+ aRetStr = pSbxVar->GetOUString();
+ break;
// LongTime: Display a time using the time format specified
// in your computer's regional settings.
// 11:24:50 AM
// 12:13:51
- case 3:
+ case 3:
// ShortTime: Display a time using the 24-hour format (hh:mm).
// 11:24
- case 4:
- double n;
- double dTime = modf( dDate, &n );
- pSbxVar->PutDate( dTime );
- if( nNamedFormat == 3 )
- aRetStr = pSbxVar->GetString();
- else
- aRetStr = pSbxVar->GetString().Copy( 0, 5 );
- break;
+ case 4:
+ double n;
+ double dTime = modf( dDate, &n );
+ pSbxVar->PutDate( dTime );
+ if( nNamedFormat == 3 )
+ {
+ aRetStr = pSbxVar->GetOUString();
+ }
+ else
+ {
+ aRetStr = pSbxVar->GetOUString().copy( 0, 5 );
+ }
+ break;
}
rPar.Get(0)->PutString( aRetStr );
@@ -2554,7 +2685,7 @@ void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUStri
Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
if( xFactory.is() )
{
- xFunc.set( xFactory->createInstance(::rtl::OUString("com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
+ xFunc.set( xFactory->createInstance(OUString("com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
}
}
Any aRet = xFunc->callFunction( sFuncName, aArgs );
@@ -2589,7 +2720,7 @@ RTLFUNC(SYD)
aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
- CallFunctionAccessFunction( aParams, rtl::OUString( "SYD" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "SYD" ), rPar.Get( 0 ) );
}
RTLFUNC(SLN)
@@ -2612,7 +2743,7 @@ RTLFUNC(SLN)
aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
- CallFunctionAccessFunction( aParams, rtl::OUString( "SLN" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "SLN" ), rPar.Get( 0 ) );
}
RTLFUNC(Pmt)
@@ -2657,7 +2788,7 @@ RTLFUNC(Pmt)
aParams[ 3 ] <<= fv;
aParams[ 4 ] <<= type;
- CallFunctionAccessFunction( aParams, rtl::OUString( "Pmt" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "Pmt" ), rPar.Get( 0 ) );
}
RTLFUNC(PPmt)
@@ -2704,7 +2835,7 @@ RTLFUNC(PPmt)
aParams[ 4 ] <<= fv;
aParams[ 5 ] <<= type;
- CallFunctionAccessFunction( aParams, rtl::OUString( "PPmt" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "PPmt" ), rPar.Get( 0 ) );
}
RTLFUNC(PV)
@@ -2749,7 +2880,7 @@ RTLFUNC(PV)
aParams[ 3 ] <<= fv;
aParams[ 4 ] <<= type;
- CallFunctionAccessFunction( aParams, rtl::OUString( "PV" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "PV" ), rPar.Get( 0 ) );
}
RTLFUNC(NPV)
@@ -2777,7 +2908,7 @@ RTLFUNC(NPV)
aParams[ 1 ] <<= aValues;
- CallFunctionAccessFunction( aParams, rtl::OUString( "NPV" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "NPV" ), rPar.Get( 0 ) );
}
RTLFUNC(NPer)
@@ -2822,7 +2953,7 @@ RTLFUNC(NPer)
aParams[ 3 ] <<= fv;
aParams[ 4 ] <<= type;
- CallFunctionAccessFunction( aParams, rtl::OUString( "NPer" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "NPer" ), rPar.Get( 0 ) );
}
RTLFUNC(MIRR)
@@ -2853,7 +2984,7 @@ RTLFUNC(MIRR)
aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
- CallFunctionAccessFunction( aParams, rtl::OUString( "MIRR" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "MIRR" ), rPar.Get( 0 ) );
}
RTLFUNC(IRR)
@@ -2890,7 +3021,7 @@ RTLFUNC(IRR)
aParams[ 0 ] <<= aValues;
aParams[ 1 ] <<= guess;
- CallFunctionAccessFunction( aParams, rtl::OUString( "IRR" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "IRR" ), rPar.Get( 0 ) );
}
RTLFUNC(IPmt)
@@ -2937,7 +3068,7 @@ RTLFUNC(IPmt)
aParams[ 4 ] <<= fv;
aParams[ 5 ] <<= type;
- CallFunctionAccessFunction( aParams, rtl::OUString( "IPmt" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "IPmt" ), rPar.Get( 0 ) );
}
RTLFUNC(FV)
@@ -2982,7 +3113,7 @@ RTLFUNC(FV)
aParams[ 3 ] <<= pv;
aParams[ 4 ] <<= type;
- CallFunctionAccessFunction( aParams, rtl::OUString( "FV" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "FV" ), rPar.Get( 0 ) );
}
RTLFUNC(DDB)
@@ -3021,7 +3152,7 @@ RTLFUNC(DDB)
aParams[ 3 ] <<= period;
aParams[ 4 ] <<= factor;
- CallFunctionAccessFunction( aParams, rtl::OUString( "DDB" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "DDB" ), rPar.Get( 0 ) );
}
RTLFUNC(Rate)
@@ -3080,7 +3211,7 @@ RTLFUNC(Rate)
aParams[ 4 ] <<= type;
aParams[ 5 ] <<= guess;
- CallFunctionAccessFunction( aParams, rtl::OUString( "Rate" ), rPar.Get( 0 ) );
+ CallFunctionAccessFunction( aParams, OUString( "Rate" ), rPar.Get( 0 ) );
}
RTLFUNC(StrReverse)
@@ -3101,7 +3232,7 @@ RTLFUNC(StrReverse)
return;
}
- rtl::OUString aStr = comphelper::string::reverseString(pSbxVariable->GetString());
+ rtl::OUString aStr = comphelper::string::reverseString(pSbxVariable->GetOUString());
rPar.Get(0)->PutString( aStr );
}
@@ -3119,8 +3250,9 @@ RTLFUNC(CompatibilityMode)
if( pInst )
{
if ( nCount == 2 )
+ {
pInst->EnableCompatibility( rPar.Get(1)->GetBool() );
-
+ }
bEnabled = pInst->IsCompatibility();
}
rPar.Get(0)->PutBool( bEnabled );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 0a19676debf9..3c2c661cc9fc 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -241,19 +241,19 @@ void SbiInstance::CalcBreakCallLevel( sal_uInt16 nFlags )
sal_uInt16 nRet;
switch( nFlags )
{
- case SbDEBUG_STEPINTO:
- nRet = nCallLvl + 1; // CallLevel+1 is also stopped
- break;
- case SbDEBUG_STEPOVER | SbDEBUG_STEPINTO:
- nRet = nCallLvl; // current CallLevel is stopped
- break;
- case SbDEBUG_STEPOUT:
- nRet = nCallLvl - 1; // smaller CallLevel is stopped
- break;
- case SbDEBUG_CONTINUE:
+ case SbDEBUG_STEPINTO:
+ nRet = nCallLvl + 1; // CallLevel+1 is also stopped
+ break;
+ case SbDEBUG_STEPOVER | SbDEBUG_STEPINTO:
+ nRet = nCallLvl; // current CallLevel is stopped
+ break;
+ case SbDEBUG_STEPOUT:
+ nRet = nCallLvl - 1; // smaller CallLevel is stopped
+ break;
+ case SbDEBUG_CONTINUE:
// Basic-IDE returns 0 instead of SbDEBUG_CONTINUE, so also default=continue
- default:
- nRet = 0; // CallLevel is always > 0 -> no StepPoint
+ default:
+ nRet = 0; // CallLevel is always > 0 -> no StepPoint
}
nBreakCallLvl = nRet; // take result
}
@@ -312,7 +312,9 @@ SbiInstance::~SbiInstance()
SbiDllMgr* SbiInstance::GetDllMgr()
{
if( !pDllMgr )
+ {
pDllMgr = new SbiDllMgr;
+ }
return pDllMgr;
}
@@ -334,8 +336,10 @@ SvNumberFormatter* SbiInstance::GetNumberFormatter()
meFormatterLangType = eLangType;
meFormatterDateFormat = eDate;
if( !pNumberFormatter )
+ {
PrepareNumberFormatter( pNumberFormatter, nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx,
&meFormatterLangType, &meFormatterDateFormat );
+ }
return pNumberFormatter;
}
@@ -349,13 +353,18 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
LanguageType eLangType;
if( peFormatterLangType )
+ {
eLangType = *peFormatterLangType;
+ }
else
+ {
eLangType = GetpApp()->GetSettings().GetLanguage();
-
+ }
DateFormat eDate;
if( peFormatterDateFormat )
+ {
eDate = *peFormatterDateFormat;
+ }
else
{
SvtSysLocale aSysLocale;
@@ -364,7 +373,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
rpNumberFormatter = new SvNumberFormatter( xFactory, eLangType );
- xub_StrLen nCheckPos = 0; short nType;
+ sal_uInt16 nCheckPos = 0; short nType;
rnStdTimeIdx = rpNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eLangType );
// the formatter's standard templates have only got a two-digit date
@@ -375,33 +384,32 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
// Problem: Print Year(Date) under engl. BS
// also have a look at: svtools\source\sbx\sbxdate.cxx
- String aDateStr;
+ OUString aDateStr;
switch( eDate )
{
- case MDY: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("MM.TT.JJJJ") ); break;
- case DMY: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("TT.MM.JJJJ") ); break;
- case YMD: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("JJJJ.MM.TT") ); break;
- default: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("MM.TT.JJJJ") );
+ case MDY: aDateStr = "MM.TT.JJJJ"; break;
+ case DMY: aDateStr = "TT.MM.JJJJ"; break;
+ case YMD: aDateStr = "JJJJ.MM.TT"; break;
+ default: aDateStr = "MM.TT.JJJJ"; break;
}
- String aStr( aDateStr );
- rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType,
+ rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType,
rnStdDateIdx, LANGUAGE_GERMAN, eLangType );
nCheckPos = 0;
- String aStrHHMMSS( RTL_CONSTASCII_USTRINGPARAM(" HH:MM:SS") );
- aStr = aDateStr;
- aStr += aStrHHMMSS;
- rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType,
+ OUString aStrHHMMSS(" HH:MM:SS");
+ aDateStr += aStrHHMMSS;
+ rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType,
rnStdDateTimeIdx, LANGUAGE_GERMAN, eLangType );
}
-
// Let engine run. If Flags == SbDEBUG_CONTINUE, take Flags over
void SbiInstance::Stop()
{
for( SbiRuntime* p = pRun; p; p = p->pNext )
+ {
p->Stop();
+ }
}
// Allows Basic IDE to set watch mode to suppress errors
@@ -414,10 +422,10 @@ void setBasicWatchMode( bool bOn )
void SbiInstance::Error( SbError n )
{
- Error( n, String() );
+ Error( n, OUString() );
}
-void SbiInstance::Error( SbError n, const String& rMsg )
+void SbiInstance::Error( SbError n, const OUString& rMsg )
{
if( !bWatchMode )
{
@@ -426,14 +434,15 @@ void SbiInstance::Error( SbError n, const String& rMsg )
}
}
-void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg )
+void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg )
{
if( !bWatchMode )
{
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
-
+ }
aErrorMsg = rMsg;
SbiRuntime::translateErrorToVba( n, aErrorMsg );
@@ -442,12 +451,13 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg )
}
}
-void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const String& rMsg )
+void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const OUString& rMsg )
{
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
-
+ }
aErrorMsg = rMsg;
SbiRuntime::translateErrorToVba( n, aErrorMsg );
@@ -460,7 +470,7 @@ void SbiInstance::FatalError( SbError n )
pRun->FatalError( n );
}
-void SbiInstance::FatalError( SbError _errCode, const String& _details )
+void SbiInstance::FatalError( SbError _errCode, const OUString& _details )
{
pRun->FatalError( _errCode, _details );
}
@@ -481,7 +491,9 @@ StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic )
{
SbxObject* pParent = pActiveModule->GetParent();
if( pParent && pParent->ISA(StarBASIC) )
+ {
pCurBasic = (StarBASIC*)pParent;
+ }
}
return pCurBasic;
}
@@ -489,20 +501,23 @@ StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic )
SbModule* SbiInstance::GetActiveModule()
{
if( pRun )
+ {
return pRun->GetModule();
+ }
else
+ {
return NULL;
+ }
}
SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel )
{
SbiRuntime* p = pRun;
while( nLevel-- && p )
+ {
p = p->pNext;
- if( p )
- return p->GetCaller();
- else
- return NULL;
+ }
+ return p ? p->GetCaller() : NULL;
}
// SbiInstance //
@@ -571,10 +586,14 @@ void SbiRuntime::SetVBAEnabled(bool bEnabled )
if ( bVBAEnabled )
{
if ( pMeth )
+ {
mpExtCaller = pMeth->mCaller;
+ }
}
else
+ {
mpExtCaller = 0;
+ }
}
// Construction of the parameter list. All ByRef-parameters are directly
@@ -629,14 +648,18 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
if( !bByVal && t != SbxVARIANT &&
(!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) )
- bByVal = sal_True;
+ {
+ bByVal = sal_True;
+ }
bTargetTypeIsArray = (p->nUserData & PARAM_INFO_WITHBRACKETS) != 0;
}
if( bByVal )
{
if( bTargetTypeIsArray )
+ {
t = SbxOBJECT;
+ }
SbxVariable* v2 = new SbxVariable( t );
v2->SetFlag( SBX_READWRITE );
*v2 = *v;
@@ -647,14 +670,20 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
if( t != SbxVARIANT && t != ( v->GetType() & 0x0FFF ) )
{
if( p && (p->eType & SbxARRAY) )
+ {
Error( SbERR_CONVERSION );
+ }
else
+ {
v->Convert( t );
+ }
}
refParams->Put( v, i );
}
if( p )
+ {
refParams->PutAlias( p->aName, i );
+ }
}
}
@@ -697,7 +726,9 @@ bool SbiRuntime::Step()
while( bBlocked )
{
if( pInst->IsReschedule() )
+ {
Application::Reschedule();
+ }
}
SbiOpcode eOp = (SbiOpcode ) ( *pCode++ );
@@ -719,8 +750,9 @@ bool SbiRuntime::Step()
(this->*( aStep2[ eOp - SbOP2_START ] ) )( nOp1, nOp2 );
}
else
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
-
+ }
SbError nSbError = SbxBase::GetError();
Error( ERRCODE_TOERROR(nSbError) );
@@ -730,7 +762,9 @@ bool SbiRuntime::Step()
// since nError can now also be set from other RT-instances
if( nError )
+ {
SbxBase::ResetError();
+ }
// from 15.3.96: display errors only if BASIC is still active
// (especially not after compiler errors at the runtime)
@@ -754,11 +788,17 @@ bool SbiRuntime::Step()
bInError = true;
if( !bError ) // On Error Resume Next
+ {
StepRESUME( 1 );
+ }
else if( pError ) // On Error Goto ...
+ {
pCode = pError;
+ }
else
+ {
bLetParentHandleThis = true;
+ }
}
else
{
@@ -791,9 +831,13 @@ bool SbiRuntime::Step()
{
pRt->nError = err;
if( pRt != pRtErrHdl )
+ {
pRt->bRun = false;
+ }
else
+ {
break;
+ }
pRt = pRt->pNext;
}
while( pRt );
@@ -803,7 +847,6 @@ bool SbiRuntime::Step()
{
pInst->Abort();
}
-
}
}
}
@@ -817,20 +860,21 @@ void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone )
nError = n;
if( isVBAEnabled() && !bVBATranslationAlreadyDone )
{
- String aMsg = pInst->GetErrorMsg();
+ OUString aMsg = pInst->GetErrorMsg();
sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg );
SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject();
SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar );
if( pGlobErr != NULL )
+ {
pGlobErr->setNumberAndDescription( nVBAErrorNumber, aMsg );
-
+ }
pInst->aErrorMsg = aMsg;
nError = SbERR_BASIC_COMPAT;
}
}
}
-void SbiRuntime::Error( SbError _errCode, const String& _details )
+void SbiRuntime::Error( SbError _errCode, const OUString& _details )
{
if ( _errCode )
{
@@ -854,20 +898,20 @@ void SbiRuntime::FatalError( SbError n )
Error( n );
}
-void SbiRuntime::FatalError( SbError _errCode, const String& _details )
+void SbiRuntime::FatalError( SbError _errCode, const OUString& _details )
{
StepSTDERROR();
Error( _errCode, _details );
}
-sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
+sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, OUString& rMsg )
{
// If a message is defined use that ( in preference to
// the defined one for the error ) NB #TODO
// if there is an error defined it more than likely
// is not the one you want ( some are the same though )
// we really need a new vba compatible error list
- if ( !rMsg.Len() )
+ if ( rMsg.isEmpty() )
{
// TEST, has to be vb here always
#ifdef DBG_UTIL
@@ -877,8 +921,10 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
StarBASIC::MakeErrorText( nError, rMsg );
rMsg = StarBASIC::GetErrorText();
- if ( !rMsg.Len() ) // no message for err no, need localized resource here
- rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
+ if ( rMsg.isEmpty() ) // no message for err no, need localized resource here
+ {
+ rMsg = "Internal Object Error:";
+ }
}
// no num? most likely then it *is* really a vba err
sal_uInt16 nVBErrorCode = StarBASIC::GetVBErrorCode( nError );
@@ -901,7 +947,9 @@ SbMethod* SbiRuntime::GetCaller()
void SbiRuntime::PushVar( SbxVariable* pVar )
{
if( pVar )
+ {
refExprStk->Put( pVar, nExprLvl++ );
+ }
}
SbxVariableRef SbiRuntime::PopVar()
@@ -915,12 +963,14 @@ SbxVariableRef SbiRuntime::PopVar()
#endif
SbxVariableRef xVar = refExprStk->Get( --nExprLvl );
#ifdef DBG_UTIL
- if ( xVar->GetName().EqualsAscii( "Cells" ) )
+ if ( xVar->GetName().equalsAscii( "Cells" ) )
OSL_TRACE( "" );
#endif
// methods hold themselves in parameter 0
if( xVar->IsA( TYPE(SbxMethod) ) )
+ {
xVar->SetParameters(0);
+ }
return xVar;
}
@@ -956,7 +1006,9 @@ void SbiRuntime::TOSMakeTemp()
{
SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
if ( p->GetType() == SbxEMPTY )
+ {
p->Broadcast( SBX_HINT_DATAWANTED );
+ }
SbxVariable* pDflt = NULL;
if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ((pDflt = getDefaultProp(p)) != NULL) )
@@ -971,7 +1023,6 @@ void SbiRuntime::TOSMakeTemp()
p->SetFlag( SBX_READWRITE );
refExprStk->Put( p, nExprLvl - 1 );
}
-
else if( p->GetRefCount() != 1 )
{
SbxVariable* pNew = new SbxVariable( *p );
@@ -984,7 +1035,9 @@ void SbiRuntime::TOSMakeTemp()
void SbiRuntime::PushGosub( const sal_uInt8* pc )
{
if( ++nGosubLvl > MAXRECURSION )
+ {
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
+ }
SbiGosubStack* p = new SbiGosubStack;
p->pCode = pc;
p->pNext = pGosubStk;
@@ -995,7 +1048,9 @@ void SbiRuntime::PushGosub( const sal_uInt8* pc )
void SbiRuntime::PopGosub()
{
if( !pGosubStk )
+ {
Error( SbERR_NO_GOSUB );
+ }
else
{
SbiGosubStack* p = pGosubStk;
@@ -1011,7 +1066,9 @@ void SbiRuntime::ClearGosubStack()
{
SbiGosubStack* p;
while(( p = pGosubStk ) != NULL )
+ {
pGosubStk = p->pNext, delete p;
+ }
nGosubLvl = 0;
}
@@ -1044,7 +1101,9 @@ void SbiRuntime::PopArgv()
void SbiRuntime::ClearArgvStack()
{
while( pArgvStk )
+ {
PopArgv();
+ }
}
// Push of the for-stack. The stack has increment, end, begin and variable.
@@ -1129,9 +1188,10 @@ void SbiRuntime::PushForEach()
catch(const uno::Exception& )
{}
}
-
if ( !p->xEnumeration.is() )
+ {
bError_ = true;
+ }
}
else
{
@@ -1170,7 +1230,9 @@ void SbiRuntime::PopFor()
void SbiRuntime::ClearForStack()
{
while( pForStk )
+ {
PopFor();
+ }
}
SbiForStack* SbiRuntime::FindForStackItemForCollection( class BasicCollection* pCollection )
@@ -1194,8 +1256,8 @@ SbiForStack* SbiRuntime::FindForStackItemForCollection( class BasicCollection* p
// DLL-calls
void SbiRuntime::DllCall
- ( const String& aFuncName,
- const String& aDLLName,
+ ( const OUString& aFuncName,
+ const OUString& aDLLName,
SbxArray* pArgs, // parameter (from index 1, can be NULL)
SbxDataType eResType, // return value
bool bCDecl ) // true: according to C-conventions
@@ -1213,7 +1275,9 @@ void SbiRuntime::DllCall
SbiDllMgr* pDllMgr = pInst->GetDllMgr();
SbError nErr = pDllMgr->Call( aFuncName, aDLLName, pArgs, *pRes, bCDecl );
if( nErr )
+ {
Error( nErr );
+ }
PushVar( pRes );
}
diff --git a/basic/source/runtime/sbdiagnose.cxx b/basic/source/runtime/sbdiagnose.cxx
index 95d2332e9900..2168c04956f2 100644
--- a/basic/source/runtime/sbdiagnose.cxx
+++ b/basic/source/runtime/sbdiagnose.cxx
@@ -31,7 +31,7 @@
static DbgChannelId nRestoreChannelId = 0;
static DbgChannelId nAssertionChannelId = 0;
static StarBASICRef xAssertionChannelBasic;
-static String sCaptureFunctionName;
+static OUString sCaptureFunctionName;
static bool bReportingAssertion = false;
void ResetCapturedAssertions()
@@ -42,7 +42,7 @@ void ResetCapturedAssertions()
}
nRestoreChannelId = 0;
xAssertionChannelBasic = NULL;
- sCaptureFunctionName = String();
+ sCaptureFunctionName = OUString();
bReportingAssertion = false;
}
@@ -56,7 +56,9 @@ void DbgReportAssertion( const sal_Char* i_assertionMessage )
// prevent infinite recursion
if ( bReportingAssertion )
+ {
return;
+ }
::comphelper::FlagRestorationGuard aGuard( bReportingAssertion, true );
SbxArrayRef const xArguments( new SbxArray( SbxVARIANT ) );
@@ -66,7 +68,9 @@ void DbgReportAssertion( const sal_Char* i_assertionMessage )
ErrCode const nError = xAssertionChannelBasic->Call( sCaptureFunctionName, xArguments );
if ( ( nError & SbERR_METHOD_NOT_FOUND ) != 0 )
+ {
ResetCapturedAssertions();
+ }
}
#endif
@@ -86,8 +90,8 @@ RTLFUNC(CaptureAssertions)
#ifdef DBG_UTIL
DBG_TESTSOLARMUTEX();
- String const sFunctionName = rPar.Get(1)->GetString();
- if ( sFunctionName.Len() == 0 )
+ OUString const sFunctionName = rPar.Get(1)->GetOUString();
+ if ( sFunctionName.isEmpty() )
{
ResetCapturedAssertions();
return;
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 8182afff7977..2a69f445d513 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -72,9 +72,9 @@ struct Methods {
struct StringHashCode
{
- size_t operator()( const String& rStr ) const
+ size_t operator()( const OUString& rStr ) const
{
- return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
+ return rtl_ustr_hashCode_WithLength( rStr.getStr(), rStr.getLength() );
}
};
@@ -715,21 +715,21 @@ static Methods aMethods[] = {
{ NULL, SbxNULL, -1,NULL,0 }}; // end of the table
-SbiStdObject::SbiStdObject( const String& r, StarBASIC* pb ) : SbxObject( r )
+SbiStdObject::SbiStdObject( const OUString& r, StarBASIC* pb ) : SbxObject( r )
{
// do we have to initialize the hashcodes?
Methods* p = aMethods;
if( !p->nHash )
while( p->nArgs != -1 )
{
- String aName_ = rtl::OUString::createFromAscii( p->pName );
+ OUString aName_ = rtl::OUString::createFromAscii( p->pName );
p->nHash = SbxVariable::MakeHashCode( aName_ );
p += ( p->nArgs & _ARGSMASK ) + 1;
}
// #i92642: Remove default properties
- Remove( rtl::OUString("Name"), SbxCLASS_DONTCARE );
- Remove( rtl::OUString("Parent"), SbxCLASS_DONTCARE );
+ Remove( OUString("Name"), SbxCLASS_DONTCARE );
+ Remove( OUString("Parent"), SbxCLASS_DONTCARE );
SetParent( pb );
@@ -753,7 +753,7 @@ SbiStdObject::~SbiStdObject()
// return NULL without error code, so that a whole chain of
// objects can be asked for the method/property.
-SbxVariable* SbiStdObject::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbiStdObject::Find( const OUString& rName, SbxClassType t )
{
// entered already?
SbxVariable* pVar = SbxObject::Find( rName, t );
@@ -798,12 +798,16 @@ SbxVariable* SbiStdObject::Find( const rtl::OUString& rName, SbxClassType t )
short nType = ( p->nArgs & _TYPEMASK );
if( p->nArgs & _CONST )
nAccess |= SBX_CONST;
- String aName_ = rtl::OUString::createFromAscii( p->pName );
+ OUString aName_ = rtl::OUString::createFromAscii( p->pName );
SbxClassType eCT = SbxCLASS_OBJECT;
if( nType & _PROPERTY )
+ {
eCT = SbxCLASS_PROPERTY;
+ }
else if( nType & _METHOD )
+ {
eCT = SbxCLASS_METHOD;
+ }
pVar = Make( aName_, eCT, p->eType );
pVar->SetUserData( nIndex + 1 );
pVar->SetFlags( nAccess );
@@ -869,10 +873,12 @@ SbxInfo* SbiStdObject::GetInfo( short nIdx )
for( short i = 0; i < nPar; i++ )
{
p++;
- String aName_ = rtl::OUString::createFromAscii( p->pName );
+ OUString aName_ = rtl::OUString::createFromAscii( p->pName );
sal_uInt16 nFlags_ = ( p->nArgs >> 8 ) & 0x03;
if( p->nArgs & _OPT )
+ {
nFlags_ |= SBX_OPTIONAL;
+ }
pInfo_->AddParam( aName_, p->eType, nFlags_ );
}
return pInfo_;
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index 0cd55efb3a6f..6b8f6a9bf7c6 100644
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -46,7 +46,7 @@ SbStdFactory::SbStdFactory()
{
}
-SbxObject* SbStdFactory::CreateObject( const rtl::OUString& rClassName )
+SbxObject* SbStdFactory::CreateObject( const OUString& rClassName )
{
if( rClassName.equalsIgnoreAsciiCase("Picture") )
return new SbStdPicture;
@@ -115,16 +115,16 @@ void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
TYPEINIT1( SbStdPicture, SbxObject );
SbStdPicture::SbStdPicture() :
- SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Picture") ) )
+ SbxObject( OUString("Picture"))
{
// Properties
- SbxVariable* p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Type") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ SbxVariable* p = Make( OUString("Type"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READ | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_TYPE );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Width") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ p = Make( OUString("Width"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READ | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_WIDTH );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Height") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ p = Make( OUString("Height"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READ | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_HEIGHT );
}
@@ -134,7 +134,7 @@ SbStdPicture::~SbStdPicture()
}
-SbxVariable* SbStdPicture::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbStdPicture::Find( const OUString& rName, SbxClassType t )
{
// entered already?
return SbxObject::Find( rName, t );
@@ -218,36 +218,40 @@ void SbStdFont::PropSize( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, sal_Bool bWrite )
{
if( bWrite )
- SetFontName( pVar->GetString() );
+ {
+ SetFontName( pVar->GetOUString() );
+ }
else
+ {
pVar->PutString( GetFontName() );
+ }
}
TYPEINIT1( SbStdFont, SbxObject );
SbStdFont::SbStdFont() :
- SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Font") ) )
+ SbxObject( OUString("Font") )
{
// Properties
- SbxVariable* p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Bold") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ SbxVariable* p = Make( OUString("Bold"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READWRITE | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_BOLD );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Italic") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ p = Make( OUString("Italic"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READWRITE | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_ITALIC );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("StrikeThrough") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ p = Make( OUString("StrikeThrough"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READWRITE | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_STRIKETHROUGH );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Underline") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ p = Make( OUString("Underline"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READWRITE | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_UNDERLINE );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Size") ), SbxCLASS_PROPERTY, SbxVARIANT );
+ p = Make( OUString("Size"), SbxCLASS_PROPERTY, SbxVARIANT );
p->SetFlags( SBX_READWRITE | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_SIZE );
// handle name property yourself
- p = Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY );
+ p = Find( OUString("Name"), SbxCLASS_PROPERTY );
DBG_ASSERT( p, "Keine Name Property" );
p->SetUserData( ATTR_IMP_NAME );
}
@@ -257,7 +261,7 @@ SbStdFont::~SbStdFont()
}
-SbxVariable* SbStdFont::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbStdFont::Find( const OUString& rName, SbxClassType t )
{
return SbxObject::Find( rName, t );
}
@@ -356,7 +360,7 @@ void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
return;
}
- pVar->PutString( String() );
+ pVar->PutString( OUString() );
}
void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
@@ -394,29 +398,29 @@ void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
TYPEINIT1( SbStdClipboard, SbxObject );
SbStdClipboard::SbStdClipboard() :
- SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Clipboard") ) )
+ SbxObject( OUString("Clipboard") )
{
- SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY );
+ SbxVariable* p = Find( OUString("Name"), SbxCLASS_PROPERTY );
DBG_ASSERT( p, "Keine Name Property" );
p->SetUserData( ATTR_IMP_NAME );
// register methods
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Clear") ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString("Clear"), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_CLEAR );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("GetData") ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString("GetData"), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_GETDATA );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("GetFormat") ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString("GetFormat"), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_GETFORMAT );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("GetText") ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString("GetText"), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_GETTEXT );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("SetData") ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString("SetData"), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_SETDATA );
- p = Make( String( RTL_CONSTASCII_USTRINGPARAM("SetText") ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( OUString("SetText"), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_SETTEXT );
}
@@ -426,7 +430,7 @@ SbStdClipboard::~SbStdClipboard()
}
-SbxVariable* SbStdClipboard::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbStdClipboard::Find( const OUString& rName, SbxClassType t )
{
return SbxObject::Find( rName, t );
}
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 05a2759af4ef..dc0798499e74 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -35,8 +35,8 @@
#include <vcl/svapp.hxx>
#include <unotools/textsearch.hxx>
-Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
- const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
+Reference< XInterface > createComListener( const Any& aControlAny, const OUString& aVBAType,
+ const OUString& aPrefix, SbxObjectRef xScopeObj );
#include <algorithm>
#include <boost/unordered_map.hpp>
@@ -179,79 +179,101 @@ namespace
{
bool NeedEsc(sal_Unicode cCode)
{
- String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
- return (STRING_NOTFOUND != sEsc.Search(cCode));
+ if((cCode & 0xFF80))
+ {
+ return false;
+ }
+ switch((sal_uInt8)(cCode & 0x07F))
+ {
+ case '.':
+ case '^':
+ case '$':
+ case '+':
+ case '\\':
+ case '|':
+ case '{':
+ case '}':
+ case '(':
+ case ')':
+ return true;
+ default:
+ return false;
+ }
}
- String VBALikeToRegexp(const String &rIn)
+ OUString VBALikeToRegexp(const OUString &rIn)
{
- String sResult;
- const sal_Unicode *start = rIn.GetBuffer();
- const sal_Unicode *end = start + rIn.Len();
+ OUStringBuffer sResult;
+ const sal_Unicode *start = rIn.getStr();
+ const sal_Unicode *end = start + rIn.getLength();
int seenright = 0;
- sResult.Append('^');
+ sResult.append('^');
while (start < end)
{
switch (*start)
{
- case '?':
- sResult.Append('.');
- start++;
- break;
- case '*':
- sResult.Append(String(RTL_CONSTASCII_USTRINGPARAM(".*")));
- start++;
- break;
- case '#':
- sResult.Append(String(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
- start++;
- break;
- case ']':
- sResult.Append('\\');
- sResult.Append(*start++);
- break;
- case '[':
- sResult.Append(*start++);
- seenright = 0;
- while (start < end && !seenright)
+ case '?':
+ sResult.append('.');
+ start++;
+ break;
+ case '*':
+ sResult.append(".*");
+ start++;
+ break;
+ case '#':
+ sResult.append("[0-9]");
+ start++;
+ break;
+ case ']':
+ sResult.append('\\');
+ sResult.append(*start++);
+ break;
+ case '[':
+ sResult.append(*start++);
+ seenright = 0;
+ while (start < end && !seenright)
+ {
+ switch (*start)
{
- switch (*start)
+ case '[':
+ case '?':
+ case '*':
+ sResult.append('\\');
+ sResult.append(*start);
+ break;
+ case ']':
+ sResult.append(*start);
+ seenright = 1;
+ break;
+ case '!':
+ sResult.append('^');
+ break;
+ default:
+ if (NeedEsc(*start))
{
- case '[':
- case '?':
- case '*':
- sResult.Append('\\');
- sResult.Append(*start);
- break;
- case ']':
- sResult.Append(*start);
- seenright = 1;
- break;
- case '!':
- sResult.Append('^');
- break;
- default:
- if (NeedEsc(*start))
- sResult.Append('\\');
- sResult.Append(*start);
- break;
+ sResult.append('\\');
}
- start++;
+ sResult.append(*start);
+ break;
}
- break;
- default:
- if (NeedEsc(*start))
- sResult.Append('\\');
- sResult.Append(*start++);
+ start++;
+ }
+ break;
+ default:
+ if (NeedEsc(*start))
+ {
+ sResult.append('\\');
+ }
+ sResult.append(*start++);
}
}
- sResult.Append('$');
+ sResult.append('$');
- return sResult;
+ return sResult.makeStringAndClear();
}
}
@@ -260,8 +282,8 @@ void SbiRuntime::StepLIKE()
SbxVariableRef refVar1 = PopVar();
SbxVariableRef refVar2 = PopVar();
- String pattern = VBALikeToRegexp(refVar1->GetString());
- String value = refVar2->GetString();
+ OUString pattern = VBALikeToRegexp(refVar1->GetOUString());
+ OUString value = refVar2->GetOUString();
com::sun::star::util::SearchOptions aSearchOpt;
@@ -273,14 +295,16 @@ void SbiRuntime::StepLIKE()
int bTextMode(1);
bool bCompatibility = ( GetSbData()->pInst && GetSbData()->pInst->IsCompatibility() );
if( bCompatibility )
+ {
bTextMode = GetImageFlag( SBIMG_COMPARETEXT );
-
+ }
if( bTextMode )
+ {
aSearchOpt.transliterateFlags |= com::sun::star::i18n::TransliterationModules_IGNORE_CASE;
-
+ }
SbxVariable* pRes = new SbxVariable;
utl::TextSearch aSearch(aSearchOpt);
- xub_StrLen nStart=0, nEnd=value.Len();
+ sal_uInt16 nStart=0, nEnd=value.getLength();
int bRes = aSearch.SearchFrwrd(value, &nStart, &nEnd);
pRes->PutBool( bRes != 0 );
@@ -309,7 +333,9 @@ void SbiRuntime::StepIS()
sal_Bool bRes = sal_Bool( eType1 == SbxOBJECT && eType2 == SbxOBJECT );
if ( bVBAEnabled && !bRes )
+ {
Error( SbERR_INVALID_USAGE_OBJECT );
+ }
bRes = ( bRes && refVar1->GetObject() == refVar2->GetObject() );
SbxVariable* pRes = new SbxVariable;
pRes->PutBool( bRes );
@@ -368,8 +394,8 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe
if ( ( !pUnoVal && !pUnoStructVal ) )
return false;
- String sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName();
- String sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName();
+ OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName();
+ OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName();
if ( pUnoStructObj )
{
@@ -437,8 +463,8 @@ void SbiRuntime::StepPUT()
// VBA Dim As New behavior handling, save init object information
struct DimAsNewRecoverItem
{
- String m_aObjClass;
- String m_aObjName;
+ OUString m_aObjClass;
+ OUString m_aObjName;
SbxObject* m_pObjParent;
SbModule* m_pClassModule;
@@ -447,8 +473,8 @@ struct DimAsNewRecoverItem
, m_pClassModule( NULL )
{}
- DimAsNewRecoverItem( const String& rObjClass, const String& rObjName,
- SbxObject* pObjParent, SbModule* pClassModule )
+ DimAsNewRecoverItem( const OUString& rObjClass, const OUString& rObjName,
+ SbxObject* pObjParent, SbModule* pClassModule )
: m_aObjClass( rObjClass )
, m_aObjName( rObjName )
, m_pObjParent( pObjParent )
@@ -474,7 +500,9 @@ void removeDimAsNewRecoverItem( SbxVariable* pVar )
DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( pVar );
if( it != rDimAsNewRecoverHash.end() )
+ {
rDimAsNewRecoverHash.erase( it );
+ }
}
@@ -514,9 +542,13 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
if( refObjVal )
+ {
refVal = refObjVal;
+ }
else if( !(eValType & SbxARRAY) )
+ {
refVal = NULL;
+ }
}
}
@@ -539,8 +571,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
if( pProcProperty )
+ {
pProcProperty->setSet( true );
-
+ }
if ( bHandleDefaultProp )
{
// get default properties for lhs & rhs where necessary
@@ -575,10 +608,14 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
SbxVariable* pDflt = NULL;
if ( pObj || bLHSHasDefaultProp )
+ {
// lhs is either a valid object || or has a defaultProp
pDflt = getDefaultProp( refVal );
+ }
if ( pDflt )
+ {
refVal = pDflt;
+ }
}
}
@@ -586,8 +623,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
bool bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW );
SbxBaseRef xPrevVarObj;
if( bDimAsNew )
+ {
xPrevVarObj = refVar->GetObject();
-
+ }
// Handle withevents
sal_Bool bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents )
@@ -599,9 +637,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if( pUnoObj != NULL )
{
Any aControlAny = pUnoObj->getUnoAny();
- String aDeclareClassName = refVar->GetDeclareClassName();
- ::rtl::OUString aVBAType = aDeclareClassName;
- ::rtl::OUString aPrefix = refVar->GetName();
+ OUString aDeclareClassName = refVar->GetDeclareClassName();
+ OUString aVBAType = aDeclareClassName;
+ OUString aPrefix = refVar->GetName();
SbxObjectRef xScopeObj = refVar->GetParent();
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
@@ -617,8 +655,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// in this case we do not want to call checkUnoStructCopy 'cause that will
// cause an error also
if ( !checkUnoStructCopy( bHandleDefaultProp, refVal, refVar ) )
+ {
*refVar = *refVal;
-
+ }
if ( bDimAsNew )
{
if( !refVar->ISA(SbxObject) )
@@ -641,9 +680,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
pNewObj->SetParent( rItem.m_pObjParent );
refVar->PutObject( pNewObj );
}
- else if( rItem.m_aObjClass.EqualsIgnoreCaseAscii( pCollectionStr ) )
+ else if( rItem.m_aObjClass.equalsIgnoreAsciiCaseAscii( pCollectionStr ) )
{
- BasicCollection* pNewCollection = new BasicCollection( String( RTL_CONSTASCII_USTRINGPARAM(pCollectionStr) ) );
+ BasicCollection* pNewCollection = new BasicCollection( OUString(pCollectionStr) );
pNewCollection->SetName( rItem.m_aObjName );
pNewCollection->SetParent( rItem.m_pObjParent );
refVar->PutObject( pNewCollection );
@@ -661,7 +700,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
SbxObject* pValObj = PTR_CAST(SbxObject,pValObjBase);
if( pValObj != NULL )
{
- String aObjClass = pValObj->GetClassName();
+ OUString aObjClass = pValObj->GetClassName();
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase);
DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
@@ -671,7 +710,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
rDimAsNewRecoverHash[refVar] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
}
- else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
+ else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) )
{
rDimAsNewRecoverHash[refVar] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL );
@@ -682,9 +721,10 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
}
-
if( bFlagsChanged )
+ {
refVar->SetFlags( n );
+ }
}
}
@@ -708,32 +748,35 @@ void SbiRuntime::StepLSET()
{
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
- if( refVar->GetType() != SbxSTRING
- || refVal->GetType() != SbxSTRING )
+ if( refVar->GetType() != SbxSTRING ||
+ refVal->GetType() != SbxSTRING )
+ {
Error( SbERR_INVALID_USAGE_OBJECT );
+ }
else
{
sal_uInt16 n = refVar->GetFlags();
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
+ {
refVar->SetFlag( SBX_WRITE );
- String aRefVarString = refVar->GetString();
- String aRefValString = refVal->GetString();
+ }
+ OUString aRefVarString = refVar->GetOUString();
+ OUString aRefValString = refVal->GetOUString();
- sal_uInt16 nVarStrLen = aRefVarString.Len();
- sal_uInt16 nValStrLen = aRefValString.Len();
- String aNewStr;
+ sal_Int32 nVarStrLen = aRefVarString.getLength();
+ sal_Int32 nValStrLen = aRefValString.getLength();
+ OUStringBuffer aNewStr;
if( nVarStrLen > nValStrLen )
{
- aRefVarString.Fill(nVarStrLen,' ');
- aNewStr = aRefValString.Copy( 0, nValStrLen );
- aNewStr += aRefVarString.Copy( nValStrLen, nVarStrLen - nValStrLen );
+ aNewStr.append(aRefValString);
+ comphelper::string::padToLength(aNewStr, nVarStrLen, ' ');
}
else
{
- aNewStr = aRefValString.Copy( 0, nVarStrLen );
+ aNewStr = aRefValString.copy( 0, nVarStrLen );
}
- refVar->PutString( aNewStr );
+ refVar->PutString(aNewStr.makeStringAndClear());
refVar->SetFlags( n );
}
}
@@ -742,27 +785,33 @@ void SbiRuntime::StepRSET()
{
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
- if( refVar->GetType() != SbxSTRING
- || refVal->GetType() != SbxSTRING )
+ if( refVar->GetType() != SbxSTRING || refVal->GetType() != SbxSTRING )
+ {
Error( SbERR_INVALID_USAGE_OBJECT );
+ }
else
{
sal_uInt16 n = refVar->GetFlags();
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
+ {
refVar->SetFlag( SBX_WRITE );
- String aRefVarString = refVar->GetString();
- String aRefValString = refVal->GetString();
+ }
+ OUString aRefVarString = refVar->GetOUString();
+ OUString aRefValString = refVal->GetOUString();
+ sal_Int32 nVarStrLen = aRefVarString.getLength();
+ sal_Int32 nValStrLen = aRefValString.getLength();
- sal_uInt16 nPos = 0;
- sal_uInt16 nVarStrLen = aRefVarString.Len();
- if( nVarStrLen > aRefValString.Len() )
+ OUStringBuffer aNewStr(nVarStrLen);
+ if (nVarStrLen > nValStrLen)
+ {
+ comphelper::string::padToLength(aNewStr, nVarStrLen - nValStrLen, ' ');
+ aNewStr.append(aRefValString);
+ }
+ else
{
- aRefVarString.Fill(nVarStrLen,' ');
- nPos = nVarStrLen - aRefValString.Len();
+ aNewStr.append(aRefValString.copy(0, nVarStrLen));
}
- aRefVarString = aRefVarString.Copy( 0, nPos );
- aRefVarString += aRefValString.Copy( 0, nVarStrLen - nPos );
- refVar->PutString(aRefVarString);
+ refVar->PutString(aNewStr.makeStringAndClear());
refVar->SetFlags( n );
}
@@ -798,7 +847,9 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
if ( refRedim )
{
if ( !refRedimpArray ) // only erase the array not ReDim Preserve
+ {
lcl_eraseImpl( refVar, bVBAEnabled );
+ }
SbxDataType eType = refVar->GetType();
lcl_clearImpl( refVar, eType );
refRedim = NULL;
@@ -807,7 +858,9 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
// must have an even number of arguments
// have in mind that Arg[0] does not count!
if( pDims && !( pDims->Count() & 1 ) )
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ }
else
{
SbxDataType eType = refVar->IsFixed() ? refVar->GetType() : SbxVARIANT;
@@ -822,10 +875,14 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
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 );
if ( lb != ub )
+ {
pArray->setHasFixedSize( true );
+ }
}
}
else
@@ -871,7 +928,9 @@ void implCopyDimArray( SbxDimArray* pNewArray, SbxDimArray* pOldArray, short nMa
SbxVariable* pSource = pOldArray->Get32( pActualIndices );
SbxVariable* pDest = pNewArray->Get32( pActualIndices );
if( pSource && pDest )
+ {
*pDest = *pSource;
+ }
}
}
}
@@ -934,7 +993,7 @@ void SbiRuntime::StepREDIMP()
// (It would be faster to work on the flat internal data array of an
// SbyArray but this solution is clearer and easier)
implCopyDimArray( pNewArray, pOldArray, nDims - 1,
- 0, pActualIndices, pLowerBounds, pUpperBounds );
+ 0, pActualIndices, pLowerBounds, pUpperBounds );
}
delete[] pUpperBounds;
@@ -965,11 +1024,14 @@ void SbiRuntime::StepREDIMP_ERASE()
}
}
- else
- if( refVar->IsFixed() )
+ else if( refVar->IsFixed() )
+ {
refVar->Clear();
+ }
else
+ {
refVar->SetType( SbxEMPTY );
+ }
}
static void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType )
@@ -1000,28 +1062,37 @@ static void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled )
bClearValues = false;
}
else
+ {
pDimArray->Clear(); // clear Dims
+ }
}
if ( bClearValues )
{
SbxArray* pArray = PTR_CAST(SbxArray,pElemObj);
if ( pArray )
+ {
pArray->Clear();
+ }
}
}
else
- // Arrays have on an erase to VB quite a complex behaviour. Here are
- // only the type problems at REDIM (#26295) removed at first:
- // Set type hard onto the array-type, because a variable with array is
- // SbxOBJECT. At REDIM there's an SbxOBJECT-array generated then and
- // the original type is lost -> runtime error
+ {
+ // Arrays have on an erase to VB quite a complex behaviour. Here are
+ // only the type problems at REDIM (#26295) removed at first:
+ // Set type hard onto the array-type, because a variable with array is
+ // SbxOBJECT. At REDIM there's an SbxOBJECT-array generated then and
+ // the original type is lost -> runtime error
lcl_clearImpl( refVar, eType );
+ }
}
- else
- if( refVar->IsFixed() )
+ else if( refVar->IsFixed() )
+ {
refVar->Clear();
+ }
else
+ {
refVar->SetType( SbxEMPTY );
+ }
}
// delete variable
@@ -1041,7 +1112,9 @@ void SbiRuntime::StepERASE_CLEAR()
void SbiRuntime::StepARRAYACCESS()
{
if( !refArgv )
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ }
SbxVariableRef refVar = PopVar();
refVar->SetParameters( refArgv );
PopArgv();
@@ -1076,7 +1149,9 @@ void SbiRuntime::StepARGC()
void SbiRuntime::StepARGV()
{
if( !refArgv )
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ }
else
{
SbxVariableRef pVal = PopVar();
@@ -1094,10 +1169,10 @@ void SbiRuntime::StepARGV()
// Input to Variable. The variable is on TOS and is
// is removed afterwards.
-
void SbiRuntime::StepINPUT()
{
- String s;
+ OUStringBuffer sin = "";
+ OUString s;
char ch = 0;
SbError err;
// Skip whitespace
@@ -1105,37 +1180,51 @@ void SbiRuntime::StepINPUT()
{
ch = pIosys->Read();
if( ch != ' ' && ch != '\t' && ch != '\n' )
+ {
break;
+ }
}
if( !err )
{
// Scan until comma or whitespace
char sep = ( ch == '"' ) ? ch : 0;
- if( sep ) ch = pIosys->Read();
+ if( sep )
+ {
+ ch = pIosys->Read();
+ }
while( ( err = pIosys->GetError() ) == 0 )
{
if( ch == sep )
{
ch = pIosys->Read();
if( ch != sep )
+ {
break;
+ }
}
else if( !sep && (ch == ',' || ch == '\n') )
+ {
break;
- s += ch;
+ }
+ sin.append( ch );
ch = pIosys->Read();
}
// skip whitespace
if( ch == ' ' || ch == '\t' )
- while( ( err = pIosys->GetError() ) == 0 )
{
- if( ch != ' ' && ch != '\t' && ch != '\n' )
- break;
- ch = pIosys->Read();
+ while( ( err = pIosys->GetError() ) == 0 )
+ {
+ if( ch != ' ' && ch != '\t' && ch != '\n' )
+ {
+ break;
+ }
+ ch = pIosys->Read();
+ }
}
}
if( !err )
{
+ s = sin.makeStringAndClear();
SbxVariableRef pVar = GetTOS();
// try to fill the variable with a numeric value first,
// then with a string value
@@ -1148,17 +1237,19 @@ void SbiRuntime::StepINPUT()
SbxBase::ResetError();
}
// the value has to be scanned in completely
- else if( nLen != s.Len() && !pVar->PutString( s ) )
+ else if( nLen != s.getLength() && !pVar->PutString( s ) )
{
err = SbxBase::GetError();
SbxBase::ResetError();
}
- else if( nLen != s.Len() && pVar->IsNumeric() )
+ else if( nLen != s.getLength() && pVar->IsNumeric() )
{
err = SbxBase::GetError();
SbxBase::ResetError();
if( !err )
+ {
err = SbERR_CONVERSION;
+ }
}
}
else
@@ -1169,13 +1260,19 @@ void SbiRuntime::StepINPUT()
}
}
if( err == SbERR_USER_ABORT )
+ {
Error( err );
+ }
else if( err )
{
if( pRestart && !pIosys->GetChannel() )
+ {
pCode = pRestart;
+ }
else
+ {
Error( err );
+ }
}
else
{
@@ -1188,7 +1285,7 @@ void SbiRuntime::StepINPUT()
void SbiRuntime::StepLINPUT()
{
- rtl::OString aInput;
+ OString aInput;
pIosys->Read( aInput );
Error( pIosys->GetError() );
SbxVariableRef p = PopVar();
@@ -1223,7 +1320,9 @@ void SbiRuntime::StepNEXT()
return;
}
if( pForStk->eForType == FOR_TO )
+ {
pForStk->refVar->Compute( SbxPLUS, *pForStk->refInc );
+ }
}
// beginning CASE: TOS in CASE-stack
@@ -1231,7 +1330,9 @@ void SbiRuntime::StepNEXT()
void SbiRuntime::StepCASE()
{
if( !refCaseStk.Is() )
+ {
refCaseStk = new SbxArray;
+ }
SbxVariableRef xVar = PopVar();
refCaseStk->Put( xVar, refCaseStk->Count() );
}
@@ -1241,16 +1342,20 @@ void SbiRuntime::StepCASE()
void SbiRuntime::StepENDCASE()
{
if( !refCaseStk || !refCaseStk->Count() )
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ }
else
+ {
refCaseStk->Remove( refCaseStk->Count() - 1 );
+ }
}
void SbiRuntime::StepSTDERROR()
{
pError = NULL; bError = true;
- pInst->aErrorMsg = String();
+ pInst->aErrorMsg = OUString();
pInst->nErr = 0L;
pInst->nErl = 0;
nError = 0L;
@@ -1259,7 +1364,7 @@ void SbiRuntime::StepSTDERROR()
void SbiRuntime::StepNOERROR()
{
- pInst->aErrorMsg = String();
+ pInst->aErrorMsg = OUString();
pInst->nErr = 0L;
pInst->nErl = 0;
nError = 0L;
@@ -1274,7 +1379,9 @@ void SbiRuntime::StepLEAVE()
bRun = false;
// If VBA and we are leaving an ErrorHandler then clear the error ( it's been processed )
if ( bInError && pError )
+ {
SbxErrObject::getUnoErrObject()->Clear();
+ }
}
void SbiRuntime::StepCHANNEL() // TOS = channel number
@@ -1293,12 +1400,14 @@ void SbiRuntime::StepCHANNEL0()
void SbiRuntime::StepPRINT() // print TOS
{
SbxVariableRef p = PopVar();
- String s1 = p->GetString();
- String s;
+ OUString s1 = p->GetOUString();
+ OUString s;
if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE )
- s = ' '; // one blank before
+ {
+ s = " "; // one blank before
+ }
s += s1;
- rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding()));
+ OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding()));
pIosys->Write( aByteStr );
Error( pIosys->GetError() );
}
@@ -1306,10 +1415,12 @@ void SbiRuntime::StepPRINT() // print TOS
void SbiRuntime::StepPRINTF() // print TOS in field
{
SbxVariableRef p = PopVar();
- OUString s1 = p->GetString();
+ OUString s1 = p->GetOUString();
OUStringBuffer s;
if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE )
+ {
s.append(' ');
+ }
s.append(s1);
comphelper::string::padToLength(s, 14, ' ');
OString aByteStr(OUStringToOString(s.makeStringAndClear(), osl_getThreadTextEncoding()));
@@ -1324,19 +1435,23 @@ void SbiRuntime::StepWRITE() // write TOS
char ch = 0;
switch (p->GetType() )
{
- case SbxSTRING: ch = '"'; break;
- case SbxCURRENCY:
- case SbxBOOL:
- case SbxDATE: ch = '#'; break;
- default: break;
+ case SbxSTRING: ch = '"'; break;
+ case SbxCURRENCY:
+ case SbxBOOL:
+ case SbxDATE: ch = '#'; break;
+ default: break;
}
- String s;
+ OUString s;
if( ch )
- s += ch;
- s += p->GetString();
+ {
+ s += OUString(ch);
+ }
+ s += p->GetOUString();
if( ch )
- s += ch;
- rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding()));
+ {
+ s += OUString(ch);
+ }
+ OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding()));
pIosys->Write( aByteStr );
Error( pIosys->GetError() );
}
@@ -1345,8 +1460,8 @@ void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos
{
SbxVariableRef pTos1 = PopVar();
SbxVariableRef pTos = PopVar();
- String aDest = pTos1->GetString();
- String aSource = pTos->GetString();
+ OUString aDest = pTos1->GetOUString();
+ OUString aSource = pTos->GetOUString();
if( hasUno() )
{
@@ -1363,7 +1478,7 @@ void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos
void SbiRuntime::StepPROMPT()
{
SbxVariableRef p = PopVar();
- rtl::OString aStr(rtl::OUStringToOString(p->GetString(), osl_getThreadTextEncoding()));
+ rtl::OString aStr(rtl::OUStringToOString(p->GetOUString(), osl_getThreadTextEncoding()));
pIosys->SetPrompt( aStr );
}
@@ -1395,9 +1510,13 @@ void SbiRuntime::StepERROR()
sal_uInt16 n = refCode->GetUShort();
SbError error = StarBASIC::GetSfxFromVBError( n );
if ( bVBAEnabled )
+ {
pInst->Error( error );
+ }
else
+ {
Error( error );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index a9466faae69b..feee72c0db8c 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -19,7 +19,9 @@
#include <stdlib.h>
+#include <comphelper/string.hxx>
#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
#include <basic/sbuno.hxx>
#include "runtime.hxx"
#include "sbintern.hxx"
@@ -28,7 +30,7 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
-bool checkUnoObjectType( SbUnoObject* refVal, const ::rtl::OUString& aClass );
+bool checkUnoObjectType( SbUnoObject* refVal, const OUString& aClass );
// loading a numeric constant (+ID)
@@ -37,16 +39,12 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
SbxVariable* p = new SbxVariable( SbxDOUBLE );
// #57844 use localized function
- String aStr = pImg->GetString( static_cast<short>( nOp1 ) );
+ OUString aStr = pImg->GetString( static_cast<short>( nOp1 ) );
// also allow , !!!
- sal_uInt16 iComma = aStr.Search( ',' );
- if( iComma != STRING_NOTFOUND )
+ sal_Int32 iComma = aStr.indexOf((sal_Unicode)',');
+ if( iComma >= 0 )
{
- String aStr1 = aStr.Copy( 0, iComma );
- String aStr2 = aStr.Copy( iComma + 1 );
- aStr = aStr1;
- aStr += '.';
- aStr += aStr2;
+ aStr = aStr.replaceAt(iComma, 1, OUString("."));
}
double n = ::rtl::math::stringToDouble( aStr, '.', ',', NULL, NULL );
@@ -80,7 +78,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
- String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxVariableRef pVal = PopVar();
if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
{
@@ -146,11 +144,21 @@ void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
{
SbxVariable* p = GetTOS();
- String& s = (String&)(const String&) *p;
- if( s.Len() > nOp1 )
- s.Erase( static_cast<xub_StrLen>( nOp1 ) );
- else
- s.Expand( static_cast<xub_StrLen>( nOp1 ), ' ' );
+ OUString s = p->GetOUString();
+ sal_Int32 nLen(nOp1);
+ if( s.getLength() != nLen )
+ {
+ rtl::OUStringBuffer aBuf(s);
+ if (aBuf.getLength() > nLen)
+ {
+ comphelper::string::truncateToLength(aBuf, nLen);
+ }
+ else
+ {
+ comphelper::string::padToLength(aBuf, nLen, ' ');
+ }
+ s = aBuf.makeStringAndClear();
+ }
}
// jump (+target)
@@ -353,7 +361,7 @@ void SbiRuntime::StepERRHDL( sal_uInt32 nOp1 )
StepJUMP( nOp1 );
pError = pCode;
pCode = p;
- pInst->aErrorMsg = String();
+ pInst->aErrorMsg = OUString();
pInst->nErr = 0;
pInst->nErl = 0;
nError = 0;
@@ -383,7 +391,7 @@ void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
if( nOp1 > 1 )
StepJUMP( nOp1 );
- pInst->aErrorMsg = String();
+ pInst->aErrorMsg = OUString();
pInst->nErr = 0;
pInst->nErl = 0;
nError = 0;
@@ -412,14 +420,14 @@ void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
{
- rtl::OString s(static_cast<sal_Char>(nOp1));
+ OString s(static_cast<sal_Char>(nOp1));
pIosys->Write( s );
Error( pIosys->GetError() );
}
// check whether TOS is a certain object class (+StringID)
-bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass )
+bool SbiRuntime::implIsClass( SbxObject* pObj, const OUString& aClass )
{
bool bRet = true;
@@ -430,13 +438,12 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass )
bRet = aClass.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("object") );
if( !bRet )
{
- String aObjClass = pObj->GetClassName();
+ OUString aObjClass = pObj->GetClassName();
SbModule* pClassMod = GetSbData()->pClassFac->FindClass( aObjClass );
SbClassData* pClassData;
if( pClassMod && (pClassData=pClassMod->pClassData) != NULL )
{
- SbxVariable* pClassVar =
- pClassData->mxIfaces->Find( aClass, SbxCLASS_DONTCARE );
+ SbxVariable* pClassVar = pClassData->mxIfaces->Find( aClass, SbxCLASS_DONTCARE );
bRet = (pClassVar != NULL);
}
}
@@ -445,7 +452,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass )
}
bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
- const ::rtl::OUString& aClass, bool bRaiseErrors, bool bDefault )
+ const OUString& aClass, bool bRaiseErrors, bool bDefault )
{
bool bOk = bDefault;
@@ -511,11 +518,13 @@ void SbiRuntime::StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt )
{
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
- String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
bool bOk = checkClass_Impl( refVal, aClass, true );
if( bOk )
+ {
StepSET_Impl( refVal, refVar, bHandleDflt ); // don't do handle dflt prop for a "proper" set
+ }
}
void SbiRuntime::StepVBASETCLASS( sal_uInt32 nOp1 )
@@ -531,7 +540,7 @@ void SbiRuntime::StepSETCLASS( sal_uInt32 nOp1 )
void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
{
SbxVariableRef xObjVal = PopVar();
- String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
bool bDefault = !bVBAEnabled;
bool bOk = checkClass_Impl( xObjVal, aClass, false, bDefault );
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index ad151a72b07d..0f6c07bd2b67 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -30,6 +30,8 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
+#include <rtl/ustrbuf.hxx>
using namespace com::sun::star::uno;
using namespace com::sun::star::container;
@@ -39,21 +41,23 @@ using namespace com::sun::star::script;
using com::sun::star::uno::Reference;
-SbxVariable* getVBAConstant( const String& rName );
+SbxVariable* getVBAConstant( const OUString& rName );
// the bits in the String-ID:
// 0x8000 - Argv is reserved
-SbxVariable* SbiRuntime::FindElement
- ( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, bool bLocal, bool bStatic )
+SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2,
+ SbError nNotFound, bool bLocal, bool bStatic )
{
bool bIsVBAInterOp = SbiRuntime::isVBAEnabled();
if( bIsVBAInterOp )
{
StarBASIC* pMSOMacroRuntimeLib = GetSbData()->pMSOMacroRuntimLib;
if( pMSOMacroRuntimeLib != NULL )
+ {
pMSOMacroRuntimeLib->ResetFlag( SBX_EXTSEARCH );
+ }
}
SbxVariable* pElem = NULL;
@@ -66,32 +70,36 @@ SbxVariable* SbiRuntime::FindElement
{
bool bFatalError = false;
SbxDataType t = (SbxDataType) nOp2;
- String aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
// Hacky capture of Evaluate [] syntax
// this should be tackled I feel at the pcode level
- if ( bIsVBAInterOp && aName.Search('[') == 0 )
+ if ( bIsVBAInterOp && aName.indexOf((sal_Unicode)'[') == 0 )
{
// emulate pcode here
StepARGC();
// psuedo StepLOADSC
- String sArg = aName.Copy( 1, aName.Len() - 2 );
+ OUString sArg = aName.copy( 1, aName.getLength() - 2 );
SbxVariable* p = new SbxVariable;
p->PutString( sArg );
PushVar( p );
StepARGV();
nOp1 = nOp1 | 0x8000; // indicate params are present
- aName = rtl::OUString("Evaluate");
+ aName = OUString("Evaluate");
}
if( bLocal )
{
if ( bStatic )
{
if ( pMeth )
+ {
pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
+ }
}
if ( !pElem )
+ {
pElem = refLocals->Find( aName, SbxCLASS_DONTCARE );
+ }
}
if( !pElem )
{
@@ -106,8 +114,9 @@ SbxVariable* SbiRuntime::FindElement
{
SbiInstance* pInst_ = GetSbData()->pInst;
if( pInst_ && pInst_->IsCompatibility() && pObj != pElem->GetParent() )
+ {
pElem = NULL; // Found but in wrong module!
-
+ }
// Interfaces: Use SBX_EXTFOUND
}
}
@@ -125,9 +134,13 @@ SbxVariable* SbiRuntime::FindElement
// Try Find in VBA symbols space
pElem = rBasic.VBAFind( aName, SbxCLASS_DONTCARE );
if ( pElem )
+ {
bSetName = false; // don't overwrite uno name
+ }
else
+ {
pElem = VBAConstantHelper::instance().getVBAConstant( aName );
+ }
}
if( !pElem )
@@ -157,7 +170,9 @@ SbxVariable* SbiRuntime::FindElement
// #72382 save locally, all variables that have been declared
// implicit would become global automatically otherwise!
if ( bSetName )
+ {
pElem->SetName( aName );
+ }
refLocals->Put( pElem, refLocals->Count() );
}
}
@@ -167,7 +182,9 @@ SbxVariable* SbiRuntime::FindElement
// not there and not in the object?
// don't establish if that thing has parameters!
if( nOp1 & 0x8000 )
+ {
bFatalError = true;
+ }
// else, if there are parameters, use different error code
if( !bLocal || pImg->GetFlag( SBIMG_EXPLICIT ) )
@@ -177,13 +194,17 @@ SbxVariable* SbiRuntime::FindElement
if( !( nOp1 & 0x8000 ) && nNotFound == SbERR_PROC_UNDEFINED )
+ {
nNotFound = SbERR_VAR_UNDEFINED;
+ }
}
if( bFatalError )
{
// #39108 use dummy variable instead of fatal error
if( !xDummyVar.Is() )
+ {
xDummyVar = new SbxVariable( SbxVARIANT );
+ }
pElem = xDummyVar;
ClearArgvStack();
@@ -193,12 +214,16 @@ SbxVariable* SbiRuntime::FindElement
else
{
if ( bStatic )
+ {
pElem = StepSTATIC_Impl( aName, t );
+ }
if ( !pElem )
{
pElem = new SbxVariable( t );
if( t != SbxVARIANT )
+ {
pElem->SetFlag( SBX_FIXED );
+ }
pElem->SetName( aName );
refLocals->Put( pElem, refLocals->Count() );
}
@@ -207,8 +232,9 @@ SbxVariable* SbiRuntime::FindElement
}
// #39108 Args can already be deleted!
if( !bFatalError )
+ {
SetupArgs( pElem, nOp1 );
-
+ }
// because a particular call-type is requested
if( pElem->IsA( TYPE(SbxMethod) ) )
{
@@ -219,7 +245,9 @@ SbxVariable* SbiRuntime::FindElement
{
if( t != SbxVARIANT && t != t2 &&
t >= SbxINTEGER && t <= SbxSTRING )
+ {
pElem->SetType( t ), bSet = true;
+ }
}
// assign pElem to a Ref, to delete a temp-var if applicable
SbxVariableRef refTemp = pElem;
@@ -242,7 +270,9 @@ SbxVariable* SbiRuntime::FindElement
pNew->SetFlag( SBX_READWRITE );
if( bSet )
+ {
pElem->SetType( t2 );
+ }
pElem = pNew;
}
// consider index-access for UnoObjects
@@ -263,23 +293,25 @@ SbxVariable* SbiRuntime::FindElement
}
// for current scope (e. g. query from BASIC-IDE)
-SbxBase* SbiRuntime::FindElementExtern( const String& rName )
+SbxBase* SbiRuntime::FindElementExtern( const OUString& rName )
{
// don't expect pMeth to be != 0, as there are none set
// in the RunInit yet
SbxVariable* pElem = NULL;
- if( !pMod || !rName.Len() )
+ if( !pMod || !rName.getLength() )
+ {
return NULL;
-
+ }
if( refLocals )
+ {
pElem = refLocals->Find( rName, SbxCLASS_DONTCARE );
-
+ }
if ( !pElem && pMeth )
{
// for statics, set the method's name in front
- String aMethName = pMeth->GetName();
- aMethName += ':';
+ OUString aMethName = pMeth->GetName();
+ aMethName += ":";
aMethName += rName;
pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE);
}
@@ -295,13 +327,13 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName )
const SbxParamInfo* pParam = pInfo->GetParam( j );
while( pParam )
{
- if( pParam->aName.EqualsIgnoreCaseAscii( rName ) )
+ if( pParam->aName.equalsIgnoreAsciiCase( rName ) )
{
if( j >= nParamCount )
{
// Parameter is missing
pElem = new SbxVariable( SbxSTRING );
- pElem->PutString( String( RTL_CONSTASCII_USTRINGPARAM("<missing parameter>" ) ) );
+ pElem->PutString( OUString("<missing parameter>"));
}
else
{
@@ -332,13 +364,15 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
if( nOp1 & 0x8000 )
{
if( !refArgv )
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ }
bool bHasNamed = false;
sal_uInt16 i;
sal_uInt16 nArgCount = refArgv->Count();
for( i = 1 ; i < nArgCount ; i++ )
{
- if( refArgv->GetAlias( i ).Len() )
+ if( !refArgv->GetAlias(i).isEmpty() )
{
bHasNamed = true; break;
}
@@ -367,13 +401,15 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
sal_uInt16 nCurPar = 1;
AutomationNamedArgsSbxArray* pArg =
new AutomationNamedArgsSbxArray( nArgCount );
- ::rtl::OUString* pNames = pArg->getNames().getArray();
+ OUString* pNames = pArg->getNames().getArray();
for( i = 1 ; i < nArgCount ; i++ )
{
SbxVariable* pVar = refArgv->Get( i );
- const String& rName = refArgv->GetAlias( i );
- if( rName.Len() )
+ const OUString& rName = refArgv->GetAlias( i );
+ if( rName.getLength() )
+ {
pNames[i] = rName;
+ }
pArg->Put( pVar, nCurPar++ );
}
refArgv = pArg;
@@ -394,22 +430,30 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY );
- rtl::OUString sDefaultMethod;
+ OUString sDefaultMethod;
if ( xDfltMethod.is() )
+ {
sDefaultMethod = xDfltMethod->getDefaultMethodName();
+ }
if ( !sDefaultMethod.isEmpty() )
{
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
{
@@ -418,15 +462,15 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
for( i = 1 ; i < nArgCount ; i++ )
{
SbxVariable* pVar = refArgv->Get( i );
- const String& rName = refArgv->GetAlias( i );
- if( rName.Len() )
+ const OUString& rName = refArgv->GetAlias( i );
+ if( rName.getLength() )
{
// nCurPar is set to the found parameter
sal_uInt16 j = 1;
const SbxParamInfo* pParam = pInfo->GetParam( j );
while( pParam )
{
- if( pParam->aName.EqualsIgnoreCaseAscii( rName ) )
+ if( pParam->aName.equalsIgnoreAsciiCase( rName ) )
{
nCurPar = j;
break;
@@ -449,7 +493,9 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
PopArgv();
}
else
+ {
p->SetParameters( NULL );
+ }
}
// getting an array element
@@ -480,13 +526,17 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pElem = new SbxVariable;
}
else
+ {
pElem = pArray->Get( pPar->Get( 1 )->GetInteger() );
+ }
}
}
// #42940, set parameter 0 to NULL so that var doesn't contain itself
if( pPar )
+ {
pPar->Put( NULL, 0 );
+ }
}
// consider index-access for UnoObjects
else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) )
@@ -526,7 +576,9 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
Any aAny2 = xIndexAccess->getByIndex( nIndex );
TypeClass eType = aAny2.getValueType().getTypeClass();
if( eType == TypeClass_INTERFACE )
+ {
xRet = *(Reference< XInterface >*)aAny2.getValue();
+ }
}
catch (const IndexOutOfBoundsException&)
{
@@ -542,7 +594,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
aAny <<= xRet;
// #67173 don't specify a name so that the real class name is entered
- String aName;
+ OUString aName;
SbxObjectRef xWrapper = (SbxObject*)new SbUnoObject( aName, aAny );
pElem->PutObject( xWrapper );
}
@@ -554,15 +606,18 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
}
else
{
- rtl::OUString sDefaultMethod;
+ OUString sDefaultMethod;
Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY );
if ( xDfltMethod.is() )
+ {
sDefaultMethod = xDfltMethod->getDefaultMethodName();
+ }
else if( xIndexAccess.is() )
- sDefaultMethod = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getByIndex" ) );
-
+ {
+ sDefaultMethod = OUString( RTL_CONSTASCII_USTRINGPARAM( "getByIndex" ) );
+ }
if ( !sDefaultMethod.isEmpty() )
{
SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD );
@@ -592,7 +647,9 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
SbxArray* pParam = pElem->GetParameters();
if( pParam != NULL && !pElem->IsSet( SBX_VAR_TO_DIM ) )
+ {
Error( SbERR_NO_OBJECT );
+ }
}
}
}
@@ -607,11 +664,13 @@ void SbiRuntime::StepRTL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, false ) );
}
-void
-SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, bool bLocal, bool bStatic )
+void SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2,
+ SbError nNotFound, bool bLocal, bool bStatic )
{
if( !refLocals )
+ {
refLocals = new SbxArray;
+ }
PushVar( FindElement( pObj, nOp1, nOp2, nNotFound, bLocal, bStatic ) );
}
// loading a local/global variable (+StringID+type)
@@ -627,12 +686,15 @@ 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 );
if( pClassModuleObject )
+ {
pMod->ResetFlag( SBX_GBLSEARCH );
+ }
}
void SbiRuntime::StepFIND_STATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
@@ -659,8 +721,9 @@ void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// ActiveComponent.Selection(0).Text
// #74254 now per list
if( pObj )
+ {
SaveRef( (SbxVariable*)pObj );
-
+ }
PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, false ) );
}
@@ -688,13 +751,18 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
(t == SbxOBJECT || t == SbxSTRING) )
{
if( t == SbxOBJECT )
+ {
p->PutObject( NULL );
+ }
else
- p->PutString( String() );
+ {
+ p->PutString( OUString() );
+ }
}
else
+ {
p->PutErr( 448 ); // like in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
-
+ }
refParams->Put( p, iLoop );
iLoop--;
}
@@ -714,11 +782,10 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
if( pParam && ( (pParam->nFlags & SBX_OPTIONAL) != 0 ) )
{
// Default value?
- sal_uInt16 nDefaultId = sal::static_int_cast< sal_uInt16 >(
- pParam->nUserData & 0xffff );
+ sal_uInt16 nDefaultId = (sal_uInt16)(pParam->nUserData & 0x0ffff);
if( nDefaultId > 0 )
{
- String aDefaultStr = pImg->GetString( nDefaultId );
+ OUString aDefaultStr = pImg->GetString( nDefaultId );
p = new SbxVariable();
p->PutString( aDefaultStr );
refParams->Put( p, i );
@@ -728,7 +795,9 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
}
if( !bOpt )
+ {
Error( SbERR_NOT_OPTIONAL );
+ }
}
else if( t != SbxVARIANT && (SbxDataType)(p->GetType() & 0x0FFF ) != t )
{
@@ -737,7 +806,9 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
*q = *p;
p = q;
if ( i )
+ {
refParams->Put( p, i );
+ }
}
SetupArgs( p, nOp1 );
PushVar( CheckArray( p ) );
@@ -748,13 +819,17 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( !refCaseStk || !refCaseStk->Count() )
+ {
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ }
else
{
SbxVariableRef xComp = PopVar();
SbxVariableRef xCase = refCaseStk->Get( refCaseStk->Count() - 1 );
if( xCase->Compare( (SbxOperator) nOp2, *xComp ) )
+ {
StepJUMP( nOp1 );
+ }
}
}
@@ -763,28 +838,36 @@ void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 nOp2 )
void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- String aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
+ OUString aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
SbxArray* pArgs = NULL;
if( nOp1 & 0x8000 )
+ {
pArgs = refArgv;
+ }
DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, false );
- aLibName = String();
+ aLibName = OUString();
if( nOp1 & 0x8000 )
+ {
PopArgv();
+ }
}
// call of a DLL-procedure after CDecl (+StringID+type)
void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- String aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
+ OUString aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
SbxArray* pArgs = NULL;
if( nOp1 & 0x8000 )
+ {
pArgs = refArgv;
+ }
DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, true );
- aLibName = String();
+ aLibName = OUString();
if( nOp1 & 0x8000 )
+ {
PopArgv();
+ }
}
@@ -795,14 +878,16 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// If the Expr-Stack at the beginning of a statement constains a variable,
// some fool has called X as a function, although it's a variable!
bool bFatalExpr = false;
- String sUnknownMethodName;
+ OUString sUnknownMethodName;
if( nExprLvl > 1 )
+ {
bFatalExpr = true;
+ }
else if( nExprLvl )
{
SbxVariable* p = refExprStk->Get( 0 );
- if( p->GetRefCount() > 1
- && refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) )
+ if( p->GetRefCount() > 1 &&
+ refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) )
{
sUnknownMethodName = p->GetName();
bFatalExpr = true;
@@ -848,12 +933,16 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// (there's a difference here in case of a jump out of a loop)
sal_uInt16 nExspectedForLevel = static_cast<sal_uInt16>( nOp2 / 0x100 );
if( pGosubStk )
+ {
nExspectedForLevel = nExspectedForLevel + pGosubStk->nStartForLvl;
+ }
// if the actual for-level is too small it'd jump out
// of a loop -> corrected
while( nForLvl > nExspectedForLevel )
+ {
PopFor();
+ }
}
// 16.10.96: #31460 new concept for StepInto/Over/Out
@@ -890,9 +979,9 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SbxVariableRef pLen = PopVar();
short nBlkLen = pLen->GetInteger();
short nChan = pChan->GetInteger();
- rtl::OString aName(rtl::OUStringToOString(pName->GetString(), osl_getThreadTextEncoding()));
+ OString aName(rtl::OUStringToOString(pName->GetOUString(), osl_getThreadTextEncoding()));
pIosys->Open( nChan, aName, static_cast<short>( nOp1 ),
- static_cast<short>( nOp2 ), nBlkLen );
+ static_cast<short>( nOp2 ), nBlkLen );
Error( pIosys->GetError() );
}
@@ -900,15 +989,17 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 )
void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
+ OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
SbxObject *pObj = SbxBase::CreateObject( aClass );
if( !pObj )
+ {
Error( SbERR_INVALID_OBJECT );
+ }
else
{
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
pObj->SetName( aName );
- // the object must be able to call the BASIC
+ // the object must be able to call the BASIC
pObj->SetParent( &rBasic );
SbxVariable* pNew = new SbxVariable;
pNew->PutObject( pObj );
@@ -979,13 +1070,17 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
pArray->GetDim32( i+1, nLower, nUpper );
nSize = nUpper - nLower + 1;
if( i == 0 )
+ {
nTotalSize = nSize;
+ }
else
+ {
nTotalSize *= nSize;
+ }
}
// create objects and insert them into the array
- String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
+ OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
for( i = 0 ; i < nTotalSize ; i++ )
{
SbxObject *pClassObj = SbxBase::CreateObject( aClass );
@@ -996,7 +1091,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
else
{
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
pClassObj->SetName( aName );
// the object must be able to call the basic
pClassObj->SetParent( &rBasic );
@@ -1060,16 +1155,18 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// create object from user-type (+StringID+StringID)
-SbxObject* createUserTypeImpl( const String& rClassName ); // sb.cxx
+SbxObject* createUserTypeImpl( const OUString& rClassName ); // sb.cxx
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 ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
SbxObject* pCopyObj = createUserTypeImpl( aClass );
if( pCopyObj )
+ {
pCopyObj->SetName( aName );
+ }
SbxVariable* pNew = new SbxVariable;
pNew->PutObject( pCopyObj );
pNew->SetDeclareClassName( aClass );
@@ -1080,24 +1177,28 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt3
{
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 );
+ OUStringBuffer aBuf;
+ comphelper::string::padToLength(aBuf, nCount, 0);
+ pVar->PutString(aBuf.makeStringAndClear());
}
bool bVarToDim = ((nOp2 & SBX_TYPE_VAR_TO_DIM_FLAG) != 0);
if( bVarToDim )
+ {
pVar->SetFlag( SBX_VAR_TO_DIM );
+ }
}
// establishing a local variable (+StringID+type)
@@ -1105,8 +1206,10 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt3
void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( !refLocals.Is() )
+ {
refLocals = new SbxArray;
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ }
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
if( refLocals->Find( aName, SbxCLASS_DONTCARE ) == NULL )
{
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
@@ -1121,18 +1224,24 @@ void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedForClassModule )
{
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);;
sal_Bool bFlag = pMod->IsSet( SBX_NO_MODIFY );
pMod->SetFlag( SBX_NO_MODIFY );
SbxVariableRef p = pMod->Find( aName, SbxCLASS_PROPERTY );
if( p.Is() )
+ {
pMod->Remove (p);
+ }
SbProperty* pProp = pMod->GetProperty( aName, t );
if( !bUsedForClassModule )
+ {
pProp->SetFlag( SBX_PRIVATE );
+ }
if( !bFlag )
+ {
pMod->ResetFlag( SBX_NO_MODIFY );
+ }
if( pProp )
{
pProp->SetFlag( SBX_DONTSTORE );
@@ -1164,9 +1273,10 @@ void SbiRuntime::StepPUBLIC_P( sal_uInt32 nOp1, sal_uInt32 nOp2 )
void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( pImg->GetFlag( SBIMG_CLASSMODULE ) )
+ {
StepPUBLIC_Impl( nOp1, nOp2, true );
-
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ }
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
// Store module scope variables at module scope
@@ -1183,10 +1293,14 @@ void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
rBasic.SetFlag( SBX_NO_MODIFY );
SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY );
if( p.Is() )
+ {
pStorage->Remove (p);
+ }
p = pStorage->Make( aName, SbxCLASS_PROPERTY, t );
if( !bFlag )
+ {
pStorage->ResetFlag( SBX_NO_MODIFY );
+ }
if( p )
{
p->SetFlag( SBX_DONTSTORE );
@@ -1222,7 +1336,7 @@ void SbiRuntime::StepFIND_G( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
// Return dummy variable
SbxDataType t = (SbxDataType) nOp2;
- String aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
SbxVariable* pDummyVar = new SbxVariable( t );
pDummyVar->SetName( aName );
@@ -1231,7 +1345,7 @@ void SbiRuntime::StepFIND_G( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
-SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t )
+SbxVariable* SbiRuntime::StepSTATIC_Impl( OUString& aName, SbxDataType& t )
{
SbxVariable* p = NULL;
if ( pMeth )
@@ -1241,7 +1355,9 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t )
{
p = new SbxVariable( t );
if( t != SbxVARIANT )
+ {
p->SetFlag( SBX_FIXED );
+ }
p->SetName( aName );
pStatics->Put( p, pStatics->Count() );
}
@@ -1251,7 +1367,7 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t )
// establishing a static variable (+StringID+type)
void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+ OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType) nOp2;
StepSTATIC_Impl( aName, t );
}
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index e1725a893fd2..9a68c1379c80 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -31,7 +31,7 @@ struct SbxDim { // an array-dimension:
class SbxVarEntry : public SbxVariableRef {
public:
- XubString* pAlias;
+ OUString* pAlias;
SbxVarEntry() : SbxVariableRef(), pAlias( NULL ) {}
~SbxVarEntry() { delete pAlias; }
};
@@ -83,11 +83,17 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray )
SbxVarEntryPtr pDstRef = new SbxVarEntry;
*((SbxVariableRef*) pDstRef) = *((SbxVariableRef*) pSrcRef);
if( pSrcRef->pAlias )
- pDstRef->pAlias = new XubString( *pSrcRef->pAlias );
+ {
+ pDstRef->pAlias = new OUString( *pSrcRef->pAlias );
+ }
if( eType != SbxVARIANT )
+ {
// Convert no objects
if( eType != SbxOBJECT || pSrc_->GetClass() != SbxCLASS_OBJECT )
+ {
((SbxVariable*) pSrc_)->Convert( eType );
+ }
+ }
pData->push_back( pDstRef );
}
}
@@ -247,36 +253,48 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx )
}
}
-const XubString& SbxArray::GetAlias( sal_uInt16 nIdx )
+const OUString& SbxArray::GetAlias( sal_uInt16 nIdx )
{
+static const OUString sEmpty("");
+
if( !CanRead() )
{
SetError( SbxERR_PROP_WRITEONLY );
- return String::EmptyString();
+ return sEmpty;
}
SbxVarEntry& rRef = (SbxVarEntry&) GetRef( nIdx );
if ( !rRef.pAlias )
- return String::EmptyString();
+ {
+ return sEmpty;
+ }
#ifdef DBG_UTIL
else
+ {
DBG_CHKOBJ( rRef, SbxBase, 0 );
+ }
#endif
return *rRef.pAlias;
}
-void SbxArray::PutAlias( const XubString& rAlias, sal_uInt16 nIdx )
+void SbxArray::PutAlias( const OUString& rAlias, sal_uInt16 nIdx )
{
if( !CanWrite() )
+ {
SetError( SbxERR_PROP_READONLY );
+ }
else
{
SbxVarEntry& rRef = (SbxVarEntry&) GetRef( nIdx );
if( !rRef.pAlias )
- rRef.pAlias = new XubString( rAlias );
+ {
+ rRef.pAlias = new OUString( rAlias );
+ }
else
+ {
*rRef.pAlias = rAlias;
+ }
}
}
@@ -284,14 +302,20 @@ void SbxArray::Insert32( SbxVariable* pVar, sal_uInt32 nIdx )
{
DBG_ASSERT( pData->size() <= SBX_MAXINDEX32, "SBX: Array wird zu gross" );
if( pData->size() > SBX_MAXINDEX32 )
+ {
return;
+ }
SbxVarEntryPtr p = new SbxVarEntry;
*((SbxVariableRef*) p) = pVar;
SbxVarEntryPtrVector::size_type nSize = pData->size();
if( nIdx > nSize )
+ {
nIdx = nSize;
+ }
if( eType != SbxVARIANT && pVar )
+ {
(*p)->Convert( eType );
+ }
if( nIdx == nSize )
{
pData->push_back( p );
@@ -307,7 +331,9 @@ void SbxArray::Insert( SbxVariable* pVar, sal_uInt16 nIdx )
{
DBG_ASSERT( pData->size() <= 0x3FF0, "SBX: Array wird zu gross" );
if( pData->size() > 0x3FF0 )
- return;
+ {
+ return;
+ }
Insert32( pVar, nIdx );
}
@@ -364,13 +390,13 @@ void SbxArray::Merge( SbxArray* p )
SbxVariable* pVar = *pRef1;
if( pVar )
{
- XubString aName = pVar->GetName();
+ OUString aName = pVar->GetName();
sal_uInt16 nHash = pVar->GetHashCode();
for( sal_uInt32 j = 0; j < pData->size(); j++ )
{
SbxVariableRef* pRef2 = (*pData)[j];
if( (*pRef2)->GetHashCode() == nHash
- && (*pRef2)->GetName().EqualsIgnoreCaseAscii( aName ) )
+ && (*pRef2)->GetName().equalsIgnoreAsciiCase( aName ) )
{
*pRef2 = pVar; pRef1 = NULL;
break;
@@ -383,7 +409,9 @@ void SbxArray::Merge( SbxArray* p )
pData->push_back( pTemp );
*((SbxVariableRef*) pRef) = *((SbxVariableRef*) pRef1);
if( pRef1->pAlias )
- pRef->pAlias = new XubString( *pRef1->pAlias );
+ {
+ pRef->pAlias = new OUString( *pRef1->pAlias );
+ }
}
}
}
@@ -441,7 +469,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
// Search of an element by his name and type. If an element is an object,
// it will also be scanned..
-SbxVariable* SbxArray::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* p = NULL;
sal_uInt32 nCount = pData->size();
@@ -459,7 +487,7 @@ SbxVariable* SbxArray::Find( const rtl::OUString& rName, SbxClassType t )
sal_uInt16 nVarHash = pVar->GetHashCode();
if( ( !nVarHash || nVarHash == nHash )
&& ( t == SbxCLASS_DONTCARE || pVar->GetClass() == t )
- && ( pVar->GetName().EqualsIgnoreCaseAscii( rName ) ) )
+ && ( pVar->GetName().equalsIgnoreAsciiCase( rName ) ) )
{
p = pVar;
p->ResetFlag( SBX_EXTFOUND );
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index c843f1689273..1716037b36ca 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -142,7 +142,7 @@ void ImpPutBool( SbxValues* p, sal_Int16 n )
switch( +p->eType )
{
case SbxCHAR:
- p->nChar = (xub_Unicode) n; break;
+ p->nChar = (sal_Unicode) n; break;
case SbxUINT:
p->nByte = (sal_uInt8) n; break;
case SbxINTEGER:
@@ -189,7 +189,7 @@ void ImpPutBool( SbxValues* p, sal_Int16 n )
break;
}
case SbxBYREF | SbxCHAR:
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
*p->pByte = (sal_uInt8) n; break;
case SbxBYREF | SbxINTEGER:
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index c6310e647e09..bcfebdaaf97d 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -253,7 +253,7 @@ void ImpPutByte( SbxValues* p, sal_uInt8 n )
break;
case SbxCHAR:
- p->nChar = (xub_Unicode) n; break;
+ p->nChar = (sal_Unicode) n; break;
case SbxBYREF | SbxSTRING:
case SbxSTRING:
@@ -272,7 +272,7 @@ void ImpPutByte( SbxValues* p, sal_uInt8 n )
break;
}
case SbxBYREF | SbxCHAR:
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
*p->pByte = n; break;
case SbxBYREF | SbxINTEGER:
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index b699246b44c5..6ab71a64524a 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -21,10 +21,10 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
-xub_Unicode ImpGetChar( const SbxValues* p )
+sal_Unicode ImpGetChar( const SbxValues* p )
{
SbxValues aTmp;
- xub_Unicode nRes = 0;
+ sal_Unicode nRes = 0;
start:
switch( +p->eType )
{
@@ -35,7 +35,7 @@ start:
case SbxCHAR:
nRes = p->nChar; break;
case SbxBYTE:
- nRes = (xub_Unicode) p->nByte;
+ nRes = (sal_Unicode) p->nByte;
break;
case SbxINTEGER:
case SbxBOOL:
@@ -44,11 +44,11 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) p->nInteger;
+ nRes = (sal_Unicode) p->nInteger;
break;
case SbxERROR:
case SbxUSHORT:
- nRes = (xub_Unicode) p->nUShort;
+ nRes = (sal_Unicode) p->nUShort;
break;
case SbxLONG:
if( p->nLong > SbxMAXCHAR )
@@ -60,7 +60,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) p->nLong;
+ nRes = (sal_Unicode) p->nLong;
break;
case SbxULONG:
if( p->nULong > SbxMAXCHAR )
@@ -68,7 +68,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXCHAR;
}
else
- nRes = (xub_Unicode) p->nULong;
+ nRes = (sal_Unicode) p->nULong;
break;
case SbxCURRENCY:
case SbxSALINT64:
@@ -87,7 +87,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) val;
+ nRes = (sal_Unicode) val;
break;
}
case SbxSALUINT64:
@@ -96,7 +96,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXCHAR;
}
else
- nRes = (xub_Unicode) p->uInt64;
+ nRes = (sal_Unicode) p->uInt64;
break;
case SbxSINGLE:
if( p->nSingle > SbxMAXCHAR )
@@ -108,7 +108,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) ImpRound( p->nSingle );
+ nRes = (sal_Unicode) ImpRound( p->nSingle );
break;
case SbxDATE:
case SbxDOUBLE:
@@ -155,7 +155,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) ImpRound( d );
+ nRes = (sal_Unicode) ImpRound( d );
}
break;
case SbxOBJECT:
@@ -205,7 +205,7 @@ start:
return nRes;
}
-void ImpPutChar( SbxValues* p, xub_Unicode n )
+void ImpPutChar( SbxValues* p, sal_Unicode n )
{
SbxValues aTmp;
start:
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 968c791f2926..40b4a9fb2fd7 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -25,26 +25,26 @@
TYPEINIT1(SbxCollection,SbxObject)
TYPEINIT1(SbxStdCollection,SbxCollection)
-static const char* pCount;
-static const char* pAdd;
-static const char* pItem;
-static const char* pRemove;
+static OUString pCount;
+static OUString pAdd;
+static OUString pItem;
+static OUString pRemove;
static sal_uInt16 nCountHash = 0, nAddHash, nItemHash, nRemoveHash;
-SbxCollection::SbxCollection( const XubString& rClass )
+SbxCollection::SbxCollection( const OUString& rClass )
: SbxObject( rClass )
{
if( !nCountHash )
{
- pCount = GetSbxRes( STRING_COUNTPROP );
- pAdd = GetSbxRes( STRING_ADDMETH );
- pItem = GetSbxRes( STRING_ITEMMETH );
- pRemove = GetSbxRes( STRING_REMOVEMETH );
- nCountHash = MakeHashCode( rtl::OUString::createFromAscii( pCount ) );
- nAddHash = MakeHashCode( rtl::OUString::createFromAscii( pAdd ) );
- nItemHash = MakeHashCode( rtl::OUString::createFromAscii( pItem ) );
- nRemoveHash = MakeHashCode( rtl::OUString::createFromAscii( pRemove ) );
+ pCount = rtl::OUString::createFromAscii(GetSbxRes( STRING_COUNTPROP ));
+ pAdd = rtl::OUString::createFromAscii(GetSbxRes( STRING_ADDMETH ));
+ pItem = rtl::OUString::createFromAscii(GetSbxRes( STRING_ITEMMETH ));
+ pRemove = rtl::OUString::createFromAscii(GetSbxRes( STRING_REMOVEMETH ));
+ nCountHash = MakeHashCode( pCount );
+ nAddHash = MakeHashCode( pAdd );
+ nItemHash = MakeHashCode( pItem );
+ nRemoveHash = MakeHashCode( pRemove );
}
Initialize();
// For Access on itself
@@ -77,14 +77,14 @@ void SbxCollection::Initialize()
SetFlag( SBX_FIXED );
ResetFlag( SBX_WRITE );
SbxVariable* p;
- p = Make( rtl::OUString::createFromAscii( pCount ), SbxCLASS_PROPERTY, SbxINTEGER );
+ p = Make( pCount , SbxCLASS_PROPERTY, SbxINTEGER );
p->ResetFlag( SBX_WRITE );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pAdd ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( pAdd, SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pItem ), SbxCLASS_METHOD, SbxOBJECT );
+ p = Make( pItem , SbxCLASS_METHOD, SbxOBJECT );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pRemove ), SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( pRemove, SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
}
@@ -96,7 +96,9 @@ SbxVariable* SbxCollection::FindUserData( sal_uInt32 nData )
return pObj ? pObj->FindUserData( nData ) : NULL;
}
else
+ {
return SbxObject::FindUserData( nData );
+ }
}
SbxVariable* SbxCollection::Find( const rtl::OUString& rName, SbxClassType t )
@@ -107,7 +109,9 @@ SbxVariable* SbxCollection::Find( const rtl::OUString& rName, SbxClassType t )
return pObj ? pObj->Find( rName, t ) : NULL;
}
else
+ {
return SbxObject::Find( rName, t );
+ }
}
void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
@@ -123,23 +127,35 @@ void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
SbxArray* pArg = pVar->GetParameters();
if( bRead || bWrite )
{
- XubString aVarName( pVar->GetName() );
+ OUString aVarName( pVar->GetName() );
if( pVar == this )
+ {
CollItem( pArg );
+ }
else if( pVar->GetHashCode() == nCountHash
- && aVarName.EqualsIgnoreCaseAscii( pCount ) )
+ && aVarName.equalsIgnoreAsciiCase( pCount ) )
+ {
pVar->PutLong( pObjs->Count() );
+ }
else if( pVar->GetHashCode() == nAddHash
- && aVarName.EqualsIgnoreCaseAscii( pAdd ) )
+ && aVarName.equalsIgnoreAsciiCase( pAdd ) )
+ {
CollAdd( pArg );
+ }
else if( pVar->GetHashCode() == nItemHash
- && aVarName.EqualsIgnoreCaseAscii( pItem ) )
+ && aVarName.equalsIgnoreAsciiCase( pItem ) )
+ {
CollItem( pArg );
+ }
else if( pVar->GetHashCode() == nRemoveHash
- && aVarName.EqualsIgnoreCaseAscii( pRemove ) )
+ && aVarName.equalsIgnoreAsciiCase( pRemove ) )
+ {
CollRemove( pArg );
+ }
else
+ {
SbxObject::SFX_NOTIFY( rCst, rId1, rHint, rId2 );
+ }
return;
}
}
@@ -151,14 +167,20 @@ void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
void SbxCollection::CollAdd( SbxArray* pPar_ )
{
if( pPar_->Count() != 2 )
+ {
SetError( SbxERR_WRONG_ARGS );
+ }
else
{
SbxBase* pObj = pPar_->Get( 1 )->GetObject();
if( !pObj || !( pObj->ISA(SbxObject) ) )
+ {
SetError( SbxERR_NOTIMP );
+ }
else
+ {
Insert( (SbxObject*) pObj );
+ }
}
}
@@ -167,21 +189,29 @@ void SbxCollection::CollAdd( SbxArray* pPar_ )
void SbxCollection::CollItem( SbxArray* pPar_ )
{
if( pPar_->Count() != 2 )
+ {
SetError( SbxERR_WRONG_ARGS );
+ }
else
{
SbxVariable* pRes = NULL;
SbxVariable* p = pPar_->Get( 1 );
if( p->GetType() == SbxSTRING )
- pRes = Find( p->GetString(), SbxCLASS_OBJECT );
+ {
+ pRes = Find( p->GetOUString(), SbxCLASS_OBJECT );
+ }
else
{
short n = p->GetInteger();
if( n >= 1 && n <= (short) pObjs->Count() )
+ {
pRes = pObjs->Get( (sal_uInt16) n - 1 );
+ }
}
if( !pRes )
+ {
SetError( SbxERR_BAD_INDEX );
+ }
pPar_->Get( 0 )->PutObject( pRes );
}
}
@@ -211,7 +241,7 @@ sal_Bool SbxCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer )
SbxStdCollection::SbxStdCollection
- ( const XubString& rClass, const XubString& rElem, sal_Bool b )
+ ( const OUString& rClass, const OUString& rElem, sal_Bool b )
: SbxCollection( rClass ), aElemClass( rElem ),
bAddRemoveOk( b )
{}
@@ -225,10 +255,14 @@ SbxStdCollection& SbxStdCollection::operator=( const SbxStdCollection& r )
{
if( &r != this )
{
- if( !r.aElemClass.EqualsIgnoreCaseAscii( aElemClass ) )
+ if( !r.aElemClass.equalsIgnoreAsciiCase( aElemClass ) )
+ {
SetError( SbxERR_CONVERSION );
+ }
else
+ {
SbxCollection::operator=( r );
+ }
}
return *this;
}
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index f168437552bb..cc6aedc5cb04 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -31,143 +31,175 @@
double ImpGetDate( const SbxValues* p )
{
double nRes;
+ SbxValue* pVal;
+
switch( +p->eType )
{
- case SbxNULL:
- SbxBase::SetError( SbxERR_CONVERSION );
- case SbxEMPTY:
- nRes = 0; break;
- case SbxCHAR:
- nRes = p->nChar; break;
- case SbxBYTE:
- nRes = p->nByte; break;
- case SbxINTEGER:
- case SbxBOOL:
- nRes = p->nInteger; break;
- case SbxERROR:
- case SbxUSHORT:
- nRes = p->nUShort; break;
- case SbxLONG:
- nRes = (double) p->nLong; break;
- case SbxULONG:
- nRes = (double) p->nULong; break;
- case SbxSINGLE:
- nRes = p->nSingle; break;
- case SbxDATE:
- case SbxDOUBLE:
- nRes = p->nDouble; break;
- case SbxCURRENCY:
- nRes = ImpCurrencyToDouble( p->nInt64 ); break;
- case SbxSALINT64:
- nRes = static_cast< double >(p->nInt64); break;
- case SbxSALUINT64:
- nRes = ImpSalUInt64ToDouble( p->uInt64 ); break;
- case SbxDECIMAL:
- case SbxBYREF | SbxDECIMAL:
- if( p->pDecimal )
- p->pDecimal->getDouble( nRes );
- else
- nRes = 0.0;
- break;
- case SbxBYREF | SbxSTRING:
- case SbxSTRING:
- case SbxLPSTR:
- if( !p->pOUString )
- nRes = 0;
- else
- {
- LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
-
- SvNumberFormatter* pFormatter;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
- xFactory = comphelper::getProcessServiceFactory();
- pFormatter = new SvNumberFormatter( xFactory, eLangType );
+ case SbxNULL:
+ SbxBase::SetError( SbxERR_CONVERSION );
+ case SbxEMPTY:
+ nRes = 0;
+ break;
+ case SbxCHAR:
+ nRes = p->nChar;
+ break;
+ case SbxBYTE:
+ nRes = p->nByte;
+ break;
+ case SbxINTEGER:
+ case SbxBOOL:
+ nRes = p->nInteger;
+ break;
+ case SbxERROR:
+ case SbxUSHORT:
+ nRes = p->nUShort;
+ break;
+ case SbxLONG:
+ nRes = (double) p->nLong;
+ break;
+ case SbxULONG:
+ nRes = (double) p->nULong;
+ break;
+ case SbxSINGLE:
+ nRes = p->nSingle;
+ break;
+ case SbxDATE:
+ case SbxDOUBLE:
+ nRes = p->nDouble;
+ break;
+ case SbxCURRENCY:
+ nRes = ImpCurrencyToDouble( p->nInt64 );
+ break;
+ case SbxSALINT64:
+ nRes = static_cast< double >(p->nInt64);
+ break;
+ case SbxSALUINT64:
+ nRes = ImpSalUInt64ToDouble( p->uInt64 );
+ break;
+ case SbxDECIMAL:
+ case SbxBYREF | SbxDECIMAL:
+ if( p->pDecimal )
+ {
+ p->pDecimal->getDouble( nRes );
+ }
+ else
+ {
+ nRes = 0.0;
+ }
+ break;
+ case SbxBYREF | SbxSTRING:
+ case SbxSTRING:
+ case SbxLPSTR:
+ if( !p->pOUString )
+ {
+ nRes = 0;
+ }
+ else
+ {
+ LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
- sal_uInt32 nIndex;
- xub_StrLen nCheckPos = 0;
- short nType = 127;
+ SvNumberFormatter* pFormatter;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ xFactory = comphelper::getProcessServiceFactory();
+ pFormatter = new SvNumberFormatter( xFactory, eLangType );
- // Default templates of the formatter have only two-digit
- // date. Therefore register an own format.
+ sal_uInt32 nIndex;
+ sal_uInt16 nCheckPos = 0;
+ short nType = 127;
- // HACK, because the number formatter in PutandConvertEntry replace the wildcard
- // for month, day, year not according to the configuration.
- // Problem: Print Year(Date) under Engl. OS
- // quod vide basic\source\runtime\runtime.cxx
+ // Default templates of the formatter have only two-digit
+ // date. Therefore register an own format.
- SvtSysLocale aSysLocale;
- DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
- String aDateStr;
- switch( eDate )
- {
- case MDY: aDateStr.AssignAscii( "MM.TT.JJJJ" ); break;
- case DMY: aDateStr.AssignAscii( "TT.MM.JJJJ" ); break;
- case YMD: aDateStr.AssignAscii( "JJJJ.MM.TT" ); break;
- default: aDateStr.AssignAscii( "MM.TT.JJJJ" );
- }
+ // HACK, because the number formatter in PutandConvertEntry replace the wildcard
+ // for month, day, year not according to the configuration.
+ // Problem: Print Year(Date) under Engl. OS
+ // quod vide basic\source\runtime\runtime.cxx
- String aStr( aDateStr );
- aStr.AppendAscii( " HH:MM:SS" );
+ SvtSysLocale aSysLocale;
+ DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
+ OUString aDateStr;
+ switch( eDate )
+ {
+ case MDY: aDateStr = "MM.TT.JJJJ"; break;
+ case DMY: aDateStr = "TT.MM.JJJJ"; break;
+ case YMD: aDateStr = "JJJJ.MM.TT"; break;
+ default: aDateStr = "MM.TT.JJJJ";
+ }
- pFormatter->PutandConvertEntry( aStr, nCheckPos, nType,
- nIndex, LANGUAGE_GERMAN, eLangType );
- sal_Bool bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes );
- if ( bSuccess )
- {
- short nType_ = pFormatter->GetType( nIndex );
- if(!(nType_ & ( NUMBERFORMAT_DATETIME | NUMBERFORMAT_DATE |
- NUMBERFORMAT_TIME | NUMBERFORMAT_DEFINED )))
- bSuccess = sal_False;
- }
+ OUString aStr( aDateStr );
+ aStr += " HH:MM:SS";
- if ( !bSuccess )
+ pFormatter->PutandConvertEntry( aStr, nCheckPos, nType,
+ nIndex, LANGUAGE_GERMAN, eLangType );
+ sal_Bool bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes );
+ if ( bSuccess )
+ {
+ short nType_ = pFormatter->GetType( nIndex );
+ if(!(nType_ & ( NUMBERFORMAT_DATETIME | NUMBERFORMAT_DATE |
+ NUMBERFORMAT_TIME | NUMBERFORMAT_DEFINED )))
{
- SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0;
+ bSuccess = sal_False;
}
-
- delete pFormatter;
}
- break;
- case SbxOBJECT:
- {
- SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
- if( pVal )
- nRes = pVal->GetDate();
- else
+
+ if ( !bSuccess )
{
- SbxBase::SetError( SbxERR_NO_OBJECT ); nRes = 0;
+ SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0;
}
- break;
- }
-
- case SbxBYREF | SbxCHAR:
- nRes = *p->pChar; break;
- case SbxBYREF | SbxBYTE:
- nRes = *p->pByte; break;
- case SbxBYREF | SbxINTEGER:
- case SbxBYREF | SbxBOOL:
- nRes = *p->pInteger; break;
- case SbxBYREF | SbxLONG:
- nRes = *p->pLong; break;
- case SbxBYREF | SbxULONG:
- nRes = *p->pULong; break;
- case SbxBYREF | SbxERROR:
- case SbxBYREF | SbxUSHORT:
- nRes = *p->pUShort; break;
- case SbxBYREF | SbxSINGLE:
- nRes = *p->pSingle; break;
- case SbxBYREF | SbxDATE:
- case SbxBYREF | SbxDOUBLE:
- nRes = *p->pDouble; break;
- case SbxBYREF | SbxCURRENCY:
- nRes = ImpCurrencyToDouble( *p->pnInt64 ); break;
- case SbxBYREF | SbxSALINT64:
- nRes = static_cast< double >(*p->pnInt64); break;
- case SbxBYREF | SbxSALUINT64:
- nRes = ImpSalUInt64ToDouble( *p->puInt64 ); break;
- default:
- SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0;
+ delete pFormatter;
+ }
+ break;
+ case SbxOBJECT:
+ pVal = PTR_CAST(SbxValue,p->pObj);
+ if( pVal )
+ {
+ nRes = pVal->GetDate();
+ }
+ else
+ {
+ SbxBase::SetError( SbxERR_NO_OBJECT ); nRes = 0;
+ }
+ break;
+ case SbxBYREF | SbxCHAR:
+ nRes = *p->pChar;
+ break;
+ case SbxBYREF | SbxBYTE:
+ nRes = *p->pByte;
+ break;
+ case SbxBYREF | SbxINTEGER:
+ case SbxBYREF | SbxBOOL:
+ nRes = *p->pInteger;
+ break;
+ case SbxBYREF | SbxLONG:
+ nRes = *p->pLong;
+ break;
+ case SbxBYREF | SbxULONG:
+ nRes = *p->pULong;
+ break;
+ case SbxBYREF | SbxERROR:
+ case SbxBYREF | SbxUSHORT:
+ nRes = *p->pUShort;
+ break;
+ case SbxBYREF | SbxSINGLE:
+ nRes = *p->pSingle;
+ break;
+ case SbxBYREF | SbxDATE:
+ case SbxBYREF | SbxDOUBLE:
+ nRes = *p->pDouble;
+ break;
+ case SbxBYREF | SbxCURRENCY:
+ nRes = ImpCurrencyToDouble( *p->pnInt64 );
+ break;
+ case SbxBYREF | SbxSALINT64:
+ nRes = static_cast< double >(*p->pnInt64);
+ break;
+ case SbxBYREF | SbxSALUINT64:
+ nRes = ImpSalUInt64ToDouble( *p->puInt64 );
+ break;
+ default:
+ SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0;
+ break;
}
return nRes;
}
@@ -175,54 +207,67 @@ double ImpGetDate( const SbxValues* p )
void ImpPutDate( SbxValues* p, double n )
{
SbxValues aTmp;
+ SbxDecimal* pDec;
+ SbxValue* pVal;
start:
switch( +p->eType )
{
- case SbxDATE:
- case SbxDOUBLE:
- p->nDouble = n; break;
-
+ case SbxDATE:
+ case SbxDOUBLE:
+ p->nDouble = n;
+ break;
// from here will be tested
- case SbxCHAR:
- aTmp.pChar = &p->nChar; goto direct;
- case SbxBYTE:
- aTmp.pByte = &p->nByte; goto direct;
- case SbxINTEGER:
- case SbxBOOL:
- aTmp.pInteger = &p->nInteger; goto direct;
- case SbxLONG:
- aTmp.pLong = &p->nLong; goto direct;
- case SbxULONG:
- aTmp.pULong = &p->nULong; goto direct;
- case SbxERROR:
- case SbxUSHORT:
- aTmp.pUShort = &p->nUShort; goto direct;
- case SbxSINGLE:
- aTmp.pSingle = &p->nSingle; goto direct;
- case SbxCURRENCY:
- case SbxSALINT64:
- aTmp.pnInt64 = &p->nInt64; goto direct;
- case SbxSALUINT64:
- aTmp.puInt64 = &p->uInt64; goto direct;
- case SbxDECIMAL:
- case SbxBYREF | SbxDECIMAL:
- {
- SbxDecimal* pDec = ImpCreateDecimal( p );
- if( !pDec->setDouble( n ) )
- SbxBase::SetError( SbxERR_OVERFLOW );
- break;
- }
- direct:
- aTmp.eType = SbxDataType( p->eType | SbxBYREF );
- p = &aTmp; goto start;
+ case SbxCHAR:
+ aTmp.pChar = &p->nChar;
+ goto direct;
+ case SbxBYTE:
+ aTmp.pByte = &p->nByte;
+ goto direct;
+ case SbxINTEGER:
+ case SbxBOOL:
+ aTmp.pInteger = &p->nInteger;
+ goto direct;
+ case SbxLONG:
+ aTmp.pLong = &p->nLong;
+ goto direct;
+ case SbxULONG:
+ aTmp.pULong = &p->nULong;
+ goto direct;
+ case SbxERROR:
+ case SbxUSHORT:
+ aTmp.pUShort = &p->nUShort;
+ goto direct;
+ case SbxSINGLE:
+ aTmp.pSingle = &p->nSingle;
+ goto direct;
+ case SbxCURRENCY:
+ case SbxSALINT64:
+ aTmp.pnInt64 = &p->nInt64;
+ goto direct;
+ case SbxSALUINT64:
+ aTmp.puInt64 = &p->uInt64;
+ goto direct;
+ case SbxDECIMAL:
+ case SbxBYREF | SbxDECIMAL:
+ pDec = ImpCreateDecimal( p );
+ if( !pDec->setDouble( n ) )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ }
+ break;
+ direct:
+ aTmp.eType = SbxDataType( p->eType | SbxBYREF );
+ p = &aTmp; goto start;
- case SbxBYREF | SbxSTRING:
- case SbxSTRING:
- case SbxLPSTR:
+ case SbxBYREF | SbxSTRING:
+ case SbxSTRING:
+ case SbxLPSTR:
{
if( !p->pOUString )
- p->pOUString = new ::rtl::OUString;
+ {
+ p->pOUString = new OUString;
+ }
Color* pColor;
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
@@ -232,12 +277,12 @@ start:
pFormatter = new SvNumberFormatter( xFactory, eLangType );
sal_uInt32 nIndex;
- xub_StrLen nCheckPos = 0;
+ sal_uInt16 nCheckPos = 0;
short nType;
SvtSysLocale aSysLocale;
DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
- String aStr;
+ OUString aStr;
// if the whole-number part is 0, we want no year!
if( n <= -1.0 || n >= 1.0 )
{
@@ -246,139 +291,153 @@ start:
{
switch( eDate )
{
- case MDY: aStr.AssignAscii( "MM.TT.JJJJ" ); break;
- case DMY: aStr.AssignAscii( "TT.MM.JJJJ" ); break;
- case YMD: aStr.AssignAscii( "JJJJ.MM.TT" ); break;
- default: aStr.AssignAscii( "MM.TT.JJJJ" );
+ case MDY: aStr = "MM.TT.JJJJ"; break;
+ case DMY: aStr = "TT.MM.JJJJ"; break;
+ case YMD: aStr = "JJJJ.MM.TT"; break;
+ default: aStr = "MM.TT.JJJJ";
}
}
else
{
switch( eDate )
{
- case MDY: aStr.AssignAscii( "MM.TT.JJJJ HH:MM:SS" ); break;
- case DMY: aStr.AssignAscii( "TT.MM.JJJJ HH:MM:SS" ); break;
- case YMD: aStr.AssignAscii( "JJJJ.MM.TT HH:MM:SS" ); break;
- default: aStr.AssignAscii( "MM.TT.JJJJ HH:MM:SS" );
+ case MDY: aStr = "MM.TT.JJJJ HH:MM:SS"; break;
+ case DMY: aStr = "TT.MM.JJJJ HH:MM:SS"; break;
+ case YMD: aStr = "JJJJ.MM.TT HH:MM:SS"; break;
+ default: aStr = "MM.TT.JJJJ HH:MM:SS";
}
}
}
else
- aStr.AppendAscii( "HH:MM:SS" );
-
+ {
+ aStr = "HH:MM:SS";
+ }
pFormatter->PutandConvertEntry( aStr,
- nCheckPos,
- nType,
- nIndex,
- LANGUAGE_GERMAN,
- eLangType );
- String aTmpString;
+ nCheckPos,
+ nType,
+ nIndex,
+ LANGUAGE_GERMAN,
+ eLangType );
+ OUString aTmpString;
pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor );
*p->pOUString = aTmpString;
delete pFormatter;
break;
}
- case SbxOBJECT:
+ case SbxOBJECT:
+ pVal = PTR_CAST(SbxValue,p->pObj);
+ if( pVal )
{
- SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
- if( pVal )
- pVal->PutDate( n );
- else
- SbxBase::SetError( SbxERR_NO_OBJECT );
- break;
+ pVal->PutDate( n );
}
- case SbxBYREF | SbxCHAR:
- if( n > SbxMAXCHAR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCHAR;
- }
- else if( n < SbxMINCHAR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCHAR;
- }
- *p->pChar = (xub_Unicode) n; break;
- case SbxBYREF | SbxBYTE:
- if( n > SbxMAXBYTE )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXBYTE;
- }
- else if( n < 0 )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
- }
- *p->pByte = (sal_uInt8) n; break;
- case SbxBYREF | SbxINTEGER:
- case SbxBYREF | SbxBOOL:
- if( n > SbxMAXINT )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXINT;
- }
- else if( n < SbxMININT )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT;
- }
- *p->pInteger = (sal_Int16) n; break;
- case SbxBYREF | SbxERROR:
- case SbxBYREF | SbxUSHORT:
- if( n > SbxMAXUINT )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXUINT;
- }
- else if( n < 0 )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
- }
- *p->pUShort = (sal_uInt16) n; break;
- case SbxBYREF | SbxLONG:
- if( n > SbxMAXLNG )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXLNG;
- }
- else if( n < SbxMINLNG )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINLNG;
- }
- *p->pLong = (sal_Int32) n; break;
- case SbxBYREF | SbxULONG:
- if( n > SbxMAXULNG )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXULNG;
- }
- else if( n < 0 )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
- }
- *p->pULong = (sal_uInt32) n; break;
- case SbxBYREF | SbxSINGLE:
- if( n > SbxMAXSNG )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXSNG;
- }
- else if( n < SbxMINSNG )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINSNG;
- }
- *p->pSingle = (float) n; break;
- case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = ImpDoubleToSalInt64( n ); break;
- case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = ImpDoubleToSalUInt64( n ); break;
- case SbxBYREF | SbxDATE:
- case SbxBYREF | SbxDOUBLE:
- *p->pDouble = (double) n; break;
- case SbxBYREF | SbxCURRENCY:
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCURR;
- }
- else if( n < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
- }
- *p->pnInt64 = ImpDoubleToCurrency( n ); break;
-
- default:
- SbxBase::SetError( SbxERR_CONVERSION );
+ else
+ {
+ SbxBase::SetError( SbxERR_NO_OBJECT );
+ }
+ break;
+ case SbxBYREF | SbxCHAR:
+ if( n > SbxMAXCHAR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCHAR;
+ }
+ else if( n < SbxMINCHAR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCHAR;
+ }
+ *p->pChar = (sal_Unicode) n;
+ break;
+ case SbxBYREF | SbxBYTE:
+ if( n > SbxMAXBYTE )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXBYTE;
+ }
+ else if( n < 0 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
+ }
+ *p->pByte = (sal_uInt8) n;
+ break;
+ case SbxBYREF | SbxINTEGER:
+ case SbxBYREF | SbxBOOL:
+ if( n > SbxMAXINT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXINT;
+ }
+ else if( n < SbxMININT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT;
+ }
+ *p->pInteger = (sal_Int16) n;
+ break;
+ case SbxBYREF | SbxERROR:
+ case SbxBYREF | SbxUSHORT:
+ if( n > SbxMAXUINT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXUINT;
+ }
+ else if( n < 0 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
+ }
+ *p->pUShort = (sal_uInt16) n;
+ break;
+ case SbxBYREF | SbxLONG:
+ if( n > SbxMAXLNG )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXLNG;
+ }
+ else if( n < SbxMINLNG )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINLNG;
+ }
+ *p->pLong = (sal_Int32) n;
+ break;
+ case SbxBYREF | SbxULONG:
+ if( n > SbxMAXULNG )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXULNG;
+ }
+ else if( n < 0 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
+ }
+ *p->pULong = (sal_uInt32) n;
+ break;
+ case SbxBYREF | SbxSINGLE:
+ if( n > SbxMAXSNG )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXSNG;
+ }
+ else if( n < SbxMINSNG )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINSNG;
+ }
+ *p->pSingle = (float) n;
+ break;
+ case SbxBYREF | SbxSALINT64:
+ *p->pnInt64 = ImpDoubleToSalInt64( n );
+ break;
+ case SbxBYREF | SbxSALUINT64:
+ *p->puInt64 = ImpDoubleToSalUInt64( n );
+ break;
+ case SbxBYREF | SbxDATE:
+ case SbxBYREF | SbxDOUBLE:
+ *p->pDouble = (double) n;
+ break;
+ case SbxBYREF | SbxCURRENCY:
+ if( n > SbxMAXCURR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCURR;
+ }
+ else if( n < SbxMINCURR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
+ }
+ *p->pnInt64 = ImpDoubleToCurrency( n );
+ break;
+ default:
+ SbxBase::SetError( SbxERR_CONVERSION );
+ break;
}
}
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index 5fa87d437686..4add26a22a8a 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -215,7 +215,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCHAR;
}
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index ef7952f97786..3eaaecf8b7c2 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -46,10 +46,10 @@ public:
static SbxVariable* Element
- ( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf,
+ ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType, const SbxSimpleCharClass& rCharClass );
-static const xub_Unicode* SkipWhitespace( const xub_Unicode* p )
+static const sal_Unicode* SkipWhitespace( const sal_Unicode* p )
{
while( *p && ( *p == ' ' || *p == '\t' ) )
p++;
@@ -59,7 +59,7 @@ static const xub_Unicode* SkipWhitespace( const xub_Unicode* p )
// Scanning of a symbol. The symbol were inserted in rSym, the return value
// is the new scan position. The symbol is at errors empty.
-static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const SbxSimpleCharClass& rCharClass )
+static const sal_Unicode* Symbol( const sal_Unicode* p, OUString& rSym, const SbxSimpleCharClass& rCharClass )
{
sal_uInt16 nLen = 0;
// Did we have a nonstandard symbol?
@@ -67,38 +67,46 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
{
rSym = ++p;
while( *p && *p != ']' )
+ {
p++, nLen++;
+ }
p++;
}
else
{
// A symbol had to begin with a alphabetic character or an underline
if( !rCharClass.isAlpha( *p ) && *p != '_' )
+ {
SbxBase::SetError( SbxERR_SYNTAX );
+ }
else
{
rSym = p;
// The it can contain alphabetic characters, numbers or underlines
while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
+ {
p++, nLen++;
+ }
// BASIC-Standard-Suffixes were ignored
if( *p && (*p == '%' || *p == '&' || *p == '!' || *p == '#' || *p == '$' ) )
+ {
p++;
+ }
}
}
- rSym.Erase( nLen );
+ rSym = rSym.copy( 0, nLen );
return p;
}
// Qualified name. Element.Element....
static SbxVariable* QualifiedName
- ( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, SbxClassType t )
+ ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, SbxClassType t )
{
static SbxSimpleCharClass aCharClass;
SbxVariableRef refVar;
- const xub_Unicode* p = SkipWhitespace( *ppBuf );
+ const sal_Unicode* p = SkipWhitespace( *ppBuf );
if( aCharClass.isAlpha( *p ) || *p == '_' || *p == '[' )
{
// Read in the element
@@ -131,44 +139,56 @@ static SbxVariable* QualifiedName
// a function (with optional parameters).
static SbxVariable* Operand
- ( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, bool bVar )
+ ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf, bool bVar )
{
static SbxSimpleCharClass aCharClass;
SbxVariableRef refVar( new SbxVariable );
- const xub_Unicode* p = SkipWhitespace( *ppBuf );
+ const sal_Unicode* p = SkipWhitespace( *ppBuf );
if( !bVar && ( aCharClass.isDigit( *p )
- || ( *p == '.' && aCharClass.isDigit( *( p+1 ) ) )
- || *p == '-'
- || *p == '&' ) )
+ || ( *p == '.' && aCharClass.isDigit( *( p+1 ) ) )
+ || *p == '-'
+ || *p == '&' ) )
{
// A number could be scanned in directly!
sal_uInt16 nLen;
- if( !refVar->Scan( rtl::OUString( p ), &nLen ) )
+ if( !refVar->Scan( OUString( p ), &nLen ) )
+ {
refVar.Clear();
+ }
else
+ {
p += nLen;
+ }
}
else if( !bVar && *p == '"' )
{
// A string
- XubString aString;
+ OUString aString;
p++;
for( ;; )
{
// This is perhaps an error
if( !*p )
+ {
return NULL;
+ }
// Double quotes are OK
if( *p == '"' )
+ {
if( *++p != '"' )
+ {
break;
- aString += *p++;
+ }
+ }
+ aString += OUString(*p++);
}
refVar->PutString( aString );
}
else
+ {
refVar = QualifiedName( pObj, pGbl, &p, SbxCLASS_DONTCARE );
+ }
*ppBuf = p;
if( refVar.Is() )
refVar->AddRef();
@@ -178,14 +198,14 @@ static SbxVariable* Operand
// Read in of a simple term. The operands +, -, * and /
// are supported.
-static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf )
+static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
{
- const xub_Unicode* p = *ppBuf;
+ const sal_Unicode* p = *ppBuf;
SbxVariableRef refVar( Operand( pObj, pGbl, &p, false ) );
p = SkipWhitespace( p );
while( refVar.Is() && ( *p == '*' || *p == '/' ) )
{
- xub_Unicode cOp = *p++;
+ sal_Unicode cOp = *p++;
SbxVariableRef refVar2( Operand( pObj, pGbl, &p, false ) );
if( refVar2.Is() )
{
@@ -210,14 +230,14 @@ static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
return refVar;
}
-static SbxVariable* PlusMinus( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf )
+static SbxVariable* PlusMinus( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
{
- const xub_Unicode* p = *ppBuf;
+ const sal_Unicode* p = *ppBuf;
SbxVariableRef refVar( MulDiv( pObj, pGbl, &p ) );
p = SkipWhitespace( p );
while( refVar.Is() && ( *p == '+' || *p == '-' ) )
{
- xub_Unicode cOp = *p++;
+ sal_Unicode cOp = *p++;
SbxVariableRef refVar2( MulDiv( pObj, pGbl, &p ) );
if( refVar2.Is() )
{
@@ -242,9 +262,9 @@ static SbxVariable* PlusMinus( SbxObject* pObj, SbxObject* pGbl, const xub_Unico
return refVar;
}
-static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf )
+static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf )
{
- const xub_Unicode* p = *ppBuf;
+ const sal_Unicode* p = *ppBuf;
SbxVariableRef refVar( Operand( pObj, pGbl, &p, true ) );
p = SkipWhitespace( p );
if( refVar.Is() )
@@ -285,17 +305,19 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
// specified object and the parameter list will be attached if necessary.
static SbxVariable* Element
- ( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf,
+ ( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType t, const SbxSimpleCharClass& rCharClass )
{
- XubString aSym;
- const xub_Unicode* p = Symbol( *ppBuf, aSym, rCharClass );
+ OUString aSym;
+ const sal_Unicode* p = Symbol( *ppBuf, aSym, rCharClass );
SbxVariableRef refVar;
- if( aSym.Len() )
+ if( !aSym.isEmpty() )
{
sal_uInt16 nOld = pObj->GetFlags();
if( pObj == pGbl )
+ {
pObj->SetFlag( SBX_GBLSEARCH );
+ }
refVar = pObj->Find( aSym, t );
pObj->SetFlags( nOld );
if( refVar.Is() )
@@ -348,22 +370,26 @@ static SbxVariable* Element
// Mainroutine
-SbxVariable* SbxObject::Execute( const XubString& rTxt )
+SbxVariable* SbxObject::Execute( const OUString& rTxt )
{
SbxVariable* pVar = NULL;
- const xub_Unicode* p = rTxt.GetBuffer();
+ const sal_Unicode* p = rTxt.getStr();
for( ;; )
{
p = SkipWhitespace( p );
if( !*p )
+ {
break;
+ }
if( *p++ != '[' )
{
SetError( SbxERR_SYNTAX ); break;
}
pVar = Assign( this, this, &p );
if( !pVar )
+ {
break;
+ }
p = SkipWhitespace( p );
if( *p++ != ']' )
{
@@ -373,17 +399,21 @@ SbxVariable* SbxObject::Execute( const XubString& rTxt )
return pVar;
}
-SbxVariable* SbxObject::FindQualified( const XubString& rName, SbxClassType t )
+SbxVariable* SbxObject::FindQualified( const OUString& rName, SbxClassType t )
{
SbxVariable* pVar = NULL;
- const xub_Unicode* p = rName.GetBuffer();
+ const sal_Unicode* p = rName.getStr();
p = SkipWhitespace( p );
if( !*p )
+ {
return NULL;;
+ }
pVar = QualifiedName( this, this, &p, t );
p = SkipWhitespace( p );
if( *p )
+ {
SetError( SbxERR_SYNTAX );
+ }
return pVar;
}
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 29cd1a9f8573..0661861f4694 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <basic/sbxform.hxx>
+#include <rtl/ustrbuf.hxx>
/*
TODO: are there any Star-Basic characteristics unconsidered?
@@ -107,14 +108,14 @@ double get_number_of_digits( double dNumber )
//=================================================================
SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
- String _sOnStrg,
- String _sOffStrg,
- String _sYesStrg,
- String _sNoStrg,
- String _sTrueStrg,
- String _sFalseStrg,
- String _sCurrencyStrg,
- String _sCurrencyFormatStrg )
+ OUString _sOnStrg,
+ OUString _sOffStrg,
+ OUString _sYesStrg,
+ OUString _sNoStrg,
+ OUString _sTrueStrg,
+ OUString _sFalseStrg,
+ OUString _sCurrencyStrg,
+ OUString _sCurrencyFormatStrg )
{
cDecPoint = _cDecPoint;
cThousandSep = _cThousandSep;
@@ -133,46 +134,50 @@ SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousa
// for one position to larger indexes, i. e. place for a new
// character (which is to be inserted) is created.
// ATTENTION: the string MUST be long enough!
-inline void SbxBasicFormater::ShiftString( String& sStrg, sal_uInt16 nStartPos )
+inline void SbxBasicFormater::ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos )
{
- sStrg.Erase( nStartPos,1 );
+ sStrg.remove(nStartPos,1);
}
-inline void SbxBasicFormater::StrAppendChar( String& sStrg, sal_Unicode ch )
-{
- sStrg.Insert( ch );
-}
-
-void SbxBasicFormater::AppendDigit( String& sStrg, short nDigit )
+void SbxBasicFormater::AppendDigit( OUStringBuffer& sStrg, short nDigit )
{
if( nDigit>=0 && nDigit<=9 )
- StrAppendChar( sStrg, (sal_Unicode)(nDigit+ASCII_0) );
+ {
+ sStrg.append((sal_Unicode)(nDigit+ASCII_0));
+ }
}
-void SbxBasicFormater::LeftShiftDecimalPoint( String& sStrg )
+void SbxBasicFormater::LeftShiftDecimalPoint( OUStringBuffer& sStrg )
{
- sal_uInt16 nPos = sStrg.Search( cDecPoint );
+ sal_Int32 nPos = -1;
- if( nPos!=STRING_NOTFOUND )
+ for(sal_Int32 i = 0; i < sStrg.getLength(); i++)
{
- // swap decimal point
- sStrg.SetChar( nPos, sStrg.GetChar( nPos - 1 ) );
- sStrg.SetChar( nPos-1, cDecPoint );
+ if(sStrg[i] == cDecPoint)
+ {
+ nPos = i;
+ break;
+ }
+ }
+ if( nPos >= 0 )
+ {
+ sStrg[nPos] = sStrg[nPos - 1];
+ sStrg[nPos - 1] = cDecPoint;
}
}
// returns a flag if rounding a 9
-void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOverflow )
+void SbxBasicFormater::StrRoundDigit( OUStringBuffer& sStrg, short nPos, sal_Bool& bOverflow )
{
if( nPos<0 )
+ {
return;
-
+ }
bOverflow = sal_False;
-
- sal_Unicode c = sStrg.GetChar( nPos );
- if( nPos>0 && (c == cDecPoint || c == cThousandSep) )
+ sal_Unicode c = sStrg[nPos];
+ if( nPos > 0 && (c == cDecPoint || c == cThousandSep) )
{
- StrRoundDigit( sStrg,nPos-1,bOverflow );
+ StrRoundDigit( sStrg, nPos - 1, bOverflow );
// CHANGE from 9.3.1997: end the method immediately after recursive call!
return;
}
@@ -182,52 +187,56 @@ void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOver
// in one piece, i. e. special characters should ONLY be in
// front OR behind the number and not right in the middle of
// the format information for the number
- while( nPos>=0 && (sStrg.GetChar( nPos )<ASCII_0 || sStrg.GetChar( nPos )>ASCII_9) )
+ while( nPos >= 0 && ( sStrg[nPos] < ASCII_0 || sStrg[nPos] > ASCII_9 ))
+ {
nPos--;
-
+ }
if( nPos==-1 )
{
- ShiftString( sStrg,0 );
- sStrg.SetChar( 0, '1' );
+ ShiftString( sStrg, 0 );
+ sStrg[0] = (sal_Unicode)'1';
bOverflow = sal_True;
}
else
{
- sal_Unicode c2 = sStrg.GetChar( nPos );
+ sal_Unicode c2 = sStrg[nPos];
if( c2 >= ASCII_0 && c2 <= ASCII_9 )
{
if( c2 == ASCII_9 )
{
- sStrg.SetChar( nPos, '0' );
- StrRoundDigit( sStrg,nPos-1,bOverflow );
+ sStrg[nPos] = (sal_Unicode)'0';
+ StrRoundDigit( sStrg, nPos - 1, bOverflow );
}
else
- sStrg.SetChar( nPos, c2+1 );
+ {
+ sStrg[nPos] = c2 + 1;
+ }
}
else
{
ShiftString( sStrg,nPos+1 );
- sStrg.SetChar( nPos+1, '1' );
+ sStrg[nPos + 1] = (sal_Unicode)'1';
bOverflow = sal_True;
}
}
}
-
-void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos )
+void SbxBasicFormater::StrRoundDigit( OUStringBuffer& sStrg, short nPos )
{
sal_Bool bOverflow;
- StrRoundDigit( sStrg,nPos,bOverflow );
+ StrRoundDigit( sStrg, nPos, bOverflow );
}
-void SbxBasicFormater::ParseBack( String& sStrg, const String& sFormatStrg,
+void SbxBasicFormater::ParseBack( OUStringBuffer& sStrg, const OUString& sFormatStrg,
short nFormatPos )
{
- for( short i=nFormatPos;
- i>0 && sFormatStrg.GetChar( i ) == '#' && sStrg.GetChar( (sStrg.Len()-1) ) == '0';
+ for( sal_Int32 i = nFormatPos;
+ i>0 && sFormatStrg[ i ] == (sal_Unicode)'#' && sStrg[sStrg.getLength() - 1] == (sal_Unicode)'0';
i-- )
- { sStrg.Erase( sStrg.Len()-1 ); }
+ {
+ sStrg.setLength(sStrg.getLength() - 1 );
+ }
}
#ifdef _with_sprintf
@@ -241,7 +250,7 @@ void SbxBasicFormater::InitScan( double _dNum )
InitExp( get_number_of_digits( dNum ) );
// maximum of 15 positions behind the decimal point, example: -1.234000000000000E-001
/*int nCount =*/ sprintf( sBuffer,"%+22.15lE",dNum );
- sSciNumStrg.AssignAscii( sBuffer );
+ sSciNumStrg = rtl::OUString::createFromAscii( sBuffer );
}
@@ -250,7 +259,7 @@ void SbxBasicFormater::InitExp( double _dNewExp )
char sBuffer[ MAX_DOUBLE_BUFFER_LENGTH ];
nNumExp = (short)_dNewExp;
/*int nCount =*/ sprintf( sBuffer,"%+i",nNumExp );
- sNumExpStrg.AssignAscii( sBuffer );
+ sNumExpStrg = rtl::OUString::createFromAscii( sBuffer );
nExpExp = (short)get_number_of_digits( (double)nNumExp );
}
@@ -262,7 +271,9 @@ short SbxBasicFormater::GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigi
// or to read a digit outside of the
// number's dissolution (double)
if( nPos>nNumExp || abs(nNumExp-nPos)>MAX_NO_OF_DIGITS )
+ {
return _NO_DIGIT;
+ }
// determine the index of the position in the number-string:
// skip the leading sign
sal_uInt16 no = 1;
@@ -273,7 +284,7 @@ short SbxBasicFormater::GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigi
// query of the number's first valid digit --> set flag
if( nPos==nNumExp )
bFoundFirstDigit = sal_True;
- return (short)(sSciNumStrg.GetChar( no ) - ASCII_0);
+ return (short)(sSciNumStrg[ no ] - ASCII_0);
}
short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit )
@@ -286,7 +297,7 @@ short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstD
if( nPos==nExpExp )
bFoundFirstDigit = sal_True;
- return (short)(sNumExpStrg.GetChar( no ) - ASCII_0);
+ return (short)(sNumExpStrg[ no ] - ASCII_0);
}
// a value for the exponent can be given because the number maybe shall
@@ -365,108 +376,115 @@ short SbxBasicFormater::RoundDigit( double dNumber )
// Copies the respective part of the format-string, if existing, and returns it.
// So a new string is created, which has to be freed by the caller later.
-String SbxBasicFormater::GetPosFormatString( const String& sFormatStrg, sal_Bool & bFound )
+OUString SbxBasicFormater::GetPosFormatString( const OUString& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
- sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR );
+ sal_Int32 nPos = sFormatStrg.indexOf( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ if( nPos >= 0 )
{
bFound = sal_True;
// the format-string for positive numbers is
// everything before the first ';'
- return sFormatStrg.Copy( 0,nPos );
+ return sFormatStrg.copy( 0,nPos );
}
- String aRetStr;
- aRetStr.AssignAscii( EMPTYFORMATSTRING );
+ OUString aRetStr;
+ aRetStr = rtl::OUString::createFromAscii( EMPTYFORMATSTRING );
return aRetStr;
}
// see also GetPosFormatString()
-String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, sal_Bool & bFound )
+OUString SbxBasicFormater::GetNegFormatString( const OUString& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
- sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR );
+ sal_Int32 nPos = sFormatStrg.indexOf( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ if( nPos >= 0)
{
// the format-string for negative numbers is
// everything between the first and the second ';'
- String sTempStrg = sFormatStrg.Copy( nPos+1 );
- nPos = sTempStrg.Search( FORMAT_SEPARATOR );
+ OUString sTempStrg = sFormatStrg.copy( nPos+1 );
+ nPos = sTempStrg.indexOf( FORMAT_SEPARATOR );
bFound = sal_True;
- if( nPos==STRING_NOTFOUND )
+ if( nPos < 0 )
+ {
return sTempStrg;
+ }
else
- return sTempStrg.Copy( 0,nPos );
+ {
+ return sTempStrg.copy( 0,nPos );
+ }
}
- String aRetStr;
- aRetStr.AssignAscii( EMPTYFORMATSTRING );
+ OUString aRetStr;
+ aRetStr = rtl::OUString::createFromAscii( EMPTYFORMATSTRING );
return aRetStr;
}
// see also GetPosFormatString()
-String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, sal_Bool & bFound )
+OUString SbxBasicFormater::Get0FormatString( const OUString& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
- sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR );
+ sal_Int32 nPos = sFormatStrg.indexOf( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ if( nPos >= 0 )
{
// the format string for the zero is
// everything after the second ';'
- String sTempStrg = sFormatStrg.Copy( nPos+1 );
- nPos = sTempStrg.Search( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ OUString sTempStrg = sFormatStrg.copy( nPos+1 );
+ nPos = sTempStrg.indexOf( FORMAT_SEPARATOR );
+ if( nPos >= 0 )
{
bFound = sal_True;
- sTempStrg = sTempStrg.Copy( nPos+1 );
- nPos = sTempStrg.Search( FORMAT_SEPARATOR );
- if( nPos==STRING_NOTFOUND )
+ sTempStrg = sTempStrg.copy( nPos+1 );
+ nPos = sTempStrg.indexOf( FORMAT_SEPARATOR );
+ if( nPos < 0 )
+ {
return sTempStrg;
+ }
else
- return sTempStrg.Copy( 0,nPos );
+ {
+ return sTempStrg.copy( 0,nPos );
+ }
}
}
- String aRetStr;
- aRetStr.AssignAscii( EMPTYFORMATSTRING );
+ OUString aRetStr;
+ aRetStr = rtl::OUString::createFromAscii( EMPTYFORMATSTRING );
return aRetStr;
}
// see also GetPosFormatString()
-String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, sal_Bool & bFound )
+OUString SbxBasicFormater::GetNullFormatString( const OUString& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
- sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR );
+ sal_Int32 nPos = sFormatStrg.indexOf( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ if( nPos >= 0 )
{
// the format-string for the Null is
// everything after the third ';'
- String sTempStrg = sFormatStrg.Copy( nPos+1 );
- nPos = sTempStrg.Search( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ OUString sTempStrg = sFormatStrg.copy( nPos+1 );
+ nPos = sTempStrg.indexOf( FORMAT_SEPARATOR );
+ if( nPos >= 0 )
{
- sTempStrg = sTempStrg.Copy( nPos+1 );
- nPos = sTempStrg.Search( FORMAT_SEPARATOR );
- if( nPos!=STRING_NOTFOUND )
+ sTempStrg = sTempStrg.copy( nPos+1 );
+ nPos = sTempStrg.indexOf( FORMAT_SEPARATOR );
+ if( nPos >= 0 )
{
bFound = sal_True;
- return sTempStrg.Copy( nPos+1 );
+ return sTempStrg.copy( nPos+1 );
}
}
}
- String aRetStr;
- aRetStr.AssignAscii( EMPTYFORMATSTRING );
+ OUString aRetStr;
+ aRetStr = rtl::OUString::createFromAscii( EMPTYFORMATSTRING );
return aRetStr;
}
-
// returns value <> 0 in case of an error
-short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
+short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
short& nNoOfOptionalDigitsLeft,
short& nNoOfExponentDigits, short& nNoOfOptionalExponentDigits,
@@ -474,10 +492,10 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
sal_Bool& bGenerateThousandSeparator,
short& nMultipleThousandSeparators )
{
- sal_uInt16 nLen;
+ sal_Int32 nLen;
short nState = 0;
- nLen = sFormatStrg.Len();
+ nLen = sFormatStrg.getLength();
nNoOfDigitsLeft = 0;
nNoOfDigitsRight = 0;
nNoOfOptionalDigitsLeft = 0;
@@ -488,81 +506,93 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
bScientific = sal_False;
// from 11.7.97: as soon as a comma (point?) is found in the format string,
// all three decimal powers are marked (i. e. thousand, million, ...)
- bGenerateThousandSeparator = sFormatStrg.Search( ',' ) != STRING_NOTFOUND;
+ bGenerateThousandSeparator = sFormatStrg.indexOf( ',' ) >= 0;
nMultipleThousandSeparators = 0;
- for( sal_uInt16 i=0; i<nLen; i++ )
+ for( sal_Int32 i = 0; i < nLen; i++ )
{
- sal_Unicode c = sFormatStrg.GetChar( i );
- switch( c ) {
- case '#':
- case '0':
- if( nState==0 )
- {
- nNoOfDigitsLeft++;
+ sal_Unicode c = sFormatStrg[ i ];
+ switch( c )
+ {
+ case '#':
+ case '0':
+ if( nState==0 )
+ {
+ nNoOfDigitsLeft++;
// TODO here maybe better error inspection of the mantissa for valid syntax (see grammar)h
- // ATTENTION: 'undefined' behaviour if # and 0 are combined!
- // REMARK: #-placeholders are actually useless for
- // scientific display before the decimal point!
- if( c=='#' )
- nNoOfOptionalDigitsLeft++;
- }
- else if( nState==1 )
- nNoOfDigitsRight++;
- else if( nState==-1 ) // search 0 in the exponent
+ // ATTENTION: 'undefined' behaviour if # and 0 are combined!
+ // REMARK: #-placeholders are actually useless for
+ // scientific display before the decimal point!
+ if( c=='#' )
{
- if( c=='#' ) // # switches on the condition
- {
- nNoOfOptionalExponentDigits++;
- nState = -2;
- }
- nNoOfExponentDigits++;
+ nNoOfOptionalDigitsLeft++;
}
- else if( nState==-2 ) // search # in the exponent
+ }
+ else if( nState==1 )
+ {
+ nNoOfDigitsRight++;
+ }
+ else if( nState==-1 ) // search 0 in the exponent
+ {
+ if( c=='#' ) // # switches on the condition
{
- if( c=='0' )
- // ERROR: 0 after # in the exponent is NOT allowed!!
- return -4;
nNoOfOptionalExponentDigits++;
- nNoOfExponentDigits++;
+ nState = -2;
}
- break;
- case '.':
- nState++;
- if( nState>1 )
- return -1; // ERROR: too many decimal points
- break;
- case '%':
- bPercent = sal_True;
- break;
- case '(':
- bCurrency = sal_True;
- break;
- case ',':
+ nNoOfExponentDigits++;
+ }
+ else if( nState==-2 ) // search # in the exponent
+ {
+ if( c=='0' )
+ {
+ // ERROR: 0 after # in the exponent is NOT allowed!!
+ return -4;
+ }
+ nNoOfOptionalExponentDigits++;
+ nNoOfExponentDigits++;
+ }
+ break;
+ case '.':
+ nState++;
+ if( nState>1 )
+ {
+ return -1; // ERROR: too many decimal points
+ }
+ break;
+ case '%':
+ bPercent = sal_True;
+ break;
+ case '(':
+ bCurrency = sal_True;
+ break;
+ case ',':
{
- sal_Unicode ch = sFormatStrg.GetChar( i+1 );
+ sal_Unicode ch = sFormatStrg[ i+1 ];
if( ch!=0 && (ch==',' || ch=='.') )
- nMultipleThousandSeparators++;
- } break;
- case 'e':
- case 'E':
- // #i13821 not when no digits before
- if( nNoOfDigitsLeft > 0 || nNoOfDigitsRight > 0 )
{
- nState = -1; // abort counting digits
- bScientific = sal_True;
+ nMultipleThousandSeparators++;
}
- break;
+ }
+ break;
+ case 'e':
+ case 'E':
+ // #i13821 not when no digits before
+ if( nNoOfDigitsLeft > 0 || nNoOfDigitsRight > 0 )
+ {
+ nState = -1; // abort counting digits
+ bScientific = sal_True;
+ }
+ break;
// OWN command-character which turns on
// the creation of thousand-separators
- case '\\':
- // Ignore next char
- i++;
- break;
- case CREATE_1000SEP_CHAR:
- bGenerateThousandSeparator = sal_True;
- break;
+ case '\\':
+ // Ignore next char
+ i++;
+ break;
+ case CREATE_1000SEP_CHAR:
+ bGenerateThousandSeparator = sal_True;
+ break;
}
}
return 0;
@@ -571,15 +601,15 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
// the flag bCreateSign says that at the mantissa a leading sign
// shall be created
void SbxBasicFormater::ScanFormatString( double dNumber,
- const String& sFormatStrg, String& sReturnStrg,
- sal_Bool bCreateSign )
+ const OUString& sFormatStrg, OUString& sReturnStrgFinal,
+ sal_Bool bCreateSign )
{
short /*nErr,*/nNoOfDigitsLeft,nNoOfDigitsRight,nNoOfOptionalDigitsLeft,
- nNoOfExponentDigits,nNoOfOptionalExponentDigits,
- nMultipleThousandSeparators;
+ nNoOfExponentDigits,nNoOfOptionalExponentDigits,
+ nMultipleThousandSeparators;
sal_Bool bPercent,bCurrency,bScientific,bGenerateThousandSeparator;
- sReturnStrg = String();
+ OUStringBuffer sReturnStrg = OUStringBuffer();
// analyse the format-string, i. e. determine the following values:
/*
@@ -598,356 +628,411 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
- other errors? multiple decimal points, E's, etc.
--> errors are simply ignored at the moment
*/
- AnalyseFormatString( sFormatStrg,nNoOfDigitsLeft,nNoOfDigitsRight,
- nNoOfOptionalDigitsLeft,nNoOfExponentDigits,
- nNoOfOptionalExponentDigits,
- bPercent,bCurrency,bScientific,bGenerateThousandSeparator,
- nMultipleThousandSeparators );
- // special handling for special characters
- if( bPercent )
- dNumber *= 100.0;
+ AnalyseFormatString( sFormatStrg, nNoOfDigitsLeft, nNoOfDigitsRight,
+ nNoOfOptionalDigitsLeft, nNoOfExponentDigits,
+ nNoOfOptionalExponentDigits,
+ bPercent, bCurrency, bScientific,
+ bGenerateThousandSeparator, nMultipleThousandSeparators );
+ // special handling for special characters
+ if( bPercent )
+ {
+ dNumber *= 100.0;
+ }
// TODO: this condition (,, or ,.) is NOT Visual-Basic compatible!
// Question: shall this stay here (requirements)?
- if( nMultipleThousandSeparators )
- dNumber /= 1000.0;
-
- double dExponent;
- short i,nLen;
- short nState,nDigitPos,nExponentPos,nMaxDigit,nMaxExponentDigit;
- sal_Bool bFirstDigit,bFirstExponentDigit,bFoundFirstDigit,
- bIsNegative,bZeroSpaceOn, bSignHappend,bDigitPosNegative;
-
- bSignHappend = sal_False;
- bFoundFirstDigit = sal_False;
- bIsNegative = dNumber<0.0;
- nLen = sFormatStrg.Len();
- dExponent = get_number_of_digits( dNumber );
- nExponentPos = 0;
- nMaxExponentDigit = 0;
- nMaxDigit = (short)dExponent;
- bDigitPosNegative = false;
- if( bScientific )
+ if( nMultipleThousandSeparators )
+ {
+ dNumber /= 1000.0;
+ }
+ double dExponent;
+ short i,nLen;
+ short nState,nDigitPos,nExponentPos,nMaxDigit,nMaxExponentDigit;
+ sal_Bool bFirstDigit,bFirstExponentDigit,bFoundFirstDigit,
+ bIsNegative,bZeroSpaceOn, bSignHappend,bDigitPosNegative;
+
+ bSignHappend = sal_False;
+ bFoundFirstDigit = sal_False;
+ bIsNegative = dNumber < 0.0;
+ nLen = sFormatStrg.getLength();
+ dExponent = get_number_of_digits( dNumber );
+ nExponentPos = 0;
+ nMaxExponentDigit = 0;
+ nMaxDigit = (short)dExponent;
+ bDigitPosNegative = false;
+ if( bScientific )
+ {
+ dExponent = dExponent - (double)(nNoOfDigitsLeft-1);
+ nDigitPos = nMaxDigit;
+ nMaxExponentDigit = (short)get_number_of_digits( dExponent );
+ nExponentPos = nNoOfExponentDigits - 1 - nNoOfOptionalExponentDigits;
+ }
+ else
+ {
+ nDigitPos = nNoOfDigitsLeft - 1; // counting starts at 0, 10^0
+ // no exponent-data is needed here!
+ bDigitPosNegative = (nDigitPos < 0);
+ }
+ bFirstDigit = sal_True;
+ bFirstExponentDigit = sal_True;
+ nState = 0; // 0 --> mantissa; 1 --> exponent
+ bZeroSpaceOn = 0;
+
+
+#ifdef _with_sprintf
+ InitScan( dNumber );
+#endif
+ // scanning the format-string:
+ sal_Unicode cForce = 0;
+ for( i = 0; i < nLen; i++ )
+ {
+ sal_Unicode c;
+ if( cForce )
{
- dExponent = dExponent - (double)(nNoOfDigitsLeft-1);
- nDigitPos = nMaxDigit;
- nMaxExponentDigit = (short)get_number_of_digits( dExponent );
- nExponentPos = nNoOfExponentDigits-1 - nNoOfOptionalExponentDigits;
+ c = cForce;
+ cForce = 0;
}
else
{
- nDigitPos = nNoOfDigitsLeft-1; // counting starts at 0, 10^0
- // no exponent-data is needed here!
- bDigitPosNegative = (nDigitPos < 0);
+ c = sFormatStrg[ i ];
}
- bFirstDigit = sal_True;
- bFirstExponentDigit = sal_True;
- nState = 0; // 0 --> mantissa; 1 --> exponent
- bZeroSpaceOn = 0;
-
-
-#ifdef _with_sprintf
- InitScan( dNumber );
-#endif
- // scanning the format-string:
- sal_Unicode cForce = 0;
- for( i=0; i<nLen; i++ )
+ switch( c )
{
- sal_Unicode c;
- if( cForce )
+ case '0':
+ case '#':
+ if( nState==0 )
{
- c = cForce;
- cForce = 0;
- }
- else
- {
- c = sFormatStrg.GetChar( i );
- }
- switch( c ) {
- case '0':
- case '#':
- if( nState==0 )
+ // handling of the mantissa
+ if( bFirstDigit )
+ {
+ // remark: at bCurrency the negative
+ // leading sign shall be shown with ()
+ if( bIsNegative && !bCreateSign && !bSignHappend )
+ {
+ bSignHappend = sal_True;
+ sReturnStrg.append('-');
+ }
+ // output redundant positions, i. e. those which
+ // are undocumented by the format-string
+ if( nMaxDigit > nDigitPos )
{
- // handling of the mantissa
- if( bFirstDigit )
+ for( short j = nMaxDigit; j > nDigitPos; j-- )
{
- // remark: at bCurrency the negative
- // leading sign shall be shown with ()
- if( bIsNegative && !bCreateSign && !bSignHappend )
- {
- bSignHappend = sal_True;
- StrAppendChar( sReturnStrg,'-' );
- }
- // output redundant positions, i. e. those which
- // are undocumented by the format-string
- if( nMaxDigit>nDigitPos )
- {
- for( short j=nMaxDigit; j>nDigitPos; j-- )
- {
- short nTempDigit;
+ short nTempDigit;
#ifdef _with_sprintf
- AppendDigit( sReturnStrg,nTempDigit = GetDigitAtPosScan( j,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, nTempDigit = GetDigitAtPosScan( j, bFoundFirstDigit ) );
#else
- AppendDigit( sReturnStrg,nTempDigit = GetDigitAtPos( dNumber,j,dNumber,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, nTempDigit = GetDigitAtPos( dNumber, j, dNumber, bFoundFirstDigit ) );
#endif
-
- if( nTempDigit!=_NO_DIGIT )
- bFirstDigit = sal_False;
-
- if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && j>0 && (j % 3 == 0) )
- StrAppendChar( sReturnStrg,cThousandSep );
- }
+ if( nTempDigit!=_NO_DIGIT )
+ {
+ bFirstDigit = sal_False;
+ }
+ if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit >= nDigitPos ) && j > 0 && (j % 3 == 0) )
+ {
+ sReturnStrg.append(cThousandSep );
}
}
+ }
+ }
- if( nMaxDigit<nDigitPos && ( c=='0' || bZeroSpaceOn ) )
- {
- AppendDigit( sReturnStrg,0 );
-
- bFirstDigit = sal_False;
- bZeroSpaceOn = 1;
- // Remark: in Visual-Basic the first 0 turns on the 0 for
- // all the following # (up to the decimal point),
- // this behaviour is simulated here with the flag.
-
- if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && nDigitPos>0 && (nDigitPos % 3 == 0) )
- StrAppendChar( sReturnStrg,cThousandSep );
- }
- else
- {
- short nTempDigit;
+ if( nMaxDigit<nDigitPos && ( c=='0' || bZeroSpaceOn ) )
+ {
+ AppendDigit( sReturnStrg, 0 );
+ bFirstDigit = sal_False;
+ bZeroSpaceOn = 1;
+ // Remark: in Visual-Basic the first 0 turns on the 0 for
+ // all the following # (up to the decimal point),
+ // this behaviour is simulated here with the flag.
+ if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit >= nDigitPos ) && nDigitPos > 0 && (nDigitPos % 3 == 0) )
+ {
+ sReturnStrg.append(cThousandSep);
+ }
+ }
+ else
+ {
+ short nTempDigit;
#ifdef _with_sprintf
- AppendDigit( sReturnStrg,nTempDigit = GetDigitAtPosScan( nDigitPos,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, nTempDigit = GetDigitAtPosScan( nDigitPos, bFoundFirstDigit ) );
#else
- AppendDigit( sReturnStrg,nTempDigit = GetDigitAtPos( dNumber,nDigitPos,dNumber,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, nTempDigit = GetDigitAtPos( dNumber, nDigitPos, dNumber, bFoundFirstDigit ) );
#endif
- if( nTempDigit!=_NO_DIGIT )
- bFirstDigit = sal_False;
-
- if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && nDigitPos>0 && (nDigitPos % 3 == 0) )
- StrAppendChar( sReturnStrg,cThousandSep );
- }
-
- nDigitPos--;
+ if( nTempDigit != _NO_DIGIT )
+ {
+ bFirstDigit = sal_False;
}
- else
+ if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && nDigitPos>0 && (nDigitPos % 3 == 0) )
{
- // handling the exponent
- if( bFirstExponentDigit )
+ sReturnStrg.append(cThousandSep);
+ }
+ }
+ nDigitPos--;
+ }
+ else
+ {
+ // handling the exponent
+ if( bFirstExponentDigit )
+ {
+ // leading sign has been given out at e/E already
+ bFirstExponentDigit = sal_False;
+ if( nMaxExponentDigit > nExponentPos )
+ // output redundant positions, i. e. those which
+ // are undocumented by the format-string
+ {
+ for( short j = nMaxExponentDigit; j > nExponentPos; j-- )
{
- // leading sign has been given out at e/E already
- bFirstExponentDigit = sal_False;
- if( nMaxExponentDigit>nExponentPos )
- // output redundant positions, i. e. those which
- // are undocumented by the format-string
- {
- for( short j=nMaxExponentDigit; j>nExponentPos; j-- )
- {
#ifdef _with_sprintf
- AppendDigit( sReturnStrg,GetDigitAtPosExpScan( dExponent,j,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, GetDigitAtPosExpScan( dExponent, j, bFoundFirstDigit ) );
#else
- AppendDigit( sReturnStrg,GetDigitAtPos( dExponent,j,dExponent,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg,GetDigitAtPos( dExponent, j, dExponent, bFoundFirstDigit ) );
#endif
- }
- }
}
+ }
+ }
- if( nMaxExponentDigit<nExponentPos && c=='0' )
- AppendDigit( sReturnStrg,0 );
- else
+ if( nMaxExponentDigit < nExponentPos && c=='0' )
+ {
+ AppendDigit( sReturnStrg, 0 );
+ }
+ else
+ {
#ifdef _with_sprintf
- AppendDigit( sReturnStrg,GetDigitAtPosExpScan( dExponent,nExponentPos,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, GetDigitAtPosExpScan( dExponent, nExponentPos, bFoundFirstDigit ) );
#else
- AppendDigit( sReturnStrg,GetDigitAtPos( dExponent,nExponentPos,dExponent,bFoundFirstDigit ) );
+ AppendDigit( sReturnStrg, GetDigitAtPos( dExponent, nExponentPos, dExponent, bFoundFirstDigit ) );
#endif
- nExponentPos--;
- }
- break;
- case '.':
- if( bDigitPosNegative ) // #i13821: If no digits before .
- {
- bDigitPosNegative = false;
- nDigitPos = 0;
- cForce = '#';
- i-=2;
- break;
- }
- StrAppendChar( sReturnStrg,cDecPoint );
- break;
- case '%':
- // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
- ParseBack( sReturnStrg,sFormatStrg,i-1 );
- sReturnStrg.Insert('%');
- break;
- case 'e':
- case 'E':
- // does mantissa have to be rounded, before the exponent is displayed?
- {
- // is there a mantissa at all?
- if( bFirstDigit )
- {
- // apparently not, i. e. invalid format string, e. g. E000.00
- // so ignore these e and E characters
- // maybe output an error (like in Visual Basic)?
+ }
+ nExponentPos--;
+ }
+ break;
+ case '.':
+ if( bDigitPosNegative ) // #i13821: If no digits before .
+ {
+ bDigitPosNegative = false;
+ nDigitPos = 0;
+ cForce = '#';
+ i-=2;
+ break;
+ }
+ sReturnStrg.append(cDecPoint);
+ break;
+ case '%':
+ // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
+ ParseBack( sReturnStrg, sFormatStrg, i-1 );
+ sReturnStrg.insert(0,'%');
+ break;
+ case 'e':
+ case 'E':
+ // does mantissa have to be rounded, before the exponent is displayed?
+ {
+ // is there a mantissa at all?
+ if( bFirstDigit )
+ {
+ // apparently not, i. e. invalid format string, e. g. E000.00
+ // so ignore these e and E characters
+ // maybe output an error (like in Visual Basic)?
- // #i13821: VB 6 behaviour
- StrAppendChar( sReturnStrg,c );
- break;
- }
+ // #i13821: VB 6 behaviour
+ sReturnStrg.append(c);
+ break;
+ }
- sal_Bool bOverflow = sal_False;
+ sal_Bool bOverflow = sal_False;
#ifdef _with_sprintf
- short nNextDigit = GetDigitAtPosScan( nDigitPos,bFoundFirstDigit );
+ short nNextDigit = GetDigitAtPosScan( nDigitPos, bFoundFirstDigit );
#else
- short nNextDigit = GetDigitAtPos( dNumber,nDigitPos,dNumber,bFoundFirstDigit );
+ short nNextDigit = GetDigitAtPos( dNumber, nDigitPos, dNumber, bFoundFirstDigit );
#endif
- if( nNextDigit>=5 )
- StrRoundDigit( sReturnStrg,sReturnStrg.Len()-1,bOverflow );
- if( bOverflow )
- {
- // a leading 9 has been rounded
- LeftShiftDecimalPoint( sReturnStrg );
- sReturnStrg.SetChar( sReturnStrg.Len()-1 , 0 );
- dExponent += 1.0;
- }
- // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
- ParseBack( sReturnStrg,sFormatStrg,i-1 );
+ if( nNextDigit>=5 )
+ {
+ StrRoundDigit( sReturnStrg, sReturnStrg.getLength() - 1, bOverflow );
+ }
+ if( bOverflow )
+ {
+ // a leading 9 has been rounded
+ LeftShiftDecimalPoint( sReturnStrg );
+ sReturnStrg[sReturnStrg.getLength() - 1] = 0;
+ dExponent += 1.0;
+ }
+ // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
+ ParseBack( sReturnStrg, sFormatStrg, i-1 );
+ }
+ // change the scanner's condition
+ nState++;
+ // output exponent character
+ sReturnStrg.append(c);
+ // i++; // MANIPULATION of the loop-variable!
+ c = sFormatStrg[ ++i ];
+ // output leading sign / exponent
+ if( c != 0 )
+ {
+ if( c == '-' )
+ {
+ if( dExponent < 0.0 )
+ {
+ sReturnStrg.append('-');
}
- // change the scanner's condition
- nState++;
- // output exponent character
- StrAppendChar( sReturnStrg,c );
- // i++; // MANIPULATION of the loop-variable!
- c = sFormatStrg.GetChar( ++i );
- // output leading sign / exponent
- if( c!=0 )
+ }
+ else if( c == '+' )
+ {
+ if( dExponent < 0.0 )
{
- if( c=='-' )
- {
- if( dExponent<0.0 )
- StrAppendChar( sReturnStrg,'-' );
- }
- else if( c=='+' )
- {
- if( dExponent<0.0 )
- StrAppendChar( sReturnStrg,'-' );
- else
- StrAppendChar( sReturnStrg,'+' );
- }
+ sReturnStrg.append('-');
}
- break;
- case ',':
- break;
- case ';':
- break;
- case '(':
- case ')':
- // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
- ParseBack( sReturnStrg,sFormatStrg,i-1 );
- if( bIsNegative )
- StrAppendChar( sReturnStrg,c );
- break;
- case '$':
- // append the string for the currency:
- sReturnStrg += sCurrencyStrg;
- break;
- case ' ':
- case '-':
- case '+':
- ParseBack( sReturnStrg,sFormatStrg,i-1 );
- StrAppendChar( sReturnStrg,c );
- break;
- case '\\':
- ParseBack( sReturnStrg,sFormatStrg,i-1 );
- // special character found, output next
- // character directly (if existing)
- c = sFormatStrg.GetChar( ++i );
- if( c!=0 )
- StrAppendChar( sReturnStrg,c );
- break;
- case CREATE_1000SEP_CHAR:
- // ignore here, action has already been
- // executed in AnalyseFormatString
- break;
- default:
- // output characters and digits, too (like in Visual-Basic)
- if( ( c>='a' && c<='z' ) ||
- ( c>='A' && c<='Z' ) ||
- ( c>='1' && c<='9' ) )
- StrAppendChar( sReturnStrg,c );
+ else
+ {
+ sReturnStrg.append('+');
+ }
+ }
+ }
+ break;
+ case ',':
+ break;
+ case ';':
+ break;
+ case '(':
+ case ')':
+ // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
+ ParseBack( sReturnStrg, sFormatStrg, i-1 );
+ if( bIsNegative )
+ {
+ sReturnStrg.append(c);
+ }
+ break;
+ case '$':
+ // append the string for the currency:
+ sReturnStrg.append(sCurrencyStrg);
+ break;
+ case ' ':
+ case '-':
+ case '+':
+ ParseBack( sReturnStrg, sFormatStrg, i-1 );
+ sReturnStrg.append(c);
+ break;
+ case '\\':
+ ParseBack( sReturnStrg, sFormatStrg, i-1 );
+ // special character found, output next
+ // character directly (if existing)
+ c = sFormatStrg[ ++i ];
+ if( c!=0 )
+ {
+ sReturnStrg.append(c);
+ }
+ break;
+ case CREATE_1000SEP_CHAR:
+ // ignore here, action has already been
+ // executed in AnalyseFormatString
+ break;
+ default:
+ // output characters and digits, too (like in Visual-Basic)
+ if( ( c>='a' && c<='z' ) ||
+ ( c>='A' && c<='Z' ) ||
+ ( c>='1' && c<='9' ) )
+ {
+ sReturnStrg.append(c);
}
}
+ }
- // scan completed - rounding necessary?
- if( !bScientific )
- {
+ // scan completed - rounding necessary?
+ if( !bScientific )
+ {
#ifdef _with_sprintf
- short nNextDigit = GetDigitAtPosScan( nDigitPos,bFoundFirstDigit );
+ short nNextDigit = GetDigitAtPosScan( nDigitPos, bFoundFirstDigit );
#else
- short nNextDigit = GetDigitAtPos( dNumber,nDigitPos,dNumber,bFoundFirstDigit );
+ short nNextDigit = GetDigitAtPos( dNumber, nDigitPos, dNumber, bFoundFirstDigit );
#endif
- if( nNextDigit>=5 )
- StrRoundDigit( sReturnStrg,sReturnStrg.Len()-1 );
+ if( nNextDigit>=5 )
+ {
+ StrRoundDigit( sReturnStrg, sReturnStrg.getLength() - 1 );
}
+ }
- if( nNoOfDigitsRight>0 )
- ParseBack( sReturnStrg,sFormatStrg,sFormatStrg.Len()-1 );
+ if( nNoOfDigitsRight>0 )
+ {
+ ParseBack( sReturnStrg, sFormatStrg, sFormatStrg.getLength()-1 );
+ }
+ sReturnStrgFinal = sReturnStrg.makeStringAndClear();
}
-String SbxBasicFormater::BasicFormatNull( String sFormatStrg )
+OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
{
sal_Bool bNullFormatFound;
- String sNullFormatStrg = GetNullFormatString( sFormatStrg,bNullFormatFound );
+ OUString sNullFormatStrg = GetNullFormatString( sFormatStrg, bNullFormatFound );
if( bNullFormatFound )
+ {
return sNullFormatStrg;
- String aRetStr;
- aRetStr.AssignAscii( "null" );
+ }
+ OUString aRetStr;
+ aRetStr = rtl::OUString::createFromAscii( "null" );
return aRetStr;
}
-String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
+OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
{
sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound;
// analyse format-string concerning predefined formats:
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_GENERALNUMBER ) )
- sFormatStrg.AssignAscii( GENERALNUMBER_FORMAT );
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_CURRENCY ) )
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
+ {
+ sFormatStrg = rtl::OUString::createFromAscii( GENERALNUMBER_FORMAT );
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_CURRENCY ) )
+ {
sFormatStrg = sCurrencyFormatStrg; // old: CURRENCY_FORMAT;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_FIXED ) )
- sFormatStrg.AssignAscii( FIXED_FORMAT );
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_STANDARD ) )
- sFormatStrg.AssignAscii( STANDARD_FORMAT );
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_PERCENT ) )
- sFormatStrg.AssignAscii( PERCENT_FORMAT );
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_SCIENTIFIC ) )
- sFormatStrg.AssignAscii( SCIENTIFIC_FORMAT );
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_YESNO ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_FIXED ) )
+ {
+ sFormatStrg = rtl::OUString::createFromAscii( FIXED_FORMAT );
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_STANDARD ) )
+ {
+ sFormatStrg = rtl::OUString::createFromAscii( STANDARD_FORMAT );
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_PERCENT ) )
+ {
+ sFormatStrg = rtl::OUString::createFromAscii( PERCENT_FORMAT );
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_SCIENTIFIC ) )
+ {
+ sFormatStrg = rtl::OUString::createFromAscii( SCIENTIFIC_FORMAT );
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_YESNO ) )
+ {
return ( dNumber==0.0 ) ? sNoStrg : sYesStrg ;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_TRUEFALSE ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_TRUEFALSE ) )
+ {
return ( dNumber==0.0 ) ? sFalseStrg : sTrueStrg ;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_ONOFF ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_ONOFF ) )
+ {
return ( dNumber==0.0 ) ? sOffStrg : sOnStrg ;
+ }
// analyse format-string concerning ';', i. e. format-strings for
// positive-, negative- and 0-values
- String sPosFormatStrg = GetPosFormatString( sFormatStrg, bPosFormatFound );
- String sNegFormatStrg = GetNegFormatString( sFormatStrg, bNegFormatFound );
- String s0FormatStrg = Get0FormatString( sFormatStrg, b0FormatFound );
+ OUString sPosFormatStrg = GetPosFormatString( sFormatStrg, bPosFormatFound );
+ OUString sNegFormatStrg = GetNegFormatString( sFormatStrg, bNegFormatFound );
+ OUString s0FormatStrg = Get0FormatString( sFormatStrg, b0FormatFound );
- String sReturnStrg;
- String sTempStrg;
+ OUString sReturnStrg;
+ OUString sTempStrg;
if( dNumber==0.0 )
{
sTempStrg = sFormatStrg;
if( b0FormatFound )
{
- if( s0FormatStrg.Len() == 0 && bPosFormatFound )
+ if( s0FormatStrg.isEmpty() && bPosFormatFound )
+ {
sTempStrg = sPosFormatStrg;
+ }
else
+ {
sTempStrg = s0FormatStrg;
+ }
}
else if( bPosFormatFound )
{
@@ -961,16 +1046,20 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
{
if( bNegFormatFound )
{
- if( sNegFormatStrg.Len() == 0 && bPosFormatFound )
+ if( sNegFormatStrg.isEmpty() && bPosFormatFound )
{
- sTempStrg = rtl::OUString("-");
+ sTempStrg = "-";
sTempStrg += sPosFormatStrg;
}
else
+ {
sTempStrg = sNegFormatStrg;
- }
+ }
+ }
else
+ {
sTempStrg = sFormatStrg;
+ }
// if NO format-string especially for negative
// values is given, output the leading sign
ScanFormatString( dNumber, sTempStrg, sReturnStrg,/*bCreateSign=*/bNegFormatFound/*sNegFormatStrg!=EMPTYFORMATSTRING*/ );
@@ -985,26 +1074,44 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
return sReturnStrg;
}
-sal_Bool SbxBasicFormater::isBasicFormat( String sFormatStrg )
+sal_Bool SbxBasicFormater::isBasicFormat( OUString sFormatStrg )
{
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_GENERALNUMBER ) )
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_CURRENCY ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_CURRENCY ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_FIXED ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_FIXED ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_STANDARD ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_STANDARD ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_PERCENT ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_PERCENT ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_SCIENTIFIC ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_SCIENTIFIC ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_YESNO ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_YESNO ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_TRUEFALSE ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_TRUEFALSE ) )
+ {
return sal_True;
- if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_ONOFF ) )
+ }
+ if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_ONOFF ) )
+ {
return sal_True;
+ }
return sal_False;
}
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 4966d24e1837..61b601e3aec8 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -566,7 +566,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCHAR;
}
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
@@ -840,7 +840,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCHAR;
}
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index 00613d25737a..90cf5f9e0038 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -246,7 +246,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCHAR;
}
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index bdf2200c6722..e72a2821c5f0 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -26,23 +26,23 @@ TYPEINIT1(SbxMethod,SbxVariable)
TYPEINIT1(SbxProperty,SbxVariable)
TYPEINIT2(SbxObject,SbxVariable,SfxListener)
-static const char* pNameProp; // Name-Property
-static const char* pParentProp; // Parent-Property
+static OUString pNameProp; // Name-Property
+static OUString pParentProp; // Parent-Property
static sal_uInt16 nNameHash = 0, nParentHash = 0;
-SbxObject::SbxObject( const XubString& rClass )
+SbxObject::SbxObject( const OUString& rClass )
: SbxVariable( SbxOBJECT ), aClassName( rClass )
{
aData.pObj = this;
if( !nNameHash )
{
- pNameProp = GetSbxRes( STRING_NAMEPROP );
- pParentProp = GetSbxRes( STRING_PARENTPROP );
- nNameHash = MakeHashCode( rtl::OUString::createFromAscii( pNameProp ) );
- nParentHash = MakeHashCode( rtl::OUString::createFromAscii( pParentProp ) );
+ pNameProp = ::rtl::OUString::createFromAscii(GetSbxRes( STRING_NAMEPROP ));
+ pParentProp = ::rtl::OUString::createFromAscii(GetSbxRes( STRING_PARENTPROP ));
+ nNameHash = MakeHashCode( pNameProp );
+ nParentHash = MakeHashCode( pParentProp );
}
SbxObject::Clear();
SbxObject::SetName( rClass );
@@ -83,7 +83,9 @@ static void CheckParentsOnDelete( SbxObject* pObj, SbxArray* p )
{
SbxVariableRef& rRef = p->GetRef( i );
if( rRef->IsBroadcaster() )
+ {
pObj->EndListening( rRef->GetBroadcaster(), sal_True );
+ }
// Did the element have more then one reference and still a Listener?
if( rRef->GetRefCount() > 1 )
{
@@ -119,9 +121,9 @@ void SbxObject::Clear()
pProps = new SbxArray;
pObjs = new SbxArray( SbxOBJECT );
SbxVariable* p;
- p = Make( rtl::OUString::createFromAscii( pNameProp ), SbxCLASS_PROPERTY, SbxSTRING );
+ p = Make( pNameProp, SbxCLASS_PROPERTY, SbxSTRING );
p->SetFlag( SBX_DONTSTORE );
- p = Make( rtl::OUString::createFromAscii( pParentProp ), SbxCLASS_PROPERTY, SbxOBJECT );
+ p = Make( pParentProp, SbxCLASS_PROPERTY, SbxOBJECT );
p->ResetFlag( SBX_WRITE );
p->SetFlag( SBX_DONTSTORE );
pDfltProp = NULL;
@@ -140,43 +142,52 @@ void SbxObject::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
SbxVariable* pVar = p->GetVar();
if( bRead || bWrite )
{
- XubString aVarName( pVar->GetName() );
+ OUString aVarName( pVar->GetName() );
sal_uInt16 nHash_ = MakeHashCode( aVarName );
- if( nHash_ == nNameHash
- && aVarName.EqualsIgnoreCaseAscii( pNameProp ) )
+ if( nHash_ == nNameHash && aVarName.equalsIgnoreAsciiCase( pNameProp ) )
{
if( bRead )
+ {
pVar->PutString( GetName() );
+ }
else
- SetName( pVar->GetString() );
+ {
+ SetName( pVar->GetOUString() );
+ }
}
- else if( nHash_ == nParentHash
- && aVarName.EqualsIgnoreCaseAscii( pParentProp ) )
+ else if( nHash_ == nParentHash && aVarName.equalsIgnoreAsciiCase( pParentProp ) )
{
SbxObject* p_ = GetParent();
if( !p_ )
+ {
p_ = this;
+ }
pVar->PutObject( p_ );
}
}
}
}
-sal_Bool SbxObject::IsClass( const rtl::OUString& rName ) const
+sal_Bool SbxObject::IsClass( const OUString& rName ) const
{
- return sal_Bool( aClassName.EqualsIgnoreCaseAscii( rName ) );
+ return sal_Bool( aClassName.equalsIgnoreAsciiCase( rName ) );
}
SbxVariable* SbxObject::FindUserData( sal_uInt32 nData )
{
if( !GetAll( SbxCLASS_DONTCARE ) )
+ {
return NULL;
-
+ }
SbxVariable* pRes = pMethods->FindUserData( nData );
if( !pRes )
+ {
pRes = pProps->FindUserData( nData );
+ }
if( !pRes )
+ {
pRes = pObjs->FindUserData( nData );
+ }
// Search in the parents?
if( !pRes && IsSet( SBX_GBLSEARCH ) )
{
@@ -198,46 +209,52 @@ SbxVariable* SbxObject::FindUserData( sal_uInt32 nData )
return pRes;
}
-SbxVariable* SbxObject::Find( const rtl::OUString& rName, SbxClassType t )
+SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t )
{
#ifdef DBG_UTIL
static sal_uInt16 nLvl = 0;
- static const char* pCls[] =
- { "DontCare","Array","Value","Variable","Method","Property","Object" };
+ static const char* pCls[] = { "DontCare","Array","Value","Variable","Method","Property","Object" };
rtl::OString aNameStr1(rtl::OUStringToOString(rName, RTL_TEXTENCODING_ASCII_US));
rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
DbgOutf( "SBX: Search %.*s %s %s in %s",
- nLvl++, " ",
- ( t >= SbxCLASS_DONTCARE && t <= SbxCLASS_OBJECT )
- ? pCls[ t-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() );
+ nLvl++, " ",
+ ( t >= SbxCLASS_DONTCARE && t <= SbxCLASS_OBJECT )
+ ? pCls[ t-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() );
#endif
if( !GetAll( t ) )
+ {
return NULL;
+ }
SbxVariable* pRes = NULL;
pObjs->SetFlag( SBX_EXTSEARCH );
if( t == SbxCLASS_DONTCARE )
{
pRes = pMethods->Find( rName, SbxCLASS_METHOD );
if( !pRes )
+ {
pRes = pProps->Find( rName, SbxCLASS_PROPERTY );
+ }
if( !pRes )
+ {
pRes = pObjs->Find( rName, t );
+ }
}
else
{
SbxArray* pArray = NULL;
switch( t )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
- default:
- DBG_ASSERT( !this, "Ungueltige SBX-Klasse" );
+ case SbxCLASS_VARIABLE:
+ case SbxCLASS_PROPERTY: pArray = pProps; break;
+ case SbxCLASS_METHOD: pArray = pMethods; break;
+ case SbxCLASS_OBJECT: pArray = pObjs; break;
+ default: DBG_ASSERT( !this, "Ungueltige SBX-Klasse" ); break;
}
if( pArray )
+ {
pRes = pArray->Find( rName, t );
+ }
}
// ExtendedsSearch in the Object-Array?
// For objects and DontCare is the array of objects already
@@ -279,14 +296,16 @@ SbxVariable* SbxObject::Find( const rtl::OUString& rName, SbxClassType t )
// The whole thing recursive, because Call() might be overloaded
// Qualified names are allowed
-sal_Bool SbxObject::Call( const XubString& rName, SbxArray* pParam )
+sal_Bool SbxObject::Call( const OUString& rName, SbxArray* pParam )
{
SbxVariable* pMeth = FindQualified( rName, SbxCLASS_DONTCARE);
if( pMeth && pMeth->ISA(SbxMethod) )
{
// FindQualified() might have been stroked!
if( pParam )
+ {
pMeth->SetParameters( pParam );
+ }
pMeth->Broadcast( SBX_HINT_DATAWANTED );
pMeth->SetParameters( NULL );
return sal_True;
@@ -297,18 +316,22 @@ sal_Bool SbxObject::Call( const XubString& rName, SbxArray* pParam )
SbxProperty* SbxObject::GetDfltProperty()
{
- if ( !pDfltProp && aDfltPropName.Len() )
+ if ( !pDfltProp && !aDfltPropName.isEmpty() )
{
pDfltProp = (SbxProperty*) Find( aDfltPropName, SbxCLASS_PROPERTY );
if( !pDfltProp )
+ {
pDfltProp = (SbxProperty*) Make( aDfltPropName, SbxCLASS_PROPERTY, SbxVARIANT );
+ }
}
return pDfltProp;
}
-void SbxObject::SetDfltProperty( const XubString& rName )
+void SbxObject::SetDfltProperty( const OUString& rName )
{
if ( rName != aDfltPropName )
+ {
pDfltProp = NULL;
+ }
aDfltPropName = rName;
SetModified( sal_True );
}
@@ -322,12 +345,11 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
SbxArray* pArray = NULL;
if( pVar ) switch( pVar->GetClass() )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
- default:
- DBG_ASSERT( !this, "Ungueltige SBX-Klasse" );
+ case SbxCLASS_VARIABLE:
+ case SbxCLASS_PROPERTY: pArray = pProps; break;
+ case SbxCLASS_METHOD: pArray = pMethods; break;
+ case SbxCLASS_OBJECT: pArray = pObjs; break;
+ default: DBG_ASSERT( !this, "Ungueltige SBX-Klasse" ); break;
}
if( pArray )
{
@@ -336,12 +358,14 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
pArray->ResetFlag( SBX_EXTSEARCH );
SbxVariable* pOld = pArray->Find( pVar->GetName(), pVar->GetClass() );
if( pOld )
- for( sal_uInt16 i = 0; i < pArray->Count(); i++ )
{
- SbxVariableRef& rRef = pArray->GetRef( i );
- if( (SbxVariable*) rRef == pOld )
+ for( sal_uInt16 i = 0; i < pArray->Count(); i++ )
{
- nArrayIdx = i; break;
+ SbxVariableRef& rRef = pArray->GetRef( i );
+ if( (SbxVariable*) rRef == pOld )
+ {
+ nArrayIdx = i; break;
+ }
}
}
}
@@ -351,21 +375,22 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
// If a new object will be established, this object will be indexed,
// if an object of this name exists already.
-SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataType dt )
+SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataType dt )
{
// Is the object already available?
SbxArray* pArray = NULL;
switch( ct )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
- default:
- DBG_ASSERT( !this, "Ungueltige SBX-Klasse" );
+ case SbxCLASS_VARIABLE:
+ case SbxCLASS_PROPERTY: pArray = pProps; break;
+ case SbxCLASS_METHOD: pArray = pMethods; break;
+ case SbxCLASS_OBJECT: pArray = pObjs; break;
+ default: DBG_ASSERT( !this, "Ungueltige SBX-Klasse" ); break;
}
if( !pArray )
+ {
return NULL;
+ }
// Collections may contain objects of the same name
if( !( ct == SbxCLASS_OBJECT && ISA(SbxCollection) ) )
{
@@ -378,17 +403,18 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
SbxVariable* pVar = NULL;
switch( ct )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY:
- pVar = new SbxProperty( rName, dt );
- break;
- case SbxCLASS_METHOD:
- pVar = new SbxMethod( rName, dt );
- break;
- case SbxCLASS_OBJECT:
- pVar = CreateObject( rName );
- break;
- default: break;
+ case SbxCLASS_VARIABLE:
+ case SbxCLASS_PROPERTY:
+ pVar = new SbxProperty( rName, dt );
+ break;
+ case SbxCLASS_METHOD:
+ pVar = new SbxMethod( rName, dt );
+ break;
+ case SbxCLASS_OBJECT:
+ pVar = CreateObject( rName );
+ break;
+ default:
+ break;
}
pVar->SetParent( this );
pArray->Put( pVar, pArray->Count() );
@@ -399,7 +425,7 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
return pVar;
}
-SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClass )
+SbxObject* SbxObject::MakeObject( const OUString& rName, const OUString& rClass )
{
// Is the object already available?
if( !ISA(SbxCollection) )
@@ -436,40 +462,49 @@ void SbxObject::Insert( SbxVariable* pVar )
// Then this element exists already
// There are objects of the same name allowed at collections
if( pArray == pObjs && ISA(SbxCollection) )
+ {
nIdx = pArray->Count();
+ }
else
{
SbxVariable* pOld = pArray->Get( nIdx );
// already inside: overwrite
if( pOld == pVar )
+ {
return;
-
+ }
EndListening( pOld->GetBroadcaster(), sal_True );
if( pVar->GetClass() == SbxCLASS_PROPERTY )
{
if( pOld == pDfltProp )
+ {
pDfltProp = (SbxProperty*) pVar;
+ }
}
}
}
StartListening( pVar->GetBroadcaster(), sal_True );
pArray->Put( pVar, nIdx );
if( pVar->GetParent() != this )
+ {
pVar->SetParent( this );
+ }
SetModified( sal_True );
Broadcast( SBX_HINT_OBJECTCHANGED );
#ifdef DBG_UTIL
- static const char* pCls[] =
- { "DontCare","Array","Value","Variable","Method","Property","Object" };
- XubString aVarName( pVar->GetName() );
- if ( !aVarName.Len() && pVar->ISA(SbxObject) )
- aVarName = PTR_CAST(SbxObject,pVar)->GetClassName();
- rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US));
- rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
- DbgOutf( "SBX: Insert %s %s in %s",
- ( pVar->GetClass() >= SbxCLASS_DONTCARE &&
- pVar->GetClass() <= SbxCLASS_OBJECT )
- ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() );
+ static const char* pCls[] =
+ { "DontCare","Array","Value","Variable","Method","Property","Object" };
+ OUString aVarName( pVar->GetName() );
+ if ( aVarName.isEmpty() && pVar->ISA(SbxObject) )
+ {
+ aVarName = PTR_CAST(SbxObject,pVar)->GetClassName();
+ }
+ rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US));
+ rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
+ DbgOutf( "SBX: Insert %s %s in %s",
+ ( pVar->GetClass() >= SbxCLASS_DONTCARE &&
+ pVar->GetClass() <= SbxCLASS_OBJECT )
+ ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() );
#endif
}
}
@@ -483,12 +518,11 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
{
switch( pVar->GetClass() )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
- default:
- DBG_ASSERT( !this, "Ungueltige SBX-Klasse" );
+ case SbxCLASS_VARIABLE:
+ case SbxCLASS_PROPERTY: pArray = pProps; break;
+ case SbxCLASS_METHOD: pArray = pMethods; break;
+ case SbxCLASS_OBJECT: pArray = pObjs; break;
+ default: DBG_ASSERT( !this, "Ungueltige SBX-Klasse" ); break;
}
}
if( pArray )
@@ -496,25 +530,29 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
StartListening( pVar->GetBroadcaster(), sal_True );
pArray->Put( pVar, pArray->Count() );
if( pVar->GetParent() != this )
+ {
pVar->SetParent( this );
+ }
SetModified( sal_True );
#ifdef DBG_UTIL
- static const char* pCls[] =
- { "DontCare","Array","Value","Variable","Method","Property","Object" };
- XubString aVarName( pVar->GetName() );
- if ( !aVarName.Len() && pVar->ISA(SbxObject) )
- aVarName = PTR_CAST(SbxObject,pVar)->GetClassName();
- rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US));
- rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
- DbgOutf( "SBX: Insert %s %s in %s",
- ( pVar->GetClass() >= SbxCLASS_DONTCARE &&
- pVar->GetClass() <= SbxCLASS_OBJECT )
- ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() );
+ static const char* pCls[] =
+ { "DontCare","Array","Value","Variable","Method","Property","Object" };
+ OUString aVarName( pVar->GetName() );
+ if ( aVarName.isEmpty() && pVar->ISA(SbxObject) )
+ {
+ aVarName = PTR_CAST(SbxObject,pVar)->GetClassName();
+ }
+ rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US));
+ rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
+ DbgOutf( "SBX: Insert %s %s in %s",
+ ( pVar->GetClass() >= SbxCLASS_DONTCARE &&
+ pVar->GetClass() <= SbxCLASS_OBJECT )
+ ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() );
#endif
}
}
-void SbxObject::Remove( const XubString& rName, SbxClassType t )
+void SbxObject::Remove( const OUString& rName, SbxClassType t )
{
Remove( SbxObject::Find( rName, t ) );
}
@@ -526,20 +564,28 @@ void SbxObject::Remove( SbxVariable* pVar )
if( pArray && nIdx < pArray->Count() )
{
#ifdef DBG_UTIL
- XubString aVarName( pVar->GetName() );
- if ( !aVarName.Len() && pVar->ISA(SbxObject) )
- aVarName = PTR_CAST(SbxObject,pVar)->GetClassName();
- rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US));
- rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
+ OUString aVarName( pVar->GetName() );
+ if ( aVarName.isEmpty() && pVar->ISA(SbxObject) )
+ {
+ aVarName = PTR_CAST(SbxObject,pVar)->GetClassName();
+ }
+ rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US));
+ rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US));
#endif
SbxVariableRef pVar_ = pArray->Get( nIdx );
if( pVar_->IsBroadcaster() )
+ {
EndListening( pVar_->GetBroadcaster(), sal_True );
+ }
if( (SbxVariable*) pVar_ == pDfltProp )
+ {
pDfltProp = NULL;
+ }
pArray->Remove( nIdx );
if( pVar_->GetParent() == this )
+ {
pVar_->SetParent( NULL );
+ }
SetModified( sal_True );
Broadcast( SBX_HINT_OBJECTCHANGED );
}
@@ -549,7 +595,9 @@ static sal_Bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray )
{
SbxArrayRef p = (SbxArray*) SbxBase::Load( rStrm );
if( !p.Is() )
+ {
return sal_False;
+ }
for( sal_uInt16 i = 0; i < p->Count(); i++ )
{
SbxVariableRef& r = p->GetRef( i );
@@ -571,36 +619,47 @@ sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
// Help for the read in of old objects: just TRUE back,
// LoadPrivateData() had to set the default status up
if( !nVer )
+ {
return sal_True;
-
+ }
pDfltProp = NULL;
if( !SbxVariable::LoadData( rStrm, nVer ) )
+ {
return sal_False;
+ }
// If it contains no alien object, insert ourselves
if( aData.eType == SbxOBJECT && !aData.pObj )
+ {
aData.pObj = this;
+ }
sal_uInt32 nSize;
- XubString aDfltProp;
- aClassName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
- RTL_TEXTENCODING_ASCII_US);
- aDfltProp = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
- RTL_TEXTENCODING_ASCII_US);
+ OUString aDfltProp;
+ aClassName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm, RTL_TEXTENCODING_ASCII_US);
+ aDfltProp = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm, RTL_TEXTENCODING_ASCII_US);
sal_uIntPtr nPos = rStrm.Tell();
rStrm >> nSize;
if( !LoadPrivateData( rStrm, nVer ) )
+ {
return sal_False;
+ }
sal_uIntPtr nNewPos = rStrm.Tell();
nPos += nSize;
DBG_ASSERT( nPos >= nNewPos, "SBX: Zu viele Daten eingelesen" );
if( nPos != nNewPos )
+ {
rStrm.Seek( nPos );
- if( !LoadArray( rStrm, this, pMethods )
- || !LoadArray( rStrm, this, pProps )
- || !LoadArray( rStrm, this, pObjs ) )
+ }
+ if( !LoadArray( rStrm, this, pMethods ) ||
+ !LoadArray( rStrm, this, pProps ) ||
+ !LoadArray( rStrm, this, pObjs ) )
+ {
return sal_False;
+ }
// Set properties
- if( aDfltProp.Len() )
+ if( !aDfltProp.isEmpty() )
+ {
pDfltProp = (SbxProperty*) pProps->Find( aDfltProp, SbxCLASS_PROPERTY );
+ }
SetModified( sal_False );
return sal_True;
}
@@ -608,118 +667,137 @@ sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
sal_Bool SbxObject::StoreData( SvStream& rStrm ) const
{
if( !SbxVariable::StoreData( rStrm ) )
+ {
return sal_False;
- XubString aDfltProp;
+ }
+ OUString aDfltProp;
if( pDfltProp )
+ {
aDfltProp = pDfltProp->GetName();
+ }
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, aClassName, RTL_TEXTENCODING_ASCII_US);
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, aDfltProp, RTL_TEXTENCODING_ASCII_US);
sal_uIntPtr nPos = rStrm.Tell();
rStrm << (sal_uInt32) 0L;
if( !StorePrivateData( rStrm ) )
+ {
return sal_False;
+ }
sal_uIntPtr nNew = rStrm.Tell();
rStrm.Seek( nPos );
rStrm << (sal_uInt32) ( nNew - nPos );
rStrm.Seek( nNew );
if( !pMethods->Store( rStrm ) )
+ {
return sal_False;
+ }
if( !pProps->Store( rStrm ) )
+ {
return sal_False;
+ }
if( !pObjs->Store( rStrm ) )
+ {
return sal_False;
+ }
((SbxObject*) this)->SetModified( sal_False );
return sal_True;
}
-XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
- const SbxObject* )
+OUString SbxObject::GenerateSource( const OUString &rLinePrefix,
+ const SbxObject* )
{
// Collect the properties in a String
- XubString aSource;
+ OUString aSource;
SbxArrayRef xProps( GetProperties() );
bool bLineFeed = false;
for ( sal_uInt16 nProp = 0; nProp < xProps->Count(); ++nProp )
{
SbxPropertyRef xProp = (SbxProperty*) xProps->Get(nProp);
- XubString aPropName( xProp->GetName() );
- if ( xProp->CanWrite()
- && !( xProp->GetHashCode() == nNameHash
- && aPropName.EqualsIgnoreCaseAscii( pNameProp ) ) )
+ OUString aPropName( xProp->GetName() );
+ if ( xProp->CanWrite() &&
+ !( xProp->GetHashCode() == nNameHash &&
+ aPropName.equalsIgnoreAsciiCase(pNameProp)))
{
// Insert a break except in front of the first property
if ( bLineFeed )
- aSource.AppendAscii( "\n" );
+ {
+ aSource += "\n";
+ }
else
+ {
bLineFeed = true;
-
+ }
aSource += rLinePrefix;
- aSource += '.';
+ aSource += ".";
aSource += aPropName;
- aSource.AppendAscii( " = " );
+ aSource += " = ";
// Display the property value textual
switch ( xProp->GetType() )
{
- case SbxEMPTY:
- case SbxNULL:
- // no value
- break;
-
- case SbxSTRING:
- {
- // Strings in quotation mark
- aSource.AppendAscii( "\"" );
- aSource += xProp->GetString();
- aSource.AppendAscii( "\"" );
- break;
- }
+ case SbxEMPTY:
+ case SbxNULL:
+ // no value
+ break;
+
+ case SbxSTRING:
+ // Strings in quotation mark
+ aSource += "\"";
+ aSource += xProp->GetOUString();
+ aSource += "\"";
+ break;
- default:
- {
- // miscellaneous, such as e.g.numerary directly
- aSource += xProp->GetString();
- break;
- }
+ default:
+ // miscellaneous, such as e.g.numerary directly
+ aSource += xProp->GetOUString();
+ break;
}
}
}
return aSource;
}
-static sal_Bool CollectAttrs( const SbxBase* p, XubString& rRes )
+static sal_Bool CollectAttrs( const SbxBase* p, OUString& rRes )
{
- XubString aAttrs;
+ OUString aAttrs;
if( p->IsHidden() )
- aAttrs.AssignAscii( "Hidden" );
+ {
+ aAttrs = "Hidden";
+ }
if( p->IsSet( SBX_EXTSEARCH ) )
{
- if( aAttrs.Len() )
- aAttrs += ',';
- aAttrs.AppendAscii( "ExtSearch" );
+ if( !aAttrs.isEmpty() )
+ {
+ aAttrs += ",";
+ }
+ aAttrs += "ExtSearch";
}
if( !p->IsVisible() )
{
- if( aAttrs.Len() )
- aAttrs += ',';
- aAttrs.AppendAscii( "Invisible" );
+ if( !aAttrs.isEmpty() )
+ {
+ aAttrs += ",";
+ }
+ aAttrs += "Invisible";
}
if( p->IsSet( SBX_DONTSTORE ) )
{
- if( aAttrs.Len() )
- aAttrs += ',';
- aAttrs.AppendAscii( "DontStore" );
+ if( !aAttrs.isEmpty() )
+ {
+ aAttrs += ",";
+ }
+ aAttrs += "DontStore";
}
- if( aAttrs.Len() )
+ if( !aAttrs.isEmpty() )
{
- rRes.AssignAscii( " (" );
+ rRes = " (";
rRes += aAttrs;
- rRes += ')';
+ rRes += ")";
return sal_True;
}
else
{
- rRes.Erase();
+ rRes = "";
return sal_False;
}
}
@@ -734,14 +812,16 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
return;
}
++nLevel;
- String aIndent;
+ OUString aIndent("");
for ( sal_uInt16 n = 1; n < nLevel; ++n )
- aIndent.AppendAscii( " " );
-
+ {
+ aIndent += " ";
+ }
// if necessary complete the object
if ( bFill )
+ {
GetAll( SbxCLASS_DONTCARE );
-
+ }
// Output the data of the object itself
rtl::OString aNameStr(rtl::OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
rtl::OString aClassNameStr(rtl::OUStringToOString(aClassName, RTL_TEXTENCODING_ASCII_US));
@@ -760,13 +840,15 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
<< "=='" << ( aParentNameStr.isEmpty() ? "<unnamed>" : aParentNameStr.getStr() ) << "'";
}
else
+ {
rStrm << "no parent ";
+ }
rStrm << " )" << endl;
rtl::OString aIndentNameStr(rtl::OUStringToOString(aIndent, RTL_TEXTENCODING_ASCII_US));
rStrm << aIndentNameStr.getStr() << "{" << endl;
// Flags
- XubString aAttrs;
+ OUString aAttrs;
if( CollectAttrs( this, aAttrs ) )
{
rtl::OString aAttrStr(rtl::OUStringToOString(aAttrs, RTL_TEXTENCODING_ASCII_US));
@@ -781,14 +863,18 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
SbxVariable* pVar = r;
if( pVar )
{
- XubString aLine( aIndent );
- aLine.AppendAscii( " - " );
+ OUString aLine( aIndent );
+ aLine += " - ";
aLine += pVar->GetName( SbxNAME_SHORT_TYPES );
- XubString aAttrs2;
+ OUString aAttrs2;
if( CollectAttrs( pVar, aAttrs2 ) )
+ {
aLine += aAttrs2;
+ }
if( !pVar->IsA( TYPE(SbxMethod) ) )
- aLine.AppendAscii( " !! Not a Method !!" );
+ {
+ aLine += " !! Not a Method !!";
+ }
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, aLine, RTL_TEXTENCODING_ASCII_US);
// Output also the object at object-methods
@@ -801,7 +887,9 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
((SbxObject*) pVar->GetValues_Impl().pObj)->Dump( rStrm, bFill );
}
else
+ {
rStrm << endl;
+ }
}
}
@@ -814,14 +902,18 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
SbxVariable* pVar = r;
if( pVar )
{
- XubString aLine( aIndent );
- aLine.AppendAscii( " - " );
+ OUString aLine( aIndent );
+ aLine += " - ";
aLine += pVar->GetName( SbxNAME_SHORT_TYPES );
- XubString aAttrs3;
+ OUString aAttrs3;
if( CollectAttrs( pVar, aAttrs3 ) )
+ {
aLine += aAttrs3;
+ }
if( !pVar->IsA( TYPE(SbxProperty) ) )
- aLine.AppendAscii( " !! Not a Property !!" );
+ {
+ aLine += " !! Not a Property !!";
+ }
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, aLine, RTL_TEXTENCODING_ASCII_US);
// output also the object at object properties
@@ -834,7 +926,9 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
((SbxObject*) pVar->GetValues_Impl().pObj)->Dump( rStrm, bFill );
}
else
+ {
rStrm << endl;
+ }
}
}
}
@@ -850,9 +944,13 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
{
rStrm << aIndentNameStr.getStr() << " - Sub";
if ( pVar->ISA(SbxObject) )
+ {
((SbxObject*) pVar)->Dump( rStrm, bFill );
+ }
else if ( pVar->ISA(SbxVariable) )
+ {
((SbxVariable*) pVar)->Dump( rStrm, bFill );
+ }
}
}
}
@@ -861,7 +959,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill )
--nLevel;
}
-SbxMethod::SbxMethod( const String& r, SbxDataType t )
+SbxMethod::SbxMethod( const OUString& r, SbxDataType t )
: SbxVariable( t )
{
SetName( r );
@@ -881,7 +979,7 @@ SbxClassType SbxMethod::GetClass() const
return SbxCLASS_METHOD;
}
-SbxProperty::SbxProperty( const String& r, SbxDataType t )
+SbxProperty::SbxProperty( const OUString& r, SbxDataType t )
: SbxVariable( t )
{
SetName( r );
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 7ea06b5e4fb5..3257354bfc74 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -229,16 +229,17 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
}
// port for CDbl in the Basic
-SbxError SbxValue::ScanNumIntnl( const String& rSrc, double& nVal, bool bSingle )
+SbxError SbxValue::ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle )
{
SbxDataType t;
sal_uInt16 nLen = 0;
SbxError nRetError = ImpScan( rSrc, nVal, t, &nLen,
/*bAllowIntntl*/false, /*bOnlyIntntl*/true );
// read completely?
- if( nRetError == SbxERR_OK && nLen != rSrc.Len() )
+ if( nRetError == SbxERR_OK && nLen != rSrc.getLength() )
+ {
nRetError = SbxERR_CONVERSION;
-
+ }
if( bSingle )
{
SbxValues aValues( nVal );
@@ -469,7 +470,7 @@ bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
#ifdef _old_format_code_
// leave the code provisionally to copy the previous implementation
-static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt )
+static sal_uInt16 printfmtnum( double nNum, OUString& rRes, const OUString& rWFmt )
{
const String& rFmt = rWFmt;
char cFill = ' '; // filling characters
@@ -545,10 +546,10 @@ static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rW
if( nLen > nWidth ) rRes += '%';
else {
nWidth -= nLen;
- while( nWidth-- ) rRes += (xub_Unicode)cFill;
- if( cPre ) rRes += (xub_Unicode)cPre;
+ while( nWidth-- ) rRes += (sal_Unicode)cFill;
+ if( cPre ) rRes += (sal_Unicode)cPre;
}
- rRes += (xub_Unicode*)&(cBuf[0]);
+ rRes += (sal_Unicode*)&(cBuf[0]);
if( bTrail )
rRes += bNeg ? '-' : ' ';
@@ -557,40 +558,47 @@ static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rW
#endif //_old_format_code_
-static sal_uInt16 printfmtstr( const XubString& rStr, XubString& rRes, const XubString& rFmt )
+static sal_uInt16 printfmtstr( const OUString& rStr, OUString& rRes, const OUString& rFmt )
{
- const xub_Unicode* pStr = rStr.GetBuffer();
- const xub_Unicode* pFmtStart = rFmt.GetBuffer();
- const xub_Unicode* pFmt = pFmtStart;
- rRes.Erase();
+ OUStringBuffer aTemp;
+ const sal_Unicode* pStr = rStr.getStr();
+ const sal_Unicode* pFmtStart = rFmt.getStr();
+ const sal_Unicode* pFmt = pFmtStart;
+
switch( *pFmt )
{
- case '!':
- rRes += *pStr++; pFmt++; break;
- case '\\':
- do
- {
- rRes += *pStr ? *pStr++ : static_cast< xub_Unicode >(' ');
- pFmt++;
- } while( *pFmt != '\\' );
- rRes += *pStr ? *pStr++ : static_cast< xub_Unicode >(' ');
- pFmt++; break;
- case '&':
- rRes = rStr;
- pFmt++; break;
- default:
- rRes = rStr;
- break;
+ case '!':
+ aTemp.append(*pStr++);
+ pFmt++;
+ break;
+ case '\\':
+ do
+ {
+ aTemp.append( *pStr ? *pStr++ : static_cast< sal_Unicode >(' '));
+ pFmt++;
+ }
+ while( *pFmt != '\\' );
+ aTemp.append(*pStr ? *pStr++ : static_cast< sal_Unicode >(' '));
+ pFmt++; break;
+ case '&':
+ aTemp = rStr;
+ pFmt++; break;
+ default:
+ aTemp = rStr;
+ break;
}
+ rRes = aTemp.makeStringAndClear();
return (sal_uInt16) ( pFmt - pFmtStart );
}
-sal_Bool SbxValue::Scan( const XubString& rSrc, sal_uInt16* pLen )
+sal_Bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen )
{
SbxError eRes = SbxERR_OK;
if( !CanWrite() )
+ {
eRes = SbxERR_PROP_READONLY;
+ }
else
{
double n;
@@ -599,7 +607,9 @@ sal_Bool SbxValue::Scan( const XubString& rSrc, sal_uInt16* pLen )
if( eRes == SbxERR_OK )
{
if( !IsFixed() )
+ {
SetType( t );
+ }
PutDouble( n );
}
}
@@ -608,7 +618,9 @@ sal_Bool SbxValue::Scan( const XubString& rSrc, sal_uInt16* pLen )
SetError( eRes ); return sal_False;
}
else
+ {
return sal_True;
+ }
}
@@ -690,7 +702,7 @@ VbaFormatInfo* getFormatInfo( const String& rFmt )
#define VBAFORMAT_LOWERCASE "<"
#define VBAFORMAT_UPPERCASE ">"
-void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
+void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const
{
short nComma = 0;
double d = 0;
@@ -700,16 +712,16 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
// VBA output besides the OOo-basic output
if( pFmt && !SbxBasicFormater::isBasicFormat( *pFmt ) )
{
- String aStr = GetString();
+ OUString aStr = GetOUString();
- if( pFmt->EqualsIgnoreCaseAscii( VBAFORMAT_LOWERCASE ) )
+ if( pFmt->equalsIgnoreAsciiCase( VBAFORMAT_LOWERCASE ) )
{
- rRes = aStr.ToLowerAscii();
+ rRes = aStr.toAsciiLowerCase();
return;
}
- if( pFmt->EqualsIgnoreCaseAscii( VBAFORMAT_UPPERCASE ) )
+ if( pFmt->equalsIgnoreAsciiCase( VBAFORMAT_UPPERCASE ) )
{
- rRes = aStr.ToUpperAscii();
+ rRes = aStr.toAsciiUpperCase();
return;
}
@@ -727,74 +739,74 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
// number format, use SvNumberFormatter to handle it.
if( bSuccess )
{
- xub_StrLen nCheckPos = 0;
+ sal_uInt16 nCheckPos = 0;
short nType;
- String aFmtStr = *pFmt;
+ OUString aFmtStr = *pFmt;
VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
if( pInfo && pInfo->meType != VBA_FORMAT_TYPE_NULL )
- {
+ {
if( pInfo->meType == VBA_FORMAT_TYPE_OFFSET )
{
nIndex = aFormatter.GetFormatIndex( pInfo->meOffset, eLangType );
}
else
- {
- aFmtStr.AssignAscii( pInfo->mpOOoFormat );
+ {
+ aFmtStr = rtl::OUString::createFromAscii(pInfo->mpOOoFormat);
aFormatter.PutandConvertEntry( aFmtStr, nCheckPos, nType, nIndex, LANGUAGE_ENGLISH, eLangType );
}
aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
}
- else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_GENERALDATE )
- || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_C ))
+ else if( aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_GENERALDATE )
+ || aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_C ))
{
if( nNumber <=-1.0 || nNumber >= 1.0 )
{
// short date
nIndex = aFormatter.GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLangType );
- aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
+ aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
// long time
if( floor( nNumber ) != nNumber )
{
- aFmtStr.AssignAscii( "H:MM:SS AM/PM" );
+ aFmtStr = "H:MM:SS AM/PM";
aFormatter.PutandConvertEntry( aFmtStr, nCheckPos, nType, nIndex, LANGUAGE_ENGLISH, eLangType );
- String aTime;
+ OUString aTime;
aFormatter.GetOutputString( nNumber, nIndex, aTime, &pCol );
- rRes.AppendAscii(" ");
+ rRes += " ";
rRes += aTime;
}
}
else
{
// long time only
- aFmtStr.AssignAscii( "H:MM:SS AM/PM" );
+ aFmtStr = "H:MM:SS AM/PM";
aFormatter.PutandConvertEntry( aFmtStr, nCheckPos, nType, nIndex, LANGUAGE_ENGLISH, eLangType );
aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
}
}
- else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_N )
- || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ))
+ else if( aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_N ) ||
+ aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_NN ))
{
sal_Int32 nMin = implGetMinute( nNumber );
- if( nMin < 10 && aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ) )
+ if( nMin < 10 && aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_NN ))
{
// Minute in two digits
sal_Unicode aBuf[2];
aBuf[0] = '0';
aBuf[1] = '0' + nMin;
- rRes = rtl::OUString(aBuf, SAL_N_ELEMENTS(aBuf));
+ rRes = OUString(aBuf, SAL_N_ELEMENTS(aBuf));
}
else
{
rRes = rtl::OUString::valueOf(nMin);
}
}
- else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_W ))
+ else if( aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_W ))
{
sal_Int32 nWeekDay = implGetWeekDay( nNumber );
rRes = rtl::OUString::valueOf(nWeekDay);
}
- else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_Y ))
+ else if( aFmtStr.equalsIgnoreAsciiCase( VBAFORMAT_Y ))
{
sal_Int16 nYear = implGetDateYear( nNumber );
double dBaseDate;
@@ -815,120 +827,115 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
SbxDataType eType = GetType();
switch( eType )
{
- case SbxCHAR:
- case SbxBYTE:
- case SbxINTEGER:
- case SbxUSHORT:
- case SbxLONG:
- case SbxULONG:
- case SbxINT:
- case SbxUINT:
- case SbxNULL: // #45929 NULL with a little cheating
- nComma = 0; goto cvt;
- case SbxSINGLE:
- nComma = 6; goto cvt;
- case SbxDOUBLE:
- nComma = 14;
-
- cvt:
- if( eType != SbxNULL )
- d = GetDouble();
+ case SbxCHAR:
+ case SbxBYTE:
+ case SbxINTEGER:
+ case SbxUSHORT:
+ case SbxLONG:
+ case SbxULONG:
+ case SbxINT:
+ case SbxUINT:
+ case SbxNULL: // #45929 NULL with a little cheating
+ nComma = 0; goto cvt;
+ case SbxSINGLE:
+ nComma = 6; goto cvt;
+ case SbxDOUBLE:
+ nComma = 14;
+
+ cvt:
+ if( eType != SbxNULL )
+ {
+ d = GetDouble();
+ }
+ // #45355 another point to jump in for isnumeric-String
+ cvt2:
+ if( pFmt )
+ {
+ SbxAppData& rAppData = GetSbxData_Impl();
- // #45355 another point to jump in for isnumeric-String
- cvt2:
- if( pFmt )
+ LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
+ if( rAppData.pBasicFormater )
{
- SbxAppData& rAppData = GetSbxData_Impl();
-
- LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
- if( rAppData.pBasicFormater )
+ if( rAppData.eBasicFormaterLangType != eLangType )
{
- if( rAppData.eBasicFormaterLangType != eLangType )
- {
- delete rAppData.pBasicFormater;
- rAppData.pBasicFormater = NULL;
- }
+ delete rAppData.pBasicFormater;
+ rAppData.pBasicFormater = NULL;
}
- rAppData.eBasicFormaterLangType = eLangType;
-
+ }
+ rAppData.eBasicFormaterLangType = eLangType;
- if( !rAppData.pBasicFormater )
- {
- SvtSysLocale aSysLocale;
- const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
- sal_Unicode cComma = rData.getNumDecimalSep()[0];
- sal_Unicode c1000 = rData.getNumThousandSep()[0];
- String aCurrencyStrg = rData.getCurrSymbol();
-
- // initialize the Basic-formater help object:
- // get resources for predefined output
- // of the Format()-command, e. g. for "On/Off"
- rtl::OUString aOnStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_ON).toString();
- rtl::OUString aOffStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_OFF).toString();
- rtl::OUString aYesStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_YES).toString();
- rtl::OUString aNoStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_NO).toString();
- rtl::OUString aTrueStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_TRUE).toString();
- rtl::OUString aFalseStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_FALSE).toString();
- rtl::OUString aCurrencyFormatStrg = SbxValueFormatResId(
- STR_BASICKEY_FORMAT_CURRENCY).toString();
-
- rAppData.pBasicFormater
- = new SbxBasicFormater( cComma,c1000,aOnStrg,aOffStrg,
- aYesStrg,aNoStrg,aTrueStrg,aFalseStrg,
- aCurrencyStrg,aCurrencyFormatStrg );
- }
- // Remark: For performance reasons there's only ONE BasicFormater-
- // object created and 'stored', so that the expensive resource-
- // loading is saved (for country-specific predefined outputs,
- // e. g. "On/Off") and the continous string-creation
- // operations, too.
- // BUT: therefore this code is NOT multithreading capable!
-
- // here are problems with ;;;Null because this method is only
- // called, if SbxValue is a number!!!
- // in addition rAppData.pBasicFormater->BasicFormatNull( *pFmt ); could be called!
- if( eType != SbxNULL )
- {
- rRes = rAppData.pBasicFormater->BasicFormat( d ,*pFmt );
- }
- else
- {
- rRes = rAppData.pBasicFormater->BasicFormatNull( *pFmt );
- }
+ if( !rAppData.pBasicFormater )
+ {
+ SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
+ sal_Unicode cComma = rData.getNumDecimalSep()[0];
+ sal_Unicode c1000 = rData.getNumThousandSep()[0];
+ OUString aCurrencyStrg = rData.getCurrSymbol();
+
+ // initialize the Basic-formater help object:
+ // get resources for predefined output
+ // of the Format()-command, e. g. for "On/Off"
+ OUString aOnStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_ON).toString();
+ OUString aOffStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_OFF).toString();
+ OUString aYesStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_YES).toString();
+ OUString aNoStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_NO).toString();
+ OUString aTrueStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_TRUE).toString();
+ OUString aFalseStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_FALSE).toString();
+ OUString aCurrencyFormatStrg = SbxValueFormatResId(STR_BASICKEY_FORMAT_CURRENCY).toString();
+
+ rAppData.pBasicFormater = new SbxBasicFormater( cComma,c1000,aOnStrg,aOffStrg,
+ aYesStrg,aNoStrg,aTrueStrg,aFalseStrg,
+ aCurrencyStrg,aCurrencyFormatStrg );
+ }
+ // Remark: For performance reasons there's only ONE BasicFormater-
+ // object created and 'stored', so that the expensive resource-
+ // loading is saved (for country-specific predefined outputs,
+ // e. g. "On/Off") and the continous string-creation
+ // operations, too.
+ // BUT: therefore this code is NOT multithreading capable!
+
+ // here are problems with ;;;Null because this method is only
+ // called, if SbxValue is a number!!!
+ // in addition rAppData.pBasicFormater->BasicFormatNull( *pFmt ); could be called!
+ if( eType != SbxNULL )
+ {
+ rRes = rAppData.pBasicFormater->BasicFormat( d ,*pFmt );
}
else
{
- ::rtl::OUString aTmpString( rRes );
- ImpCvtNum( GetDouble(), nComma, aTmpString );
- rRes = aTmpString;
+ rRes = rAppData.pBasicFormater->BasicFormatNull( *pFmt );
}
- break;
- case SbxSTRING:
- if( pFmt )
+
+ }
+ else
+ {
+ OUString aTmpString( rRes );
+ ImpCvtNum( GetDouble(), nComma, aTmpString );
+ rRes = aTmpString;
+ }
+ break;
+ case SbxSTRING:
+ if( pFmt )
+ {
+ // #45355 converting if numeric
+ if( IsNumericRTL() )
{
- // #45355 converting if numeric
- if( IsNumericRTL() )
- {
- ScanNumIntnl( GetString(), d, /*bSingle*/false );
- goto cvt2;
- }
- else
- {
- printfmtstr( GetString(), rRes, *pFmt );
- }
+ ScanNumIntnl( GetOUString(), d, /*bSingle*/false );
+ goto cvt2;
}
else
- rRes = GetString();
- break;
- default:
- rRes = GetString();
+ {
+ printfmtstr( GetOUString(), rRes, *pFmt );
+ }
+ }
+ else
+ {
+ rRes = GetOUString();
+ }
+ break;
+ default:
+ rRes = GetOUString();
}
}
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 0c88aa5bfb2c..f48d185e2829 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -239,7 +239,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCHAR;
}
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index a17cb1690fb6..e0306fcfb6a3 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -70,23 +70,31 @@
case SbxSTRING:
case SbxLPSTR:
if ( p->pOUString )
+ {
*aTmp.pOUString = *p->pOUString;
+ }
break;
case SbxOBJECT:
{
SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
if( pVal )
- aRes = pVal->GetString();
+ {
+ aRes = pVal->GetOUString();
+ }
else if( p->pObj && p->pObj->IsFixed()
&& (p->pObj->GetType() == (SbxARRAY | SbxBYTE )) )
{
// convert byte array to string
SbxArray* pArr = PTR_CAST(SbxArray, p->pObj);
if( pArr )
+ {
aRes = ByteArrayToString( pArr );
+ }
}
else
+ {
SbxBase::SetError( SbxERR_NO_OBJECT );
+ }
break;
}
case SbxERROR:
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index 41710f911400..d9080c760069 100644
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -272,7 +272,7 @@ start:
}
case SbxBYREF | SbxCHAR:
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index acbf6336c4e9..53b8958221c6 100644
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -240,7 +240,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCHAR;
}
- *p->pChar = (xub_Unicode) n; break;
+ *p->pChar = (sal_Unicode) n; break;
case SbxBYREF | SbxBYTE:
if( n > SbxMAXBYTE )
{
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 5d7f5179ad6c..1bd875bec702 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -127,7 +127,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
&& aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
&& (r.aData.eType == SbxSTRING) )
{
- ::rtl::OUString aStr = r.GetString();
+ OUString aStr = r.GetOUString();
SbxArray* pArr = StringToByteArray(aStr);
PutObject(pArr);
return *this;
@@ -405,38 +405,30 @@ sal_Bool SbxValue::Get( SbxValues& rRes ) const
return bRes;
}
-const XubString& SbxValue::GetString() const
-{
- SbxValues aRes;
- aRes.eType = SbxSTRING;
- if( Get( aRes ) )
- ((SbxValue*) this)->aToolString = *aRes.pOUString;
- else
- ((SbxValue*) this)->aToolString.Erase();
-
- return aToolString;
-}
-
-const XubString& SbxValue::GetCoreString() const
+const OUString& SbxValue::GetCoreString() const
{
SbxValues aRes;
aRes.eType = SbxCoreSTRING;
if( Get( aRes ) )
+ {
((SbxValue*) this)->aToolString = *aRes.pOUString;
+ }
else
- ((SbxValue*) this)->aToolString.Erase();
-
+ {
+ ((SbxValue*) this)->aToolString = "";
+ }
return aToolString;
}
-::rtl::OUString SbxValue::GetOUString() const
+OUString SbxValue::GetOUString() const
{
- ::rtl::OUString aResult;
+ OUString aResult;
SbxValues aRes;
aRes.eType = SbxSTRING;
if( Get( aRes ) )
+ {
aResult = *aRes.pOUString;
-
+ }
return aResult;
}
@@ -452,7 +444,7 @@ sal_Bool SbxValue::GetBool() const
t SbxValue::g() const { SbxValues aRes(e); Get( aRes ); return aRes.m; }
GET( GetByte, SbxBYTE, sal_uInt8, nByte )
-GET( GetChar, SbxCHAR, xub_Unicode, nChar )
+GET( GetChar, SbxCHAR, sal_Unicode, nChar )
GET( GetCurrency, SbxCURRENCY, sal_Int64, nInt64 )
GET( GetDate, SbxDATE, double, nDouble )
GET( GetDouble, SbxDOUBLE, double, nDouble )
@@ -815,7 +807,7 @@ sal_Bool SbxValue::SetType( SbxDataType t )
sal_uInt16 nSlotId = pThisVar
? ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) )
: 0;
- DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName().EqualsAscii("Parent"),
+ DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName().equalsAscii("Parent"),
"SID_PARENTOBJECT heisst nicht 'Parent'" );
sal_Bool bParentProp = 5345 == nSlotId;
if ( !bParentProp )
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 60e344840f42..f9148c75003f 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -43,7 +43,7 @@ static sal_uIntPtr nVar = 0;
class SbxVariableImpl
{
friend class SbxVariable;
- String m_aDeclareClassName;
+ OUString m_aDeclareClassName;
Reference< XInterface > m_xComListener;
StarBASIC* m_pComListenerParentBasic;
@@ -76,7 +76,10 @@ SbxVariable::SbxVariable() : SbxValue()
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic );
SbxVariable::SbxVariable( const SbxVariable& r )
- : SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo )
+ : SvRefBase( r ),
+ SbxValue( r ),
+ mpPar( r.mpPar ),
+ pInfo( r.pInfo )
{
mpSbxVariableImpl = NULL;
if( r.mpSbxVariableImpl != NULL )
@@ -84,7 +87,9 @@ SbxVariable::SbxVariable( const SbxVariable& r )
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
#ifndef DISABLE_SCRIPTING
if( mpSbxVariableImpl->m_xComListener.is() )
+ {
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
+ }
#endif
}
pCst = NULL;
@@ -102,9 +107,10 @@ SbxVariable::SbxVariable( const SbxVariable& r )
nHash = 0;
}
#ifdef DBG_UTIL
- static sal_Char const aCellsStr[] = "Cells";
- if ( maName.EqualsAscii( aCellsStr ) )
- maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
+ if ( maName.equalsAscii( "Cells"))
+ {
+ maName = "Cells";
+ }
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
#endif
}
@@ -126,15 +132,18 @@ void removeDimAsNewRecoverItem( SbxVariable* pVar );
SbxVariable::~SbxVariable()
{
#ifdef DBG_UTIL
- rtl::OString aBStr(rtl::OUStringToOString(maName, RTL_TEXTENCODING_ASCII_US));
+ OString aBStr(rtl::OUStringToOString(maName, RTL_TEXTENCODING_ASCII_US));
DbgOutf( "SbxVariable::Dtor %lx (%s)", (void*)this, aBStr.getStr() );
- static sal_Char const aCellsStr[] = "Cells";
- if ( maName.EqualsAscii( aCellsStr ) )
- maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
+ if ( maName.equalsAscii( "Cells"))
+ {
+ maName = "Cells";
+ }
#endif
#ifndef DISABLE_SCRIPTING
if( IsSet( SBX_DIM_AS_NEW ))
+ {
removeDimAsNewRecoverItem( this );
+ }
#endif
delete mpSbxVariableImpl;
delete pCst;
@@ -145,7 +154,9 @@ SbxVariable::~SbxVariable()
SfxBroadcaster& SbxVariable::GetBroadcaster()
{
if( !pCst )
+ {
pCst = new SfxBroadcaster;
+ }
return *pCst;
}
@@ -169,19 +180,29 @@ void SbxVariable::Broadcast( sal_uIntPtr nHintId )
// Because the method could be called from outside, check the
// rights here again
if( nHintId & SBX_HINT_DATAWANTED )
+ {
if( !CanRead() )
+ {
return;
+ }
+ }
if( nHintId & SBX_HINT_DATACHANGED )
+ {
if( !CanWrite() )
+ {
return;
+ }
+ }
// Avoid further broadcasting
SfxBroadcaster* pSave = pCst;
pCst = NULL;
sal_uInt16 nSaveFlags = GetFlags();
SetFlag( SBX_READWRITE );
if( mpPar.Is() )
+ {
// Register this as element 0, but don't change over the parent!
mpPar->GetRef( 0 ) = this;
+ }
pSave->Broadcast( SbxHint( nHintId, this ) );
delete pCst; // who knows already, onto which thoughts someone comes?
pCst = pSave;
@@ -195,7 +216,9 @@ SbxInfo* SbxVariable::GetInfo()
{
Broadcast( SBX_HINT_INFOWANTED );
if( pInfo.Is() )
+ {
SetModified( sal_True );
+ }
}
return pInfo;
}
@@ -213,84 +236,110 @@ void SbxVariable::SetParameters( SbxArray* p )
/////////////////////////// Name of the variables ///////////////////////////
-void SbxVariable::SetName( const XubString& rName )
+void SbxVariable::SetName( const OUString& rName )
{
maName = rName;
nHash = MakeHashCode( rName );
}
-const XubString& SbxVariable::GetName( SbxNameType t ) const
+const OUString& SbxVariable::GetName( SbxNameType t ) const
{
static char cSuffixes[] = " %&!#@ $";
if( t == SbxNAME_NONE )
+ {
return maName;
+ }
// Request parameter-information (not for objects)
((SbxVariable*)this)->GetInfo();
// Append nothing, if it is a simple property (no empty brackets)
- if( !pInfo
- || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY ) )
+ if( !pInfo || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY ))
+ {
return maName;
- xub_Unicode cType = ' ';
- XubString aTmp( maName );
+ }
+ sal_Unicode cType = ' ';
+ OUString aTmp( maName );
// short type? Then fetch it, posible this is 0.
SbxDataType et = GetType();
if( t == SbxNAME_SHORT_TYPES )
{
if( et <= SbxSTRING )
+ {
cType = cSuffixes[ et ];
+ }
if( cType != ' ' )
- aTmp += cType;
+ {
+ aTmp += OUString(sal_Unicode(cType));
+ }
}
- aTmp += '(';
+ aTmp += "(";
+
for(SbxParams::const_iterator i = pInfo->aParams.begin(); i != pInfo->aParams.end(); ++i)
{
int nt = i->eType & 0x0FFF;
if( i != pInfo->aParams.begin() )
- aTmp += ',';
+ {
+ aTmp += ",";
+ }
if( i->nFlags & SBX_OPTIONAL )
- aTmp += String( SbxRes( STRING_OPTIONAL ) );
+ {
+ aTmp += OUString( SbxRes( STRING_OPTIONAL ) );
+ }
if( i->eType & SbxBYREF )
- aTmp += String( SbxRes( STRING_BYREF ) );
+ {
+ aTmp += OUString( SbxRes( STRING_BYREF ) );
+ }
aTmp += i->aName;
cType = ' ';
// short type? Then fetch it, posible this is 0.
if( t == SbxNAME_SHORT_TYPES )
{
if( nt <= SbxSTRING )
+ {
cType = cSuffixes[ nt ];
+ }
}
if( cType != ' ' )
{
- aTmp += cType;
+ aTmp += OUString((sal_Unicode)cType);
if( i->eType & SbxARRAY )
- aTmp.AppendAscii( "()" );
+ {
+ aTmp += "()";
+ }
}
else
{
if( i->eType & SbxARRAY )
- aTmp.AppendAscii( "()" );
+ {
+ aTmp += "()";
+ }
// long type?
if( t != SbxNAME_SHORT )
{
- aTmp += String( SbxRes( STRING_AS ) );
+ aTmp += OUString( SbxRes( STRING_AS ) );
if( nt < 32 )
- aTmp += String( SbxRes(
- sal::static_int_cast< sal_uInt16 >( STRING_TYPES + nt ) ) );
+ {
+ aTmp += OUString( SbxRes( sal::static_int_cast< sal_uInt16 >( STRING_TYPES + nt ) ) );
+ }
else
- aTmp += String( SbxRes( STRING_ANY ) );
+ {
+ aTmp += OUString( SbxRes( STRING_ANY ) );
+ }
}
}
}
- aTmp += ')';
+ aTmp += ")";
// Long type? Then fetch it
if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
{
- aTmp += String( SbxRes( STRING_AS ) );
+ aTmp += OUString( SbxRes( STRING_AS ) );
if( et < 32 )
- aTmp += String( SbxRes(
- sal::static_int_cast< sal_uInt16 >( STRING_TYPES + et ) ) );
+ {
+ aTmp += OUString( SbxRes( sal::static_int_cast< sal_uInt16 >( STRING_TYPES + et ) ) );
+ }
else
- aTmp += String( SbxRes( STRING_ANY ) );
+ {
+ aTmp += OUString( SbxRes( STRING_ANY ) );
+ }
}
((SbxVariable*) this)->aToolString = aTmp;
return aToolString;
@@ -298,20 +347,23 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
// Create a simple hashcode: the first six characters were evaluated.
-sal_uInt16 SbxVariable::MakeHashCode( const XubString& rName )
+sal_uInt16 SbxVariable::MakeHashCode( const OUString& rName )
{
sal_uInt16 n = 0;
- sal_uInt16 nLen = rName.Len();
+ sal_Int32 i = 0;
+ sal_uInt16 nLen = rName.getLength();
if( nLen > 6 )
+ {
nLen = 6;
- const xub_Unicode* p = rName.GetBuffer();
- while( nLen-- )
+ }
+ while( nLen-- )
{
- sal_uInt8 c = (sal_uInt8)*p;
- p++;
+ sal_uInt8 c = (sal_uInt8)rName[i++];
// If we have a commen sigen break!!
if( c >= 0x80 )
+ {
return 0;
+ }
n = sal::static_int_cast< sal_uInt16 >( ( n << 3 ) + toupper( c ) );
}
return n;
@@ -328,11 +380,15 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
#ifndef DISABLE_SCRIPTING
if( mpSbxVariableImpl->m_xComListener.is() )
+ {
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
+ }
#endif
}
else
+ {
mpSbxVariableImpl = NULL;
+ }
return *this;
}
@@ -341,11 +397,17 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
SbxDataType SbxVariable::GetType() const
{
if( aData.eType == SbxOBJECT )
+ {
return aData.pObj ? aData.pObj->GetType() : SbxOBJECT;
+ }
else if( aData.eType == SbxVARIANT )
+ {
return aData.pObj ? aData.pObj->GetType() : SbxVARIANT;
+ }
else
+ {
return aData.eType;
+ }
}
SbxClassType SbxVariable::GetClass() const
@@ -356,10 +418,14 @@ SbxClassType SbxVariable::GetClass() const
void SbxVariable::SetModified( sal_Bool b )
{
if( IsSet( SBX_NO_MODIFY ) )
+ {
return;
+ }
SbxBase::SetModified( b );
if( pParent && pParent != this ) //??? HotFix: Recursion out here MM
+ {
pParent->SetModified( b );
+ }
}
void SbxVariable::SetParent( SbxObject* p )
@@ -374,15 +440,17 @@ void SbxVariable::SetParent( SbxObject* p )
if ( pChildren )
{
for ( sal_uInt16 nIdx = 0; !bFound && nIdx < pChildren->Count(); ++nIdx )
+ {
bFound = ( this == pChildren->Get(nIdx) );
+ }
}
if ( !bFound )
{
- String aMsg = rtl::OUString("dangling: [");
+ OUString aMsg = "dangling: [";
aMsg += GetName();
- aMsg.AppendAscii( "].SetParent([" );
+ aMsg += "].SetParent([";
aMsg += p->GetName();
- aMsg.AppendAscii( "])" );
+ aMsg += "])";
rtl::OString aBStr(rtl::OUStringToOString(aMsg, RTL_TEXTENCODING_ASCII_US));
DbgOut( aBStr.getStr(), DBG_OUT_WARNING, __FILE__, __LINE__);
}
@@ -395,17 +463,19 @@ void SbxVariable::SetParent( SbxObject* p )
SbxVariableImpl* SbxVariable::getImpl( void )
{
if( mpSbxVariableImpl == NULL )
+ {
mpSbxVariableImpl = new SbxVariableImpl();
+ }
return mpSbxVariableImpl;
}
-const String& SbxVariable::GetDeclareClassName( void )
+const OUString& SbxVariable::GetDeclareClassName( void )
{
SbxVariableImpl* pImpl = getImpl();
return pImpl->m_aDeclareClassName;
}
-void SbxVariable::SetDeclareClassName( const String& rDeclareClassName )
+void SbxVariable::SetDeclareClassName( const OUString& rDeclareClassName )
{
SbxVariableImpl* pImpl = getImpl();
pImpl->m_aDeclareClassName = rDeclareClassName;
@@ -439,9 +509,11 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
if( cMark == 0xFF )
{
if( !SbxValue::LoadData( rStrm, nVer ) )
+ {
return sal_False;
+ }
maName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
- RTL_TEXTENCODING_ASCII_US);
+ RTL_TEXTENCODING_ASCII_US);
sal_uInt32 nTemp;
rStrm >> nTemp;
nUserData = nTemp;
@@ -451,70 +523,74 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
rStrm.SeekRel( -1L );
rStrm >> nType;
maName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
- RTL_TEXTENCODING_ASCII_US);
+ RTL_TEXTENCODING_ASCII_US);
sal_uInt32 nTemp;
rStrm >> nTemp;
nUserData = nTemp;
// correction: old methods have instead of SbxNULL now SbxEMPTY
if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD )
+ {
nType = SbxEMPTY;
+ }
SbxValues aTmp;
- String aTmpString;
- ::rtl::OUString aVal;
+ OUString aTmpString;
+ OUString aVal;
aTmp.eType = aData.eType = (SbxDataType) nType;
aTmp.pOUString = &aVal;
switch( nType )
{
- case SbxBOOL:
- case SbxERROR:
- case SbxINTEGER:
- rStrm >> aTmp.nInteger; break;
- case SbxLONG:
- rStrm >> aTmp.nLong; break;
- case SbxSINGLE:
- {
- // Floats as ASCII
- aTmpString = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(
+ case SbxBOOL:
+ case SbxERROR:
+ case SbxINTEGER:
+ rStrm >> aTmp.nInteger; break;
+ case SbxLONG:
+ rStrm >> aTmp.nLong; break;
+ case SbxSINGLE:
+ {
+ // Floats as ASCII
+ aTmpString = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(
rStrm, RTL_TEXTENCODING_ASCII_US);
- double d;
- SbxDataType t;
- if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE )
- {
- aTmp.nSingle = 0;
- return sal_False;
- }
- aTmp.nSingle = (float) d;
- break;
- }
- case SbxDATE:
- case SbxDOUBLE:
+ double d;
+ SbxDataType t;
+ if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE )
{
- // Floats as ASCII
- aTmpString = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
- RTL_TEXTENCODING_ASCII_US);
- SbxDataType t;
- if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK )
- {
- aTmp.nDouble = 0;
- return sal_False;
- }
- break;
+ aTmp.nSingle = 0;
+ return sal_False;
}
- case SbxSTRING:
- aVal = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
- RTL_TEXTENCODING_ASCII_US);
- break;
- case SbxEMPTY:
- case SbxNULL:
- break;
- default:
- aData.eType = SbxNULL;
- DBG_ASSERT( !this, "Nicht unterstuetzer Datentyp geladen" );
+ aTmp.nSingle = (float) d;
+ break;
+ }
+ case SbxDATE:
+ case SbxDOUBLE:
+ {
+ // Floats as ASCII
+ aTmpString = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
+ RTL_TEXTENCODING_ASCII_US);
+ SbxDataType t;
+ if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK )
+ {
+ aTmp.nDouble = 0;
return sal_False;
+ }
+ break;
+ }
+ case SbxSTRING:
+ aVal = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStrm,
+ RTL_TEXTENCODING_ASCII_US);
+ break;
+ case SbxEMPTY:
+ case SbxNULL:
+ break;
+ default:
+ aData.eType = SbxNULL;
+ DBG_ASSERT( !this, "Nicht unterstuetzer Datentyp geladen" );
+ return sal_False;
}
// putt value
if( nType != SbxNULL && nType != SbxEMPTY && !Put( aTmp ) )
+ {
return sal_False;
+ }
}
rStrm >> cMark;
// cMark is also a version number!
@@ -523,13 +599,17 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
if( cMark )
{
if( cMark > 2 )
+ {
return sal_False;
+ }
pInfo = new SbxInfo;
pInfo->LoadData( rStrm, (sal_uInt16) cMark );
}
// Load private data only, if it is a SbxVariable
if( GetClass() == SbxCLASS_VARIABLE && !LoadPrivateData( rStrm, nVer ) )
+ {
return sal_False;
+ }
((SbxVariable*) this)->Broadcast( SBX_HINT_DATACHANGED );
nHash = MakeHashCode( maName );
SetModified( sal_True );
@@ -557,11 +637,15 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const
pThis->ResetFlag( SBX_NO_BROADCAST );
}
else
+ {
bValStore = SbxValue::StoreData( rStrm );
+ }
if( !bValStore )
+ {
return sal_False;
+ }
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStrm, maName,
- RTL_TEXTENCODING_ASCII_US);
+ RTL_TEXTENCODING_ASCII_US);
rStrm << (sal_uInt32)nUserData;
if( pInfo.Is() )
{
@@ -569,12 +653,18 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const
pInfo->StoreData( rStrm );
}
else
+ {
rStrm << (sal_uInt8) 0;
+ }
// Save private data only, if it is a SbxVariable
if( GetClass() == SbxCLASS_VARIABLE )
+ {
return StorePrivateData( rStrm );
+ }
else
+ {
return sal_True;
+ }
}
////////////////////////////// SbxInfo ///////////////////////////////////
@@ -582,7 +672,7 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const
SbxInfo::SbxInfo() : aHelpFile(), nHelpId( 0 ), aParams()
{}
-SbxInfo::SbxInfo( const String& r, sal_uInt32 n )
+SbxInfo::SbxInfo( const OUString& r, sal_uInt32 n )
: aHelpFile( r ), nHelpId( n ), aParams()
{}
@@ -602,7 +692,9 @@ SbxAlias& SbxAlias::operator=( const SbxAlias& r )
SbxAlias::~SbxAlias()
{
if( xAlias.Is() )
+ {
EndListening( xAlias->GetBroadcaster() );
+ }
}
void SbxAlias::Broadcast( sal_uIntPtr nHt )
@@ -611,9 +703,13 @@ void SbxAlias::Broadcast( sal_uIntPtr nHt )
{
xAlias->SetParameters( GetParameters() );
if( nHt == SBX_HINT_DATAWANTED )
+ {
SbxVariable::operator=( *xAlias );
+ }
else if( nHt == SBX_HINT_DATACHANGED || nHt == SBX_HINT_CONVERTED )
+ {
*xAlias = *this;
+ }
else if( nHt == SBX_HINT_INFOWANTED )
{
xAlias->Broadcast( nHt );
@@ -631,7 +727,9 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
xAlias.Clear();
// delete the alias?
if( pParent )
+ {
pParent->Remove( this );
+ }
}
}
@@ -643,9 +741,13 @@ void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill )
<< aBNameStr.getStr();
rtl::OString aBParentNameStr(rtl::OUStringToOString(GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US));
if ( GetParent() )
+ {
rStrm << " in parent '" << aBParentNameStr.getStr() << "'";
+ }
else
+ {
rStrm << " no parent";
+ }
rStrm << " ) ";
// output also the object at object-vars
@@ -658,7 +760,9 @@ void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill )
((SbxObject*) GetValues_Impl().pObj)->Dump( rStrm, bFill );
}
else
+ {
rStrm << endl;
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index b9ad7f19ecce..1d77d41ed59e 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -125,20 +126,9 @@ bool writeOasis2OOoLibraryElement(
Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
- Reference< xml::sax::XExtendedDocumentHandler > xWriter(
- xSMgr->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.xml.sax.Writer" ) ),
- xContext ),
- UNO_QUERY );
-
- Reference< io::XActiveDataSource > xSource( xWriter, UNO_QUERY );
- xSource->setOutputStream( xOutput );
+ Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
- if ( !xWriter.is() )
- {
- return sal_False;
- }
+ xWriter->setOutputStream( xOutput );
Sequence<Any> aArgs( 1 );
aArgs[0] <<= xWriter;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index dfce89aa5101..7d49a15ef850 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -83,9 +84,6 @@ using namespace osl;
using com::sun::star::uno::Reference;
-using ::rtl::OUString;
-using ::rtl::OStringBuffer;
-using ::rtl::OUStringToOString;
using ::rtl::Uri;
// #i34411: Flag for error handling during migration
@@ -143,8 +141,9 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
{
Type aAnyType = aElement.getValueType();
if( mType != aAnyType )
+ {
throw IllegalArgumentException();
-
+ }
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
if( aIt == mHashMap.end() )
{
@@ -189,8 +188,9 @@ void NameContainer::insertByName( const OUString& aName, const Any& aElement )
{
Type aAnyType = aElement.getValueType();
if( mType != aAnyType )
+ {
throw IllegalArgumentException();
-
+ }
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
if( aIt != mHashMap.end() )
{
@@ -237,7 +237,7 @@ void NameContainer::removeByName( const OUString& aName )
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
if( aIt == mHashMap.end() )
{
- rtl::OUString sMessage = rtl::OUStringBuffer().append('"')
+ OUString sMessage = OUStringBuffer().append('"')
.append(aName).append("\" not found")
.makeStringAndClear();
throw NoSuchElementException(sMessage, uno::Reference< uno::XInterface >());
@@ -291,7 +291,10 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi
throw (RuntimeException)
{
if( !xListener.is() )
- throw RuntimeException("addContainerListener called with null xListener", static_cast< cppu::OWeakObject * >(this));
+ {
+ throw RuntimeException("addContainerListener called with null xListener",
+ static_cast< cppu::OWeakObject * >(this));
+ }
Reference< XInterface > xIface( xListener, UNO_QUERY );
maContainerListeners.addInterface( xIface );
}
@@ -300,7 +303,9 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine
throw (RuntimeException)
{
if( !xListener.is() )
+ {
throw RuntimeException();
+ }
Reference< XInterface > xIface( xListener, UNO_QUERY );
maContainerListeners.removeInterface( xIface );
}
@@ -310,7 +315,9 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen
throw (RuntimeException)
{
if( !xListener.is() )
+ {
throw RuntimeException();
+ }
Reference< XInterface > xIface( xListener, UNO_QUERY );
maChangesListeners.addInterface( xIface );
}
@@ -319,7 +326,9 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis
throw (RuntimeException)
{
if( !xListener.is() )
+ {
throw RuntimeException();
+ }
Reference< XInterface > xIface( xListener, UNO_QUERY );
maChangesListeners.removeInterface( xIface );
}
@@ -330,12 +339,15 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis
void ModifiableHelper::setModified( sal_Bool _bModified )
{
if ( _bModified == mbModified )
+ {
return;
+ }
mbModified = _bModified;
if ( m_aModifyListeners.getLength() == 0 )
+ {
return;
-
+ }
EventObject aModifyEvent( m_rEventSource );
m_aModifyListeners.notifyEach( &XModifyListener::modified, aModifyEvent );
}
@@ -347,7 +359,8 @@ VBAScriptListenerContainer::VBAScriptListenerContainer( ::osl::Mutex& rMutex ) :
{
}
-bool VBAScriptListenerContainer::implTypedNotify( const Reference< vba::XVBAScriptListener >& rxListener, const vba::VBAScriptEvent& rEvent ) throw (Exception)
+bool VBAScriptListenerContainer::implTypedNotify( const Reference< vba::XVBAScriptListener >& rxListener, const vba::VBAScriptEvent& rEvent )
+ throw (Exception)
{
rxListener->notifyVBAScriptEvent( rEvent );
return true; // notify all other listeners too
@@ -385,14 +398,19 @@ SfxLibraryContainer::SfxLibraryContainer( void )
SfxLibraryContainer::~SfxLibraryContainer()
{
if( mbOwnBasMgr )
+ {
BasicManager::LegacyDeleteBasicManager( mpBasMgr );
+ }
DBG_DTOR( SfxLibraryContainer, NULL );
}
void SfxLibraryContainer::checkDisposed() const
{
if ( isDisposed() )
- throw DisposedException( ::rtl::OUString(), *const_cast< SfxLibraryContainer* >( this ) );
+ {
+ throw DisposedException( OUString(),
+ *const_cast< SfxLibraryContainer* >( this ) );
+ }
}
void SfxLibraryContainer::enterMethod()
@@ -409,16 +427,18 @@ void SfxLibraryContainer::leaveMethod()
BasicManager* SfxLibraryContainer::getBasicManager( void )
{
if ( mpBasMgr )
+ {
return mpBasMgr;
-
+ }
Reference< XModel > xDocument( mxOwnerDocument.get(), UNO_QUERY );
SAL_WARN_IF(
!xDocument.is(), "basic",
("SfxLibraryContainer::getBasicManager: cannot obtain a BasicManager"
" without document!"));
if ( xDocument.is() )
+ {
mpBasMgr = BasicManagerRepository::getDocumentBasicManager( xDocument );
-
+ }
return mpBasMgr;
}
@@ -429,40 +449,47 @@ Reference< XStorage > SAL_CALL SfxLibraryContainer::getRootStorage() throw (Runt
return mxStorage;
}
-void SAL_CALL SfxLibraryContainer::setRootStorage( const Reference< XStorage >& _rxRootStorage ) throw (IllegalArgumentException, RuntimeException)
+void SAL_CALL SfxLibraryContainer::setRootStorage( const Reference< XStorage >& _rxRootStorage )
+ throw (IllegalArgumentException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
if ( !_rxRootStorage.is() )
+ {
throw IllegalArgumentException();
-
+ }
mxStorage = _rxRootStorage;
onNewRootStorage();
}
-void SAL_CALL SfxLibraryContainer::storeLibrariesToStorage( const Reference< XStorage >& _rxRootStorage ) throw (IllegalArgumentException, WrappedTargetException, RuntimeException)
+void SAL_CALL SfxLibraryContainer::storeLibrariesToStorage( const Reference< XStorage >& _rxRootStorage )
+ throw (IllegalArgumentException, WrappedTargetException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
if ( !_rxRootStorage.is() )
+ {
throw IllegalArgumentException();
-
+ }
try
{
storeLibraries_Impl( _rxRootStorage, true );
}
catch( const Exception& )
{
- throw WrappedTargetException( ::rtl::OUString(), *this, ::cppu::getCaughtException() );
+ throw WrappedTargetException( OUString(),
+ *this, ::cppu::getCaughtException() );
}
}
// Methods XModifiable
-sal_Bool SfxLibraryContainer::isModified() throw (RuntimeException)
+sal_Bool SfxLibraryContainer::isModified()
+ throw (RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
if ( maModifiable.isModified() )
+ {
return sal_True;
-
+ }
// the library container is not modified, go through the libraries and check whether they are modified
Sequence< OUString > aNames = maNameContainer.getElementNames();
const OUString* pNames = aNames.getConstArray();
@@ -483,26 +510,31 @@ sal_Bool SfxLibraryContainer::isModified() throw (RuntimeException)
return sal_True;
}
else
+ {
return sal_True;
+ }
}
}
return sal_False;
}
-void SAL_CALL SfxLibraryContainer::setModified( sal_Bool _bModified ) throw (PropertyVetoException, RuntimeException)
+void SAL_CALL SfxLibraryContainer::setModified( sal_Bool _bModified )
+ throw (PropertyVetoException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
maModifiable.setModified( _bModified );
}
-void SAL_CALL SfxLibraryContainer::addModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException)
+void SAL_CALL SfxLibraryContainer::addModifyListener( const Reference< XModifyListener >& _rxListener )
+ throw (RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
maModifiable.addModifyListener( _rxListener );
}
-void SAL_CALL SfxLibraryContainer::removeModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException)
+void SAL_CALL SfxLibraryContainer::removeModifyListener( const Reference< XModifyListener >& _rxListener )
+ throw (RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
maModifiable.removeModifyListener( _rxListener );
@@ -515,13 +547,14 @@ Any SAL_CALL SfxLibraryContainer::getRootLocation() throw (RuntimeException)
return makeAny( getRootStorage() );
}
-::rtl::OUString SAL_CALL SfxLibraryContainer::getContainerLocationName() throw (RuntimeException)
+OUString SAL_CALL SfxLibraryContainer::getContainerLocationName() throw (RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
return maLibrariesDir;
}
-void SAL_CALL SfxLibraryContainer::storeLibraries( ) throw (WrappedTargetException, RuntimeException)
+void SAL_CALL SfxLibraryContainer::storeLibraries( )
+ throw (WrappedTargetException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
try
@@ -533,7 +566,7 @@ void SAL_CALL SfxLibraryContainer::storeLibraries( ) throw (WrappedTargetExcept
}
catch( const Exception& )
{
- throw WrappedTargetException( ::rtl::OUString(), *this, ::cppu::getCaughtException() );
+ throw WrappedTargetException( OUString(), *this, ::cppu::getCaughtException() );
}
}
@@ -563,14 +596,17 @@ static void createVariableURL( OUString& rStr, const OUString& rLibName,
const OUString& rInfoFileName, bool bUser )
{
if( bUser )
- rStr = OUString(RTL_CONSTASCII_USTRINGPARAM("$(USER)/basic/"));
+ {
+ rStr = OUString("$(USER)/basic/");
+ }
else
- rStr = OUString(RTL_CONSTASCII_USTRINGPARAM("$(INST)/share/basic/"));
-
+ {
+ rStr = OUString("$(INST)/share/basic/");
+ }
rStr += rLibName;
- rStr += OUString(sal_Unicode('/'));
+ rStr += "/";
rStr += rInfoFileName;
- rStr += OUString(RTL_CONSTASCII_USTRINGPARAM(".xlb/"));
+ rStr += ".xlb/";
}
void SfxLibraryContainer::init( const OUString& rInitialDocumentURL, const uno::Reference< embed::XStorage >& rxInitialStorage )
@@ -663,11 +699,13 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
{
uno::Reference< embed::XStorage > xLibrariesStor;
- String aFileName;
+ OUString aFileName;
int nPassCount = 1;
if( !bStorage && meInitMode == DEFAULT )
+ {
nPassCount = 2;
+ }
for( int nPass = 0 ; nPass < nPassCount ; nPass++ )
{
if( bStorage )
@@ -683,7 +721,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
if ( xLibrariesStor.is() )
{
aFileName = maInfoFileName;
- aFileName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") );
+ aFileName += "-lc.xml";
try
{
@@ -698,7 +736,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// Check old version
aFileName = maOldInfoFileName;
- aFileName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
+ aFileName += ".xml";
try
{
@@ -711,14 +749,16 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
{
// Check for EA2 document version with wrong extensions
aFileName = maOldInfoFileName;
- aFileName += String( RTL_CONSTASCII_USTRINGPARAM(".xli") );
+ aFileName += ".xli";
xStream = xLibrariesStor->openStreamElement( aFileName, embed::ElementModes::READ );
}
}
}
if ( xStream.is() )
+ {
xInput = xStream->getInputStream();
+ }
}
catch(const uno::Exception& )
{
@@ -735,11 +775,15 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
else
{
if( nPass == 1 )
- pLibInfoInetObj = new INetURLObject( String(maLibraryPath).GetToken(0) );
+ {
+ pLibInfoInetObj = new INetURLObject( maLibraryPath.getToken(0, (sal_Unicode)';') );
+ }
else
- pLibInfoInetObj = new INetURLObject( String(maLibraryPath).GetToken(1) );
+ {
+ pLibInfoInetObj = new INetURLObject( maLibraryPath.getToken(1, (sal_Unicode)';') );
+ }
pLibInfoInetObj->insertName( maInfoFileName, sal_False, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
- pLibInfoInetObj->setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlc") ) );
+ pLibInfoInetObj->setExtension( OUString("xlc") );
aFileName = pLibInfoInetObj->GetMainURL( INetURLObject::NO_DECODE );
}
@@ -756,9 +800,9 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// Old variant?
if( !xInput.is() && nPass == 0 )
{
- INetURLObject aLibInfoInetObj( String(maLibraryPath).GetToken(1) );
+ INetURLObject aLibInfoInetObj( maLibraryPath.getToken(1, (sal_Unicode)';') );
aLibInfoInetObj.insertName( maOldInfoFileName, sal_False, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
- aLibInfoInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xli") ) );
+ aLibInfoInetObj.setExtension( OUString( "xli") );
aFileName = aLibInfoInetObj.GetMainURL( INetURLObject::NO_DECODE );
try
@@ -809,15 +853,19 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
OUString aStorageURL = rLib.aStorageURL;
if( !bStorage && aStorageURL.isEmpty() && nPass == 0 )
{
- String aLibraryPath;
+ OUString aLibraryPath;
if( meInitMode == CONTAINER_INIT_FILE )
+ {
aLibraryPath = maLibraryPath;
+ }
else
- aLibraryPath = String(maLibraryPath).GetToken(1);
+ {
+ aLibraryPath = maLibraryPath.getToken(1, (sal_Unicode)';');
+ }
INetURLObject aInetObj( aLibraryPath );
aInetObj.insertName( rLib.aName, sal_True, INetURLObject::LAST_SEGMENT,
- sal_True, INetURLObject::ENCODE_ALL );
+ sal_True, INetURLObject::ENCODE_ALL );
OUString aLibDirPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( mxSFI->isFolder( aLibDirPath ) )
{
@@ -827,9 +875,9 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
else if( rLib.bLink )
{
// Check "share" path
- INetURLObject aShareInetObj( String(maLibraryPath).GetToken(0) );
+ INetURLObject aShareInetObj( maLibraryPath.getToken(0, (sal_Unicode)';') );
aShareInetObj.insertName( rLib.aName, sal_True, INetURLObject::LAST_SEGMENT,
- sal_True, INetURLObject::ENCODE_ALL );
+ sal_True, INetURLObject::ENCODE_ALL );
OUString aShareLibDirPath = aShareInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( mxSFI->isFolder( aShareLibDirPath ) )
{
@@ -849,8 +897,9 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// If the same library name is used by the shared and the
// user lib container index files the user file wins
if( nPass == 1 && hasByName( aLibName ) )
+ {
continue;
-
+ }
SfxLibrary* pImplLib;
if( rLib.bLink )
{
@@ -865,8 +914,10 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
pImplLib->mbLoaded = sal_False;
pImplLib->mbReadOnly = rLib.bReadOnly;
if( !bStorage )
+ {
checkStorageURL( rLib.aStorageURL, pImplLib->maLibInfoFileURL,
- pImplLib->maStorageURL, pImplLib->maUnexpandedStorageURL );
+ pImplLib->maStorageURL, pImplLib->maUnexpandedStorageURL );
+ }
}
maModifiable.setModified( sal_False );
@@ -874,22 +925,23 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
if( !mbOldInfoFormat )
{
uno::Reference< embed::XStorage > xLibraryStor;
- if( !pImplLib->mbInitialised && bStorage )
+ if( !pImplLib->mbInitialised && bStorage )
{
- try {
+ try
+ {
xLibraryStor = xLibrariesStor->openStorageElement( rLib.aName,
embed::ElementModes::READ );
}
catch(const uno::Exception& )
{
- #if OSL_DEBUG_LEVEL > 0
+ #if OSL_DEBUG_LEVEL > 0
Any aError( ::cppu::getCaughtException() );
SAL_WARN(
"basic",
"couldn't open sub storage for library \""
<< rLib.aName << "\". Exception: "
<< comphelper::anyToString(aError));
- #endif
+ #endif
}
}
@@ -903,7 +955,9 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
("Different library names in library container and"
" library info files!"));
if( GbMigrationSuppressErrors && !bLoaded )
+ {
removeLibrary( aLibName );
+ }
}
}
else if( !bStorage )
@@ -926,8 +980,9 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// Keep flag for documents to force writing the new index files
if( !bStorage )
+ {
mbOldInfoFormat = false;
-
+ }
delete pLibArray;
}
}
@@ -958,13 +1013,15 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
OUString aName = pNames[ i ];
SfxLibrary* pImplLib = getImplLib( aName );
if( pImplLib->mbPreload )
+ {
loadLibrary( aName );
+ }
}
}
if( meInitMode == DEFAULT )
{
- INetURLObject aUserBasicInetObj( String(maLibraryPath).GetToken(1) );
+ INetURLObject aUserBasicInetObj( maLibraryPath.getToken(1, (sal_Unicode)';') );
OUString aStandardStr( RTL_CONSTASCII_USTRINGPARAM("Standard") );
static char const strPrevFolderName_1[] = "__basic_80";
@@ -980,7 +1037,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
try
{
INetURLObject aPrevUserBasicInetObj = aPrevUserBasicInetObj_1;
- String aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( mxSFI->isFolder( aPrevFolder ) )
{
// Check if Standard folder exists and is complete
@@ -993,35 +1050,35 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
OUString aPrevStandardFolder = aPrevUserBasicStandardInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( mxSFI->isFolder( aPrevStandardFolder ) )
{
- OUString aXlbExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlb") ) );
+ OUString aXlbExtension( "xlb" );
OUString aCheckFileName;
// Check if script.xlb exists
- aCheckFileName = OUString( RTL_CONSTASCII_USTRINGPARAM("script") );
+ aCheckFileName = OUString("script");
checkAndCopyFileImpl( aUserBasicStandardInetObj,
aPrevUserBasicStandardInetObj,
aCheckFileName, aXlbExtension, mxSFI );
// Check if dialog.xlb exists
- aCheckFileName = OUString( RTL_CONSTASCII_USTRINGPARAM("dialog") );
+ aCheckFileName = OUString("dialog");
checkAndCopyFileImpl( aUserBasicStandardInetObj,
aPrevUserBasicStandardInetObj,
aCheckFileName, aXlbExtension, mxSFI );
// Check if module1.xba exists
- OUString aXbaExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xba") ) );
- aCheckFileName = OUString( RTL_CONSTASCII_USTRINGPARAM("Module1") );
+ OUString aXbaExtension("xba");
+ aCheckFileName = OUString("Module1");
checkAndCopyFileImpl( aUserBasicStandardInetObj,
aPrevUserBasicStandardInetObj,
aCheckFileName, aXbaExtension, mxSFI );
}
else
{
- String aStandardFolder = aUserBasicStandardInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aStandardFolder = aUserBasicStandardInetObj.GetMainURL( INetURLObject::NO_DECODE );
mxSFI->copy( aStandardFolder, aPrevStandardFolder );
}
- String aPrevCopyToFolder = aPrevUserBasicInetObj_2.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aPrevCopyToFolder = aPrevUserBasicInetObj_2.GetMainURL( INetURLObject::NO_DECODE );
mxSFI->copy( aPrevFolder, aPrevCopyToFolder );
}
else
@@ -1035,11 +1092,11 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
Reference< XInterface > xRef = static_cast< XInterface* >( static_cast< OWeakObject* >(pPrevCont) );
// Rename previous basic folder to make storage URLs correct during initialisation
- String aFolderUserBasic = aUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aFolderUserBasic = aUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
INetURLObject aUserBasicTmpInetObj( aUserBasicInetObj );
aUserBasicTmpInetObj.removeSegment();
aUserBasicTmpInetObj.Append( rtl::OString( "__basic_tmp" ));
- String aFolderTmp = aUserBasicTmpInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aFolderTmp = aUserBasicTmpInetObj.GetMainURL( INetURLObject::NO_DECODE );
mxSFI->move( aFolderUserBasic, aFolderTmp );
try
@@ -1062,7 +1119,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
INetURLObject aPrevUserBasicLibInfoInetObj( aUserBasicInetObj );
aPrevUserBasicLibInfoInetObj.insertName( maInfoFileName, sal_False, INetURLObject::LAST_SEGMENT,
sal_True, INetURLObject::ENCODE_ALL );
- aPrevUserBasicLibInfoInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlc") ) );
+ aPrevUserBasicLibInfoInetObj.setExtension( OUString("xlc"));
OUString aLibInfoFileName = aPrevUserBasicLibInfoInetObj.GetMainURL( INetURLObject::NO_DECODE );
Sequence<Any> aInitSeq( 1 );
aInitSeq.getArray()[0] <<= aLibInfoFileName;
@@ -1074,10 +1131,10 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
mxSFI->move( aFolderUserBasic, aPrevFolder );
mxSFI->move( aFolderTmp, aFolderUserBasic );
- OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"));
- OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"));
- OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"));
- OUString aInstSearchStr(RTL_CONSTASCII_USTRINGPARAM("$(INST)"));
+ OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
+ OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
+ OUString aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+ OUString aInstSearchStr("$(INST)");
Sequence< OUString > aNames = pPrevCont->getElementNames();
const OUString* pNames = aNames.getConstArray();
@@ -1092,7 +1149,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
{
SfxLibrary* pImplLib = getImplLib( aStandardStr );
INetURLObject aStandardFolderInetObj( pImplLib->maStorageURL );
- String aStandardFolder = pImplLib->maStorageURL;
+ OUString aStandardFolder = pImplLib->maStorageURL;
mxSFI->kill( aStandardFolder );
}
else
@@ -1114,24 +1171,30 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
bCreateLink = false;
}
if( bCreateLink )
+ {
createLibraryLink( aLibName, pImplLib->maStorageURL, pImplLib->mbReadOnly );
+ }
}
else
{
// Move folder if not already done
INetURLObject aUserBasicLibFolderInetObj( aUserBasicInetObj );
aUserBasicLibFolderInetObj.Append( aLibName );
- String aLibFolder = aUserBasicLibFolderInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aLibFolder = aUserBasicLibFolderInetObj.GetMainURL( INetURLObject::NO_DECODE );
INetURLObject aPrevUserBasicLibFolderInetObj( aPrevUserBasicInetObj );
aPrevUserBasicLibFolderInetObj.Append( aLibName );
- String aPrevLibFolder = aPrevUserBasicLibFolderInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aPrevLibFolder = aPrevUserBasicLibFolderInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( mxSFI->isFolder( aPrevLibFolder ) && !mxSFI->isFolder( aLibFolder ) )
+ {
mxSFI->move( aPrevLibFolder, aLibFolder );
+ }
if( aLibName == aStandardStr )
- maNameContainer.removeByName( aLibName );
+ {
+ maNameContainer.removeByName( aLibName );
+ }
// Create library
Reference< XNameContainer > xLib = createLibrary( aLibName );
@@ -1139,12 +1202,11 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
pNewLib->mbLoaded = false;
pNewLib->implSetModified( sal_False );
checkStorageURL( aLibFolder, pNewLib->maLibInfoFileURL,
- pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL );
+ pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL );
uno::Reference< embed::XStorage > xDummyStor;
::xmlscript::LibDescriptor aLibDesc;
- implLoadLibraryIndexFile
- ( pNewLib, aLibDesc, xDummyStor, pNewLib->maLibInfoFileURL );
+ implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, pNewLib->maLibInfoFileURL );
implImportLibDescriptor( pNewLib, aLibDesc );
}
}
@@ -1164,12 +1226,12 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
INetURLObject aPrevUserBasicInetObj_Err( aUserBasicInetObj );
aPrevUserBasicInetObj_Err.removeSegment();
aPrevUserBasicInetObj_Err.Append( rtl::OString( strErrorSavFolderName ));
- String aPrevFolder_Err = aPrevUserBasicInetObj_Err.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aPrevFolder_Err = aPrevUserBasicInetObj_Err.GetMainURL( INetURLObject::NO_DECODE );
bool bSaved = false;
try
{
- String aPrevFolder_1 = aPrevUserBasicInetObj_1.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aPrevFolder_1 = aPrevUserBasicInetObj_1.GetMainURL( INetURLObject::NO_DECODE );
if( mxSFI->isFolder( aPrevFolder_1 ) )
{
mxSFI->move( aPrevFolder_1, aPrevFolder_Err );
@@ -1180,11 +1242,15 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
{}
try
{
- String aPrevFolder_2 = aPrevUserBasicInetObj_2.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aPrevFolder_2 = aPrevUserBasicInetObj_2.GetMainURL( INetURLObject::NO_DECODE );
if( !bSaved && mxSFI->isFolder( aPrevFolder_2 ) )
+ {
mxSFI->move( aPrevFolder_2, aPrevFolder_Err );
+ }
else
+ {
mxSFI->kill( aPrevFolder_2 );
+ }
}
catch(const Exception& )
{}
@@ -1195,14 +1261,15 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
void SfxLibraryContainer::implScanExtensions( void )
{
ScriptExtensionIterator aScriptIt;
- rtl::OUString aLibURL;
+ OUString aLibURL;
bool bPureDialogLib = false;
while ( !(aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).isEmpty())
{
if( bPureDialogLib && maInfoFileName == "script" )
+ {
continue;
-
+ }
// Extract lib name
sal_Int32 nLen = aLibURL.getLength();
sal_Int32 indexLastSlash = aLibURL.lastIndexOf( '/' );
@@ -1217,30 +1284,34 @@ void SfxLibraryContainer::implScanExtensions( void )
// If a library of the same exists the existing library wins
if( hasByName( aLibName ) )
+ {
continue;
-
+ }
// Add index file to URL
OUString aIndexFileURL = aLibURL;
if( nReduceCopy == 0 )
- aIndexFileURL += OUString(sal_Unicode('/'));
+ {
+ aIndexFileURL += "/";
+ }
aIndexFileURL += maInfoFileName;
- aIndexFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM(".xlb"));
+ aIndexFileURL += OUString(".xlb");
// Create link
const bool bReadOnly = false;
- Reference< XNameAccess > xLib =
- createLibraryLink( aLibName, aIndexFileURL, bReadOnly );
+ Reference< XNameAccess > xLib = createLibraryLink( aLibName, aIndexFileURL, bReadOnly );
}
}
// Handle maLibInfoFileURL and maStorageURL correctly
void SfxLibraryContainer::checkStorageURL( const OUString& aSourceURL,
- OUString& aLibInfoFileURL, OUString& aStorageURL, OUString& aUnexpandedStorageURL )
+ OUString& aLibInfoFileURL, OUString& aStorageURL,
+ OUString& aUnexpandedStorageURL )
{
OUString aExpandedSourceURL = expand_url( aSourceURL );
if( aExpandedSourceURL != aSourceURL )
+ {
aUnexpandedStorageURL = aSourceURL;
-
+ }
INetURLObject aInetObj( aExpandedSourceURL );
OUString aExtension = aInetObj.getExtension();
if( aExtension.compareToAscii( "xlb" ) == COMPARE_EQUAL )
@@ -1255,12 +1326,12 @@ void SfxLibraryContainer::checkStorageURL( const OUString& aSourceURL,
// URL to library folder
aStorageURL = aExpandedSourceURL;
aInetObj.insertName( maInfoFileName, sal_False, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
- aInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlb") ) );
+ aInetObj.setExtension( OUString("xlb") );
aLibInfoFileURL = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
}
}
-SfxLibrary* SfxLibraryContainer::getImplLib( const String& rLibraryName )
+SfxLibrary* SfxLibraryContainer::getImplLib( const OUString& rLibraryName )
{
Any aLibAny = maNameContainer.getByName( rLibraryName ) ;
Reference< XNameAccess > xNameAccess;
@@ -1273,19 +1344,19 @@ SfxLibrary* SfxLibraryContainer::getImplLib( const String& rLibraryName )
// Storing with password encryption
// Empty implementation, avoids unneccesary implementation in dlgcont.cxx
-sal_Bool SfxLibraryContainer::implStorePasswordLibrary(
- SfxLibrary*,
- const OUString&,
- const uno::Reference< embed::XStorage >&, const uno::Reference< task::XInteractionHandler >& )
+sal_Bool SfxLibraryContainer::implStorePasswordLibrary( SfxLibrary*,
+ const OUString&,
+ const uno::Reference< embed::XStorage >&,
+ const uno::Reference< task::XInteractionHandler >& )
{
return sal_False;
}
sal_Bool SfxLibraryContainer::implStorePasswordLibrary(
SfxLibrary* /*pLib*/,
- const ::rtl::OUString& /*aName*/,
+ const OUString& /*aName*/,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& /*xStorage*/,
- const ::rtl::OUString& /*aTargetURL*/,
+ const OUString& /*aTargetURL*/,
const Reference< XSimpleFileAccess2 > /*xToUseSFI*/,
const uno::Reference< task::XInteractionHandler >& )
{
@@ -1304,18 +1375,16 @@ throw(WrappedTargetException, RuntimeException)
#define EXPAND_PROTOCOL "vnd.sun.star.expand"
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-OUString SfxLibraryContainer::createAppLibraryFolder
- ( SfxLibrary* pLib, const OUString& aName )
+OUString SfxLibraryContainer::createAppLibraryFolder( SfxLibrary* pLib, const OUString& aName )
{
OUString aLibDirPath = pLib->maStorageURL;
if( aLibDirPath.isEmpty() )
{
- INetURLObject aInetObj( String(maLibraryPath).GetToken(1) );
+ INetURLObject aInetObj( maLibraryPath.getToken(1, (sal_Unicode)';') );
aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
checkStorageURL( aInetObj.GetMainURL( INetURLObject::NO_DECODE ), pLib->maLibInfoFileURL,
- pLib->maStorageURL, pLib->maUnexpandedStorageURL );
+ pLib->maStorageURL, pLib->maUnexpandedStorageURL );
aLibDirPath = pLib->maStorageURL;
}
@@ -1334,7 +1403,8 @@ OUString SfxLibraryContainer::createAppLibraryFolder
// Storing
void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
- const OUString& aName, const uno::Reference< embed::XStorage >& xStorage )
+ const OUString& aName,
+ const uno::Reference< embed::XStorage >& xStorage )
{
OUString aDummyLocation;
Reference< XSimpleFileAccess2 > xDummySFA;
@@ -1344,9 +1414,11 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
// New variant for library export
void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
- const OUString& aName, const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess2 > xToUseSFI,
- const Reference< XInteractionHandler >& xHandler )
+ const OUString& aName,
+ const uno::Reference< embed::XStorage >& xStorage,
+ const OUString& aTargetURL,
+ Reference< XSimpleFileAccess2 > xToUseSFI,
+ const Reference< XInteractionHandler >& xHandler )
{
sal_Bool bLink = pLib->mbLink;
bool bStorage = xStorage.is() && !bLink;
@@ -1360,9 +1432,8 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
for( sal_Int32 i = 0 ; i < nNameCount ; i++ )
{
OUString aElementName = pNames[ i ];
-
OUString aStreamName = aElementName;
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
+ aStreamName += ".xml";
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
@@ -1371,13 +1442,14 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
"invalid library element \"" << aElementName << '"');
continue;
}
- try {
+ try
+ {
uno::Reference< io::XStream > xElementStream = xStorage->openStreamElement(
aStreamName,
embed::ElementModes::READWRITE );
// throw uno::RuntimeException(); // TODO: method must either return the stream or throw an exception
- OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
+ OUString aMime( "text/xml" );
uno::Reference< beans::XPropertySet > xProps( xElementStream, uno::UNO_QUERY );
SAL_WARN_IF(
@@ -1387,10 +1459,10 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
if ( xProps.is() )
{
- xProps->setPropertyValue( rtl::OUString("MediaType"), uno::makeAny( aMime ) );
+ xProps->setPropertyValue( OUString("MediaType"), uno::makeAny( aMime ) );
// #87671 Allow encryption
- xProps->setPropertyValue( rtl::OUString("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
+ xProps->setPropertyValue( OUString("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
Reference< XOutputStream > xOutput = xElementStream->getOutputStream();
Reference< XNameContainer > xLib( pLib );
@@ -1403,7 +1475,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
// TODO: error handling?
}
}
-
pLib->storeResourcesToStorage( xStorage );
}
else
@@ -1414,8 +1485,9 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
{
Reference< XSimpleFileAccess2 > xSFI = mxSFI;
if( xToUseSFI.is() )
+ {
xSFI = xToUseSFI;
-
+ }
OUString aLibDirPath;
if( bExport )
{
@@ -1424,8 +1496,9 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
aLibDirPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( !xSFI->isFolder( aLibDirPath ) )
+ {
xSFI->createFolder( aLibDirPath );
-
+ }
pLib->storeResourcesToURL( aLibDirPath, xHandler );
}
else
@@ -1440,9 +1513,10 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
INetURLObject aElementInetObj( aLibDirPath );
aElementInetObj.insertName( aElementName, sal_False,
- INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
aElementInetObj.setExtension( maLibElementFileExtension );
- String aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ OUString aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
@@ -1456,7 +1530,9 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
try
{
if( xSFI->exists( aElementPath ) )
+ {
xSFI->kill( aElementPath );
+ }
Reference< XOutputStream > xOutput = xSFI->openFileWrite( aElementPath );
Reference< XNameContainer > xLib( pLib );
writeLibraryElement( xLib, aElementName, xOutput );
@@ -1465,8 +1541,9 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
catch(const Exception& )
{
if( bExport )
+ {
throw;
-
+ }
SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aElementPath );
sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
ErrorHandler::HandleError( nErrorCode );
@@ -1476,13 +1553,16 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
catch(const Exception& )
{
if( bExport )
+ {
throw;
+ }
}
}
}
void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
- const ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage )
+ const ::xmlscript::LibDescriptor& rLib,
+ const uno::Reference< embed::XStorage >& xStorage )
{
OUString aDummyLocation;
Reference< XSimpleFileAccess2 > xDummySFA;
@@ -1491,18 +1571,13 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
// New variant for library export
void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
- const ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess2 > xToUseSFI )
+ const ::xmlscript::LibDescriptor& rLib,
+ const uno::Reference< embed::XStorage >& xStorage,
+ const OUString& aTargetURL,
+ Reference< XSimpleFileAccess2 > xToUseSFI )
{
// Create sax writer
- Reference< XExtendedDocumentHandler > xHandler(
- mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
- if( !xHandler.is() )
- {
- SAL_WARN("basic", "couldn't create sax-writer component");
- return;
- }
+ Reference< XWriter > xWriter = xml::sax::Writer::create(comphelper::getComponentContext(mxMSF));
sal_Bool bLink = pLib->mbLink;
bool bStorage = xStorage.is() && !bLink;
@@ -1513,9 +1588,10 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
if( bStorage )
{
OUString aStreamName( maInfoFileName );
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lb.xml") );
+ aStreamName += "-lb.xml";
- try {
+ try
+ {
xInfoStream = xStorage->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
SAL_WARN_IF(!xInfoStream.is(), "basic", "No stream!");
uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY );
@@ -1523,11 +1599,11 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
if ( xProps.is() )
{
- OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
- xProps->setPropertyValue( rtl::OUString("MediaType"), uno::makeAny( aMime ) );
+ OUString aMime("text/xml");
+ xProps->setPropertyValue( OUString("MediaType"), uno::makeAny( aMime ) );
// #87671 Allow encryption
- xProps->setPropertyValue( rtl::OUString("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
+ xProps->setPropertyValue( OUString("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
xOut = xInfoStream->getOutputStream();
}
@@ -1544,8 +1620,9 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
bool bExport = !aTargetURL.isEmpty();
Reference< XSimpleFileAccess2 > xSFI = mxSFI;
if( xToUseSFI.is() )
+ {
xSFI = xToUseSFI;
-
+ }
OUString aLibInfoPath;
if( bExport )
{
@@ -1553,8 +1630,9 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
aInetObj.insertName( rLib.aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
OUString aLibDirPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( !xSFI->isFolder( aLibDirPath ) )
+ {
xSFI->createFolder( aLibDirPath );
-
+ }
aInetObj.insertName( maInfoFileName, sal_False, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
aInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlb") ) );
aLibInfoPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
@@ -1568,14 +1646,17 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
try
{
if( xSFI->exists( aLibInfoPath ) )
+ {
xSFI->kill( aLibInfoPath );
+ }
xOut = xSFI->openFileWrite( aLibInfoPath );
}
catch(const Exception& )
{
if( bExport )
+ {
throw;
-
+ }
SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath );
sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
ErrorHandler::HandleError( nErrorCode );
@@ -1586,16 +1667,15 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
SAL_WARN("basic", "couldn't open output stream");
return;
}
-
- Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( xOut );
-
- xmlscript::exportLibrary( xHandler, rLib );
+ xWriter->setOutputStream( xOut );
+ xmlscript::exportLibrary( xWriter, rLib );
}
bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
- ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage, const OUString& aIndexFileName )
+ ::xmlscript::LibDescriptor& rLib,
+ const uno::Reference< embed::XStorage >& xStorage,
+ const OUString& aIndexFileName )
{
Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF));
@@ -1609,15 +1689,16 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
// Read info file
uno::Reference< io::XInputStream > xInput;
- String aLibInfoPath;
+ OUString aLibInfoPath;
if( bStorage )
{
aLibInfoPath = maInfoFileName;
aLibInfoPath += String( RTL_CONSTASCII_USTRINGPARAM("-lb.xml") );
- try {
+ try
+ {
uno::Reference< io::XStream > xInfoStream =
- xStorage->openStreamElement( aLibInfoPath, embed::ElementModes::READ );
+ xStorage->openStreamElement( aLibInfoPath, embed::ElementModes::READ );
xInput = xInfoStream->getInputStream();
}
catch(const uno::Exception& )
@@ -1634,8 +1715,9 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
aLibInfoPath = pLib->maLibInfoFileURL;
}
else
+ {
aLibInfoPath = aIndexFileName;
-
+ }
try
{
xInput = mxSFI->openFileRead( aLibInfoPath );
@@ -1661,7 +1743,8 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
source.sSystemId = aLibInfoPath;
// start parsing
- try {
+ try
+ {
xParser->setDocumentHandler( ::xmlscript::importLibrary( rLib ) );
xParser->parseStream( source );
}
@@ -1681,7 +1764,7 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
pLib->mbLoaded = sal_False;
rLib.aStorageURL = aIndexFileName;
checkStorageURL( rLib.aStorageURL, pLib->maLibInfoFileURL, pLib->maStorageURL,
- pLib->maUnexpandedStorageURL );
+ pLib->maUnexpandedStorageURL );
implImportLibDescriptor( pLib, rLib );
}
@@ -1689,8 +1772,8 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
return true;
}
-void SfxLibraryContainer::implImportLibDescriptor
- ( SfxLibrary* pLib, ::xmlscript::LibDescriptor& rLib )
+void SfxLibraryContainer::implImportLibDescriptor( SfxLibrary* pLib,
+ ::xmlscript::LibDescriptor& rLib )
{
if( !pLib->mbInitialised )
{
@@ -1705,14 +1788,14 @@ void SfxLibraryContainer::implImportLibDescriptor
pLib->mbReadOnly = rLib.bReadOnly;
pLib->mbPreload = rLib.bPreload;
pLib->implSetModified( sal_False );
-
pLib->mbInitialised = true;
}
}
// Methods of new XLibraryStorage interface?
-void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage, bool bComplete )
+void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage,
+ bool bComplete )
{
const Sequence< OUString > aNames = maNameContainer.getElementNames();
sal_Int32 nNameCount = aNames.getLength();
@@ -1725,18 +1808,21 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
{
SfxLibrary* pImplLib = getImplLib( *pName );
if( pImplLib->mbSharedIndexFile || pImplLib->mbExtension )
+ {
nLibsToSave--;
+ }
}
if( !nLibsToSave )
+ {
return;
-
+ }
boost::scoped_ptr< ::xmlscript::LibDescriptorArray > pLibArray(new ::xmlscript::LibDescriptorArray(nLibsToSave));
// Write to storage?
bool bStorage = i_rStorage.is();
uno::Reference< embed::XStorage > xSourceLibrariesStor;
uno::Reference< embed::XStorage > xTargetLibrariesStor;
- ::rtl::OUString sTempTargetStorName;
+ OUString sTempTargetStorName;
const bool bInplaceStorage = bStorage && ( i_rStorage == mxStorage );
if ( bStorage )
{
@@ -1747,26 +1833,30 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
Reference< XNameAccess > xNameAccess;
aLibAny >>= xNameAccess;
if ( ! ( xNameAccess->hasElements() || ( bInplaceStorage && isModified() ) ) )
+ {
return;
+ }
}
// create the empty target storage
try
{
- ::rtl::OUString sTargetLibrariesStoreName;
+ OUString sTargetLibrariesStoreName;
if ( bInplaceStorage )
{
// create a temporary target storage
- const ::rtl::OUStringBuffer aTempTargetNameBase = maLibrariesDir + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_temp_" ) );
+ const OUStringBuffer aTempTargetNameBase = maLibrariesDir + OUString( "_temp_" );
sal_Int32 index = 0;
do
{
- ::rtl::OUStringBuffer aTempTargetName( aTempTargetNameBase );
+ OUStringBuffer aTempTargetName( aTempTargetNameBase );
aTempTargetName.append( index++ );
sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear();
if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) )
+ {
break;
+ }
}
while ( true );
sTempTargetStorName = sTargetLibrariesStoreName;
@@ -1775,7 +1865,9 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
{
sTargetLibrariesStoreName = maLibrariesDir;
if ( i_rStorage->hasByName( sTargetLibrariesStoreName ) )
+ {
i_rStorage->removeElement( sTargetLibrariesStoreName );
+ }
}
xTargetLibrariesStor.set( i_rStorage->openStorageElement( sTargetLibrariesStoreName, embed::ElementModes::READWRITE ), UNO_QUERY_THROW );
@@ -1790,7 +1882,10 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
try
{
if ( mxStorage->hasByName( maLibrariesDir ) || bInplaceStorage )
- xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ );
+ {
+ xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir,
+ bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ );
+ }
}
catch( const uno::Exception& )
{
@@ -1806,12 +1901,16 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
{
SfxLibrary* pImplLib = getImplLib( *pName );
if( pImplLib->mbSharedIndexFile )
+ {
continue;
+ }
const bool bExtensionLib = pImplLib->mbExtension;
::xmlscript::LibDescriptor& rLib = bExtensionLib ?
- aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray];
+ aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray];
if( !bExtensionLib )
+ {
iArray++;
+ }
rLib.aName = *pName;
rLib.bLink = pImplLib->mbLink;
@@ -1853,28 +1952,32 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
}
catch(const uno::Exception& )
{
- #if OSL_DEBUG_LEVEL > 0
+ #if OSL_DEBUG_LEVEL > 0
Any aError( ::cppu::getCaughtException() );
SAL_WARN(
"basic",
"couldn't create sub storage for library \""
<< rLib.aName << "\". Exception: "
<< comphelper::anyToString(aError));
- #endif
+ #endif
return;
}
}
// Maybe lib is not loaded?!
if( bComplete )
+ {
loadLibrary( rLib.aName );
-
+ }
if( pImplLib->mbPasswordProtected )
+ {
implStorePasswordLibrary( pImplLib, rLib.aName, xLibraryStor, uno::Reference< task::XInteractionHandler >() );
// TODO: Check return value
+ }
else
+ {
implStoreLibrary( pImplLib, rLib.aName, xLibraryStor );
-
+ }
implStoreLibraryIndexFile( pImplLib, rLib, xLibraryStor );
if( bStorage )
{
@@ -1890,7 +1993,6 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
}
}
}
-
maModifiable.setModified( sal_True );
pImplLib->implSetModified( sal_False );
}
@@ -1919,20 +2021,20 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if ( xSourceLibrariesStor.is() )
{
// remove
- const Sequence< ::rtl::OUString > aRemoveNames( xSourceLibrariesStor->getElementNames() );
- for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray();
- pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength();
- ++pRemoveName
+ const Sequence< OUString > aRemoveNames( xSourceLibrariesStor->getElementNames() );
+ for ( const OUString* pRemoveName = aRemoveNames.getConstArray();
+ pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength();
+ ++pRemoveName
)
{
xSourceLibrariesStor->removeElement( *pRemoveName );
}
// copy
- const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() );
- for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray();
- pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength();
- ++pCopyName
+ const Sequence< OUString > aCopyNames( xTargetLibrariesStor->getElementNames() );
+ for ( const OUString* pCopyName = aCopyNames.getConstArray();
+ pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength();
+ ++pCopyName
)
{
xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName );
@@ -1943,7 +2045,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
xTargetLibrariesStor->dispose();
i_rStorage->removeElement( sTempTargetStorName );
xTargetLibrariesStor.clear();
- sTempTargetStorName = ::rtl::OUString();
+ sTempTargetStorName = OUString();
// adjust target
xTargetLibrariesStor = xSourceLibrariesStor;
@@ -1956,20 +2058,15 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
}
if( !mbOldInfoFormat && !maModifiable.isModified() )
+ {
return;
+ }
maModifiable.setModified( sal_False );
mbOldInfoFormat = false;
// Write library container info
// Create sax writer
- Reference< XExtendedDocumentHandler > xHandler(
- mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
- if( !xHandler.is() )
- {
- SAL_WARN("basic", "couldn't create sax-writer component");
- return;
- }
+ Reference< XWriter > xWriter = xml::sax::Writer::create(comphelper::getComponentContext(mxMSF));
// Write info file
uno::Reference< io::XOutputStream > xOut;
@@ -1977,22 +2074,24 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if( bStorage )
{
OUString aStreamName( maInfoFileName );
- aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") );
+ aStreamName += "-lc.xml";
- try {
+ try
+ {
xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY );
SAL_WARN_IF(
!xProps.is(), "basic",
"The stream must implement XPropertySet!");
if ( !xProps.is() )
+ {
throw uno::RuntimeException();
-
- OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
- xProps->setPropertyValue( rtl::OUString("MediaType"), uno::makeAny( aMime ) );
+ }
+ OUString aMime( "text/xml" );
+ xProps->setPropertyValue( OUString("MediaType"), uno::makeAny( aMime ) );
// #87671 Allow encryption
- xProps->setPropertyValue( rtl::OUString("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
+ xProps->setPropertyValue( OUString("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
xOut = xInfoStream->getOutputStream();
}
@@ -2005,15 +2104,17 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
else
{
// Create Output stream
- INetURLObject aLibInfoInetObj( String(maLibraryPath).GetToken(1) );
+ INetURLObject aLibInfoInetObj( maLibraryPath.getToken(1, (sal_Unicode)';') );
aLibInfoInetObj.insertName( maInfoFileName, sal_False, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
- aLibInfoInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlc") ) );
- String aLibInfoPath( aLibInfoInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ aLibInfoInetObj.setExtension( OUString("xlc") );
+ OUString aLibInfoPath( aLibInfoInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
try
{
if( mxSFI->exists( aLibInfoPath ) )
+ {
mxSFI->kill( aLibInfoPath );
+ }
xOut = mxSFI->openFileWrite( aLibInfoPath );
}
catch(const Exception& )
@@ -2031,12 +2132,11 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
return;
}
- Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( xOut );
+ xWriter->setOutputStream( xOut );
try
{
- xmlscript::exportLibraryContainer( xHandler, pLibArray.get() );
+ xmlscript::exportLibraryContainer( xWriter, pLibArray.get() );
if ( bStorage )
{
uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY );
@@ -2044,8 +2144,9 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
!xTransact.is(), "basic",
"The storage must implement XTransactedObject!");
if ( !xTransact.is() )
+ {
throw uno::RuntimeException();
-
+ }
xTransact->commit();
}
}
@@ -2099,7 +2200,7 @@ sal_Bool SfxLibraryContainer::hasByName( const OUString& aName )
// Methods XLibraryContainer
Reference< XNameContainer > SAL_CALL SfxLibraryContainer::createLibrary( const OUString& Name )
- throw(IllegalArgumentException, ElementExistException, RuntimeException)
+ throw(IllegalArgumentException, ElementExistException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
SfxLibrary* pNewLib = implCreateLibrary( Name );
@@ -2118,7 +2219,7 @@ Reference< XNameContainer > SAL_CALL SfxLibraryContainer::createLibrary( const O
Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
( const OUString& Name, const OUString& StorageURL, sal_Bool ReadOnly )
- throw(IllegalArgumentException, ElementExistException, RuntimeException)
+ throw(IllegalArgumentException, ElementExistException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
// TODO: Check other reasons to force ReadOnly status
@@ -2149,9 +2250,9 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
maNameContainer.insertByName( Name, aElement );
maModifiable.setModified( sal_True );
- OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"));
- OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"));
- OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"));
+ OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
+ OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
+ OUString aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
if( StorageURL.indexOf( aUserSearchStr ) != -1 )
{
pNewLib->mbExtension = true;
@@ -2175,8 +2276,9 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name )
aLibAny >>= xNameAccess;
SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() );
if( pImplLib->mbReadOnly && !pImplLib->mbLink )
+ {
throw IllegalArgumentException();
-
+ }
// Remove from container
maNameContainer.removeByName( Name );
maModifiable.setModified( sal_True );
@@ -2185,7 +2287,9 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name )
if( !pImplLib->mbLink )
{
if( mxStorage.is() )
+ {
return;
+ }
if( xNameAccess->hasElements() )
{
Sequence< OUString > aNames = pImplLib->getElementNames();
@@ -2199,18 +2303,20 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name )
// Delete index file
createAppLibraryFolder( pImplLib, Name );
- String aLibInfoPath = pImplLib->maLibInfoFileURL;
+ OUString aLibInfoPath = pImplLib->maLibInfoFileURL;
try
{
if( mxSFI->exists( aLibInfoPath ) )
+ {
mxSFI->kill( aLibInfoPath );
+ }
}
catch(const Exception& ) {}
// Delete folder if empty
- INetURLObject aInetObj( String(maLibraryPath).GetToken(1) );
+ INetURLObject aInetObj( maLibraryPath.getToken(1, (sal_Unicode)';') );
aInetObj.insertName( Name, sal_True, INetURLObject::LAST_SEGMENT,
- sal_True, INetURLObject::ENCODE_ALL );
+ sal_True, INetURLObject::ENCODE_ALL );
OUString aLibDirPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
try
@@ -2220,7 +2326,9 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name )
Sequence< OUString > aContentSeq = mxSFI->getFolderContents( aLibDirPath, true );
sal_Int32 nCount = aContentSeq.getLength();
if( !nCount )
+ {
mxSFI->kill( aLibDirPath );
+ }
}
}
catch(const Exception& )
@@ -2265,14 +2373,17 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
uno::Reference< embed::XStorage > xLibraryStor;
if( bStorage )
{
- try {
+ try
+ {
xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
SAL_WARN_IF(
!xLibrariesStor.is(), "basic",
("The method must either throw exception or return a"
" storage!"));
if ( !xLibrariesStor.is() )
+ {
throw uno::RuntimeException();
+ }
xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
SAL_WARN_IF(
@@ -2280,7 +2391,9 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
("The method must either throw exception or return a"
" storage!"));
if ( !xLibrariesStor.is() )
+ {
throw uno::RuntimeException();
+ }
}
catch(const uno::Exception& )
{
@@ -2311,28 +2424,33 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
uno::Reference< io::XStream > xElementStream;
aFile = aElementName;
- aFile += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
+ aFile += ".xml";
- try {
+ try
+ {
xElementStream = xLibraryStor->openStreamElement( aFile, embed::ElementModes::READ );
- } catch(const uno::Exception& )
+ }
+ catch(const uno::Exception& )
{}
if( !xElementStream.is() )
{
// Check for EA2 document version with wrong extensions
aFile = aElementName;
- aFile += String( RTL_CONSTASCII_USTRINGPARAM(".") );
+ aFile += ".";
aFile += maLibElementFileExtension;
- try {
+ try
+ {
xElementStream = xLibraryStor->openStreamElement( aFile, embed::ElementModes::READ );
- } catch(const uno::Exception& )
+ }
+ catch(const uno::Exception& )
{}
}
if ( xElementStream.is() )
+ {
xInStream = xElementStream->getInputStream();
-
+ }
if ( !xInStream.is() )
{
SAL_WARN(
@@ -2344,28 +2462,30 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
}
else
{
- String aLibDirPath = pImplLib->maStorageURL;
+ OUString aLibDirPath = pImplLib->maStorageURL;
INetURLObject aElementInetObj( aLibDirPath );
aElementInetObj.insertName( aElementName, sal_False,
- INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
aElementInetObj.setExtension( maLibElementFileExtension );
aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
}
Reference< XNameContainer > xLib( pImplLib );
Any aAny = importLibraryElement( xLib, aElementName,
- aFile, xInStream );
+ aFile, xInStream );
if( pImplLib->hasByName( aElementName ) )
{
if( aAny.hasValue() )
+ {
pImplLib->maNameContainer.replaceByName( aElementName, aAny );
+ }
}
else
{
pImplLib->maNameContainer.insertByName( aElementName, aAny );
}
}
-
pImplLib->implSetModified( sal_False );
}
}
@@ -2387,7 +2507,9 @@ OUString SAL_CALL SfxLibraryContainer::getLibraryLinkURL( const OUString& Name )
SfxLibrary* pImplLib = getImplLib( Name );
sal_Bool bLink = pImplLib->mbLink;
if( !bLink )
+ {
throw IllegalArgumentException();
+ }
OUString aRetStr = pImplLib->maLibInfoFileURL;
return aRetStr;
}
@@ -2430,8 +2552,9 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
{
LibraryContainerMethodGuard aGuard( *this );
if( maNameContainer.hasByName( NewName ) )
+ {
throw ElementExistException();
-
+ }
// Get and hold library before removing
Any aLibAny = maNameContainer.getByName( Name ) ;
@@ -2440,7 +2563,9 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
aLibAny >>= xNameAccess;
SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() );
if( pImplLib->mbPasswordProtected && !pImplLib->mbPasswordVerified )
+ {
return; // Lib with unverified password cannot be renamed
+ }
loadLibrary( Name );
// Remove from container
@@ -2458,28 +2583,31 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
OUString aLibDirPath = pImplLib->maStorageURL;
- INetURLObject aDestInetObj( String(maLibraryPath).GetToken(1) );
+ INetURLObject aDestInetObj( maLibraryPath.getToken(1, (sal_Unicode)';'));
aDestInetObj.insertName( NewName, sal_True, INetURLObject::LAST_SEGMENT,
- sal_True, INetURLObject::ENCODE_ALL );
+ sal_True, INetURLObject::ENCODE_ALL );
OUString aDestDirPath = aDestInetObj.GetMainURL( INetURLObject::NO_DECODE );
// Store new URL
OUString aLibInfoFileURL = pImplLib->maLibInfoFileURL;
checkStorageURL( aDestDirPath, pImplLib->maLibInfoFileURL, pImplLib->maStorageURL,
- pImplLib->maUnexpandedStorageURL );
+ pImplLib->maUnexpandedStorageURL );
try
{
if( mxSFI->isFolder( aLibDirPath ) )
{
if( !mxSFI->isFolder( aDestDirPath ) )
+ {
mxSFI->createFolder( aDestDirPath );
-
+ }
// Move index file
try
{
if( mxSFI->exists( pImplLib->maLibInfoFileURL ) )
+ {
mxSFI->kill( pImplLib->maLibInfoFileURL );
+ }
mxSFI->move( aLibInfoFileURL, pImplLib->maLibInfoFileURL );
}
catch(const Exception& )
@@ -2497,18 +2625,21 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
aElementInetObj.insertName( aElementName, sal_False,
INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
aElementInetObj.setExtension( maLibElementFileExtension );
- String aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ OUString aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
INetURLObject aElementDestInetObj( aDestDirPath );
aElementDestInetObj.insertName( aElementName, sal_False,
- INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
aElementDestInetObj.setExtension( maLibElementFileExtension );
- String aDestElementPath( aElementDestInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ OUString aDestElementPath( aElementDestInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
try
{
if( mxSFI->exists( aDestElementPath ) )
+ {
mxSFI->kill( aDestElementPath );
+ }
mxSFI->move( aElementPath, aDestElementPath );
}
catch(const Exception& )
@@ -2522,7 +2653,7 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
sal_Int32 nCount = aContentSeq.getLength();
if( !nCount )
{
- mxSFI->kill( aLibDirPath );
+ mxSFI->kill( aLibDirPath );
}
bMovedSuccessful = true;
@@ -2537,11 +2668,13 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
}
if( bStorage && !pImplLib->mbLink )
+ {
pImplLib->implSetModified( sal_True );
-
+ }
if( bMovedSuccessful )
+ {
maNameContainer.insertByName( NewName, aLibAny ) ;
-
+ }
}
@@ -2571,7 +2704,7 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument
throw IllegalArgumentException();
}
-void SAL_CALL SfxLibraryContainer::initializeFromDocumentURL( const ::rtl::OUString& _rInitialDocumentURL )
+void SAL_CALL SfxLibraryContainer::initializeFromDocumentURL( const OUString& _rInitialDocumentURL )
{
init( _rInitialDocumentURL, NULL );
}
@@ -2583,9 +2716,10 @@ void SAL_CALL SfxLibraryContainer::initializeFromDocument( const Reference< XSto
try
{
Reference< XServiceInfo > xSI( _rxDocument, UNO_QUERY_THROW );
- if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OfficeDocument" ) ) ) )
+ if ( xSI->supportsService( OUString("com.sun.star.document.OfficeDocument")))
+ {
xDocStorage.set( _rxDocument->getDocumentStorage(), UNO_QUERY_THROW );
-
+ }
Reference< XModel > xDocument( _rxDocument, UNO_QUERY_THROW );
Reference< XComponent > xDocComponent( _rxDocument, UNO_QUERY_THROW );
@@ -2595,8 +2729,9 @@ void SAL_CALL SfxLibraryContainer::initializeFromDocument( const Reference< XSto
catch( const Exception& ) { }
if ( !xDocStorage.is() )
+ {
throw IllegalArgumentException();
-
+ }
init( OUString(), xDocStorage );
}
@@ -2639,17 +2774,15 @@ sal_Bool SAL_CALL SfxLibraryContainer::isLibraryPasswordVerified( const OUString
throw IllegalArgumentException();
}
-sal_Bool SAL_CALL SfxLibraryContainer::verifyLibraryPassword
- ( const OUString&, const OUString& )
- throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+sal_Bool SAL_CALL SfxLibraryContainer::verifyLibraryPassword( const OUString&, const OUString& )
+ throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
throw IllegalArgumentException();
}
-void SAL_CALL SfxLibraryContainer::changeLibraryPassword(
- const OUString&, const OUString&, const OUString& )
- throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+void SAL_CALL SfxLibraryContainer::changeLibraryPassword(const OUString&, const OUString&, const OUString& )
+ throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
throw IllegalArgumentException();
@@ -2674,7 +2807,7 @@ void SAL_CALL SfxLibraryContainer::removeContainerListener( const Reference< XCo
// Methods XLibraryContainerExport
void SAL_CALL SfxLibraryContainer::exportLibrary( const OUString& Name, const OUString& URL,
const Reference< XInteractionHandler >& Handler )
- throw ( uno::Exception, NoSuchElementException, RuntimeException)
+ throw ( uno::Exception, NoSuchElementException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
SfxLibrary* pImplLib = getImplLib( Name );
@@ -2691,10 +2824,13 @@ void SAL_CALL SfxLibraryContainer::exportLibrary( const OUString& Name, const OU
uno::Reference< ::com::sun::star::embed::XStorage > xDummyStor;
if( pImplLib->mbPasswordProtected )
+ {
implStorePasswordLibrary( pImplLib, Name, xDummyStor, URL, xToUseSFI, Handler );
+ }
else
+ {
implStoreLibrary( pImplLib, Name, xDummyStor, URL, xToUseSFI, Handler );
-
+ }
::xmlscript::LibDescriptor aLibDesc;
aLibDesc.aName = Name;
aLibDesc.bLink = false; // Link status gets lost?
@@ -2713,15 +2849,14 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
{
if( !mxMacroExpander.is() )
{
- Reference< XComponentContext > xContext(
- comphelper::getComponentContext( mxMSF ) );
+ Reference< XComponentContext > xContext(comphelper::getComponentContext( mxMSF ) );
Reference< util::XMacroExpander > xExpander;
- xContext->getValueByName(
- OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
+ xContext->getValueByName( OUString("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
if(! xExpander.is())
{
throw uno::DeploymentException(
- OUSTR("no macro expander singleton available!"), Reference< XInterface >() );
+ OUString("no macro expander singleton available!"),
+ Reference< XInterface >() );
}
MutexGuard guard( Mutex::getGlobalMutex() );
if( !mxMacroExpander.is() )
@@ -2731,8 +2866,9 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
}
if( !mxMacroExpander.is() )
+ {
return url;
-
+ }
// cut protocol
OUString macro( url.copy( sizeof (EXPAND_PROTOCOL ":") -1 ) );
// decode uric class chars
@@ -2760,14 +2896,16 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
SfxLibrary* pImplLib = getImplLib( Name );
sal_Bool bLink = pImplLib->mbLink;
if( !bLink )
+ {
throw IllegalArgumentException();
+ }
OUString aRetStr = pImplLib->maOriginalStorageURL;
return aRetStr;
}
// XVBACompatibility
-::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException)
+sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException)
{
return mbVBACompat;
}
@@ -2781,13 +2919,15 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
if( BasicManager* pBasMgr = getBasicManager() )
{
// get the standard library
- String aLibName = pBasMgr->GetName();
- if ( aLibName.Len() == 0 )
- aLibName = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-
+ OUString aLibName = pBasMgr->GetName();
+ if ( aLibName.isEmpty())
+ {
+ aLibName = "Standard";
+ }
if( StarBASIC* pBasic = pBasMgr->GetLib( aLibName ) )
+ {
pBasic->SetVBAEnabled( _vbacompatmodeon );
-
+ }
/* If in VBA compatibility mode, force creation of the VBA Globals
object. Each application will create an instance of its own
implementation and store it in its Basic manager. Implementations
@@ -2799,7 +2939,7 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
{
Reference< XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
- xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
+ xFactory->createInstance( OUString( "ooo.vba.VBAGlobals"));
}
catch(const Exception& )
{
@@ -2807,7 +2947,7 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
}
}
-void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _projectname ) throw (RuntimeException)
+void SAL_CALL SfxLibraryContainer::setProjectName( const OUString& _projectname ) throw (RuntimeException)
{
msProjectName = _projectname;
BasicManager* pBasMgr = getBasicManager();
@@ -2816,7 +2956,9 @@ void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _proje
// code expect the name of the VBA project to be set as the name of
// the basic manager. Provide fail back here.
if( pBasMgr )
+ {
pBasMgr->SetName( msProjectName );
+ }
}
sal_Int32 SAL_CALL SfxLibraryContainer::getRunningVBAScripts() throw (RuntimeException)
@@ -2835,17 +2977,17 @@ void SAL_CALL SfxLibraryContainer::removeVBAScriptListener( const Reference< vba
maVBAScriptListeners.removeTypedListener( rxListener );
}
-void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName ) throw (RuntimeException)
+void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifier, const OUString& rModuleName ) throw (RuntimeException)
{
// own lock for accessing the number of running scripts
enterMethod();
switch( nIdentifier )
{
- case vba::VBAScriptEventId::SCRIPT_STARTED:
- ++mnRunningVBAScripts;
+ case vba::VBAScriptEventId::SCRIPT_STARTED:
+ ++mnRunningVBAScripts;
break;
- case vba::VBAScriptEventId::SCRIPT_STOPPED:
- --mnRunningVBAScripts;
+ case vba::VBAScriptEventId::SCRIPT_STOPPED:
+ --mnRunningVBAScripts;
break;
}
leaveMethod();
@@ -2857,15 +2999,19 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie
}
// Methods XServiceInfo
-::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
+sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const OUString& _rServiceName )
throw (RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
const OUString* pSupportedServices = aSupportedServices.getConstArray();
for ( sal_Int32 i=0; i<aSupportedServices.getLength(); ++i, ++pSupportedServices )
+ {
if ( *pSupportedServices == _rServiceName )
+ {
return sal_True;
+ }
+ }
return sal_False;
}
@@ -2924,10 +3070,14 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
void SfxLibrary::implSetModified( sal_Bool _bIsModified )
{
if ( mbIsModified == _bIsModified )
+ {
return;
+ }
mbIsModified = _bIsModified;
if ( mbIsModified )
+ {
mrModifiable.setModified( sal_True );
+ }
}
// Methods XInterface
@@ -2945,7 +3095,9 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType )
static_cast< XElementAccess * >( this ),
static_cast< XChangesNotifier * >( this ) ) );
if( !aRet.hasValue() )
+ {
aRet = OComponentHelper::queryInterface( rType );
+ }
return aRet;
}
@@ -2989,24 +3141,28 @@ sal_Bool SfxLibrary::hasByName( const OUString& aName )
void SfxLibrary::impl_checkReadOnly()
{
if( mbReadOnly || (mbLink && mbReadOnlyLink) )
+ {
throw IllegalArgumentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Library is readonly." ) ),
+ OUString("Library is readonly."),
// TODO: resource
*this, 0
);
+ }
}
void SfxLibrary::impl_checkLoaded()
{
if ( !mbLoaded )
+ {
throw WrappedTargetException(
- ::rtl::OUString(),
+ OUString(),
*this,
makeAny( LibraryNotLoadedException(
- ::rtl::OUString(),
+ OUString(),
*this
) )
);
+ }
}
// Methods XNameReplace
@@ -3040,7 +3196,7 @@ void SfxLibrary::insertByName( const OUString& aName, const Any& aElement )
implSetModified( sal_True );
}
-void SfxLibrary::impl_removeWithoutChecks( const ::rtl::OUString& _rElementName )
+void SfxLibrary::impl_removeWithoutChecks( const OUString& _rElementName )
{
maNameContainer.removeByName( _rElementName );
implSetModified( sal_True );
@@ -3050,14 +3206,17 @@ void SfxLibrary::impl_removeWithoutChecks( const ::rtl::OUString& _rElementName
{
INetURLObject aElementInetObj( maStorageURL );
aElementInetObj.insertName( _rElementName, sal_False,
- INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
aElementInetObj.setExtension( maLibElementFileExtension );
OUString aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
try
{
if( mxSFI->exists( aFile ) )
+ {
mxSFI->kill( aFile );
+ }
}
catch(const Exception& )
{
@@ -3162,9 +3321,9 @@ ScriptExtensionIterator::ScriptExtensionIterator( void )
, m_pScriptSubPackageIterator( NULL )
{}
-rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib )
+OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib )
{
- rtl::OUString aRetLib;
+ OUString aRetLib;
while( aRetLib.isEmpty() && m_eState != END_REACHED )
{
@@ -3175,8 +3334,9 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
Reference< deployment::XPackage > xScriptPackage =
implGetNextUserScriptPackage( rbPureDialogLib );
if( !xScriptPackage.is() )
+ {
break;
-
+ }
aRetLib = xScriptPackage->getURL();
break;
}
@@ -3186,8 +3346,9 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
Reference< deployment::XPackage > xScriptPackage =
implGetNextSharedScriptPackage( rbPureDialogLib );
if( !xScriptPackage.is() )
+ {
break;
-
+ }
aRetLib = xScriptPackage->getURL();
break;
}
@@ -3196,8 +3357,9 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
Reference< deployment::XPackage > xScriptPackage =
implGetNextBundledScriptPackage( rbPureDialogLib );
if( !xScriptPackage.is() )
+ {
break;
-
+ }
aRetLib = xScriptPackage->getURL();
break;
}
@@ -3222,8 +3384,9 @@ ScriptSubPackageIterator::ScriptSubPackageIterator( Reference< deployment::XPack
{
Reference< deployment::XPackage > xScriptPackage;
if( !m_xMainPackage.is() )
+ {
return;
-
+ }
// Check if parent package is registered
beans::Optional< beans::Ambiguous<sal_Bool> > option( m_xMainPackage->isRegistered
( Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>() ) );
@@ -3232,7 +3395,9 @@ ScriptSubPackageIterator::ScriptSubPackageIterator( Reference< deployment::XPack
{
beans::Ambiguous<sal_Bool> const & reg = option.Value;
if( !reg.IsAmbiguous && reg.Value )
+ {
bRegistered = true;
+ }
}
if( bRegistered )
{
@@ -3240,22 +3405,22 @@ ScriptSubPackageIterator::ScriptSubPackageIterator( Reference< deployment::XPack
if( m_xMainPackage->isBundle() )
{
m_bIsBundle = true;
- m_aSubPkgSeq = m_xMainPackage->getBundle
- ( Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>() );
+ m_aSubPkgSeq = m_xMainPackage->getBundle( Reference<task::XAbortChannel>(),
+ Reference<ucb::XCommandEnvironment>() );
m_nSubPkgCount = m_aSubPkgSeq.getLength();
}
}
}
-Reference< deployment::XPackage > ScriptSubPackageIterator::getNextScriptSubPackage
- ( bool& rbPureDialogLib )
+Reference< deployment::XPackage > ScriptSubPackageIterator::getNextScriptSubPackage( bool& rbPureDialogLib )
{
rbPureDialogLib = false;
Reference< deployment::XPackage > xScriptPackage;
if( !m_bIsValid )
+ {
return xScriptPackage;
-
+ }
if( m_bIsBundle )
{
const Reference< deployment::XPackage >* pSeq = m_aSubPkgSeq.getConstArray();
@@ -3265,7 +3430,9 @@ Reference< deployment::XPackage > ScriptSubPackageIterator::getNextScriptSubPack
const Reference< deployment::XPackage > xSubPkg = pSeq[ iPkg ];
xScriptPackage = implDetectScriptPackage( xSubPkg, rbPureDialogLib );
if( xScriptPackage.is() )
+ {
break;
+ }
}
m_iNextSubPkg = iPkg + 1;
}
@@ -3278,15 +3445,15 @@ Reference< deployment::XPackage > ScriptSubPackageIterator::getNextScriptSubPack
return xScriptPackage;
}
-Reference< deployment::XPackage > ScriptSubPackageIterator::implDetectScriptPackage
- ( const Reference< deployment::XPackage > xPackage, bool& rbPureDialogLib )
+Reference< deployment::XPackage > ScriptSubPackageIterator::implDetectScriptPackage ( const Reference< deployment::XPackage > xPackage,
+ bool& rbPureDialogLib )
{
Reference< deployment::XPackage > xScriptPackage;
if( xPackage.is() )
{
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType();
- rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
+ OUString aMediaType = xPackageTypeInfo->getMediaType();
if ( aMediaType == sBasicLibMediaType )
{
xScriptPackage = xPackage;
@@ -3301,8 +3468,7 @@ Reference< deployment::XPackage > ScriptSubPackageIterator::implDetectScriptPack
return xScriptPackage;
}
-Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScriptPackage
- ( bool& rbPureDialogLib )
+Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScriptPackage( bool& rbPureDialogLib )
{
Reference< deployment::XPackage > xScriptPackage;
@@ -3310,11 +3476,10 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
{
try
{
- Reference< XExtensionManager > xManager =
- ExtensionManager::get( m_xContext );
- m_aUserPackagesSeq = xManager->getDeployedExtensions
- (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")),
- Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ Reference< XExtensionManager > xManager = ExtensionManager::get( m_xContext );
+ m_aUserPackagesSeq = xManager->getDeployedExtensions(OUString("user"),
+ Reference< task::XAbortChannel >(),
+ Reference< ucb::XCommandEnvironment >() );
}
catch(const com::sun::star::uno::DeploymentException& )
{
@@ -3358,8 +3523,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
return xScriptPackage;
}
-Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScriptPackage
- ( bool& rbPureDialogLib )
+Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScriptPackage( bool& rbPureDialogLib )
{
Reference< deployment::XPackage > xScriptPackage;
@@ -3367,11 +3531,10 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
{
try
{
- Reference< XExtensionManager > xSharedManager =
- ExtensionManager::get( m_xContext );
- m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions
- (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")),
- Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ Reference< XExtensionManager > xSharedManager = ExtensionManager::get( m_xContext );
+ m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions(OUString("shared"),
+ Reference< task::XAbortChannel >(),
+ Reference< ucb::XCommandEnvironment >() );
}
catch(const com::sun::star::uno::DeploymentException& )
{
@@ -3414,8 +3577,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
return xScriptPackage;
}
-Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScriptPackage
- ( bool& rbPureDialogLib )
+Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScriptPackage( bool& rbPureDialogLib )
{
Reference< deployment::XPackage > xScriptPackage;
@@ -3423,11 +3585,10 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
{
try
{
- Reference< XExtensionManager > xManager =
- ExtensionManager::get( m_xContext );
- m_aBundledPackagesSeq = xManager->getDeployedExtensions
- (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")),
- Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ Reference< XExtensionManager > xManager = ExtensionManager::get( m_xContext );
+ m_aBundledPackagesSeq = xManager->getDeployedExtensions(OUString("bundled"),
+ Reference< task::XAbortChannel >(),
+ Reference< ucb::XCommandEnvironment >() );
}
catch(const com::sun::star::uno::DeploymentException& )
{
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index bbc8509d23c2..00ffe7893b94 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
@@ -72,8 +73,6 @@ using namespace com::sun::star;
using namespace cppu;
using namespace osl;
-using ::rtl::OUString;
-
//============================================================================
// Implementation class SfxScriptLibraryContainer
@@ -83,13 +82,12 @@ const sal_Char* SAL_CALL SfxScriptLibraryContainer::getLibElementFileExtension()
const sal_Char* SAL_CALL SfxScriptLibraryContainer::getLibrariesDir() const { return "Basic"; }
// OldBasicPassword interface
-void SfxScriptLibraryContainer::setLibraryPassword
- ( const String& rLibraryName, const String& rPassword )
+void SfxScriptLibraryContainer::setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword )
{
try
{
SfxLibrary* pImplLib = getImplLib( rLibraryName );
- if( rPassword.Len() )
+ if( !rPassword.isEmpty() )
{
pImplLib->mbDoc50Password = true;
pImplLib->mbPasswordProtected = sal_True;
@@ -99,16 +97,18 @@ void SfxScriptLibraryContainer::setLibraryPassword
catch(const NoSuchElementException& ) {}
}
-String SfxScriptLibraryContainer::getLibraryPassword( const String& rLibraryName )
+OUString SfxScriptLibraryContainer::getLibraryPassword( const OUString& rLibraryName )
{
SfxLibrary* pImplLib = getImplLib( rLibraryName );
- String aPassword;
+ OUString aPassword;
if( pImplLib->mbPasswordVerified )
+ {
aPassword = pImplLib->maPassword;
+ }
return aPassword;
}
-void SfxScriptLibraryContainer::clearLibraryPassword( const String& rLibraryName )
+void SfxScriptLibraryContainer::clearLibraryPassword( const OUString& rLibraryName )
{
try
{
@@ -120,7 +120,7 @@ void SfxScriptLibraryContainer::clearLibraryPassword( const String& rLibraryName
catch(const NoSuchElementException& ) {}
}
-sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryName )
+sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const OUString& rLibraryName )
{
SfxLibrary* pImplLib = getImplLib( rLibraryName );
return pImplLib->mbPasswordProtected;
@@ -148,14 +148,14 @@ SfxLibrary* SfxScriptLibraryContainer::implCreateLibrary( const OUString& aName
return pRet;
}
-SfxLibrary* SfxScriptLibraryContainer::implCreateLibraryLink
- ( const OUString& aName, const OUString& aLibInfoFileURL,
- const OUString& StorageURL, sal_Bool ReadOnly )
+SfxLibrary* SfxScriptLibraryContainer::implCreateLibraryLink( const OUString& aName,
+ const OUString& aLibInfoFileURL,
+ const OUString& StorageURL,
+ sal_Bool ReadOnly )
{
(void)aName; // Only needed for SfxDialogLibrary
- SfxLibrary* pRet =
- new SfxScriptLibrary
- ( maModifiable, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly );
+ SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxMSF, mxSFI,
+ aLibInfoFileURL, StorageURL, ReadOnly );
return pRet;
}
@@ -172,31 +172,21 @@ bool SAL_CALL SfxScriptLibraryContainer::isLibraryElementValid( Any aElement ) c
return SfxScriptLibrary::containsValidModule( aElement );
}
-void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
-(
- const Reference < XNameContainer >& xLib,
- const OUString& aElementName,
- const Reference< XOutputStream >& xOutput
-)
+void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement( const Reference < XNameContainer >& xLib,
+ const OUString& aElementName,
+ const Reference< XOutputStream >& xOutput)
throw(Exception)
{
// Create sax writer
- Reference< XExtendedDocumentHandler > xHandler(
- mxMSF->createInstance(
- OUString( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
- if( !xHandler.is() )
- {
- OSL_FAIL( "### couldn't create sax-writer component\n" );
- return;
- }
+ Reference< XWriter > xWriter = xml::sax::Writer::create(comphelper::getComponentContext(mxMSF));
Reference< XTruncate > xTruncate( xOutput, UNO_QUERY );
OSL_ENSURE( xTruncate.is(), "Currently only the streams that can be truncated are expected!" );
if ( xTruncate.is() )
+ {
xTruncate->truncate();
-
- Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( xOutput );
+ }
+ xWriter->setOutputStream( xOutput );
xmlscript::ModuleDescriptor aMod;
aMod.aName = aElementName;
@@ -211,16 +201,16 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
switch( aModInfo.ModuleType )
{
case ModuleType::NORMAL:
- aMod.aModuleType = OUString( "normal" );
+ aMod.aModuleType = "normal";
break;
case ModuleType::CLASS:
- aMod.aModuleType = OUString( "class" );
+ aMod.aModuleType ="class";
break;
case ModuleType::FORM:
- aMod.aModuleType = OUString( "form" );
+ aMod.aModuleType = "form";
break;
case ModuleType::DOCUMENT:
- aMod.aModuleType = OUString( "document" );
+ aMod.aModuleType = "document";
break;
case ModuleType::UNKNOWN:
// nothing
@@ -228,7 +218,7 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
}
}
- xmlscript::exportScriptModule( xHandler, aMod );
+ xmlscript::exportScriptModule( xWriter, aMod );
}
@@ -303,7 +293,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
{
Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
- xFactory->createInstance( ::rtl::OUString( "ooo.vba.VBAGlobals" ) );
+ xFactory->createInstance( OUString( "ooo.vba.VBAGlobals" ) );
}
catch(const Exception& )
{
@@ -354,7 +344,9 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
if( xVBAModuleInfo.is() )
{
if( xVBAModuleInfo->hasModuleInfo( aElementName ) )
+ {
xVBAModuleInfo->removeModuleInfo( aElementName );
+ }
xVBAModuleInfo->insertModuleInfo( aElementName, aModInfo );
}
}
@@ -403,7 +395,9 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::isLibraryPasswordVerified( const OU
LibraryContainerMethodGuard aGuard( *this );
SfxLibrary* pImplLib = getImplLib( Name );
if( !pImplLib->mbPasswordProtected )
+ {
throw IllegalArgumentException();
+ }
sal_Bool bRet = pImplLib->mbPasswordVerified;
return bRet;
}
@@ -415,15 +409,18 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::verifyLibraryPassword
LibraryContainerMethodGuard aGuard( *this );
SfxLibrary* pImplLib = getImplLib( Name );
if( !pImplLib->mbPasswordProtected || pImplLib->mbPasswordVerified )
+ {
throw IllegalArgumentException();
-
+ }
// Test password
sal_Bool bSuccess = sal_False;
if( pImplLib->mbDoc50Password )
{
bSuccess = ( Password == pImplLib->maPassword );
if( bSuccess )
+ {
pImplLib->mbPasswordVerified = sal_True;
+ }
}
else
{
@@ -439,28 +436,33 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::verifyLibraryPassword
// Reload library to get source
if( pImplLib->mbLoaded )
+ {
implLoadPasswordLibrary( pImplLib, Name );
+ }
}
}
return bSuccess;
}
void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString& Name,
- const OUString& OldPassword, const OUString& NewPassword )
+ const OUString& OldPassword,
+ const OUString& NewPassword )
throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
SfxLibrary* pImplLib = getImplLib( Name );
if( OldPassword == NewPassword )
+ {
return;
-
+ }
sal_Bool bOldPassword = !OldPassword.isEmpty();
sal_Bool bNewPassword = !NewPassword.isEmpty();
sal_Bool bStorage = mxStorage.is() && !pImplLib->mbLink;
if( pImplLib->mbReadOnly || (bOldPassword && !pImplLib->mbPasswordProtected) )
+ {
throw IllegalArgumentException();
-
+ }
// Library must be loaded
loadLibrary( Name );
@@ -473,13 +475,16 @@ void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString&
if( isLibraryPasswordVerified( Name ) )
{
if( pImplLib->maPassword != OldPassword )
+ {
throw IllegalArgumentException();
+ }
}
else
{
if( !verifyLibraryPassword( Name, OldPassword ) )
+ {
throw IllegalArgumentException();
-
+ }
// Reload library to get source
// Should be done in verifyLibraryPassword loadLibrary( Name );
}
@@ -536,15 +541,22 @@ void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString&
INetURLObject aElementInetObj( aLibDirPath );
aElementInetObj.insertName( aElementName, sal_False,
- INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
if( bKillUncryptedFiles )
+ {
aElementInetObj.setExtension( maLibElementFileExtension );
+ }
else
+ {
aElementInetObj.setExtension( OUString( "pba" ) );
- String aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+ OUString aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
if( mxSFI->exists( aElementPath ) )
+ {
mxSFI->kill( aElementPath );
+ }
}
}
catch(const Exception& ) {}
@@ -556,13 +568,17 @@ void setStreamKey( uno::Reference< io::XStream > xStream, const ::rtl::OUString&
{
uno::Reference< embed::XEncryptionProtectedSource > xEncrStream( xStream, uno::UNO_QUERY );
if ( xEncrStream.is() )
+ {
xEncrStream->setEncryptionPassword( aPass );
+ }
}
// Impl methods
sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
- const ::rtl::OUString& aName, const uno::Reference< embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
+ const ::rtl::OUString& aName,
+ const uno::Reference< embed::XStorage >& xStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
{
OUString aDummyLocation;
Reference< XSimpleFileAccess2 > xDummySFA;
@@ -570,16 +586,19 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
}
sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL, const Reference< XSimpleFileAccess2 > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::rtl::OUString& aTargetURL,
+ const Reference< XSimpleFileAccess2 > xToUseSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
{
bool bExport = !aTargetURL.isEmpty();
BasicManager* pBasicMgr = getBasicManager();
OSL_ENSURE( pBasicMgr, "SfxScriptLibraryContainer::implStorePasswordLibrary: cannot do this without a BasicManager!" );
if ( !pBasicMgr )
+ {
return sal_False;
-
+ }
// Only need to handle the export case here,
// save/saveas etc are handled in sfxbasemodel::storeSelf &
// sfxbasemodel::impl_store
@@ -592,14 +611,17 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
uno::Reference< task::XInteractionRequest > xReq( pReq );
xHandler->handle( xReq );
if ( pReq->isAbort() )
+ {
throw util::VetoException();
+ }
}
}
StarBASIC* pBasicLib = pBasicMgr->GetLib( aName );
if( !pBasicLib )
+ {
return sal_False;
-
+ }
Sequence< OUString > aElementNames = pLib->getElementNames();
sal_Int32 nNameCount = aElementNames.getLength();
const OUString* pNames = aElementNames.getConstArray();
@@ -617,16 +639,18 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
if( pMod )
{
OUString aCodeStreamName = aElementName;
- aCodeStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".bin") );
+ aCodeStreamName += ".bin";
- try {
+ try
+ {
uno::Reference< io::XStream > xCodeStream = xStorage->openStreamElement(
- aCodeStreamName,
- embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+ aCodeStreamName,
+ embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
if ( !xCodeStream.is() )
+ {
throw uno::RuntimeException();
-
+ }
SvMemoryStream aMemStream;
/*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream );
@@ -637,9 +661,10 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
Reference< XOutputStream > xOut = xCodeStream->getOutputStream();
if ( !xOut.is() )
+ {
throw io::IOException(); // access denied because the stream is readonly
-
- xOut->writeBytes( aBinSeq );
+ }
+ xOut->writeBytes( aBinSeq );
xOut->closeOutput();
}
catch(const uno::Exception& )
@@ -652,27 +677,29 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
{
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
- #if OSL_DEBUG_LEVEL > 0
+ #if OSL_DEBUG_LEVEL > 0
::rtl::OStringBuffer aMessage;
aMessage.append( "invalid library element '" );
aMessage.append( ::rtl::OUStringToOString( aElementName, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
OSL_FAIL( aMessage.makeStringAndClear().getStr() );
- #endif
+ #endif
continue;
}
OUString aSourceStreamName = aElementName;
- aSourceStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
+ aSourceStreamName += ".xml";
- try {
+ try
+ {
uno::Reference< io::XStream > xSourceStream = xStorage->openStreamElement(
- aSourceStreamName,
- embed::ElementModes::READWRITE );
+ aSourceStreamName,
+ embed::ElementModes::READWRITE );
uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY );
if ( !xProps.is() )
+ {
throw uno::RuntimeException();
-
+ }
OUString aMime( "text/xml" );
xProps->setPropertyValue( rtl::OUString("MediaType"), uno::makeAny( aMime ) );
@@ -705,17 +732,21 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
{
Reference< XSimpleFileAccess2 > xSFI = mxSFI;
if( xToUseSFI.is() )
+ {
xSFI = xToUseSFI;
-
+ }
OUString aLibDirPath;
if( bExport )
{
INetURLObject aInetObj( aTargetURL );
- aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
aLibDirPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( !xSFI->isFolder( aLibDirPath ) )
+ {
xSFI->createFolder( aLibDirPath );
+ }
}
else
{
@@ -728,31 +759,33 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
INetURLObject aElementInetObj( aLibDirPath );
aElementInetObj.insertName( aElementName, sal_False,
- INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, sal_True,
+ INetURLObject::ENCODE_ALL );
aElementInetObj.setExtension( OUString( "pba" ) );
- String aElementPath = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aElementPath = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
- #if OSL_DEBUG_LEVEL > 0
+ #if OSL_DEBUG_LEVEL > 0
::rtl::OStringBuffer aMessage;
aMessage.append( "invalid library element '" );
aMessage.append( ::rtl::OUStringToOString( aElementName, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
OSL_FAIL( aMessage.makeStringAndClear().getStr() );
- #endif
+ #endif
continue;
}
try
{
uno::Reference< embed::XStorage > xElementRootStorage =
- ::comphelper::OStorageHelper::GetStorageFromURL(
- aElementPath,
- embed::ElementModes::READWRITE );
+ ::comphelper::OStorageHelper::GetStorageFromURL(
+ aElementPath,
+ embed::ElementModes::READWRITE );
if ( !xElementRootStorage.is() )
+ {
throw uno::RuntimeException();
-
+ }
// Write binary image stream
SbModule* pMod = pBasicLib->FindModule( aElementName );
if( pMod )
@@ -794,20 +827,24 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
OSL_ENSURE( xEncr.is(),
"StorageStream opened for writing must implement XEncryptionProtectedSource!\n" );
if ( !xEncr.is() )
+ {
throw uno::RuntimeException();
+ }
xEncr->setEncryptionPassword( pLib->maPassword );
}
catch(const ::com::sun::star::packages::WrongPasswordException& )
{
xSourceStream = xElementRootStorage->openEncryptedStreamElement(
- aSourceStreamName,
- embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,
- pLib->maPassword );
+ aSourceStreamName,
+ embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,
+ pLib->maPassword );
}
uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY );
if ( !xProps.is() )
+ {
throw uno::RuntimeException();
+ }
OUString aMime( "text/xml" );
xProps->setPropertyValue( rtl::OUString("MediaType"), uno::makeAny( aMime ) );
@@ -820,7 +857,9 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
uno::Reference< embed::XTransactedObject > xTransact( xElementRootStorage, uno::UNO_QUERY );
OSL_ENSURE( xTransact.is(), "The storage must implement XTransactedObject!\n" );
if ( !xTransact.is() )
+ {
throw uno::RuntimeException();
+ }
xTransact->commit();
}
@@ -853,7 +892,9 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
{
if( pScriptLib->mbLoadedBinary && !bVerifyPasswordOnly &&
(pScriptLib->mbLoadedSource || !pLib->mbPasswordVerified) )
- return sal_False;
+ {
+ return sal_False;
+ }
}
StarBASIC* pBasicLib = NULL;
@@ -867,8 +908,9 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
pBasicLib = pBasicMgr ? pBasicMgr->GetLib( Name ) : NULL;
pScriptLib->mbLoaded = bLoaded; // Restore flag
if( !pBasicLib )
+ {
return sal_False;
-
+ }
bLoadBinary = sal_True;
pScriptLib->mbLoadedBinary = true;
}
@@ -893,11 +935,14 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
try {
xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
if ( !xLibrariesStor.is() )
+ {
throw uno::RuntimeException();
-
+ }
xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
if ( !xLibraryStor.is() )
+ {
throw uno::RuntimeException();
+ }
}
catch(const uno::Exception& )
{
@@ -921,15 +966,17 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
}
OUString aCodeStreamName= aElementName;
- aCodeStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".bin") );
+ aCodeStreamName += ".bin";
- try {
+ try
+ {
uno::Reference< io::XStream > xCodeStream = xLibraryStor->openStreamElement(
aCodeStreamName,
embed::ElementModes::READ );
if ( !xCodeStream.is() )
+ {
throw uno::RuntimeException();
-
+ }
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xCodeStream );
if ( !pStream || pStream->GetError() )
{
@@ -954,31 +1001,36 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
{
// Access encrypted source stream
OUString aSourceStreamName = aElementName;
- aSourceStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
+ aSourceStreamName += ".xml";
- try {
+ try
+ {
uno::Reference< io::XStream > xSourceStream = xLibraryStor->openEncryptedStreamElement(
aSourceStreamName,
embed::ElementModes::READ,
pLib->maPassword );
if ( !xSourceStream.is() )
+ {
throw uno::RuntimeException();
-
+ }
// if this point is reached then the password is correct
if ( !bVerifyPasswordOnly )
{
uno::Reference< io::XInputStream > xInStream = xSourceStream->getInputStream();
if ( !xInStream.is() )
+ {
throw io::IOException(); // read access denied, seems to be impossible
-
+ }
Reference< XNameContainer > xLib( pLib );
Any aAny = importLibraryElement( xLib,
- aElementName, aSourceStreamName,
- xInStream );
+ aElementName, aSourceStreamName,
+ xInStream );
if( pLib->hasByName( aElementName ) )
{
if( aAny.hasValue() )
+ {
pLib->maNameContainer.replaceByName( aElementName, aAny );
+ }
}
else
{
@@ -1007,13 +1059,14 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
aElementInetObj.insertName( aElementName, sal_False,
INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
aElementInetObj.setExtension( OUString( "pba" ) );
- String aElementPath = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aElementPath = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
uno::Reference< embed::XStorage > xElementRootStorage;
- try {
+ try
+ {
xElementRootStorage = ::comphelper::OStorageHelper::GetStorageFromURL(
- aElementPath,
- embed::ElementModes::READ );
+ aElementPath,
+ embed::ElementModes::READ );
} catch(const uno::Exception& )
{
// TODO: error handling
@@ -1031,7 +1084,8 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
pBasicLib->SetModified( sal_False );
}
- try {
+ try
+ {
OUString aCodeStreamName( "code.bin" );
uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement(
aCodeStreamName,
@@ -1063,29 +1117,34 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
{
// Access encrypted source stream
OUString aSourceStreamName( "source.xml" );
- try {
+ try
+ {
uno::Reference< io::XStream > xSourceStream = xElementRootStorage->openEncryptedStreamElement(
aSourceStreamName,
embed::ElementModes::READ,
pLib->maPassword );
if ( !xSourceStream.is() )
+ {
throw uno::RuntimeException();
-
+ }
if ( !bVerifyPasswordOnly )
{
uno::Reference< io::XInputStream > xInStream = xSourceStream->getInputStream();
if ( !xInStream.is() )
+ {
throw io::IOException(); // read access denied, seems to be impossible
-
+ }
Reference< XNameContainer > xLib( pLib );
Any aAny = importLibraryElement( xLib,
- aElementName,
- aSourceStreamName,
- xInStream );
+ aElementName,
+ aSourceStreamName,
+ xInStream );
if( pLib->hasByName( aElementName ) )
{
if( aAny.hasValue() )
+ {
pLib->maNameContainer.replaceByName( aElementName, aAny );
+ }
}
else
{
@@ -1100,7 +1159,6 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
}
}
}
-
}
catch(const Exception& )
{
@@ -1117,13 +1175,15 @@ void SfxScriptLibraryContainer::onNewRootStorage()
{
}
-sal_Bool SAL_CALL
-SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
+sal_Bool SAL_CALL SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library )
+ throw (uno::RuntimeException)
{
BasicManager* pBasicMgr = getBasicManager();
OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
if ( pBasicMgr )
+ {
return pBasicMgr->HasExeCode( Library ); // need to change this to take name
+ }
// default to it has code if we can't decide
return sal_True;
}
@@ -1135,12 +1195,14 @@ void createRegistryInfo_SfxScriptLibraryContainer()
static OAutoRegistration< SfxScriptLibraryContainer > aAutoRegistration;
}
-::rtl::OUString SAL_CALL SfxScriptLibraryContainer::getImplementationName( ) throw (RuntimeException)
+OUString SAL_CALL SfxScriptLibraryContainer::getImplementationName( )
+ throw (RuntimeException)
{
return getImplementationName_static();
}
-Sequence< ::rtl::OUString > SAL_CALL SfxScriptLibraryContainer::getSupportedServiceNames( ) throw (RuntimeException)
+Sequence< OUString > SAL_CALL SfxScriptLibraryContainer::getSupportedServiceNames( )
+ throw (RuntimeException)
{
return getSupportedServiceNames_static();
}
@@ -1159,12 +1221,10 @@ OUString SfxScriptLibraryContainer::getImplementationName_static()
return OUString("com.sun.star.comp.sfx2.ScriptLibraryContainer" );
}
-Reference< XInterface > SAL_CALL SfxScriptLibraryContainer::Create
- ( const Reference< XComponentContext >& )
- throw( Exception )
+Reference< XInterface > SAL_CALL SfxScriptLibraryContainer::Create( const Reference< XComponentContext >& )
+ throw( Exception )
{
- Reference< XInterface > xRet =
- static_cast< XInterface* >( static_cast< OWeakObject* >(new SfxScriptLibraryContainer()) );
+ Reference< XInterface > xRet = static_cast< XInterface* >( static_cast< OWeakObject* >(new SfxScriptLibraryContainer()) );
return xRet;
}
@@ -1241,38 +1301,47 @@ bool SAL_CALL SfxScriptLibrary::isLibraryElementValid( ::com::sun::star::uno::An
IMPLEMENT_FORWARD_XINTERFACE2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
IMPLEMENT_FORWARD_XTYPEPROVIDER2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
-script::ModuleInfo SAL_CALL
-SfxScriptLibrary::getModuleInfo( const ::rtl::OUString& ModuleName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+script::ModuleInfo SAL_CALL SfxScriptLibrary::getModuleInfo( const OUString& ModuleName )
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
if ( !hasModuleInfo( ModuleName ) )
+ {
throw NoSuchElementException();
+ }
return mModuleInfos[ ModuleName ];
}
-sal_Bool SAL_CALL
-SfxScriptLibrary::hasModuleInfo( const ::rtl::OUString& ModuleName ) throw (RuntimeException)
+sal_Bool SAL_CALL SfxScriptLibrary::hasModuleInfo( const OUString& ModuleName )
+ throw (RuntimeException)
{
sal_Bool bRes = sal_False;
ModuleInfoMap::iterator it = mModuleInfos.find( ModuleName );
if ( it != mModuleInfos.end() )
+ {
bRes = sal_True;
-
+ }
return bRes;
}
-void SAL_CALL SfxScriptLibrary::insertModuleInfo( const ::rtl::OUString& ModuleName, const script::ModuleInfo& ModuleInfo ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void SAL_CALL SfxScriptLibrary::insertModuleInfo( const OUString& ModuleName, const script::ModuleInfo& ModuleInfo )
+ throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
if ( hasModuleInfo( ModuleName ) )
+ {
throw ElementExistException();
+ }
mModuleInfos[ ModuleName ] = ModuleInfo;
}
-void SAL_CALL SfxScriptLibrary::removeModuleInfo( const ::rtl::OUString& ModuleName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL SfxScriptLibrary::removeModuleInfo( const OUString& ModuleName )
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
// #FIXME add NoSuchElementException to the spec
if ( !hasModuleInfo( ModuleName ) )
+ {
throw NoSuchElementException();
+ }
mModuleInfos.erase( mModuleInfos.find( ModuleName ) );
}