diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2011-01-19 12:16:23 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2011-01-19 12:16:23 +0100 |
commit | 81744e6bbf0f5f4c6d6a99399cc56cee284a4757 (patch) | |
tree | 6002236fa1c1a1d96683d8f0a431127fa3d98af6 | |
parent | e5b085ce3e35347a22d58e41ec99b5d5cea9f854 (diff) | |
parent | d1242e6c5c7884a68fcc6f84594c8a93fcde56b6 (diff) |
CWS-TOOLING: integrate CWS ab79
-rw-r--r-- | basic/source/basmgr/basicmanagerrepository.cxx | 7 | ||||
-rwxr-xr-x | basic/source/classes/sbunoobj.cxx | 94 |
2 files changed, 101 insertions, 0 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index a5a1d4c8ca12..695f57ff2e02 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -507,6 +507,13 @@ namespace basic // register as listener for the BasicManager being destroyed StartListening( *_out_rpBasicManager ); + + // #i104876: Library container must not be modified just after + // creation. This happens as side effect when creating default + // "Standard" libraries and needs to be corrected here + xBasicLibs->setModified( sal_False ); + xDialogLibs->setModified( sal_False ); + } //-------------------------------------------------------------------- diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index e176eb9e3654..51a93ce94e4a 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1297,6 +1297,30 @@ Any sbxToUnoValue( SbxVariable* pVar ) return sbxToUnoValueImpl( pVar ); } + +// Funktion, um einen globalen Bezeichner im +// UnoScope zu suchen und fuer Sbx zu wrappen +static bool implGetTypeByName( const String& rName, Type& rRetType ) +{ + bool bSuccess = false; + + Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); + if( xTypeAccess->hasByHierarchicalName( rName ) ) + { + Any aRet = xTypeAccess->getByHierarchicalName( rName ); + Reference< XTypeDescription > xTypeDesc; + aRet >>= xTypeDesc; + + if( xTypeDesc.is() ) + { + rRetType = Type( xTypeDesc->getTypeClass(), xTypeDesc->getName() ); + bSuccess = true; + } + } + return bSuccess; +} + + // Konvertierung von Sbx nach Uno mit bekannter Zielklasse Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty ) { @@ -1387,6 +1411,39 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty } break; + case TypeClass_TYPE: + { + if( eBaseType == SbxOBJECT ) + { + // XIdlClass? + Reference< XIdlClass > xIdlClass; + + SbxBaseRef pObj = (SbxBase*)pVar->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + Any aUnoAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + aUnoAny >>= xIdlClass; + } + + if( xIdlClass.is() ) + { + ::rtl::OUString aClassName = xIdlClass->getName(); + Type aType( xIdlClass->getTypeClass(), aClassName.getStr() ); + aRetVal <<= aType; + } + } + else if( eBaseType == SbxSTRING ) + { + // String representing type? + String aTypeName = pVar->GetString(); + Type aType; + bool bSuccess = implGetTypeByName( aTypeName, aType ); + if( bSuccess ) + aRetVal <<= aType; + } + } + break; + /* folgende Typen lassen wir erstmal weg case TypeClass_SERVICE: break; case TypeClass_CLASS: break; @@ -4237,6 +4294,8 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) (void)pBasic; (void)bWrite; + static String aTypeTypeString( RTL_CONSTASCII_USTRINGPARAM("type") ); + // 2 parameters needed if ( rPar.Count() != 3 ) { @@ -4248,6 +4307,41 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) String aTypeName = rPar.Get(1)->GetString(); SbxVariable* pVal = rPar.Get(2); + if( aTypeName == aTypeTypeString ) + { + SbxDataType eBaseType = pVal->SbxValue::GetType(); + String aValTypeName; + if( eBaseType == SbxSTRING ) + { + aValTypeName = pVal->GetString(); + } + else if( eBaseType == SbxOBJECT ) + { + // XIdlClass? + Reference< XIdlClass > xIdlClass; + + SbxBaseRef pObj = (SbxBase*)pVal->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + Any aUnoAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + aUnoAny >>= xIdlClass; + } + + if( xIdlClass.is() ) + aValTypeName = xIdlClass->getName(); + } + Type aType; + bool bSuccess = implGetTypeByName( aValTypeName, aType ); + if( bSuccess ) + { + Any aTypeAny( aType ); + SbxVariableRef refVar = rPar.Get(0); + SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aTypeAny ); + refVar->PutObject( xUnoAnyObject ); + } + return; + } + // Check the type Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); Any aRet; |