From 9066ef90e6707477488cce9b18d3e28613f336e2 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 17 Sep 2009 14:29:05 +0000 Subject: CWS-TOOLING: integrate CWS ab74 2009-09-10 10:13:43 +0200 jsk r276023 : Test Cases for #i103691, #i103697, #i103990 2009-09-03 15:42:36 +0200 ab r275754 : #i103990# Removed warning 2009-09-03 09:02:32 +0200 ab r275744 : CWS-TOOLING: rebase CWS ab74 to trunk@275331 (milestone: DEV300:m56) 2009-09-02 17:14:42 +0200 ab r275724 : #i103697# Applied patch 2009-08-27 15:11:50 +0200 ab r275488 : #i103354# Check Lucene index file to be named _0.cfs, fail otherwise 2009-08-26 08:57:21 +0200 ab r275393 : #i104354# Changed loop variable type to avoid Solaris Intel compiler optimizer bug 2009-08-17 14:17:32 +0200 ab r275053 : #i73263# Adapted breakpoint dialog to longer strings 2009-08-13 17:09:30 +0200 ab r274951 : #i103691# Fix empty comparison behaviour 2009-08-13 13:03:28 +0200 ab r274935 : #i103948# Applied patch 2009-08-13 12:31:15 +0200 ab r274931 : #i103134# Patch: Always set default property 2009-08-13 11:02:50 +0200 ab r274926 : #i103990# Support arrays in user types 2009-07-21 11:16:54 +0200 ab r274171 : #i102816# Make sure LocaleItem is loaded before copying from it 2009-07-20 14:56:35 +0200 ab r274139 : #i102816# Use default language as final fallback in service implementation --- basic/source/classes/sb.cxx | 27 ++++++++++ basic/source/classes/sbunoobj.cxx | 6 ++- basic/source/comp/dim.cxx | 63 ++++++++++++++++++---- basic/source/inc/expr.hxx | 1 + basic/source/inc/parser.hxx | 1 + basic/source/runtime/methods1.cxx | 7 ++- basic/source/sbx/sbxvalue.cxx | 2 +- eventattacher/source/eventattacher.cxx | 2 +- scripting/source/stringresource/stringresource.cxx | 20 +++++-- scripting/source/stringresource/stringresource.hxx | 3 ++ 10 files changed, 114 insertions(+), 18 deletions(-) diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 4f123c2e23..6b22b4f280 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -303,6 +303,33 @@ SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj ) if( pProp ) { SbxProperty* pNewProp = new SbxProperty( *pProp ); + if( pVar->GetType() & SbxARRAY ) + { + SbxBase* pParObj = pVar->GetObject(); + SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj); + SbxDimArray* pDest = new SbxDimArray( pVar->GetType() ); + INT32 lb = 0; + INT32 ub = 0; + + pDest->setHasFixedSize( pSource->hasFixedSize() ); + if ( pSource->GetDims() && pSource->hasFixedSize() ) + { + for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j ) + { + pSource->GetDim32( (INT32)j, lb, ub ); + pDest->AddDim32( lb, ub ); + } + } + else + pDest->unoAddDim( 0, -1 ); // variant array + + USHORT nSavFlags = pVar->GetFlags(); + pNewProp->ResetFlag( SBX_FIXED ); + // need to reset the FIXED flag + // when calling PutObject ( because the type will not match Object ) + pNewProp->PutObject( pDest ); + pNewProp->SetFlags( nSavFlags ); + } pProps->PutDirect( pNewProp, i ); } } diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 96794c067f..8ee3df992e 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -750,7 +750,11 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) // SbUnoObject instanzieren String aName; SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue ); - if ( SbiRuntime::isVBAEnabled() ) + //If this is called externally e.g. from the scripting + //framework then there is no 'active' runtime the default property will not be set up + //only a vba object will have XDefaultProp set anyway so... this + //test seems a bit of overkill + //if ( SbiRuntime::isVBAEnabled() ) { String sDfltPropName; diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index b6c95c5748..dfb9637d06 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -212,7 +212,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) // #110004 It can also be a sub/function if( !bConst && (eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY || - eCurTok == STATIC || eCurTok == ENUM ) ) + eCurTok == STATIC || eCurTok == ENUM || eCurTok == DECLARE) ) { // Next token is read here, because !bConst bool bPrivate = ( eFirstTok == PRIVATE ); @@ -241,6 +241,12 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) DefEnum( bPrivate ); return; } + else if( eCurTok == DECLARE ) + { + Next(); + DefDeclare( bPrivate ); + return; + } } #ifdef SHARED @@ -546,7 +552,7 @@ void SbiParser::DefType( BOOL bPrivate ) SbxObject *pType = new SbxObject(aSym); SbiSymDef* pElem; - SbiDimList* pDim; + SbiDimList* pDim = NULL; BOOL bDone = FALSE; while( !bDone && !IsEof() ) @@ -570,13 +576,6 @@ void SbiParser::DefType( BOOL bPrivate ) pElem = VarDecl(&pDim,FALSE,FALSE); if( !pElem ) bDone = TRUE; // Error occured - if( pDim ) - { - // HOT FIX, to be updated - delete pDim; - Error( SbERR_NO_STRINGS_ARRAYS ); - } - } if( pElem ) { @@ -586,6 +585,43 @@ void SbiParser::DefType( BOOL bPrivate ) else { SbxProperty *pTypeElem = new SbxProperty (pElem->GetName(),pElem->GetType()); + if( pDim ) + { + SbxDimArray* pArray = new SbxDimArray( pElem->GetType() ); + if ( pDim->GetSize() ) + { + // Dimension the target array + + for ( short i=0; iGetSize();++i ) + { + INT32 ub = -1; + INT32 lb = nBase; + SbiExprNode* pNode = pDim->Get(i)->GetExprNode(); + ub = pNode->GetNumber(); + if ( !pDim->Get( i )->IsBased() ) // each dim is low/up + { + if ( ++i >= pDim->GetSize() ) // trouble + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + pNode = pDim->Get(i)->GetExprNode(); + lb = ub; + ub = pNode->GetNumber(); + } + else if ( !bCompatible ) + ub += nBase; + pArray->AddDim32( lb, ub ); + } + pArray->setHasFixedSize( true ); + } + else + pArray->unoAddDim( 0, -1 ); // variant array + USHORT nSavFlags = pTypeElem->GetFlags(); + // need to reset the FIXED flag + // when calling PutObject ( because the type will not match Object ) + pTypeElem->ResetFlag( SBX_FIXED ); + pTypeElem->PutObject( pArray ); + pTypeElem->SetFlags( nSavFlags ); + } + delete pDim; pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() ); } delete pElem; @@ -872,6 +908,11 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) void SbiParser::Declare() { + DefDeclare( FALSE ); +} + +void SbiParser::DefDeclare( BOOL bPrivate ) +{ Next(); if( eCurTok != SUB && eCurTok != FUNCTION ) Error( SbERR_UNEXPECTED, eCurTok ); @@ -892,12 +933,16 @@ void SbiParser::Declare() // Als Variable deklariert Error( SbERR_BAD_DECLARATION, pDef->GetName() ); delete pDef; + pDef = NULL; } else pDef->Match( p ); } else aPublics.Add( pDef ); + + if ( pDef ) + pDef->SetPublic( !bPrivate ); } } } diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 948ba9f5d2..b41d5aba30 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -144,6 +144,7 @@ public: SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z short GetDepth(); // Tiefe eines Baumes berechnen const String& GetString() { return aStrVal; } + short GetNumber() { return (short)nVal; } SbiExprList* GetParameters() { return aVar.pPar; } SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; } diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx index a12a8690dd..8c00ca2592 100644 --- a/basic/source/inc/parser.hxx +++ b/basic/source/inc/parser.hxx @@ -66,6 +66,7 @@ class SbiParser : public SbiTokenizer void StmntBlock( SbiToken ); // Statement-Block abarbeiten void DefType( BOOL bPrivate ); // Parse type declaration void DefEnum( BOOL bPrivate ); // Parse enum declaration + void DefDeclare( BOOL bPrivate ); void EnableCompatibility(); public: SbxArrayRef rTypeArray; // das Type-Array diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 350eec59c8..08a94feefc 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -662,12 +662,15 @@ RTLFUNC(Array) } // Parameter ins Array uebernehmen - for( short i = 0 ; i < nArraySize ; i++ ) + // ATTENTION: Using type USHORT for loop variable is + // mandatory to workaround a problem with the + // Solaris Intel compiler optimizer! See i104354 + for( USHORT i = 0 ; i < nArraySize ; i++ ) { SbxVariable* pVar = rPar.Get(i+1); SbxVariable* pNew = new SbxVariable( *pVar ); pNew->SetFlag( SBX_WRITE ); - short index = i; + short index = static_cast< short >(i); if ( bIncIndex ) ++index; pArray->Put( pNew, &index ); diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index e746f3d115..4779a85443 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -1470,7 +1470,7 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const bRes = TRUE; } else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY ) - bRes = TRUE; + bRes = !bVBAInterop ? TRUE : ( eOp == SbxEQ ? TRUE : FALSE ); // Sonderregel 1: Ist ein Operand Null, ist das Ergebnis FALSE else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL ) bRes = FALSE; diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 2cce29fc11..c55ca4a8c4 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -882,7 +882,7 @@ void * SAL_CALL component_getFactory( { Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString( RTL_CONSTASCII_USTRINGPARAM( pImplName ) ), + OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ), ::comp_EventAttacher::EventAttacherImpl_CreateInstance, ::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static() ) ); diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 55fbed2ab6..82f63b0fe9 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -359,8 +359,9 @@ sal_Bool StringResourceImpl::isReadOnly() return m_bReadOnly; } -void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindClosestMatch ) - throw (IllegalArgumentException, RuntimeException) +void StringResourceImpl::implSetCurrentLocale( const Locale& locale, + sal_Bool FindClosestMatch, sal_Bool bUseDefaultIfNoMatch ) + throw (IllegalArgumentException, RuntimeException) { ::osl::MutexGuard aGuard( getMutex() ); @@ -370,6 +371,9 @@ void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindCl else pLocaleItem = getItemForLocale( locale, true ); + if( pLocaleItem == NULL && bUseDefaultIfNoMatch ) + pLocaleItem = m_pDefaultLocaleItem; + if( pLocaleItem != NULL ) { loadLocale( pLocaleItem ); @@ -380,6 +384,13 @@ void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindCl } } +void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindClosestMatch ) + throw (IllegalArgumentException, RuntimeException) +{ + sal_Bool bUseDefaultIfNoMatch = false; + implSetCurrentLocale( locale, FindClosestMatch, bUseDefaultIfNoMatch ); +} + void StringResourceImpl::setDefaultLocale( const Locale& locale ) throw (IllegalArgumentException, RuntimeException,NoSupportException) { @@ -500,7 +511,7 @@ void StringResourceImpl::newLocale( const Locale& locale ) LocaleItem* pCopyFromItem = m_pDefaultLocaleItem; if( pCopyFromItem == NULL ) pCopyFromItem = m_pCurrentLocaleItem; - if( pCopyFromItem != NULL ) + if( pCopyFromItem != NULL && loadLocale( pCopyFromItem ) ) { const IdToStringMap& rSourceMap = pCopyFromItem->m_aIdToStringMap; IdToStringMap& rTargetMap = pLocaleItem->m_aIdToStringMap; @@ -863,7 +874,8 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters implScanLocales(); sal_Bool FindClosestMatch = true; - setCurrentLocale( aCurrentLocale, FindClosestMatch ); + sal_Bool bUseDefaultIfNoMatch = true; + implSetCurrentLocale( aCurrentLocale, FindClosestMatch, bUseDefaultIfNoMatch ); } // ----------------------------------------------------------------------------- diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index 2d21c46b75..62756e48aa 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -169,6 +169,9 @@ protected: // Returns the LocalItem for a given locale, if it exists, otherwise NULL // This method performes a closest match search, at least the language must match LocaleItem* getClosestMatchItemForLocale( const ::com::sun::star::lang::Locale& locale ); + void implSetCurrentLocale( const ::com::sun::star::lang::Locale& locale, + sal_Bool FindClosestMatch, sal_Bool bUseDefaultIfNoMatch ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); void implModified( void ); void implNotifyListeners( void ); -- cgit v1.2.3