summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-08-30 14:10:40 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-08-30 14:10:40 +0200
commit152a5a2bdc7e3908eaa14e8f232649c98929a9b8 (patch)
treefcc21e3525b08b6828bfa8b65570d69d63b14b9f
parenta1ca8de0bfb86a277c5526c9b0fa642faa9133b9 (diff)
parentfaf3732ff2f34712f6e974aa46f132cd734d22a5 (diff)
dba33h: merge after pulling OOO330.m6
-rw-r--r--basic/inc/basic/sbmod.hxx4
-rw-r--r--basic/inc/basic/sbxvar.hxx12
-rwxr-xr-xbasic/source/classes/sb.cxx130
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx23
-rw-r--r--basic/source/comp/codegen.cxx12
-rw-r--r--basic/source/comp/dim.cxx70
-rw-r--r--basic/source/comp/exprgen.cxx73
-rw-r--r--basic/source/comp/exprtree.cxx10
-rw-r--r--basic/source/comp/makefile.mk33
-rwxr-xr-xbasic/source/comp/sbcomp.cxx2
-rw-r--r--basic/source/inc/expr.hxx3
-rw-r--r--basic/source/inc/parser.hxx5
-rw-r--r--basic/source/inc/sbintern.hxx6
-rw-r--r--basic/source/inc/sbunoobj.hxx1
-rw-r--r--basic/source/inc/symtbl.hxx3
-rw-r--r--basic/source/runtime/methods1.cxx14
-rw-r--r--basic/source/runtime/step0.cxx229
-rw-r--r--basic/source/sbx/sbxbool.cxx18
-rw-r--r--basic/source/sbx/sbxbyte.cxx10
-rw-r--r--basic/source/sbx/sbxchar.cxx15
-rw-r--r--basic/source/sbx/sbxconv.hxx16
-rw-r--r--basic/source/sbx/sbxcurr.cxx26
-rw-r--r--basic/source/sbx/sbxdate.cxx12
-rw-r--r--basic/source/sbx/sbxdbl.cxx10
-rw-r--r--basic/source/sbx/sbxdec.cxx20
-rw-r--r--basic/source/sbx/sbxdec.hxx4
-rw-r--r--basic/source/sbx/sbxint.cxx38
-rw-r--r--basic/source/sbx/sbxlng.cxx10
-rw-r--r--basic/source/sbx/sbxres.cxx2
-rw-r--r--basic/source/sbx/sbxres.hxx2
-rw-r--r--basic/source/sbx/sbxscan.cxx37
-rw-r--r--basic/source/sbx/sbxsng.cxx10
-rw-r--r--basic/source/sbx/sbxstr.cxx50
-rw-r--r--basic/source/sbx/sbxuint.cxx10
-rw-r--r--basic/source/sbx/sbxulng.cxx10
-rw-r--r--basic/source/sbx/sbxvalue.cxx105
-rw-r--r--basic/source/sbx/sbxvar.cxx40
-rw-r--r--configmgr/source/xcsparser.cxx10
-rw-r--r--desktop/inc/app.hxx3
-rw-r--r--desktop/source/app/app.cxx20
-rw-r--r--desktop/source/app/appfirststart.cxx102
-rw-r--r--desktop/win32/source/officeloader/officeloader.cxx1
-rw-r--r--editeng/source/editeng/eehtml.cxx12
-rwxr-xr-xediteng/source/editeng/impedit.hxx3
-rwxr-xr-xediteng/source/editeng/impedit4.cxx369
-rw-r--r--editeng/source/misc/svxacorr.cxx24
-rw-r--r--framework/source/loadenv/loadenv.cxx3
-rw-r--r--officecfg/registry/schema/org/openoffice/Setup.xcs9
-rw-r--r--oovbaapi/ooo/vba/excel/XGlobals.idl7
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl6
-rw-r--r--scripting/source/basprov/basmodnode.cxx14
-rw-r--r--scripting/source/basprov/basprov.cxx2
-rw-r--r--sfx2/inc/sfx2/docfile.hxx1
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx25
-rw-r--r--sfx2/source/doc/docfile.cxx47
-rw-r--r--sfx2/source/doc/doctemplates.cxx2
-rwxr-xr-xsfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx3
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx7
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx47
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx24
62 files changed, 1183 insertions, 637 deletions
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index 15afc1f40f..ae52ca4046 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -44,6 +44,7 @@ class SbProcedureProperty;
class SbIfaceMapperMethod;
class SbClassModuleObject;
+struct ClassModuleRunInitItem;
struct SbClassData;
class SbModuleImpl;
@@ -71,6 +72,7 @@ protected:
SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
bool bIsProxyModule;
+ static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem );
void StartDefinitions();
SbMethod* GetMethod( const String&, SbxDataType );
SbProperty* GetProperty( const String&, SbxDataType );
@@ -134,7 +136,7 @@ public:
void SetVBACompat( BOOL bCompat );
INT32 GetModuleType() { return mnType; }
void SetModuleType( INT32 nType ) { mnType = nType; }
- bool GetIsProxyModule() { return bIsProxyModule; }
+ bool isProxyModule() { return bIsProxyModule; }
void AddVarName( const String& aName );
void RemoveVars();
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index 0e44b07079..7988c95399 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -178,7 +178,7 @@ struct SbxValues
sal_uInt64 uInt64;
int nInt;
unsigned int nUInt;
- String* pString;
+ ::rtl::OUString* pOUString;
SbxDecimal* pDecimal;
SbxBase* pObj;
@@ -212,7 +212,7 @@ struct SbxValues
SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
- SbxValues( const String* _pString ): pString( (String*) _pString ), eType(SbxSTRING) {}
+ SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::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) {}
@@ -237,7 +237,8 @@ class SbxValue : public SbxBase
SbxValue* TheRealValue() const;
protected:
SbxValues aData; // Data
- String aPic; // Picture-String
+ ::rtl::OUString aPic; // Picture-String
+ String aToolString; // tool string copy
virtual void Broadcast( ULONG ); // Broadcast-Call
virtual ~SbxValue();
@@ -303,6 +304,7 @@ public:
UINT16 GetErr() const;
const String& GetString() const;
const String& GetCoreString() const;
+ ::rtl::OUString GetOUString() const;
SbxDecimal* GetDecimal() const;
SbxBase* GetObject() const;
BOOL HasObject() const;
@@ -325,8 +327,8 @@ public:
BOOL PutDate( double );
BOOL PutBool( BOOL );
BOOL PutErr( USHORT );
- BOOL PutStringExt( const String& ); // with extended analysis (International, "TRUE"/"FALSE")
- BOOL PutString( const String& );
+ BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE")
+ BOOL PutString( const ::rtl::OUString& );
BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING
BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR
BOOL PutDecimal( SbxDecimal* pDecimal );
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index df5bd58e90..f8aef3d6d2 100755
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -57,6 +57,7 @@
#include <vos/mutex.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "errobject.hxx"
+#include <hash_map>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
@@ -552,6 +553,39 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
USHORT nFlags_ = pProp->GetFlags();
pProp->SetFlag( SBX_NO_BROADCAST );
SbxProperty* pNewProp = new SbxProperty( *pProp );
+
+ // Special handling for modules instances and collections, they need
+ // to be instantiated, otherwise all refer to the same base object
+ SbxDataType eVarType = pProp->GetType();
+ if( eVarType == SbxOBJECT )
+ {
+ SbxBase* pObjBase = pProp->GetObject();
+ SbxObject* pObj = PTR_CAST(SbxObject,pObjBase);
+ if( pObj != NULL )
+ {
+ String aObjClass = pObj->GetClassName();
+ (void)aObjClass;
+
+ SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
+ if( pClassModuleObj != NULL )
+ {
+ SbModule* pLclClassModule = pClassModuleObj->getClassModule();
+ SbClassModuleObject* pNewObj = new SbClassModuleObject( pLclClassModule );
+ pNewObj->SetName( pProp->GetName() );
+ pNewObj->SetParent( pLclClassModule->pParent );
+ pNewProp->PutObject( pNewObj );
+ }
+ else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
+ {
+ String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
+ BasicCollection* pNewCollection = new BasicCollection( aCollectionName );
+ pNewCollection->SetName( pProp->GetName() );
+ pNewCollection->SetParent( pClassModule->pParent );
+ pNewProp->PutObject( pNewCollection );
+ }
+ }
+ }
+
pNewProp->ResetFlag( SBX_NO_BROADCAST );
pNewProp->SetParent( this );
pProps->PutDirect( pNewProp, i );
@@ -726,6 +760,7 @@ SbClassData::SbClassData( void )
void SbClassData::clear( void )
{
mxIfaces->Clear();
+ maRequiredTypes.clear();
}
SbClassFactory::SbClassFactory( void )
@@ -981,6 +1016,72 @@ SbModule* StarBASIC::FindModule( const String& rName )
return NULL;
}
+
+struct ClassModuleRunInitItem
+{
+ SbModule* m_pModule;
+ bool m_bProcessing;
+ bool m_bRunInitDone;
+ //ModuleVector m_vModulesDependingOnThisModule;
+
+ ClassModuleRunInitItem( void )
+ : m_pModule( NULL )
+ , m_bProcessing( false )
+ , m_bRunInitDone( false )
+ {}
+ ClassModuleRunInitItem( SbModule* pModule )
+ : m_pModule( pModule )
+ , m_bProcessing( false )
+ , m_bRunInitDone( false )
+ {}
+};
+
+typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
+ ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap;
+
+static ModuleInitDependencyMap* GpMIDMap = NULL;
+
+void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
+{
+ ModuleInitDependencyMap& rMIDMap = *GpMIDMap;
+
+ rItem.m_bProcessing = true;
+
+ //bool bAnyDependencies = true;
+ SbModule* pModule = rItem.m_pModule;
+ if( pModule->pClassData != NULL )
+ {
+ StringVector& rReqTypes = pModule->pClassData->maRequiredTypes;
+ if( rReqTypes.size() > 0 )
+ {
+ for( StringVector::iterator it = rReqTypes.begin() ; it != rReqTypes.end() ; ++it )
+ {
+ String& rStr = *it;
+
+ // Is required type a class module?
+ ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr );
+ if( itFind != rMIDMap.end() )
+ {
+ ClassModuleRunInitItem& rParentItem = itFind->second;
+ if( rParentItem.m_bProcessing )
+ {
+ // TODO: raise error?
+ DBG_ERROR( "Cyclic module dependency detected" );
+ continue;
+ }
+
+ if( !rParentItem.m_bRunInitDone )
+ implProcessModuleRunInit( rParentItem );
+ }
+ }
+ }
+ }
+
+ pModule->RunInit();
+ rItem.m_bRunInitDone = true;
+ rItem.m_bProcessing = false;
+}
+
// Run Init-Code of all modules (including inserted libraries)
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
@@ -994,10 +1095,33 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
// compile modules first then RunInit ( otherwise there is
// can be order dependency, e.g. classmodule A has a member
// of of type classmodule B and classmodule B hasn't been compiled yet )
+
+ // Consider required types to init in right order. Class modules
+ // that are required by other modules have to be initialized first.
+ ModuleInitDependencyMap aMIDMap;
+ GpMIDMap = &aMIDMap;
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
- pModule->RunInit();
+ String aModuleName = pModule->GetName();
+ if( pModule->isProxyModule() )
+ aMIDMap[aModuleName] = ClassModuleRunInitItem( pModule );
+ }
+
+ ModuleInitDependencyMap::iterator it;
+ for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it )
+ {
+ ClassModuleRunInitItem& rItem = it->second;
+ SbModule::implProcessModuleRunInit( rItem );
+ }
+ GpMIDMap = NULL;
+
+ // Call RunInit on standard modules
+ for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
+ {
+ SbModule* pModule = (SbModule*)pModules->Get( nMod );
+ if( !pModule->isProxyModule() )
+ pModule->RunInit();
}
// Check all objects if they are BASIC,
@@ -1962,7 +2086,7 @@ void BasicCollection::CollItem( SbxArray* pPar_ )
if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() )
pRes = xItemArray->Get32( nIndex );
if( !pRes )
- SetError( SbxERR_BAD_INDEX );
+ SetError( SbERR_BAD_ARGUMENT );
else
*(pPar_->Get(0)) = *pRes;
}
@@ -1980,6 +2104,6 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() )
xItemArray->Remove32( nIndex );
else
- SetError( SbxERR_BAD_INDEX );
+ SetError( SbERR_BAD_ARGUMENT );
}
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 1a9e046aa1..3a8c224424 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -71,6 +71,7 @@
#include <com/sun/star/bridge/oleautomation/Date.hpp>
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
using com::sun::star::uno::Reference;
@@ -300,7 +301,12 @@ SbUnoObject* createOLEObject_Impl( const String& aType )
SbUnoObject* pUnoObj = NULL;
if( xOLEFactory.is() )
{
- Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aType );
+ // some type names available in VBA can not be directly used in COM
+ ::rtl::OUString aOLEType = aType;
+ if ( aOLEType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SAXXMLReader30" ) ) ) )
+ aOLEType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Msxml2.SAXXMLReader.3.0" ) );
+
+ Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aOLEType );
if( xOLEObject.is() )
{
Any aAny;
@@ -1460,7 +1466,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
aRetVal.setValue( &c , getCharCppuType() );
break;
}
- case TypeClass_STRING: aRetVal <<= ::rtl::OUString( pVar->GetString() ); break;
+ case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break;
case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break;
case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break;
//case TypeClass_OCTET: break;
@@ -2265,6 +2271,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
: SbxObject( aName_ )
, bNeedIntrospection( TRUE )
+ , bIgnoreNativeCOMObjectMembers( FALSE )
{
static Reference< XIntrospection > xIntrospection;
@@ -2310,6 +2317,12 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
bNeedIntrospection = FALSE;
return;
}
+
+ // Ignore introspection based members for COM objects to avoid
+ // hiding of equally named COM symbols, e.g. XInvocation::getValue
+ Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY );
+ if( xAutomationObject.is() )
+ bIgnoreNativeCOMObjectMembers = TRUE;
}
maTmpUnoObj = aUnoObj_;
@@ -2553,7 +2566,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
if( !pRes )
{
::rtl::OUString aUName( rName );
- if( mxUnoAccess.is() )
+ if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers )
{
if( mxExactName.is() )
{
@@ -2713,10 +2726,12 @@ void SbUnoObject::implCreateAll( void )
// Instrospection besorgen
Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
- if( !xAccess.is() )
+ if( !xAccess.is() || bIgnoreNativeCOMObjectMembers )
{
if( mxInvocation.is() )
xAccess = mxInvocation->getIntrospection();
+ else if( bIgnoreNativeCOMObjectMembers )
+ return;
}
if( !xAccess.is() )
return;
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index c7e8f1101c..256dcf92e0 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -138,11 +138,10 @@ void SbiCodeGen::Save()
pCLASSFAC->AddClassModule( &rMod );
nIfaceCount = pParser->aIfaceVector.size();
+ if( !rMod.pClassData )
+ rMod.pClassData = new SbClassData;
if( nIfaceCount )
{
- if( !rMod.pClassData )
- rMod.pClassData = new SbClassData;
-
for( int i = 0 ; i < nIfaceCount ; i++ )
{
const String& rIfaceName = pParser->aIfaceVector[i];
@@ -152,6 +151,8 @@ void SbiCodeGen::Save()
pIfaces->Insert( pIfaceVar, pIfaces->Count() );
}
}
+
+ rMod.pClassData->maRequiredTypes = pParser->aRequiredTypes;
}
else
{
@@ -161,6 +162,7 @@ void SbiCodeGen::Save()
rMod.mnType = com::sun::star::script::ModuleType::NORMAL;
rMod.bIsProxyModule = false;
}
+
if( pParser->bText )
p->SetFlag( SBIMG_COMPARETEXT );
// GlobalCode-Flag
@@ -257,6 +259,10 @@ void SbiCodeGen::Save()
if( !pProc->IsPublic() )
pMeth->SetFlag( SBX_PRIVATE );
+ // Declare? -> Hidden
+ if( pProc->GetLib().Len() > 0 )
+ pMeth->SetFlag( SBX_HIDDEN );
+
pMeth->nStart = pProc->GetAddr();
pMeth->nLine1 = pProc->GetLine1();
pMeth->nLine2 = pProc->GetLine2();
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index b5131c99f1..367be2a3e3 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -161,6 +161,9 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
// In den String-Pool uebernehmen
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
+
+ if( rDef.IsNew() && pProc == NULL )
+ aRequiredTypes.push_back( aCompleteName );
}
eType = SbxOBJECT;
break;
@@ -874,7 +877,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
}
if( bCompatible && Peek() == PARAMARRAY )
{
- if( bByVal || bByVal || bOptional )
+ if( bByVal || bOptional )
Error( SbERR_UNEXPECTED, PARAMARRAY );
Next();
bParamArray = TRUE;
@@ -946,6 +949,8 @@ void SbiParser::DefDeclare( BOOL bPrivate )
Error( SbERR_UNEXPECTED, eCurTok );
else
{
+ bool bFunction = (eCurTok == FUNCTION);
+
SbiProcDef* pDef = ProcDecl( TRUE );
if( pDef )
{
@@ -970,7 +975,70 @@ void SbiParser::DefDeclare( BOOL bPrivate )
aPublics.Add( pDef );
if ( pDef )
+ {
pDef->SetPublic( !bPrivate );
+
+ // New declare handling
+ if( pDef->GetLib().Len() > 0 )
+ {
+ if( bNewGblDefs && nGblChain == 0 )
+ {
+ nGblChain = aGen.Gen( _JUMP, 0 );
+ bNewGblDefs = FALSE;
+ }
+
+ USHORT nSavLine = nLine;
+ aGen.Statement();
+ pDef->Define();
+ pDef->SetLine1( nSavLine );
+ pDef->SetLine2( nSavLine );
+
+ SbiSymPool& rPool = pDef->GetParams();
+ USHORT nParCount = rPool.GetSize();
+
+ SbxDataType eType = pDef->GetType();
+ if( bFunction )
+ aGen.Gen( _PARAM, 0, sal::static_int_cast< UINT16 >( eType ) );
+
+ if( nParCount > 1 )
+ {
+ aGen.Gen( _ARGC );
+
+ for( USHORT i = 1 ; i < nParCount ; ++i )
+ {
+ SbiSymDef* pParDef = rPool.Get( i );
+ SbxDataType eParType = pParDef->GetType();
+
+ aGen.Gen( _PARAM, i, sal::static_int_cast< UINT16 >( eParType ) );
+ aGen.Gen( _ARGV );
+
+ USHORT nTyp = sal::static_int_cast< USHORT >( pParDef->GetType() );
+ if( pParDef->IsByVal() )
+ {
+ // Reset to avoid additional byval in call to wrapper function
+ pParDef->SetByVal( FALSE );
+ nTyp |= 0x8000;
+ }
+ aGen.Gen( _ARGTYP, nTyp );
+ }
+ }
+
+ aGen.Gen( _LIB, aGblStrings.Add( pDef->GetLib() ) );
+
+ SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL;
+ USHORT nId = pDef->GetId();
+ if( pDef->GetAlias().Len() )
+ nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() );
+ if( nParCount > 1 )
+ nId |= 0x8000;
+ aGen.Gen( eOp, nId, sal::static_int_cast< UINT16 >( eType ) );
+
+ if( bFunction )
+ aGen.Gen( _PUT );
+
+ aGen.Gen( _LEAVE );
+ }
+ }
}
}
}
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index 82b2d39dcf..ea2dd286da 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -115,13 +115,8 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
}
else
{
- SbiProcDef* pProc = aVar.pDef->GetProcDef();
- // per DECLARE definiert?
- if( pProc && pProc->GetLib().Len() )
- eOp = pProc->IsCdecl() ? _CALLC : _CALL;
- else
- eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL :
- (aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
+ eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL :
+ (aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
}
if( eOp == _FIND )
@@ -187,17 +182,6 @@ void SbiExprNode::GenElement( SbiOpcode eOp )
aVar.pPar->Gen();
}
- SbiProcDef* pProc = aVar.pDef->GetProcDef();
- // per DECLARE definiert?
- if( pProc )
- {
- // Dann evtl. einen LIB-Befehl erzeugen
- if( pProc->GetLib().Len() )
- pGen->Gen( _LIB, pGen->GetParser()->aGblStrings.Add( pProc->GetLib() ) );
- // und den Aliasnamen nehmen
- if( pProc->GetAlias().Len() )
- nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() );
- }
pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) );
if( aVar.pvMorePar )
@@ -223,13 +207,8 @@ void SbiExprList::Gen()
{
pParser->aGen.Gen( _ARGC );
// AB 10.1.96: Typ-Anpassung bei DECLARE
- USHORT nCount = 1, nParAnz = 0;
- SbiSymPool* pPool = NULL;
- if( pProc )
- {
- pPool = &pProc->GetParams();
- nParAnz = pPool->GetSize();
- }
+ USHORT nCount = 1 /*, nParAnz = 0*/;
+// SbiSymPool* pPool = NULL;
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
{
pExpr->Gen();
@@ -239,6 +218,7 @@ void SbiExprList::Gen()
USHORT nSid = pParser->aGblStrings.Add( pExpr->GetName() );
pParser->aGen.Gen( _ARGN, nSid );
+ /* TODO: Check after Declare concept change
// AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
if( pProc )
{
@@ -246,39 +226,26 @@ void SbiExprList::Gen()
pParser->Error( SbERR_NO_NAMED_ARGS );
// Spaeter, wenn Named Args bei DECLARE moeglich
- /*
- for( USHORT i = 1 ; i < nParAnz ; i++ )
- {
- SbiSymDef* pDef = pPool->Get( i );
- const String& rName = pDef->GetName();
- if( rName.Len() )
- {
- if( pExpr->GetName().ICompare( rName )
- == COMPARE_EQUAL )
- {
- pParser->aGen.Gen( _ARGTYP, pDef->GetType() );
- break;
- }
- }
- }
- */
+ //for( USHORT i = 1 ; i < nParAnz ; i++ )
+ //{
+ // SbiSymDef* pDef = pPool->Get( i );
+ // const String& rName = pDef->GetName();
+ // if( rName.Len() )
+ // {
+ // if( pExpr->GetName().ICompare( rName )
+ // == COMPARE_EQUAL )
+ // {
+ // pParser->aGen.Gen( _ARGTYP, pDef->GetType() );
+ // break;
+ // }
+ // }
+ //}
}
+ */
}
else
{
pParser->aGen.Gen( _ARGV );
-
- // Funktion mit DECLARE -> Typ-Anpassung
- if( pProc && nCount < nParAnz )
- {
- SbiSymDef* pDef = pPool->Get( nCount );
- USHORT nTyp = sal::static_int_cast< USHORT >(
- pDef->GetType() );
- // Zusätzliches Flag für BYVAL einbauen
- if( pDef->IsByVal() )
- nTyp |= 0x8000;
- pParser->aGen.Gen( _ARGTYP, nTyp );
- }
}
}
}
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 389b9e49c2..f858c428af 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -338,15 +338,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// damit erwischen wir n% = 5 : print n
eType = eDefType;
}
- // Funktion?
- if( pDef->GetProcDef() )
- {
- SbiProcDef* pProc = pDef->GetProcDef();
- if( pPar && pProc->GetLib().Len() ) // DECLARE benutzt?
- pPar->SetProc( pProc );
- // Wenn keine Pars, vorerst nichts machen
- // Pruefung auf Typ-Anzahl waere denkbar
- }
// Typcheck bei Variablen:
// ist explizit im Scanner etwas anderes angegeben?
// Bei Methoden ist dies OK!
@@ -868,7 +859,6 @@ SbiExprList::SbiExprList( SbiParser* p )
{
pParser = p;
pFirst = NULL;
- pProc = NULL;
nExpr =
nDim = 0;
bError =
diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk
index bd3c750df3..d65f6a431e 100644
--- a/basic/source/comp/makefile.mk
+++ b/basic/source/comp/makefile.mk
@@ -34,39 +34,26 @@ TARGET=comp
.INCLUDE : settings.mk
-CXXFILES= \
- sbcomp.cxx \
- dim.cxx \
- exprtree.cxx \
- exprnode.cxx \
- exprgen.cxx \
- codegen.cxx \
- io.cxx \
- loops.cxx \
- parser.cxx \
- scanner.cxx \
- token.cxx \
- symtbl.cxx \
- buffer.cxx
-
SLOFILES= \
- $(SLO)$/sbcomp.obj \
+ $(SLO)$/buffer.obj \
+ $(SLO)$/codegen.obj \
$(SLO)$/dim.obj \
- $(SLO)$/exprtree.obj \
- $(SLO)$/exprnode.obj \
$(SLO)$/exprgen.obj \
- $(SLO)$/codegen.obj \
+ $(SLO)$/exprnode.obj \
+ $(SLO)$/exprtree.obj \
$(SLO)$/io.obj \
$(SLO)$/loops.obj \
$(SLO)$/parser.obj \
+ $(SLO)$/sbcomp.obj \
$(SLO)$/scanner.obj \
- $(SLO)$/token.obj \
$(SLO)$/symtbl.obj \
- $(SLO)$/buffer.obj
+ $(SLO)$/token.obj
EXCEPTIONSFILES= \
- $(SLO)$/parser.obj \
- $(SLO)$/exprtree.obj
+ $(SLO)$/codegen.obj \
+ $(SLO)$/dim.obj \
+ $(SLO)$/exprtree.obj \
+ $(SLO)$/parser.obj
# --- Targets --------------------------------------------------------------
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index b1769343bb..f9cd852efc 100755
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -261,7 +261,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
{
aStr.AppendAscii( "Entering " );
}
- String aModuleName = pModule->GetName();
+ String aModuleName = pTraceMod->GetName();
aStr += aModuleName;
if( pMethod != NULL )
{
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index af7302d1e1..96604cbdd9 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -234,7 +234,6 @@ class SbiExprList { // Basisklasse fuer Parameter und Dims
protected:
SbiParser* pParser; // Parser
SbiExpression* pFirst; // Expressions
- SbiProcDef* pProc; // DECLARE-Funktion (Parameter-Anpassung)
short nExpr; // Anzahl Expressions
short nDim; // Anzahl Dimensionen
BOOL bError; // TRUE: Fehler
@@ -249,8 +248,6 @@ public:
SbiExpression* Get( short );
BOOL Test( const SbiProcDef& ); // Parameter-Checks
void Gen(); // Code-Erzeugung
- // Setzen einer Funktionsdefinition zum Abgleich der Parameter
- void SetProc( SbiProcDef* p ) { pProc = p; }
void addExpression( SbiExpression* pExpr );
};
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 4fb7b1886c..d83bc3c68c 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -34,7 +34,7 @@
#include <vector>
-typedef ::std::vector< String > IfaceVector;
+typedef ::std::vector< String > StringVector;
struct SbiParseStack;
@@ -81,7 +81,8 @@ public:
BOOL bText; // OPTION COMPARE TEXT
BOOL bExplicit; // TRUE: OPTION EXPLICIT
BOOL bClassModule; // TRUE: OPTION ClassModule
- IfaceVector aIfaceVector; // Holds all interfaces implemented by a class module
+ StringVector aIfaceVector; // Holds all interfaces implemented by a class module
+ StringVector aRequiredTypes; // Types used in Dim As New <type> outside subs
SbxDataType eDefTypes[26]; // DEFxxx-Datentypen
SbiParser( StarBASIC*, SbModule* );
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 938315aa12..00621e2c21 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -50,10 +50,16 @@ public:
virtual SbxObject* CreateObject( const String& );
};
+typedef ::std::vector< String > StringVector;
+
struct SbClassData
{
SbxArrayRef mxIfaces;
+ // types this module depends on because of use in Dim As New <type>
+ // needed for initialization order of class modules
+ StringVector maRequiredTypes;
+
SbClassData( void );
~SbClassData( void )
{ clear(); }
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index b8993c1e71..f2277e99d0 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -52,6 +52,7 @@ class SbUnoObject: public SbxObject
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
BOOL bNeedIntrospection;
+ BOOL bIgnoreNativeCOMObjectMembers;
::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
// Hilfs-Methode zum Anlegen der dbg_-Properties
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index a2a5896943..fd0906e022 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -159,7 +159,8 @@ public:
void SetOptional() { bOpt = TRUE; }
void SetParamArray() { bParamArray = TRUE; }
void SetWithEvents() { bWithEvents = TRUE; }
- void SetByVal() { bByVal = TRUE; }
+ void SetByVal( BOOL bByVal_ = TRUE )
+ { bByVal = bByVal_; }
void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; }
void SetNew() { bNew = TRUE; }
void SetDefinedAs() { bAs = TRUE; }
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index f22a52c51a..1fd7263725 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -528,11 +528,13 @@ RTLFUNC(DoEvents)
(void)pBasic;
(void)bWrite;
(void)rPar;
- Timer aTimer;
- aTimer.SetTimeout( 1 );
- aTimer.Start();
- while ( aTimer.IsActive() )
- Application::Yield();
+ // Dummy implementation as the following code leads
+ // to performance problems for unknown reasons
+ //Timer aTimer;
+ //aTimer.SetTimeout( 1 );
+ //aTimer.Start();
+ //while ( aTimer.IsActive() )
+ // Application::Reschedule();
}
RTLFUNC(GetGUIVersion)
@@ -1586,8 +1588,6 @@ RTLFUNC(Join)
}
-typedef ::std::vector< String > StringVector;
-
RTLFUNC(Split)
{
(void)pBasic;
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 112c88bd3b..7d1f92fcf4 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -431,144 +431,143 @@ void SbiRuntime::StepPUT()
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{
// #67733 Typen mit Array-Flag sind auch ok
- SbxDataType eValType = refVal->GetType();
+
+ // Check var, !object is no error for sure if, only if type is fixed
SbxDataType eVarType = refVar->GetType();
- if( (eValType != SbxOBJECT
- && eValType != SbxEMPTY
-// seems like when using the default method its possible for objects
-// to be empty ( no broadcast has taken place yet ) or the actual value is
-
- && !bHandleDefaultProp
- && !(eValType & SbxARRAY)) ||
- (eVarType != SbxOBJECT
- && eVarType != SbxEMPTY
- && !bHandleDefaultProp
- && !(eVarType & SbxARRAY) ) )
+ if( !bHandleDefaultProp && eVarType != SbxOBJECT && !(eVarType & SbxARRAY) && refVar->IsFixed() )
{
Error( SbERR_INVALID_USAGE_OBJECT );
+ return;
}
- else
+
+ // Check value, !object is no error for sure if, only if type is fixed
+ SbxDataType eValType = refVal->GetType();
+// bool bGetValObject = false;
+ if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() )
+ {
+ Error( SbERR_INVALID_USAGE_OBJECT );
+ return;
+ }
+
+ // Getting in here causes problems with objects with default properties
+ // if they are SbxEMPTY I guess
+ if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) )
{
- // Getting in here causes problems with objects with default properties
- // if they are SbxEMPTY I guess
- if ( !bHandleDefaultProp || ( bHandleDefaultProp && refVal->GetType() == SbxOBJECT ) )
+ // Auf refVal GetObject fuer Collections ausloesen
+ SbxBase* pObjVarObj = refVal->GetObject();
+ if( pObjVarObj )
{
- // Auf refVal GetObject fuer Collections ausloesen
- SbxBase* pObjVarObj = refVal->GetObject();
- if( pObjVarObj )
- {
- SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
+ SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
- // #67733 Typen mit Array-Flag sind auch ok
- if( refObjVal )
- refVal = refObjVal;
- else if( !(eValType & SbxARRAY) )
- refVal = NULL;
- }
+ // #67733 Typen mit Array-Flag sind auch ok
+ if( refObjVal )
+ refVal = refObjVal;
+ else if( !(eValType & SbxARRAY) )
+ refVal = NULL;
}
+ }
- // #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
- // Object deklarierten Variable zugewiesen werden, kann hier
- // refVal ungueltig sein!
- if( !refVal )
+ // #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
+ // Object deklarierten Variable zugewiesen werden, kann hier
+ // refVal ungueltig sein!
+ if( !refVal )
+ {
+ Error( SbERR_INVALID_USAGE_OBJECT );
+ }
+ else
+ {
+ // Store auf die eigene Methode (innerhalb einer Function)?
+ BOOL bFlagsChanged = FALSE;
+ USHORT n = 0;
+ if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
{
- Error( SbERR_INVALID_USAGE_OBJECT );
+ bFlagsChanged = TRUE;
+ n = refVar->GetFlags();
+ refVar->SetFlag( SBX_WRITE );
}
- else
- {
- // Store auf die eigene Methode (innerhalb einer Function)?
- BOOL bFlagsChanged = FALSE;
- USHORT n = 0;
- if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
- {
- bFlagsChanged = TRUE;
- n = refVar->GetFlags();
- refVar->SetFlag( SBX_WRITE );
- }
- SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
- if( pProcProperty )
- pProcProperty->setSet( true );
+ SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
+ if( pProcProperty )
+ pProcProperty->setSet( true );
- if ( bHandleDefaultProp )
+ if ( bHandleDefaultProp )
+ {
+ // get default properties for lhs & rhs where necessary
+ // SbxVariable* defaultProp = NULL; unused variable
+ bool bLHSHasDefaultProp = false;
+ // LHS try determine if a default prop exists
+ if ( refVar->GetType() == SbxOBJECT )
{
- // get default properties for lhs & rhs where necessary
- // SbxVariable* defaultProp = NULL; unused variable
- bool bLHSHasDefaultProp = false;
- // LHS try determine if a default prop exists
- if ( refVar->GetType() == SbxOBJECT )
+ SbxVariable* pDflt = getDefaultProp( refVar );
+ if ( pDflt )
{
- SbxVariable* pDflt = getDefaultProp( refVar );
- if ( pDflt )
- {
- refVar = pDflt;
- bLHSHasDefaultProp = true;
- }
+ refVar = pDflt;
+ bLHSHasDefaultProp = true;
}
- // RHS only get a default prop is the rhs has one
- if ( refVal->GetType() == SbxOBJECT )
- {
- // check if lhs is a null object
- // if it is then use the object not the default property
- SbxObject* pObj = NULL;
-
-
- pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
-
- // calling GetObject on a SbxEMPTY variable raises
- // object not set errors, make sure its an Object
- if ( !pObj && refVar->GetType() == SbxOBJECT )
- {
- SbxBase* pObjVarObj = refVar->GetObject();
- pObj = PTR_CAST(SbxObject,pObjVarObj);
- }
- SbxVariable* pDflt = NULL;
- if ( pObj || bLHSHasDefaultProp )
- // lhs is either a valid object || or has a defaultProp
- pDflt = getDefaultProp( refVal );
- if ( pDflt )
- refVal = pDflt;
- }
- }
-
- // Handle withevents
- BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
- if ( bWithEvents )
+ }
+ // RHS only get a default prop is the rhs has one
+ if ( refVal->GetType() == SbxOBJECT )
{
- Reference< XInterface > xComListener;
+ // check if lhs is a null object
+ // if it is then use the object not the default property
+ SbxObject* pObj = NULL;
- SbxBase* pObj = refVal->GetObject();
- SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
- if( pUnoObj != NULL )
- {
- Any aControlAny = pUnoObj->getUnoAny();
- String aDeclareClassName = refVar->GetDeclareClassName();
- ::rtl::OUString aVBAType = aDeclareClassName;
- ::rtl::OUString aPrefix = refVar->GetName();
- SbxObjectRef xScopeObj = refVar->GetParent();
- xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
-
- refVal->SetDeclareClassName( aDeclareClassName );
- refVal->SetComListener( xComListener ); // Hold reference
- }
+
+ pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
- *refVar = *refVal;
+ // calling GetObject on a SbxEMPTY variable raises
+ // object not set errors, make sure its an Object
+ if ( !pObj && refVar->GetType() == SbxOBJECT )
+ {
+ SbxBase* pObjVarObj = refVar->GetObject();
+ pObj = PTR_CAST(SbxObject,pObjVarObj);
+ }
+ SbxVariable* pDflt = NULL;
+ if ( pObj || bLHSHasDefaultProp )
+ // lhs is either a valid object || or has a defaultProp
+ pDflt = getDefaultProp( refVal );
+ if ( pDflt )
+ refVal = pDflt;
}
- else
+ }
+
+ // Handle withevents
+ BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
+ if ( bWithEvents )
+ {
+ Reference< XInterface > xComListener;
+
+ SbxBase* pObj = refVal->GetObject();
+ SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
+ if( pUnoObj != NULL )
{
- *refVar = *refVal;
+ Any aControlAny = pUnoObj->getUnoAny();
+ String aDeclareClassName = refVar->GetDeclareClassName();
+ ::rtl::OUString aVBAType = aDeclareClassName;
+ ::rtl::OUString aPrefix = refVar->GetName();
+ SbxObjectRef xScopeObj = refVar->GetParent();
+ xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
+
+ refVal->SetDeclareClassName( aDeclareClassName );
+ refVal->SetComListener( xComListener ); // Hold reference
}
- // lhs is a property who's value is currently (Empty e.g. no broadcast yet)
- // in this case if there is a default prop involved the value of the
- // default property may infact be void so the type will also be SbxEMPTY
- // in this case we do not want to call checkUnoStructCopy 'cause that will
- // cause an error also
- if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
- // #67607 Uno-Structs kopieren
- checkUnoStructCopy( refVal, refVar );
- if( bFlagsChanged )
- refVar->SetFlags( n );
+ *refVar = *refVal;
}
+ else
+ {
+ *refVar = *refVal;
+ }
+
+ // lhs is a property who's value is currently (Empty e.g. no broadcast yet)
+ // in this case if there is a default prop involved the value of the
+ // default property may infact be void so the type will also be SbxEMPTY
+ // in this case we do not want to call checkUnoStructCopy 'cause that will
+ // cause an error also
+ if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
+ // #67607 Uno-Structs kopieren
+ checkUnoStructCopy( refVal, refVar );
+ if( bFlagsChanged )
+ refVar->SetFlags( n );
}
}
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 38ca84eddf..7551a586b3 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -87,21 +87,20 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
case SbxSTRING:
case SbxLPSTR:
nRes = SbxFALSE;
- if( p->pString )
+ if ( p->pOUString )
{
- if( p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_TRUE ) ) )
+ if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) )
nRes = SbxTRUE;
- else if( !p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_FALSE ) ) )
+ else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
{
// Jetzt kann es noch in eine Zahl konvertierbar sein
BOOL bError = TRUE;
double n;
SbxDataType t;
USHORT nLen = 0;
- String s( *p->pString );
- if( ImpScan( s, n, t, &nLen ) == SbxERR_OK )
+ if( ImpScan( *p->pOUString, n, t, &nLen ) == SbxERR_OK )
{
- if( nLen == s.Len() )
+ if( nLen == p->pOUString->getLength() )
{
bError = FALSE;
if( n != 0.0 )
@@ -202,9 +201,10 @@ void ImpPutBool( SbxValues* p, INT16 n )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- *p->pString = SbxRes( n ? STRING_TRUE : STRING_FALSE );
+ if ( !p->pOUString )
+ p->pOUString = new ::rtl::OUString( SbxRes( n ? STRING_TRUE : STRING_FALSE ) );
+ else
+ *p->pOUString = SbxRes( n ? STRING_TRUE : STRING_FALSE );
break;
case SbxOBJECT:
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index 12ec2fd3c6..b70b82662a 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -165,13 +165,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXBYTE )
{
@@ -279,9 +279,9 @@ void ImpPutByte( SbxValues* p, BYTE n )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 0, *p->pString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index 9f0bb41ce6..ca52057a7c 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -39,7 +39,7 @@ using namespace rtl;
xub_Unicode ImpGetChar( const SbxValues* p )
{
SbxValues aTmp;
- xub_Unicode nRes;
+ xub_Unicode nRes = 0;
start:
switch( +p->eType )
{
@@ -156,13 +156,11 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- nRes = 0;
- else
+ if ( p->pOUString )
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXCHAR )
{
@@ -274,9 +272,10 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- *p->pString = n;
+ if ( !p->pOUString )
+ p->pOUString = new ::rtl::OUString( n );
+ else
+ *p->pOUString = ::rtl::OUString( n );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx
index 57c42889a0..83e1a8dbc8 100644
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -33,13 +33,13 @@
class SbxArray;
// SBXSCAN.CXX
-extern void ImpCvtNum( double nNum, short nPrec, String& rRes, BOOL bCoreString=FALSE );
+extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString=FALSE );
extern SbxError ImpScan
- ( const String& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen,
+ ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen,
BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE );
// mit erweiterter Auswertung (International, "TRUE"/"FALSE")
-extern BOOL ImpConvStringExt( String& rSrc, SbxDataType eTargetType );
+extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
// SBXINT.CXX
@@ -116,9 +116,9 @@ void ImpPutDate( SbxValues*, double );
// SBXSTR.CXX
-String ImpGetString( const SbxValues* );
-String ImpGetCoreString( const SbxValues* );
-void ImpPutString( SbxValues*, const String* );
+::rtl::OUString ImpGetString( const SbxValues* );
+::rtl::OUString ImpGetCoreString( const SbxValues* );
+void ImpPutString( SbxValues*, const ::rtl::OUString* );
// SBXCHAR.CXX
@@ -145,7 +145,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* );
void ImpPutBool( SbxValues*, INT16 );
// ByteArry <--> String
-SbxArray* StringToByteArray(const String& rStr);
-String ByteArrayToString(SbxArray* pArr);
+SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
+::rtl::OUString ByteArrayToString(SbxArray* pArr);
#endif
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index db21871188..9ca7f8e0cd 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -37,8 +37,8 @@
#include <basic/sbxvar.hxx>
#include "sbxconv.hxx"
-static String ImpCurrencyToString( const SbxINT64& );
-static SbxINT64 ImpStringToCurrency( const String& );
+static ::rtl::OUString ImpCurrencyToString( const SbxINT64& );
+static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& );
SbxINT64 ImpGetCurrency( const SbxValues* p )
{
@@ -121,10 +121,10 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes.SetNull();
else
- nRes = ImpStringToCurrency( *p->pString );
+ nRes = ImpStringToCurrency( *p->pOUString );
break;
case SbxOBJECT:
{
@@ -224,10 +224,10 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
- *p->pString = ImpCurrencyToString( r );
+ *p->pOUString = ImpCurrencyToString( r );
break;
case SbxOBJECT:
{
@@ -319,7 +319,7 @@ start:
// Hilfs-Funktionen zur Wandlung
-static String ImpCurrencyToString( const SbxINT64 &r )
+static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r )
{
BigInt a10000 = 10000;
@@ -331,20 +331,20 @@ static String ImpCurrencyToString( const SbxINT64 &r )
aFrac %= a10000;
aFrac += a10000;
- String aString;
+ ::rtl::OUString aString;
if( r.nHigh < 0 )
- aString = '-';
+ aString = ::rtl::OUString( (sal_Unicode)'-' );
aString += aInt.GetString();
- aString += '.';
+ aString += ::rtl::OUString( (sal_Unicode)'.' );
aString += aFrac.GetString().GetBuffer()+1;
return aString;
}
-static SbxINT64 ImpStringToCurrency( const String &r )
+static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r )
{
int nDec = 4;
String aStr;
- const sal_Unicode* p = r.GetBuffer();
+ const sal_Unicode* p = r.getStr();
if( *p == '-' )
aStr += *p++;
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index a653b77a9b..31d4a27691 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -86,7 +86,7 @@ double ImpGetDate( const SbxValues* p )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
@@ -126,7 +126,7 @@ double ImpGetDate( const SbxValues* p )
pFormatter->PutandConvertEntry( aStr, nCheckPos, nType,
nIndex, LANGUAGE_GERMAN, eLangType );
- BOOL bSuccess = pFormatter->IsNumberFormat( *p->pString, nIndex, nRes );
+ BOOL bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes );
if ( bSuccess )
{
short nType_ = pFormatter->GetType( nIndex );
@@ -248,8 +248,8 @@ start:
case SbxLPSTR:
#ifndef DOS
{
- if( !p->pString )
- p->pString = new XubString;
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
Color* pColor;
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
@@ -299,7 +299,9 @@ start:
nIndex,
LANGUAGE_GERMAN,
eLangType );
- pFormatter->GetOutputString( n, nIndex, *p->pString, &pColor );
+ String aTmpString;
+ pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor );
+ *p->pOUString = aTmpString;
delete pFormatter;
#endif
break;
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index 9c28864c0d..c8009245d0 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -76,7 +76,7 @@ double ImpGetDouble( const SbxValues* p )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
{
nRes = 0;
if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour
@@ -86,7 +86,7 @@ double ImpGetDouble( const SbxValues* p )
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
{
nRes = 0;
if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour
@@ -188,9 +188,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 14, *p->pString, bCoreString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 14, *p->pOUString, bCoreString );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 72c6b14f5b..09fa957041 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -211,7 +211,7 @@ void SbxDecimal::setUInt( unsigned int val )
// sbxscan.cxx
void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep );
-bool SbxDecimal::setString( String* pString )
+bool SbxDecimal::setString( ::rtl::OUString* pOUString )
{
static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
@@ -224,11 +224,11 @@ bool SbxDecimal::setString( String* pString )
HRESULT hResult;
if( cDecimalSep != '.' || cThousandSep != ',' )
{
- int nLen = pString->Len();
+ int nLen = pOUString->getLength();
sal_Unicode* pBuffer = new sal_Unicode[nLen + 1];
pBuffer[nLen] = 0;
- const sal_Unicode* pSrc = pString->GetBuffer();
+ const sal_Unicode* pSrc = pOUString->getStr();
int i;
for( i = 0 ; i < nLen ; ++i )
pBuffer[i] = pSrc[i];
@@ -248,7 +248,7 @@ bool SbxDecimal::setString( String* pString )
}
else
{
- hResult = VarDecFromStr( (OLECHAR*)pString->GetBuffer(), nLANGID, 0, &maDec );
+ hResult = VarDecFromStr( (OLECHAR*)pOUString->getStr(), nLANGID, 0, &maDec );
}
bRet = ( hResult == S_OK );
return bRet;
@@ -373,7 +373,7 @@ bool SbxDecimal::setSingle( float val ) { (void)val; return false; }
bool SbxDecimal::setDouble( double val ) { (void)val; return false; }
void SbxDecimal::setInt( int val ) { (void)val; }
void SbxDecimal::setUInt( unsigned int val ) { (void)val; }
-bool SbxDecimal::setString( String* pString ) { (void)pString; return false; }
+bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { (void)pOUString; return false; }
bool SbxDecimal::getChar( sal_Unicode& rVal ) { (void)rVal; return false; }
bool SbxDecimal::getByte( BYTE& rVal ) { (void)rVal; return false; }
@@ -388,7 +388,7 @@ bool SbxDecimal::getUInt( unsigned int& rVal ) { (void)rVal; return false; }
#endif
-bool SbxDecimal::getString( String& rString )
+bool SbxDecimal::getString( ::rtl::OUString& rString )
{
#ifdef WIN32
static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
@@ -528,7 +528,7 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
- pnDecRes->setString( p->pString ); break;
+ pnDecRes->setString( p->pOUString ); break;
case SbxOBJECT:
{
SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
@@ -670,10 +670,10 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
- if( !p->pString )
- p->pString = new XubString;
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
// ImpCvtNum( (double) n, 0, *p->pString );
- pDec->getString( *p->pString );
+ pDec->getString( *p->pOUString );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx
index 3fb31e6860..3b623476bf 100644
--- a/basic/source/sbx/sbxdec.hxx
+++ b/basic/source/sbx/sbxdec.hxx
@@ -85,7 +85,7 @@ public:
bool setDouble( double val );
void setInt( int val );
void setUInt( unsigned int val );
- bool setString( String* pString );
+ bool setString( ::rtl::OUString* pOUString );
void setDecimal( SbxDecimal* pDecimal )
{
#ifdef WIN32
@@ -106,7 +106,7 @@ public:
bool getDouble( double& rVal );
bool getInt( int& rVal );
bool getUInt( unsigned int& rVal );
- bool getString( String& rString );
+ bool getString( ::rtl::OUString& rString );
bool operator -= ( const SbxDecimal &r );
bool operator += ( const SbxDecimal &r );
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index f831040a1d..0ed76dfdef 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -154,13 +154,13 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXINT )
{
@@ -275,9 +275,9 @@ start:
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 0, *p->pString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{
@@ -456,20 +456,19 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
- ::rtl::OUString aOUStr( *p->pString );
::rtl::OString aOStr = ::rtl::OUStringToOString
- ( aOUStr, RTL_TEXTENCODING_ASCII_US );
+ ( *p->pOUString, RTL_TEXTENCODING_ASCII_US );
nRes = aOStr.toInt64();
if( nRes == 0 )
{
// Check if really 0 or invalid conversion
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else
nRes = ImpDoubleToSalInt64( d );
@@ -575,13 +574,12 @@ start:
case SbxSTRING:
case SbxLPSTR:
{
- if( !p->pString )
- p->pString = new XubString;
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
::rtl::OString aOStr = ::rtl::OString::valueOf( n );
- ::rtl::OUString aOUStr = ::rtl::OStringToOUString
+ (*p->pOUString) = ::rtl::OStringToOUString
( aOStr, RTL_TEXTENCODING_ASCII_US );
- (*p->pString) = aOUStr;
break;
}
case SbxOBJECT:
@@ -745,20 +743,19 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
- ::rtl::OUString aOUStr( *p->pString );
::rtl::OString aOStr = ::rtl::OUStringToOString
- ( aOUStr, RTL_TEXTENCODING_ASCII_US );
+ ( *p->pOUString, RTL_TEXTENCODING_ASCII_US );
sal_Int64 n64 = aOStr.toInt64();
if( n64 == 0 )
{
// Check if really 0 or invalid conversion
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXSALUINT64 )
{
@@ -879,16 +876,15 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
if( n > SbxMAXSALINT64 )
SbxBase::SetError( SbxERR_CONVERSION );
else
{
::rtl::OString aOStr = ::rtl::OString::valueOf( (sal_Int64)n );
- ::rtl::OUString aOUStr = ::rtl::OStringToOUString
+ (*p->pOUString) = ::rtl::OStringToOUString
( aOStr, RTL_TEXTENCODING_ASCII_US );
- (*p->pString) = aOUStr;
}
break;
case SbxOBJECT:
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index a36fd1fc49..8ef9f5bd86 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -119,13 +119,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXLNG )
{
@@ -240,9 +240,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 0, *p->pString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx
index b450bf6faa..40cae63485 100644
--- a/basic/source/sbx/sbxres.cxx
+++ b/basic/source/sbx/sbxres.cxx
@@ -86,6 +86,6 @@ const char* GetSbxRes( USHORT nId )
}
SbxRes::SbxRes( USHORT nId )
- : XubString( String::CreateFromAscii( GetSbxRes( nId ) ) )
+ : ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) )
{}
diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx
index 0d4ad5f39e..1685123c5f 100644
--- a/basic/source/sbx/sbxres.hxx
+++ b/basic/source/sbx/sbxres.hxx
@@ -75,7 +75,7 @@
#define SBXRES_MAX 44
-class SbxRes : public String
+class SbxRes : public ::rtl::OUString
{
public:
SbxRes( USHORT );
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index f6d6842786..3bf354c41a 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -71,10 +71,10 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep )
// Das ganze gibt auch noch einen Konversionsfehler, wenn der Datentyp
// Fixed ist und das ganze nicht hineinpasst!
-SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType,
+SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType,
USHORT* pLen, BOOL bAllowIntntl, BOOL bOnlyIntntl )
{
- ByteString aBStr( rWSrc, RTL_TEXTENCODING_ASCII_US );
+ ::rtl::OString aBStr( ::rtl::OUStringToOString( rWSrc, RTL_TEXTENCODING_ASCII_US ) );
// Bei International Komma besorgen
char cIntntlComma, cIntntl1000;
@@ -100,7 +100,7 @@ SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType,
cIntntl1000 = (char)cThousandSep;
}
- const char* pStart = aBStr.GetBuffer();
+ const char* pStart = aBStr.getStr();
const char* p = pStart;
char buf[ 80 ], *q = buf;
BOOL bRes = TRUE;
@@ -391,7 +391,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
#pragma warning(disable: 4748) // "... because optimizations are disabled ..."
#endif
-void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString )
+void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString )
{
char *q;
char cBuf[ 40 ], *p = cBuf;
@@ -415,18 +415,18 @@ void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString )
if( *p == cDecimalSep ) p--;
while( *q ) *++p = *q++;
*++p = 0;
- rRes = String::CreateFromAscii( cBuf );
+ rRes = ::rtl::OUString::createFromAscii( cBuf );
}
#ifdef _MSC_VER
#pragma optimize( "", on )
#endif
-BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
+BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
{
// Merken, ob ueberhaupt was geaendert wurde
BOOL bChanged = FALSE;
- String aNewString;
+ ::rtl::OUString aNewString;
// Nur Spezial-Fälle behandeln, als Default tun wir nichts
switch( eTargetType )
@@ -436,7 +436,7 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
case SbxDOUBLE:
case SbxCURRENCY:
{
- ByteString aBStr( rSrc, RTL_TEXTENCODING_ASCII_US );
+ ::rtl::OString aBStr( ::rtl::OUStringToOString( rSrc, RTL_TEXTENCODING_ASCII_US ) );
// Komma besorgen
sal_Unicode cDecimalSep, cThousandSep;
@@ -446,10 +446,11 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
// Ersetzen, wenn DecimalSep kein '.' (nur den ersten)
if( cDecimalSep != (sal_Unicode)'.' )
{
- USHORT nPos = aNewString.Search( cDecimalSep );
- if( nPos != STRING_NOTFOUND )
+ sal_Int32 nPos = aNewString.indexOf( cDecimalSep );
+ if( nPos != -1 )
{
- aNewString.SetChar( nPos, '.' );
+ sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr();
+ pStr[nPos] = (sal_Unicode)'.';
bChanged = TRUE;
}
}
@@ -459,15 +460,15 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType )
// Bei BOOL TRUE und FALSE als String pruefen
case SbxBOOL:
{
- if( rSrc.EqualsIgnoreCaseAscii( "true" ) )
+ if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) )
{
- aNewString = String::CreateFromInt32(SbxTRUE);
+ aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxTRUE );
bChanged = TRUE;
}
else
- if( rSrc.EqualsIgnoreCaseAscii( "false" ) )
+ if( rSrc.equalsIgnoreAsciiCaseAscii( "false" ) )
{
- aNewString = String::CreateFromInt32(SbxFALSE);
+ aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxFALSE );
bChanged = TRUE;
}
break;
@@ -935,7 +936,11 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
//old: printfmtnum( GetDouble(), rRes, *pFmt );
}
else
- ImpCvtNum( GetDouble(), nComma, rRes );
+ {
+ ::rtl::OUString aTmpString( rRes );
+ ImpCvtNum( GetDouble(), nComma, aTmpString );
+ rRes = aTmpString;
+ }
break;
case SbxSTRING:
if( pFmt )
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index d3b873b96a..521a8ff04a 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -112,13 +112,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXSNG )
{
@@ -237,9 +237,9 @@ start:
case SbxSTRING:
case SbxLPSTR:
{
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 6, *p->pString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 6, *p->pOUString );
break;
}
case SbxOBJECT:
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index 73167aafb2..b4d1c402dd 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -44,12 +44,12 @@ using namespace rtl;
// Die Konversion eines Items auf String wird ueber die Put-Methoden
// der einzelnen Datentypen abgewickelt, um doppelten Code zu vermeiden.
-XubString ImpGetString( const SbxValues* p )
+::rtl::OUString ImpGetString( const SbxValues* p )
{
SbxValues aTmp;
- XubString aRes;
+ ::rtl::OUString aRes;
aTmp.eType = SbxSTRING;
- aTmp.pString = &aRes;
+ aTmp.pOUString = &aRes;
switch( +p->eType )
{
case SbxNULL:
@@ -86,8 +86,8 @@ XubString ImpGetString( const SbxValues* p )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( p->pString )
- aRes = *p->pString;
+ if ( p->pOUString )
+ *aTmp.pOUString = *p->pOUString;
break;
case SbxOBJECT:
{
@@ -109,7 +109,7 @@ XubString ImpGetString( const SbxValues* p )
case SbxERROR:
// Hier wird der String "Error n" erzeugt
aRes = SbxRes( STRING_ERRORMSG );
- aRes += p->nUShort; break;
+ aRes += ::rtl::OUString( p->nUShort ); break;
case SbxDATE:
ImpPutDate( &aTmp, p->nDouble ); break;
@@ -145,7 +145,7 @@ XubString ImpGetString( const SbxValues* p )
}
// AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString()
-XubString ImpGetCoreString( const SbxValues* p )
+::rtl::OUString ImpGetCoreString( const SbxValues* p )
{
// Vorerst nur fuer double
if( ( p->eType & (~SbxBYREF) ) == SbxDOUBLE )
@@ -153,7 +153,6 @@ XubString ImpGetCoreString( const SbxValues* p )
SbxValues aTmp;
XubString aRes;
aTmp.eType = SbxSTRING;
- aTmp.pString = &aRes;
if( p->eType == SbxDOUBLE )
ImpPutDouble( &aTmp, p->nDouble, /*bCoreString=*/TRUE );
else
@@ -164,15 +163,15 @@ XubString ImpGetCoreString( const SbxValues* p )
return ImpGetString( p );
}
-void ImpPutString( SbxValues* p, const XubString* n )
+void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
{
SbxValues aTmp;
aTmp.eType = SbxSTRING;
- XubString* pTmp = NULL;
+ ::rtl::OUString* pTmp = NULL;
// Sicherheitshalber, falls ein NULL-Ptr kommt
if( !n )
- n = pTmp = new XubString;
- aTmp.pString = (XubString*) n;
+ n = pTmp = new ::rtl::OUString;
+ aTmp.pOUString = (::rtl::OUString*)n;
switch( +p->eType )
{
case SbxCHAR:
@@ -209,14 +208,15 @@ void ImpPutString( SbxValues* p, const XubString* n )
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( n->Len() )
+ if( n->getLength() )
{
- if( !p->pString )
- p->pString = new XubString;
- *p->pString = *n;
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString( *n );
+ else
+ *p->pOUString = *n;
}
else
- delete p->pString, p->pString = NULL;
+ delete p->pOUString, p->pOUString = NULL;
break;
case SbxOBJECT:
{
@@ -258,18 +258,18 @@ void ImpPutString( SbxValues* p, const XubString* n )
}
// Convert string to an array of bytes, preserving unicode (2bytes per character)
-SbxArray* StringToByteArray(const String& rStr)
+SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
{
- USHORT nArraySize = rStr.Len() * 2;
- const sal_Unicode* pSrc = rStr.GetBuffer();
+ sal_Int32 nArraySize = rStr.getLength() * 2;
+ const sal_Unicode* pSrc = rStr.getStr();
SbxDimArray* pArray = new SbxDimArray(SbxBYTE);
bool bIncIndex = ( IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
if( nArraySize )
{
if( bIncIndex )
- pArray->AddDim( 1, nArraySize );
+ pArray->AddDim32( 1, nArraySize );
else
- pArray->AddDim( 0, nArraySize-1 );
+ pArray->AddDim32( 0, nArraySize-1 );
}
else
{
@@ -290,7 +290,7 @@ SbxArray* StringToByteArray(const String& rStr)
}
// Convert an array of bytes to string (2bytes per character)
-String ByteArrayToString(SbxArray* pArr)
+::rtl::OUString ByteArrayToString(SbxArray* pArr)
{
USHORT nCount = pArr->Count();
OUStringBuffer aStrBuf;
@@ -315,7 +315,5 @@ String ByteArrayToString(SbxArray* pArr)
aStrBuf.append(aChar);
}
- String aStr(aStrBuf.makeStringAndClear());
-
- return aStr;
+ return aStrBuf.makeStringAndClear();
}
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index 008677959d..94eca8aa34 100644
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -151,13 +151,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXUINT )
{
@@ -272,9 +272,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 0, *p->pString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index aa9f18f7da..b68358c246 100644
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -127,13 +127,13 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
+ if( !p->pOUString )
nRes = 0;
else
{
double d;
SbxDataType t;
- if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+ if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else if( d > SbxMAXULNG )
{
@@ -246,9 +246,9 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
- if( !p->pString )
- p->pString = new XubString;
- ImpCvtNum( (double) n, 0, *p->pString );
+ if( !p->pOUString )
+ p->pOUString = new ::rtl::OUString;
+ ImpCvtNum( (double) n, 0, *p->pOUString );
break;
case SbxOBJECT:
{
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 34ca872679..9cbdeafdb2 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -236,7 +236,7 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase()
case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break;
case SbxDATE:
case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = (double*) p; break;
- case SbxSTRING: n |= SbxBYREF; aData.pString = (XubString*) p; break;
+ case SbxSTRING: n |= SbxBYREF; aData.pOUString = (::rtl::OUString*) p; break;
case SbxERROR:
case SbxUSHORT:
case SbxBOOL: n |= SbxBYREF; aData.pUShort = (UINT16*) p; break;
@@ -280,8 +280,8 @@ SbxValue::SbxValue( const SbxValue& r )
switch( aData.eType )
{
case SbxSTRING:
- if( aData.pString )
- aData.pString = new XubString( *aData.pString );
+ if( aData.pOUString )
+ aData.pOUString = new ::rtl::OUString( *aData.pOUString );
break;
case SbxOBJECT:
if( aData.pObj )
@@ -309,7 +309,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
&& aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
&& (r.aData.eType == SbxSTRING) )
{
- String aStr = r.GetString();
+ ::rtl::OUString aStr = r.GetString();
SbxArray* pArr = StringToByteArray(aStr);
PutObject(pArr);
return *this;
@@ -323,7 +323,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
SbxArray* pArr = PTR_CAST(SbxArray, pObj);
if( pArr )
{
- String aStr = ByteArrayToString( pArr );
+ ::rtl::OUString aStr = ByteArrayToString( pArr );
PutString(aStr);
return *this;
}
@@ -385,7 +385,7 @@ void SbxValue::Clear()
case SbxVOID:
break;
case SbxSTRING:
- delete aData.pString; aData.pString = NULL;
+ delete aData.pOUString; aData.pOUString = NULL;
break;
case SbxOBJECT:
if( aData.pObj )
@@ -551,9 +551,9 @@ BOOL SbxValue::Get( SbxValues& rRes ) const
case SbxULONG: rRes.nULong = ImpGetULong( &p->aData ); break;
case SbxLPSTR:
case SbxSTRING: p->aPic = ImpGetString( &p->aData );
- rRes.pString = &p->aPic; break;
+ rRes.pOUString = &p->aPic; break;
case SbxCoreSTRING: p->aPic = ImpGetCoreString( &p->aData );
- rRes.pString = &p->aPic; break;
+ rRes.pOUString = &p->aPic; break;
case SbxINT:
#if SAL_TYPES_SIZEOFINT == 2
rRes.nInt = (int) ImpGetInteger( &p->aData );
@@ -618,13 +618,11 @@ const XubString& SbxValue::GetString() const
SbxValues aRes;
aRes.eType = SbxSTRING;
if( Get( aRes ) )
- // Geht in Ordnung, da Ptr eine Kopie ist
- return *aRes.pString;
+ ((SbxValue*) this)->aToolString = *aRes.pOUString;
else
- {
- ((SbxValue*) this)->aPic.Erase();
- return aPic;
- }
+ ((SbxValue*) this)->aToolString.Erase();
+
+ return aToolString;
}
const XubString& SbxValue::GetCoreString() const
@@ -632,13 +630,22 @@ const XubString& SbxValue::GetCoreString() const
SbxValues aRes;
aRes.eType = SbxCoreSTRING;
if( Get( aRes ) )
- // Geht in Ordnung, da Ptr eine Kopie ist
- return *aRes.pString;
+ ((SbxValue*) this)->aToolString = *aRes.pOUString;
else
- {
- ((SbxValue*) this)->aPic.Erase();
- return aPic;
- }
+ ((SbxValue*) this)->aToolString.Erase();
+
+ return aToolString;
+}
+
+::rtl::OUString SbxValue::GetOUString() const
+{
+ ::rtl::OUString aResult;
+ SbxValues aRes;
+ aRes.eType = SbxSTRING;
+ if( Get( aRes ) )
+ aResult = *aRes.pOUString;
+
+ return aResult;
}
BOOL SbxValue::HasObject() const
@@ -727,7 +734,7 @@ BOOL SbxValue::Put( const SbxValues& rVal )
case SbxUSHORT: ImpPutUShort( &p->aData, rVal.nUShort ); break;
case SbxULONG: ImpPutULong( &p->aData, rVal.nULong ); break;
case SbxLPSTR:
- case SbxSTRING: ImpPutString( &p->aData, rVal.pString ); break;
+ case SbxSTRING: ImpPutString( &p->aData, rVal.pOUString ); break;
case SbxINT:
#if SAL_TYPES_SIZEOFINT == 2
ImpPutInteger( &p->aData, (INT16) rVal.nInt );
@@ -803,10 +810,10 @@ BOOL SbxValue::Put( const SbxValues& rVal )
// werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs
// explizit mit "TRUE" oder "FALSE" angegeben werden.
// Implementierung in ImpConvStringExt (SBXSCAN.CXX)
-BOOL SbxValue::PutStringExt( const XubString& r )
+BOOL SbxValue::PutStringExt( const ::rtl::OUString& r )
{
// Kopieren, bei Unicode gleich konvertieren
- String aStr( r );
+ ::rtl::OUString aStr( r );
// Eigenen Typ bestimmen (nicht wie in Put() mit TheRealValue(),
// Objekte werden sowieso nicht behandelt)
@@ -820,9 +827,9 @@ BOOL SbxValue::PutStringExt( const XubString& r )
// sonst Original (Unicode bleibt erhalten)
BOOL bRet;
if( ImpConvStringExt( aStr, eTargetType ) )
- aRes.pString = (XubString*)&aStr;
+ aRes.pOUString = (::rtl::OUString*)&aStr;
else
- aRes.pString = (XubString*)&r;
+ aRes.pOUString = (::rtl::OUString*)&r;
// #34939: Bei Strings. die eine Zahl enthalten und wenn this einen
// Num-Typ hat, Fixed-Flag setzen, damit der Typ nicht veraendert wird
@@ -851,10 +858,10 @@ BOOL SbxValue::PutStringExt( const XubString& r )
BOOL SbxValue::PutString( const xub_Unicode* p )
{
- XubString aVal( p );
+ ::rtl::OUString aVal( p );
SbxValues aRes;
aRes.eType = SbxSTRING;
- aRes.pString = &aVal;
+ aRes.pOUString = &aVal;
Put( aRes );
return BOOL( !IsError() );
}
@@ -909,19 +916,19 @@ BOOL SbxValue::fillAutomationDecimal
BOOL SbxValue::PutpChar( const xub_Unicode* p )
{
- XubString aVal( p );
+ ::rtl::OUString aVal( p );
SbxValues aRes;
aRes.eType = SbxLPSTR;
- aRes.pString = &aVal;
+ aRes.pOUString = &aVal;
Put( aRes );
return BOOL( !IsError() );
}
-BOOL SbxValue::PutString( const XubString& r )
+BOOL SbxValue::PutString( const ::rtl::OUString& r )
{
SbxValues aRes;
aRes.eType = SbxSTRING;
- aRes.pString = (XubString*) &r;
+ aRes.pOUString = (::rtl::OUString*) &r;
Put( aRes );
return BOOL( !IsError() );
}
@@ -986,14 +993,14 @@ BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const
SbxDataType t = GetType();
if( t == SbxSTRING )
{
- if( aData.pString )
+ if( aData.pOUString )
{
- XubString s( *aData.pString );
+ ::rtl::OUString s( *aData.pOUString );
double n;
SbxDataType t2;
USHORT nLen = 0;
if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/FALSE, bOnlyIntntl ) == SbxERR_OK )
- return BOOL( nLen == s.Len() );
+ return BOOL( nLen == s.getLength() );
}
return FALSE;
}
@@ -1046,7 +1053,7 @@ BOOL SbxValue::SetType( SbxDataType t )
switch( aData.eType )
{
case SbxSTRING:
- delete aData.pString;
+ delete aData.pOUString;
break;
case SbxOBJECT:
if( aData.pObj && aData.pObj != this )
@@ -1163,14 +1170,14 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
Get( aL );
// #30576: Erstmal testen, ob Wandlung geklappt hat
- if( aL.pString != NULL && aR.pString != NULL )
+ if( aL.pOUString != NULL && aR.pOUString != NULL )
{
- *aL.pString += *aR.pString;
+ *aL.pOUString += *aR.pOUString;
}
// Nicht einmal Left OK?
- else if( aL.pString == NULL )
+ else if( aL.pOUString == NULL )
{
- aL.pString = new String();
+ aL.pOUString = new ::rtl::OUString();
}
Put( aL );
}
@@ -1493,17 +1500,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
if( Get( aL ) && rOp.Get( aR ) ) switch( eOp )
{
case SbxEQ:
- bRes = BOOL( *aL.pString == *aR.pString ); break;
+ bRes = BOOL( *aL.pOUString == *aR.pOUString ); break;
case SbxNE:
- bRes = BOOL( *aL.pString != *aR.pString ); break;
+ bRes = BOOL( *aL.pOUString != *aR.pOUString ); break;
case SbxLT:
- bRes = BOOL( *aL.pString < *aR.pString ); break;
+ bRes = BOOL( *aL.pOUString < *aR.pOUString ); break;
case SbxGT:
- bRes = BOOL( *aL.pString > *aR.pString ); break;
+ bRes = BOOL( *aL.pOUString > *aR.pOUString ); break;
case SbxLE:
- bRes = BOOL( *aL.pString <= *aR.pString ); break;
+ bRes = BOOL( *aL.pOUString <= *aR.pOUString ); break;
case SbxGE:
- bRes = BOOL( *aL.pString >= *aR.pString ); break;
+ bRes = BOOL( *aL.pOUString >= *aR.pOUString ); break;
default:
SetError( SbxERR_NOTIMP );
}
@@ -1668,9 +1675,9 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
XubString aVal;
r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
if( aVal.Len() )
- aData.pString = new XubString( aVal );
+ aData.pOUString = new ::rtl::OUString( aVal );
else
- aData.pString = NULL; // JSM 22.09.1995
+ aData.pOUString = NULL; // JSM 22.09.1995
break;
}
case SbxERROR:
@@ -1781,9 +1788,9 @@ BOOL SbxValue::StoreData( SvStream& r ) const
break;
}
case SbxSTRING:
- if( aData.pString )
+ if( aData.pOUString )
{
- r.WriteByteString( *aData.pString, RTL_TEXTENCODING_ASCII_US );
+ r.WriteByteString( *aData.pOUString, RTL_TEXTENCODING_ASCII_US );
}
else
{
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 69ae79cad5..4ce6eaf961 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -239,9 +239,9 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
if( i )
aTmp += ',';
if( q->nFlags & SBX_OPTIONAL )
- aTmp += SbxRes( STRING_OPTIONAL );
+ aTmp += String( SbxRes( STRING_OPTIONAL ) );
if( q->eType & SbxBYREF )
- aTmp += SbxRes( STRING_BYREF );
+ aTmp += String( SbxRes( STRING_BYREF ) );
aTmp += q->aName;
cType = ' ';
// Kurzer Typ? Dann holen, evtl. ist dieser 0.
@@ -263,12 +263,12 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
// langer Typ?
if( t != SbxNAME_SHORT )
{
- aTmp += SbxRes( STRING_AS );
+ aTmp += String( SbxRes( STRING_AS ) );
if( nt < 32 )
- aTmp += SbxRes(
- sal::static_int_cast< USHORT >( STRING_TYPES + nt ) );
+ aTmp += String( SbxRes(
+ sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ) );
else
- aTmp += SbxRes( STRING_ANY );
+ aTmp += String( SbxRes( STRING_ANY ) );
}
}
}
@@ -276,15 +276,15 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
// Langer Typ? Dann holen
if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
{
- aTmp += SbxRes( STRING_AS );
+ aTmp += String( SbxRes( STRING_AS ) );
if( et < 32 )
- aTmp += SbxRes(
- sal::static_int_cast< USHORT >( STRING_TYPES + et ) );
+ aTmp += String( SbxRes(
+ sal::static_int_cast< USHORT >( STRING_TYPES + et ) ) );
else
- aTmp += SbxRes( STRING_ANY );
+ aTmp += String( SbxRes( STRING_ANY ) );
}
- ((SbxVariable*) this)->aPic = aTmp;
- return aPic;
+ ((SbxVariable*) this)->aToolString = aTmp;
+ return aToolString;
}
// Einen simplen Hashcode erzeugen: Es werden die ersten 6 Zeichen gewertet.
@@ -431,9 +431,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD )
nType = SbxEMPTY;
SbxValues aTmp;
- XubString aVal;
+ String aTmpString;
+ ::rtl::OUString aVal;
aTmp.eType = aData.eType = (SbxDataType) nType;
- aTmp.pString = &aVal;
+ aTmp.pOUString = &aVal;
switch( nType )
{
case SbxBOOL:
@@ -445,10 +446,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
case SbxSINGLE:
{
// Floats als ASCII
- rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
+ rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
double d;
SbxDataType t;
- if( ImpScan( aVal, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE )
+ if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE )
{
aTmp.nSingle = 0;
return FALSE;
@@ -460,9 +461,9 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
case SbxDOUBLE:
{
// Floats als ASCII
- rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
+ rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
SbxDataType t;
- if( ImpScan( aVal, aTmp.nDouble, t, NULL ) != SbxERR_OK )
+ if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK )
{
aTmp.nDouble = 0;
return FALSE;
@@ -470,7 +471,8 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
break;
}
case SbxSTRING:
- rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
+ rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
+ aVal = aTmpString;
break;
case SbxEMPTY:
case SbxNULL:
diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx
index 79e122759f..37b46494c6 100644
--- a/configmgr/source/xcsparser.cxx
+++ b/configmgr/source/xcsparser.cxx
@@ -321,15 +321,19 @@ void XcsParser::endElement(XmlReader const & reader) {
} else {
switch (state_) {
case STATE_COMPONENT_SCHEMA:
+ // To support old, broken extensions with .xcs files that contain
+ // empty <component-schema> elements:
+ state_ = STATE_COMPONENT_DONE;
+ break;
+ case STATE_TEMPLATES:
+ state_ = STATE_TEMPLATES_DONE;
+ break;
case STATE_TEMPLATES_DONE:
throw css::uno::RuntimeException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("no component element in ")) +
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >());
- case STATE_TEMPLATES:
- state_ = STATE_TEMPLATES_DONE;
- break;
case STATE_COMPONENT_DONE:
break;
default:
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 1c13317c3b..510b16d8e0 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -134,6 +134,9 @@ class Desktop : public Application
static sal_Bool IsFirstStartWizardNeeded();
static sal_Bool CheckExtensionDependencies();
+ static void DoRestartActionsIfNecessary( sal_Bool bQuickStart );
+ static void SetRestartState();
+
void SynchronizeExtensionRepositories();
void SetSplashScreenText( const ::rtl::OUString& rText );
void SetSplashScreenProgress( sal_Int32 );
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 399d3aa64b..045970ea97 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1558,6 +1558,7 @@ void Desktop::Main()
std::auto_ptr<SvtLanguageOptions> pLanguageOptions;
std::auto_ptr<SvtPathOptions> pPathOptions;
+ Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
sal_Bool bRestartRequested( sal_False );
sal_Bool bUseSystemFileDialog(sal_True);
int nAcquireCount( 0 );
@@ -1761,7 +1762,6 @@ void Desktop::Main()
impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" );
- Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
{
::comphelper::ComponentContext aContext( xSMgr );
xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
@@ -1922,6 +1922,10 @@ void Desktop::Main()
// The configuration error handler currently is only for startup
aConfigErrHandler.deactivate();
+ // Acquire solar mutex just before we enter our message loop
+ if ( nAcquireCount )
+ Application::AcquireSolarMutex( nAcquireCount );
+
// call Application::Execute to process messages in vcl message loop
RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
@@ -1932,7 +1936,16 @@ void Desktop::Main()
com::sun::star::uno::ContextLayer layer2(
new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
- Execute();
+ // check whether the shutdown is caused by restart just before entering the Execute
+ bRestartRequested = bRestartRequested || ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
+ if ( !bRestartRequested )
+ {
+ // if this run of the office is triggered by restart, some additional actions should be done
+ DoRestartActionsIfNecessary( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoQuickstart() );
+
+ Execute();
+ }
}
catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
{
@@ -1946,6 +1959,9 @@ void Desktop::Main()
}
}
+ if ( bRestartRequested )
+ SetRestartState();
+
if (xGlobalBroadcaster.is())
{
css::document::EventObject aEvent;
diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx
index 9e2d865184..943f45de2b 100644
--- a/desktop/source/app/appfirststart.cxx
+++ b/desktop/source/app/appfirststart.cxx
@@ -36,12 +36,14 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
#include "app.hxx"
-using rtl::OUString;
-using namespace desktop;
-using namespace com::sun::star::beans;
+using ::rtl::OUString;
+using namespace ::desktop;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
@@ -128,24 +130,29 @@ sal_Bool Desktop::LicenseNeedsAcceptance()
*/
}
-/* Local function - was the wizard completed already? */
-static sal_Bool impl_isFirstStart()
+/* Local function - get access to the configuration */
+static Reference< XPropertySet > impl_getConfigurationAccess( const OUString& rPath )
{
- try {
- Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- // get configuration provider
- Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
- xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+ // get configuration provider
+ Reference< XMultiServiceFactory > xConfigProvider = Reference< XMultiServiceFactory >(
+ xFactory->createInstance( sConfigSrvc ), UNO_QUERY_THROW );
- Sequence< Any > theArgs(1);
- NamedValue v(OUString::createFromAscii("NodePath"), makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
- theArgs[0] <<= v;
+ Sequence< Any > aArgs( 1 );
+ NamedValue aValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NodePath" ) ), makeAny( rPath ) );
+ aArgs[0] <<= aValue;
+ return Reference< XPropertySet >(
+ xConfigProvider->createInstanceWithArguments( sAccessSrvc, aArgs ), UNO_QUERY_THROW );
+}
- Reference< XPropertySet > pset = Reference< XPropertySet >(
- theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
+/* Local function - was the wizard completed already? */
+static sal_Bool impl_isFirstStart()
+{
+ try {
+ Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
- Any result = pset->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"));
+ Any result = xPSet->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"));
sal_Bool bCompleted = sal_False;
if ((result >>= bCompleted) && bCompleted)
return sal_False; // wizard was already completed
@@ -219,20 +226,9 @@ static sal_Bool impl_isLicenseAccepted()
try
{
- Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-
- // get configuration provider
- Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
- xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+ Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
- Sequence< Any > theArgs(1);
- NamedValue v(OUString::createFromAscii("NodePath"),
- makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
- theArgs[0] <<= v;
- Reference< XPropertySet > pset = Reference< XPropertySet >(
- theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
-
- Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
+ Any result = xPSet->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
OUString aAcceptDate;
if (result >>= aAcceptDate)
@@ -272,3 +268,51 @@ sal_Bool Desktop::IsFirstStartWizardNeeded()
return impl_isFirstStart() || !impl_isLicenseAccepted();
}
+void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart )
+{
+ if ( bQuickStart )
+ {
+ try
+ {
+ Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
+
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) );
+ Any aRestart = xPSet->getPropertyValue( sPropName );
+ sal_Bool bRestart = sal_False;
+ if ( ( aRestart >>= bRestart ) && bRestart )
+ {
+ xPSet->setPropertyValue( sPropName, makeAny( sal_False ) );
+ Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
+
+ Sequence< Any > aSeq( 2 );
+ aSeq[0] <<= sal_True;
+ aSeq[1] <<= sal_True;
+
+ Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Quickstart" ) ) ),UNO_QUERY_THROW );
+ xQuickstart->initialize( aSeq );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ // this is no critical operation so it should not prevent office from starting
+ }
+ }
+}
+
+void Desktop::SetRestartState()
+{
+ try
+ {
+ Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) );
+ xPSet->setPropertyValue( sPropName, makeAny( sal_True ) );
+ Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
+ }
+ catch( uno::Exception& )
+ {
+ // this is no critical operation, ignore the exception
+ }
+
+}
+
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index a1a352ecb9..42a152e6c4 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -339,6 +339,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
p = desktop_win32::commandLineAppend(p, argv[i]);
}
}
+
p = desktop_win32::commandLineAppend(
p, MY_STRING(L"\" \"-env:OOO_CWD="));
if (cwdLen == 0) {
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index 87bf077bb2..651b232848 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -43,7 +43,7 @@
#include <editeng/wghtitem.hxx>
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
-
+#include <tools/tenccvt.hxx>
#define ACTION_INSERTTEXT 1
#define ACTION_INSERTPARABRK 2
@@ -66,6 +66,16 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValu
nNumberingLevel = 0;
bFieldsInserted = FALSE;
+ DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), "EditHTMLParser::EditHTMLParser: Where does the encoding come from?" );
+ DBG_ASSERT( !IsSwitchToUCS2(), "EditHTMLParser::::EditHTMLParser: Switch to UCS2?" );
+
+ // Altough the real default encoding is ISO8859-1, we use MS-1252
+ // als default encoding.
+ SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
+
+ // If the file starts with a BOM, switch to UCS2.
+ SetSwitchToUCS2( TRUE );
+
if ( pHTTPHeaderAttrs )
SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 9c425bc07c..709475a219 100755
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -51,6 +51,7 @@
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
#include <i18npool/lang.h>
#include <vos/ref.hxx>
@@ -1002,6 +1003,8 @@ public:
void SetAutoCompleteText( const String& rStr, sal_Bool bUpdateTipWindow );
EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
+ short ReplaceTextOnly( ContentNode* pNode, USHORT nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets );
+
void SetAsianCompressionMode( USHORT n );
USHORT GetAsianCompressionMode() const { return nAsianCompressionMode; }
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 9b09b563be..e15b7e7d1c 100755
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -76,6 +76,9 @@
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/linguistic2/XMeaning.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#include <unotools/transliterationwrapper.hxx>
#include <unotools/textsearch.hxx>
#include <comphelper/processfactory.hxx>
@@ -83,6 +86,8 @@
#include <svtools/rtfkeywd.hxx>
#include <editeng/edtdlg.hxx>
+#include <vector>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -2811,8 +2816,23 @@ void ImpEditEngine::SetAutoCompleteText( const String& rStr, sal_Bool bClearTipW
#endif // !SVX_LIGHT
}
+
+struct TransliterationChgData
+{
+ USHORT nStart;
+ xub_StrLen nLen;
+ EditSelection aSelection;
+ String aNewText;
+ uno::Sequence< sal_Int32 > aOffsets;
+};
+
+
EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode )
{
+ uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
+ if (!_xBI.is())
+ return rSelection;
+
EditSelection aSel( rSelection );
aSel.Adjust( aEditDoc );
@@ -2821,8 +2841,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
EditSelection aNewSel( aSel );
- USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
+ const USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
+ const USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
BOOL bChanges = FALSE;
BOOL bLenChanged = FALSE;
@@ -2845,83 +2865,266 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
USHORT nCurrentEnd = nEndPos;
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
- do
- {
- if ( bConsiderLanguage )
+ // since we don't use Hiragana/Katakana or half-width/full-width transliterations here
+ // it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will
+ // occasionaly miss words in consecutive sentences). Also with ANYWORD_IGNOREWHITESPACES
+ // text like 'just-in-time' will be converted to 'Just-In-Time' which seems to be the
+ // proper thing to do.
+ const sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES;
+
+ //! In order to have less trouble with changing text size, e.g. because
+ //! of ligatures or � (German small sz) being resolved, we need to process
+ //! the text replacements from end to start.
+ //! This way the offsets for the yet to be changed words will be
+ //! left unchanged by the already replaced text.
+ //! For this we temporarily save the changes to be done in this vector
+ std::vector< TransliterationChgData > aChanges;
+ TransliterationChgData aChgData;
+
+ if (nTransliterationMode == i18n::TransliterationModulesExtra::TITLE_CASE)
+ {
+ // for 'capitalize every word' we need to iterate over each word
+
+ i18n::Boundary aSttBndry;
+ i18n::Boundary aEndBndry;
+ aSttBndry = _xBI->getWordBoundary(
+ *pNode, nStartPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ),
+ nWordType, TRUE /*prefer forward direction*/);
+ aEndBndry = _xBI->getWordBoundary(
+ *pNode, nEndPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ),
+ nWordType, FALSE /*prefer backward direction*/);
+
+ // prevent backtracking to the previous word if selection is at word boundary
+ if (aSttBndry.endPos <= nStartPos)
+ {
+ aSttBndry = _xBI->nextWord(
+ *pNode, aSttBndry.endPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, aSttBndry.endPos + 1 ) ) ),
+ nWordType);
+ }
+ // prevent advancing to the next word if selection is at word boundary
+ if (aEndBndry.startPos >= nEndPos)
{
- nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd );
- if ( nCurrentEnd > nEndPos )
- nCurrentEnd = nEndPos;
+ aEndBndry = _xBI->previousWord(
+ *pNode, aEndBndry.startPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ),
+ nWordType);
}
- xub_StrLen nLen = nCurrentEnd - nCurrentStart;
+ i18n::Boundary aCurWordBndry( aSttBndry );
+ while (aCurWordBndry.startPos <= aEndBndry.startPos)
+ {
+ nCurrentStart = (xub_StrLen)aCurWordBndry.startPos;
+ nCurrentEnd = (xub_StrLen)aCurWordBndry.endPos;
+ sal_Int32 nLen = nCurrentEnd - nCurrentStart;
+ DBG_ASSERT( nLen > 0, "invalid word length of 0" );
+#if OSL_DEBUG_LEVEL > 1
+ String aText( pNode->Copy( nCurrentStart, nLen ) );
+#endif
+
+ Sequence< sal_Int32 > aOffsets;
+ String aNewText( aTranslitarationWrapper.transliterate( *pNode,
+ GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
+ nCurrentStart, nLen, &aOffsets ));
- Sequence <sal_Int32> aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) );
+ if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ {
+ aChgData.nStart = nCurrentStart;
+ aChgData.nLen = nLen;
+ aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
+ aChgData.aNewText = aNewText;
+ aChgData.aOffsets = aOffsets;
+ aChanges.push_back( aChgData );
+ }
+#if OSL_DEBUG_LEVEL > 1
+ String aSelTxt ( GetSelected( aChgData.aSelection ) );
+ (void) aSelTxt;
+#endif
- if( ( nLen != aNewText.Len() ) || !pNode->Equals( aNewText, nCurrentStart, nLen ) )
+ aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
+ nWordType);
+ }
+ DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" );
+ }
+ else if (nTransliterationMode == i18n::TransliterationModulesExtra::SENTENCE_CASE)
+ {
+ // for 'sentence case' we need to iterate sentence by sentence
+
+ sal_Int32 nLastStart = _xBI->beginOfSentence(
+ *pNode, nEndPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) );
+ sal_Int32 nLastEnd = _xBI->endOfSentence(
+ *pNode, nLastStart,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) );
+
+ // extend nCurrentStart, nCurrentEnd to the current sentence boundaries
+ nCurrentStart = _xBI->beginOfSentence(
+ *pNode, nStartPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) );
+ nCurrentEnd = _xBI->endOfSentence(
+ *pNode, nCurrentStart,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
+
+ // prevent backtracking to the previous sentence if selection starts at end of a sentence
+ if (nCurrentEnd <= nStartPos)
{
- bChanges = TRUE;
- if ( nLen != aNewText.Len() )
- bLenChanged = TRUE;
+ // now nCurrentStart is probably located on a non-letter word. (unless we
+ // are in Asian text with no spaces...)
+ // Thus to get the real sentence start we should locate the next real word,
+ // that is one found by DICTIONARY_WORD
+ i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
+ i18n::WordType::DICTIONARY_WORD);
+
+ // now get new current sentence boundaries
+ nCurrentStart = _xBI->beginOfSentence(
+ *pNode, aBndry.startPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
+ nCurrentEnd = _xBI->endOfSentence(
+ *pNode, nCurrentStart,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
+ }
+ // prevent advancing to the next sentence if selection ends at start of a sentence
+ if (nLastStart >= nEndPos)
+ {
+ // now nCurrentStart is probably located on a non-letter word. (unless we
+ // are in Asian text with no spaces...)
+ // Thus to get the real sentence start we should locate the previous real word,
+ // that is one found by DICTIONARY_WORD
+ i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ),
+ i18n::WordType::DICTIONARY_WORD);
+ nLastEnd = _xBI->endOfSentence(
+ *pNode, aBndry.startPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
+ if (nCurrentEnd > nLastEnd)
+ nCurrentEnd = nLastEnd;
+ }
-#ifndef SVX_LIGHT
- // Create UndoAction on Demand....
- if ( !pUndo && IsUndoEnabled() && !IsInUndo() )
- {
- ESelection aESel( CreateESel( aSel ) );
- pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode );
+ while (nCurrentStart < nLastEnd)
+ {
+ sal_Int32 nLen = nCurrentEnd - nCurrentStart;
+ DBG_ASSERT( nLen > 0, "invalid word length of 0" );
+#if OSL_DEBUG_LEVEL > 1
+ String aText( pNode->Copy( nCurrentStart, nLen ) );
+#endif
- if ( ( nStartNode == nEndNode ) && !aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() ) )
- pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) );
- else
- pUndo->SetText( CreateBinTextObject( aSel, NULL ) );
+ Sequence< sal_Int32 > aOffsets;
+ String aNewText( aTranslitarationWrapper.transliterate( *pNode,
+ GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
+ nCurrentStart, nLen, &aOffsets ));
+
+ if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ {
+ aChgData.nStart = nCurrentStart;
+ aChgData.nLen = nLen;
+ aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
+ aChgData.aNewText = aNewText;
+ aChgData.aOffsets = aOffsets;
+ aChanges.push_back( aChgData );
}
-#endif
- // Change text without loosing the attributes
- USHORT nCharsAfterTransliteration =
- sal::static_int_cast< USHORT >(aOffsets.getLength());
- const sal_Int32* pOffsets = aOffsets.getConstArray();
- short nDiffs = 0;
- for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ )
+ i18n::Boundary aFirstWordBndry;
+ aFirstWordBndry = _xBI->nextWord(
+ *pNode, nCurrentEnd,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
+ nWordType);
+ nCurrentStart = aFirstWordBndry.startPos;
+ nCurrentEnd = _xBI->endOfSentence(
+ *pNode, nCurrentStart,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
+ }
+ DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" );
+ }
+ else
+ {
+ do
+ {
+ if ( bConsiderLanguage )
{
- USHORT nCurrentPos = nCurrentStart+n;
- sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n];
+ nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd );
+ if ( nCurrentEnd > nEndPos )
+ nCurrentEnd = nEndPos;
+ }
- if ( !nDiff )
- {
- DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
- pNode->SetChar( nCurrentPos, aNewText.GetChar(n) );
- }
- else if ( nDiff < 0 )
- {
- // Replace first char, delete the rest...
- DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
- pNode->SetChar( nCurrentPos, aNewText.GetChar(n) );
+ xub_StrLen nLen = nCurrentEnd - nCurrentStart;
- DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" );
- GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) );
- }
- else
- {
- DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." );
- GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), aNewText.GetChar(n) );
+ Sequence< sal_Int32 > aOffsets;
+ String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) );
- }
- nDiffs = sal::static_int_cast< short >(nDiffs + nDiff);
+ if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ {
+ aChgData.nStart = nCurrentStart;
+ aChgData.nLen = nLen;
+ aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
+ aChgData.aNewText = aNewText;
+ aChgData.aOffsets = aOffsets;
+ aChanges.push_back( aChgData );
}
- if ( nNode == nEndNode )
- aNewSel.Max().GetIndex() =
- aNewSel.Max().GetIndex() + nDiffs;
+ nCurrentStart = nCurrentEnd;
+ } while( nCurrentEnd < nEndPos );
+ }
- ParaPortion* pParaPortion = GetParaPortions()[nNode];
- pParaPortion->MarkSelectionInvalid( nCurrentStart, std::max< USHORT >( nCurrentStart+nLen, nCurrentStart+aNewText.Len() ) );
+ if (aChanges.size() > 0)
+ {
+#ifndef SVX_LIGHT
+ // Create a single UndoAction on Demand for all the changes ...
+ if ( !pUndo && IsUndoEnabled() && !IsInUndo() )
+ {
+ // adjust selection to include all changes
+ for (size_t i = 0; i < aChanges.size(); ++i)
+ {
+ const EditSelection &rSel = aChanges[i].aSelection;
+ if (aSel.Min().GetNode() == rSel.Min().GetNode() &&
+ aSel.Min().GetIndex() > rSel.Min().GetIndex())
+ aSel.Min().SetIndex( rSel.Min().GetIndex() );
+ if (aSel.Max().GetNode() == rSel.Max().GetNode() &&
+ aSel.Max().GetIndex() < rSel.Max().GetIndex())
+ aSel.Max().SetIndex( rSel.Max().GetIndex() );
+ }
+ aNewSel = aSel;
+
+ ESelection aESel( CreateESel( aSel ) );
+ pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode );
+ const bool bSingleNode = aSel.Min().GetNode()== aSel.Max().GetNode();
+ const bool bHasAttribs = aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() );
+ if (bSingleNode && !bHasAttribs)
+ pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) );
+ else
+ pUndo->SetText( CreateBinTextObject( aSel, NULL ) );
}
- nCurrentStart = nCurrentEnd;
- } while( nCurrentEnd < nEndPos );
+#endif
+
+ // now apply the changes from end to start to leave the offsets of the
+ // yet unchanged text parts remain the same.
+ for (size_t i = 0; i < aChanges.size(); ++i)
+ {
+ const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ];
+
+ bChanges = TRUE;
+ if (rData.nLen != rData.aNewText.Len())
+ bLenChanged = TRUE;
+
+ // Change text without loosing the attributes
+ USHORT nDiffs = ReplaceTextOnly( rData.aSelection.Min().GetNode(),
+ rData.nStart, rData.nLen, rData.aNewText, rData.aOffsets );
+
+ // adjust selection in end node to possibly changed size
+ if (aSel.Max().GetNode() == rData.aSelection.Max().GetNode())
+ aNewSel.Max().GetIndex() = aNewSel.Max().GetIndex() + nDiffs;
+
+ USHORT nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() );
+ ParaPortion* pParaPortion = GetParaPortions()[nSelNode];
+ pParaPortion->MarkSelectionInvalid( rData.nStart,
+ std::max< USHORT >( rData.nStart + rData.nLen,
+ rData.nStart + rData.aNewText.Len() ) );
+ }
+ } // if (aChanges.size() > 0)
}
#ifndef SVX_LIGHT
@@ -2945,6 +3148,52 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
return aNewSel;
}
+
+short ImpEditEngine::ReplaceTextOnly(
+ ContentNode* pNode,
+ USHORT nCurrentStart, xub_StrLen nLen,
+ const String& rNewText,
+ const uno::Sequence< sal_Int32 >& rOffsets )
+{
+ (void) nLen;
+
+ // Change text without loosing the attributes
+ USHORT nCharsAfterTransliteration =
+ sal::static_int_cast< USHORT >(rOffsets.getLength());
+ const sal_Int32* pOffsets = rOffsets.getConstArray();
+ short nDiffs = 0;
+ for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ )
+ {
+ USHORT nCurrentPos = nCurrentStart+n;
+ sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n];
+
+ if ( !nDiff )
+ {
+ DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
+ pNode->SetChar( nCurrentPos, rNewText.GetChar(n) );
+ }
+ else if ( nDiff < 0 )
+ {
+ // Replace first char, delete the rest...
+ DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
+ pNode->SetChar( nCurrentPos, rNewText.GetChar(n) );
+
+ DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" );
+ GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) );
+ }
+ else
+ {
+ DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." );
+ GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), rNewText.GetChar(n) );
+
+ }
+ nDiffs = sal::static_int_cast< short >(nDiffs + nDiff);
+ }
+
+ return nDiffs;
+}
+
+
void ImpEditEngine::SetAsianCompressionMode( USHORT n )
{
if ( n != nAsianCompressionMode )
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 78edae142d..8eea009a4e 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1243,27 +1243,25 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
{
// Remove the NBSP if it wasn't an autocorrection
- if ( NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
+ if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK )
{
// Look for the last HARD_SPACE
xub_StrLen nPos = nInsPos - 1;
- bool bFound = false;
- while ( nPos != STRING_NOTFOUND && !bFound )
+ bool bContinue = true;
+ while ( bContinue )
{
- sal_Unicode cTmpChar = rTxt.GetChar( nPos );
+ const sal_Unicode cTmpChar = rTxt.GetChar( nPos );
if ( cTmpChar == CHAR_HARDBLANK )
- bFound = true;
- else if ( !NeedsHardspaceAutocorr( cTmpChar ) )
- nPos = STRING_NOTFOUND;
+ {
+ rDoc.Delete( nPos, nPos + 1 );
+ nRet = AddNonBrkSpace;
+ bContinue = false;
+ }
+ else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 )
+ bContinue = false;
nPos--;
}
-
- if ( bFound && nPos != STRING_NOTFOUND )
- {
- rDoc.Delete( nPos + 1, nPos + 2 );
- nRet = AddNonBrkSpace;
- }
}
}
}
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 392b98eb6e..68683df34c 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -103,6 +103,7 @@
#include <unotools/moduleoptions.hxx>
#include <svtools/sfxecode.hxx>
#include <unotools/processfactory.hxx>
+#include <unotools/ucbhelper.hxx>
#include <comphelper/configurationhelper.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
@@ -1407,7 +1408,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
// don't check the complete URL here.
// use its main part - ignore optional jumpmarks!
const ::rtl::OUString sURL = xModel->getURL();
- if (!m_aURL.Main.equals(sURL))
+ if (!::utl::UCBContentHelper::EqualURLs( m_aURL.Main, sURL ))
{
xTask.clear ();
continue;
diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs
index 76c4bb1778..62d3fdcce8 100644
--- a/officecfg/registry/schema/org/openoffice/Setup.xcs
+++ b/officecfg/registry/schema/org/openoffice/Setup.xcs
@@ -395,7 +395,14 @@
<author>AS</author>
<desc>Contains all of the document factories that were installed during setup.</desc>
</info>
- </set>
+ </set>
+ <prop oor:name="OfficeRestartInProgress" oor:type="xs:boolean">
+ <info>
+ <author>MAV</author>
+ <desc>The entry specifies that we are in restart process</desc>
+ </info>
+ <value>false</value>
+ </prop>
</group>
<group oor:name="L10N">
<info>
diff --git a/oovbaapi/ooo/vba/excel/XGlobals.idl b/oovbaapi/ooo/vba/excel/XGlobals.idl
index c54740a613..ad9d85eb45 100644
--- a/oovbaapi/ooo/vba/excel/XGlobals.idl
+++ b/oovbaapi/ooo/vba/excel/XGlobals.idl
@@ -42,6 +42,10 @@
#ifndef __ooo_vba_XAssistant_idl__
#include <ooo/vba/XAssistant.idl>
#endif
+#ifndef __ooo_vba_excel_XApplication_idl__
+#include <ooo/vba/excel/XApplication.idl>
+#endif
+
module ooo { module vba { module excel {
interface XRange;
@@ -55,6 +59,9 @@ interface XGlobals: com::sun::star::uno::XInterface
[attribute, readonly] ooo::vba::XAssistant Assistant;
[attribute, readonly] any Selection;
[attribute, readonly] XWorkbook ThisWorkbook;
+ [attribute, readonly] ooo::vba::excel::XApplication Excel;
+ [attribute, readonly] any Debug;
+
void Calculate() raises(com::sun::star::script::BasicErrorException);
XRange Cells([in] any RowIndex, [in] any ColumnIndex);
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index 07e9f23d4b..a6d86957ec 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -66,13 +66,15 @@ interface XWorksheet
[attribute, readonly] boolean ProtectionMode;
[attribute, readonly] boolean ProtectContents;
[attribute, readonly] boolean ProtectDrawingObjects;
- [attribute, readonly] XRange UsedRange;
+ [attribute, readonly] boolean ProtectScenarios;
+ [attribute, readonly] XRange UsedRange;
[attribute, readonly] XWorksheet Next;
[attribute, readonly] XWorksheet Previous;
[attribute, readonly] string CodeName;
[attribute, readonly] short Index;
[attribute] long EnableSelection;
-
+ [attribute] boolean AutoFilterMode;
+
void Activate();
void Calculate( );
void Select();
diff --git a/scripting/source/basprov/basmodnode.cxx b/scripting/source/basprov/basmodnode.cxx
index 687fea3584..f56bc33519 100644
--- a/scripting/source/basprov/basmodnode.cxx
+++ b/scripting/source/basprov/basmodnode.cxx
@@ -97,14 +97,22 @@ namespace basprov
if ( pMethods )
{
sal_Int32 nCount = pMethods->Count();
- aChildNodes.realloc( nCount );
+ sal_Int32 nRealCount = 0;
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< USHORT >( i ) ) );
+ if ( pMethod && !pMethod->IsHidden() )
+ ++nRealCount;
+ }
+ aChildNodes.realloc( nRealCount );
Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
+ sal_Int32 iTarget = 0;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< USHORT >( i ) ) );
- if ( pMethod )
- pChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) );
+ if ( pMethod && !pMethod->IsHidden() )
+ pChildNodes[iTarget++] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) );
}
}
}
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index c616371276..f02394e11d 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -412,7 +412,7 @@ namespace basprov
if ( pMethods )
{
SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( aMethod, SbxCLASS_METHOD ) );
- if ( pMethod )
+ if ( pMethod && !pMethod->IsHidden() )
{
if ( m_pDocBasicManager == pBasicMgr )
xScript = new BasicScriptImpl( aDescription, pMethod, *m_pDocBasicManager, m_xInvocationContext );
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index cd43e0989d..f53d438267 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -323,7 +323,6 @@ public:
static com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag > GetVersionList(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
- static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL );
static ::rtl::OUString CreateTempCopyWithExt( const ::rtl::OUString& aURL );
static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort );
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index bf6782ef7e..5336b5cfe5 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -45,6 +45,8 @@
#include <rtl/uuid.h>
#include <rtl/ustrbuf.hxx>
+#include <rtl/uri.hxx>
+#include <rtl/bootstrap.hxx>
#include <comphelper/interaction.hxx>
#include <comphelper/makesequence.hxx>
@@ -136,6 +138,24 @@ uno::Reference<rdf::XURI> createBaseURI(
throw uno::RuntimeException();
}
+ // #i108078# workaround non-hierarchical vnd.sun.star.expand URIs
+ // this really should be done somewhere else, not here.
+ ::rtl::OUString pkgURI(i_rPkgURI);
+ if (pkgURI.matchIgnoreAsciiCaseAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:")))
+ {
+ // expand it here (makeAbsolute requires hierarchical URI)
+ pkgURI = pkgURI.copy( RTL_CONSTASCII_LENGTH("vnd.sun.star.expand:") );
+ if (pkgURI.getLength() != 0) {
+ pkgURI = ::rtl::Uri::decode(
+ pkgURI, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8);
+ if (pkgURI.getLength() == 0) {
+ throw uno::RuntimeException();
+ }
+ ::rtl::Bootstrap::expandMacros(pkgURI);
+ }
+ }
+
const uno::Reference<lang::XMultiComponentFactory> xServiceFactory(
i_xContext->getServiceManager(), uno::UNO_SET_THROW);
const uno::Reference<uri::XUriReferenceFactory> xUriFactory(
@@ -146,11 +166,12 @@ uno::Reference<rdf::XURI> createBaseURI(
uno::Reference< uri::XUriReference > xBaseURI;
const uno::Reference< uri::XUriReference > xPkgURI(
- xUriFactory->parse(i_rPkgURI), uno::UNO_SET_THROW );
+ xUriFactory->parse(pkgURI), uno::UNO_SET_THROW );
xPkgURI->clearFragment();
+
// need to know whether the storage is a FileSystemStorage
// XServiceInfo would be better, but it is not implemented
-// if ( i_rPkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(i_rPkgURI) )
+// if ( pkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(pkgURI) )
if (true) {
xBaseURI.set( xPkgURI, uno::UNO_SET_THROW );
#if 0
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 43d98d1c04..f0d3511716 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3717,53 +3717,6 @@ void SfxMedium::SetCachedSignatureState_Impl( sal_uInt16 nState )
pImp->m_nSignatureState = nState;
}
-//----------------------------------------------------------------
-sal_Bool SfxMedium::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL )
-{
- sal_Bool bResult = sal_False;
-
- if ( aFirstURL.getLength() && aSecondURL.getLength() )
- {
- INetURLObject aFirst( aFirstURL );
- INetURLObject aSecond( aSecondURL );
-
- if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID )
- {
- try
- {
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
- throw uno::RuntimeException();
-
- uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac
- = pBroker->getContentIdentifierFactoryInterface();
- if ( !xIdFac.is() )
- throw uno::RuntimeException();
-
- uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst
- = xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) );
- uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond
- = xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) );
-
- if ( xIdFirst.is() && xIdSecond.is() )
- {
- uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider =
- pBroker->getContentProviderInterface();
- if ( !xProvider.is() )
- throw uno::RuntimeException();
- bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond );
- }
- }
- catch( uno::Exception& )
- {
- OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" );
- }
- }
- }
-
- return bResult;
-}
-
BOOL SfxMedium::HasStorage_Impl() const
{
return pImp->xStorage.is();
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 72fe259c12..879e1b534e 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -1919,7 +1919,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
aStoreArgs[1].Value <<= rTemplateName;
::rtl::OUString aCurrentDocumentURL = rStorable->getLocation();
- if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
+ if( !::utl::UCBContentHelper::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs );
else
rStorable->store();
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 5b91b31fcf..343f880581 100755
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -732,7 +732,7 @@ void SfxObjectShell::FreeSharedFile( const ::rtl::OUString& aTempFileURL )
SetSharedXMLFlag( sal_False );
if ( IsDocShared() && aTempFileURL.getLength()
- && !SfxMedium::EqualURLs( aTempFileURL, GetSharedFileURL() ) )
+ && !::utl::UCBContentHelper::EqualURLs( aTempFileURL, GetSharedFileURL() ) )
{
if ( pImp->m_bAllowShareControlFileClean )
{
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index ac048a24e2..c38049073e 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1189,7 +1189,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( pMedium
&& pMedium->GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL
&& rMedium.GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL
- && SfxMedium::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
+ && ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
{
bStoreToSameLocation = sal_True;
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save" ) ) );
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 8122e61147..9aa9749ca0 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -95,6 +95,7 @@
#include <framework/titlehelper.hxx>
#include <comphelper/numberedcollection.hxx>
#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/ucbhelper.hxx>
//________________________________________________________________________________________________________
// includes of my own project
@@ -2648,7 +2649,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
sal_Bool bSaved = sal_False;
if ( !bSaveTo && m_pData->m_pObjectShell && sURL.getLength()
&& sURL.compareToAscii( "private:stream", 14 ) != COMPARE_EQUAL
- && SfxMedium::EqualURLs( getLocation(), sURL ) )
+ && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) )
{
// this is the same file URL as the current document location, try to use storeOwn if possible
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index 538360899e..77c5338442 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -90,6 +90,13 @@ namespace ooo
VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection );
VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* );
+ /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value.
+ Returns false, if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC bool extractBoolFromAny( bool& rbValue, const css::uno::Any& rAny );
+ /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value.
+ Throws, if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC bool extractBoolFromAny( const css::uno::Any& rAny ) throw (css::uno::RuntimeException);
+
VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 12422bc559..33e357b00c 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -153,28 +153,41 @@ void SAL_CALL
ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
{
uno::Any aObject = getValue( aPropertyName );
- // The Object *must* support XDefaultProperty here because getValue will
- // only return properties that are Objects ( e.g. controls )
- // e.g. Userform1.aControl = something
- // 'aControl' has to support XDefaultProperty to make sense here
- uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW );
- rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName();
- uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) );
- uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW );
- xPropSet->setPropertyValue( aDfltPropName, aValue );
+
+ // in case the dialog is already closed the VBA implementation should not throw exceptions
+ if ( aObject.hasValue() )
+ {
+ // The Object *must* support XDefaultProperty here because getValue will
+ // only return properties that are Objects ( e.g. controls )
+ // e.g. Userform1.aControl = something
+ // 'aControl' has to support XDefaultProperty to make sense here
+ uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW );
+ rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName();
+ uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) );
+ uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( aDfltPropName, aValue );
+ }
}
uno::Any SAL_CALL
ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
{
- uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
- uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
- uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
- ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
- uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
- return uno::makeAny( xVBAControl );
+ uno::Any aResult;
+
+ // in case the dialog is already closed the VBA implementation should not throw exceptions
+ if ( m_xDialog.is() )
+ {
+ uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
+ ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
+ uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
+ ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
+ pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
+ aResult = uno::makeAny( xVBAControl );
+ }
+
+ return aResult;
}
::sal_Bool SAL_CALL
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 86d8e478cd..cf1981fa8f 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -625,6 +625,30 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
dispatchExecute( pViewShell, SID_VIEWSHELL1 );
}
+bool extractBoolFromAny( bool& rbValue, const uno::Any& rAny )
+{
+ if( rAny >>= rbValue ) return true;
+
+ sal_Int64 nSigned = 0;
+ if( rAny >>= nSigned ) { rbValue = nSigned != 0; return true; }
+
+ sal_uInt64 nUnsigned = 0;
+ if( rAny >>= nUnsigned ) { rbValue = nUnsigned > 0; return true; }
+
+ double fDouble = 0.0;
+ if( rAny >>= fDouble ) { rbValue = fDouble != 0.0; return true; }
+
+ return false;
+}
+
+bool extractBoolFromAny( const uno::Any& rAny ) throw (uno::RuntimeException)
+{
+ bool bValue = false;
+ if( extractBoolFromAny( bValue, rAny ) )
+ return bValue;
+ throw uno::RuntimeException();
+}
+
rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
{
uno::Type aType = pvargItem.getValueType();