diff options
122 files changed, 3527 insertions, 1098 deletions
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx index bccf8212f10e..abb482f7bfe5 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 4d9d19b52a59..0cddcbdf8d17 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 e28b0a304f28..056c2ea38c4c 100755..100644 --- 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 9ee07fde1413..79f55faf37b6 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 46f829b382e8..93fb18baf86e 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 bff3d22dd9b0..59d77e3f3757 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 60869307aecf..3e034af204f5 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() ); - // Zustzliches Flag fr 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 42969b98d0d8..7a4ea5965558 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 bd3c750df355..d65f6a431e43 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 e6fe73177dd2..5b7e5c70591d 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 9b8f51d09dea..851d0d6f1fe5 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 1161c4ed259d..733a65db7f61 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 59cfe21d25a8..4c54e2301bd5 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 2d9836e3530e..78afa9783ca8 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 9bd8cfd49754..f2fbaa0ac1f1 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 bbb3e930e012..2a536eae65be 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -520,11 +520,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) @@ -1553,8 +1555,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 ea40f0c65877..2acf59ca6b71 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -424,144 +424,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() ) { - // Getting in here causes problems with objects with default properties - // if they are SbxEMPTY I guess - if ( !bHandleDefaultProp || ( bHandleDefaultProp && refVal->GetType() == SbxOBJECT ) ) + 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 ) ) + { + // 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; + } + // 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); + 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; + // 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 ) - { - Reference< XInterface > xComListener; - - 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 - } + // Handle withevents + BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); + if ( bWithEvents ) + { + Reference< XInterface > xComListener; - *refVar = *refVal; - } - else + 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 728b8e1472b0..3216e401b707 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 8485b7105e21..e13c63967fc3 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 f9bca67a28d9..bd4ce91f451b 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 c1ada75286ab..16fec542cded 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 74380f84a75f..e27b11d5166c 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 8dffb2758749..1ac8c254ca6b 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 { @@ -125,7 +125,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 ); @@ -243,8 +243,8 @@ start: case SbxSTRING: case SbxLPSTR: { - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; Color* pColor; LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); @@ -294,7 +294,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; break; } diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index 460f331c59b8..be55d3409131 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 319b0aac366c..2191d91c8d82 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 03f97bec5992..cd80bbad282e 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 406b8599e568..47c38aecb1c2 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 c84b087dfc33..1cf2d84061f9 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 f42c400afd91..369349e72069 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 8cd0ad26e951..8ed3c7054278 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 3d45818e6401..b8aad9bbf2e4 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-Flle 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 82507dbe15e9..70ef1653666b 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 6deb2da29ba1..b4156a116ddc 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 ce0aea70b062..5b75a24d6d26 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 3dd81b8c616d..e0f6f3fa421d 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 7ee31af70556..4ea4836b701b 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 20060f1f7493..58e3c1ae92c2 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/README b/configmgr/source/README index b731043d34ed..b00990d1eeb2 100644 --- a/configmgr/source/README +++ b/configmgr/source/README @@ -70,6 +70,7 @@ writemodfile.cxx broadcaster.cxx Notification management. +additions.hxx update.cxx Extension manager interface. diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 190db364cdfe..eda60e6d612a 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -798,13 +798,22 @@ void Access::initBroadcasterAndChanges( css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement } - //TODO: if (allChanges != 0) { - // allChanges->push_back( - // css::util::ElementChange( - // css::uno::makeAny(...), - // css::uno::Any(), css::uno::Any())); - // //TODO: non-void ReplacedElement - //} + if (allChanges != 0) { + rtl::OUStringBuffer path( + getRelativePathRepresentation()); + if (path.getLength() != 0) { + path.append(sal_Unicode('/')); + } + path.append( + Data::createSegment( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), + i->first)); + allChanges->push_back( + css::util::ElementChange( + css::uno::makeAny(path.makeStringAndClear()), + css::uno::Any(), css::uno::Any())); + //TODO: non-void ReplacedElement + } } // else: spurious Modifications::Node not representing a change break; diff --git a/configmgr/source/additions.hxx b/configmgr/source/additions.hxx new file mode 100644 index 000000000000..f34373c7f742 --- /dev/null +++ b/configmgr/source/additions.hxx @@ -0,0 +1,43 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX +#define INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX + +#include "sal/config.h" + +#include <list> + +#include "path.hxx" + +namespace configmgr { + +typedef std::list< Path > Additions; + +} + +#endif diff --git a/configmgr/source/broadcaster.cxx b/configmgr/source/broadcaster.cxx index bb77039dcc8f..ab59d333d6d3 100644 --- a/configmgr/source/broadcaster.cxx +++ b/configmgr/source/broadcaster.cxx @@ -32,13 +32,17 @@ #include "com/sun/star/beans/XPropertyChangeListener.hpp" #include "com/sun/star/container/XContainerListener.hpp" #include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/XEventListener.hpp" +#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/XChangesListener.hpp" +#include "cppuhelper/exc_hlp.hxx" #include "osl/diagnose.hxx" +#include "rtl/string.h" +#include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -50,6 +54,13 @@ namespace { namespace css = com::sun::star; +void appendMessage( + rtl::OUStringBuffer & buffer, css::uno::Exception const & exception) +{ + buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("; ")); + buffer.append(exception.Message); +} + } void Broadcaster::addDisposeNotification( @@ -108,14 +119,16 @@ void Broadcaster::addChangesNotification( } void Broadcaster::send() { - bool exception = false; + css::uno::Any exception; + rtl::OUStringBuffer messages; for (DisposeNotifications::iterator i(disposeNotifications_.begin()); i != disposeNotifications_.end(); ++i) { try { i->listener->disposing(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ContainerNotifications::iterator i( @@ -125,8 +138,9 @@ void Broadcaster::send() { try { i->listener->elementInserted(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ContainerNotifications::iterator i( @@ -136,8 +150,9 @@ void Broadcaster::send() { try { i->listener->elementRemoved(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ContainerNotifications::iterator i( @@ -147,8 +162,9 @@ void Broadcaster::send() { try { i->listener->elementReplaced(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (PropertyChangeNotifications::iterator i( @@ -158,8 +174,9 @@ void Broadcaster::send() { try { i->listener->propertyChange(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (PropertiesChangeNotifications::iterator i( @@ -169,8 +186,9 @@ void Broadcaster::send() { try { i->listener->propertiesChange(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ChangesNotifications::iterator i(changesNotifications_.begin()); @@ -178,16 +196,19 @@ void Broadcaster::send() { try { i->listener->changesOccurred(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } - if (exception) { //TODO - throw css::uno::RuntimeException( - rtl::OUString( + if (exception.hasValue()) { + throw css::lang::WrappedTargetRuntimeException( + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "configmgr exceptions during listener notification")), - css::uno::Reference< css::uno::XInterface >()); + "configmgr exceptions during listener notification")) + + messages.makeStringAndClear()), + css::uno::Reference< css::uno::XInterface >(), + exception); } } diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 04e6317c959d..33b0eca3f65f 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -54,10 +54,12 @@ #include "rtl/ustring.hxx" #include "sal/types.h" +#include "additions.hxx" #include "components.hxx" #include "data.hxx" #include "modifications.hxx" #include "node.hxx" +#include "nodemap.hxx" #include "parsemanager.hxx" #include "partial.hxx" #include "rootaccess.hxx" @@ -86,12 +88,12 @@ typedef std::list< UnresolvedListItem > UnresolvedList; void parseXcsFile( rtl::OUString const & url, int layer, Data & data, Partial const * partial, - Modifications * modifications) + Modifications * modifications, Additions * additions) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { - OSL_ASSERT(partial == 0 && modifications == 0); - (void) partial; (void) modifications; + OSL_ASSERT(partial == 0 && modifications == 0 && additions == 0); + (void) partial; (void) modifications; (void) additions; OSL_VERIFY( rtl::Reference< ParseManager >( new ParseManager(url, new XcsParser(layer, data)))->parse()); @@ -99,14 +101,16 @@ void parseXcsFile( void parseXcuFile( rtl::OUString const & url, int layer, Data & data, Partial const * partial, - Modifications * modifications) + Modifications * modifications, Additions * additions) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { OSL_VERIFY( rtl::Reference< ParseManager >( new ParseManager( - url, new XcuParser(layer, data, partial, modifications)))-> + url, + new XcuParser( + layer, data, partial, modifications, additions)))-> parse()); } @@ -116,6 +120,29 @@ rtl::OUString expand(rtl::OUString const & str) { return s; } +bool canRemoveFromLayer(int layer, rtl::Reference< Node > const & node) { + OSL_ASSERT(node.is()); + if (node->getLayer() > layer && node->getLayer() < Data::NO_LAYER) { + return false; + } + switch (node->kind()) { + case Node::KIND_LOCALIZED_PROPERTY: + case Node::KIND_GROUP: + for (NodeMap::iterator i(node->getMembers().begin()); + i != node->getMembers().end(); ++i) + { + if (!canRemoveFromLayer(layer, i->second)) { + return false; + } + } + return true; + case Node::KIND_SET: + return node->getMembers().empty(); + default: // Node::KIND_PROPERTY, Node::KIND_LOCALIZED_VALUE + return true; + } +} + static bool singletonCreated = false; static Components * singleton = 0; @@ -218,7 +245,7 @@ void Components::insertExtensionXcsFile( bool shared, rtl::OUString const & fileUri) { try { - parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0); + parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( (rtl::OUString( @@ -233,9 +260,12 @@ void Components::insertExtensionXcuFile( bool shared, rtl::OUString const & fileUri, Modifications * modifications) { OSL_ASSERT(modifications != 0); + int layer = shared ? 10 : 14; + Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer); try { - parseXcuFile(fileUri, shared ? 10 : 14, data_, 0, modifications); + parseXcuFile(fileUri, layer, data_, 0, modifications, adds); } catch (css::container::NoSuchElementException & e) { + data_.removeExtensionXcuAdditions(fileUri); throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -245,6 +275,58 @@ void Components::insertExtensionXcuFile( } } +void Components::removeExtensionXcuFile( + rtl::OUString const & fileUri, Modifications * modifications) +{ + //TODO: Ideally, exactly the data coming from the specified xcu file would + // be removed. However, not enough information is recorded in the in-memory + // data structures to do so. So, as a workaround, all those set elements + // that were freshly added by the xcu and have afterwards been left + // unchanged or have only had their properties changed in the user layer are + // removed (and nothing else). The heuristic to determine + // whether a node has been left unchanged is to check the layer ID (as + // usual) and additionally to check that the node does not recursively + // contain any non-empty sets (multiple extension xcu files are merged into + // one layer, so checking layer ID alone is not enough). Since + // item->additions records all additions of set members in textual order, + // the latter check works well when iterating through item->additions in + // reverse order. + OSL_ASSERT(modifications != 0); + rtl::Reference< Data::ExtensionXcu > item( + data_.removeExtensionXcuAdditions(fileUri)); + if (item.is()) { + for (Additions::reverse_iterator i(item->additions.rbegin()); + i != item->additions.rend(); ++i) + { + rtl::Reference< Node > parent; + NodeMap const * map = &data_.components; + rtl::Reference< Node > node; + for (Path::const_iterator j(i->begin()); j != i->end(); ++j) { + parent = node; + node = Data::findNode(Data::NO_LAYER, *map, *j); + if (!node.is()) { + break; + } + map = &node->getMembers(); + } + if (node.is()) { + OSL_ASSERT(parent.is()); + if (parent->kind() == Node::KIND_SET) { + OSL_ASSERT( + node->kind() == Node::KIND_GROUP || + node->kind() == Node::KIND_SET); + if (canRemoveFromLayer(item->layer, node)) { + parent->getMembers().erase(i->back()); + data_.modifications.remove(*i); + modifications->add(*i); + } + } + } + } + writeModifications(); + } +} + void Components::insertModificationXcuFile( rtl::OUString const & fileUri, std::set< rtl::OUString > const & includedPaths, @@ -254,7 +336,7 @@ void Components::insertModificationXcuFile( OSL_ASSERT(modifications != 0); try { Partial part(includedPaths, excludedPaths); - parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications); + parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications, 0); } catch (css::uno::Exception & e) { //TODO: more specific exception catching OSL_TRACE( "configmgr error inserting %s: %s", @@ -377,7 +459,8 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":BUNDLED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); + "PackageRegistryBackend/configmgr.ini"))), + false); parseXcsXcuIniLayer( 9, expand( @@ -386,8 +469,9 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":SHARED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); - parseXcsXcuLayer( //TODO: migrate + "PackageRegistryBackend/configmgr.ini"))), + true); + parseXcsXcuLayer( 11, expand( rtl::OUString( @@ -396,6 +480,8 @@ Components::Components( ":UNO_USER_PACKAGES_CACHE}/registry/" "com.sun.star.comp.deployment.configuration." "PackageRegistryBackend/registry")))); + // can be dropped once old UserInstallation format can no longer exist + // (probably OOo 4) parseXcsXcuIniLayer( 13, expand( @@ -404,7 +490,8 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":UNO_USER_PACKAGES_CACHE}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); + "PackageRegistryBackend/configmgr.ini"))), + true); try { parseModificationLayer(); } catch (css::uno::Exception & e) { //TODO: more specific exception catching @@ -470,7 +557,7 @@ void Components::parseFiles( file.match(extension, file.getLength() - extension.getLength())) { try { - (*parseFile)(stat.getFileURL(), layer, data_, 0, 0); + (*parseFile)(stat.getFileURL(), layer, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( (rtl::OUString( @@ -486,19 +573,26 @@ void Components::parseFiles( void Components::parseFileList( int layer, FileParser * parseFile, rtl::OUString const & urls, - rtl::Bootstrap const & ini) + rtl::Bootstrap const & ini, bool recordAdditions) { for (sal_Int32 i = 0;;) { rtl::OUString url(urls.getToken(0, ' ', i)); if (url.getLength() != 0) { ini.expandMacrosFrom(url); //TODO: detect failure + Additions * adds = 0; + if (recordAdditions) { + adds = data_.addExtensionXcuAdditions(url, layer); + } try { - (*parseFile)(url, layer, data_, 0, 0); + (*parseFile)(url, layer, data_, 0, 0, adds); } catch (css::container::NoSuchElementException & e) { OSL_TRACE( "configmgr file does not exist: %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8).getStr()); + if (adds != 0) { + data_.removeExtensionXcuAdditions(url); + } } } if (i == -1) { @@ -610,18 +704,20 @@ void Components::parseXcsXcuLayer(int layer, rtl::OUString const & url) { url + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/data")), false); } -void Components::parseXcsXcuIniLayer(int layer, rtl::OUString const & url) { +void Components::parseXcsXcuIniLayer( + int layer, rtl::OUString const & url, bool recordAdditions) +{ //TODO: rtl::Bootstrap::getFrom "first trie[s] to retrieve the value via the // global function" rtl::Bootstrap ini(url); rtl::OUString urls; if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SCHEMA")), urls)) { - parseFileList(layer, &parseXcsFile, urls, ini); + parseFileList(layer, &parseXcsFile, urls, ini, false); } if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA")), urls)) { - parseFileList(layer + 1, &parseXcuFile, urls, ini); + parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions); } } @@ -650,13 +746,13 @@ rtl::OUString Components::getModificationFileUrl() const { void Components::parseModificationLayer() { try { - parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0); + parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0, 0); } catch (css::container::NoSuchElementException &) { OSL_TRACE( "configmgr user registrymodifications.xcu does not (yet) exist"); // Migrate old user layer data (can be removed once migration is no - // longer relevant; also see hack for xsi namespace in XmlReader - // constructor): + // longer relevant, probably OOo 4; also see hack for xsi namespace in + // XmlReader constructor): parseFiles( Data::NO_LAYER, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".xcu")), &parseXcuFile, diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index 2e635680c1ce..880ac95d34a8 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -38,7 +38,10 @@ #include "com/sun/star/uno/Reference.hxx" #include "rtl/ref.hxx" +#include "additions.hxx" #include "data.hxx" +#include "modifications.hxx" +#include "nodemap.hxx" #include "path.hxx" namespace com { namespace sun { namespace star { @@ -56,7 +59,6 @@ namespace rtl { namespace configmgr { class Broadcaster; -class Modifications; class Node; class Partial; class RootAccess; @@ -98,6 +100,9 @@ public: bool shared, rtl::OUString const & fileUri, Modifications * modifications); + void removeExtensionXcuFile( + rtl::OUString const & fileUri, Modifications * modifications); + void insertModificationXcuFile( rtl::OUString const & fileUri, std::set< rtl::OUString > const & includedPaths, @@ -109,7 +114,8 @@ public: private: typedef void FileParser( - rtl::OUString const &, int, Data &, Partial const *, Modifications *); + rtl::OUString const &, int, Data &, Partial const *, Modifications *, + Additions *); Components( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > @@ -123,13 +129,14 @@ private: void parseFileList( int layer, FileParser * parseFile, rtl::OUString const & urls, - rtl::Bootstrap const & ini); + rtl::Bootstrap const & ini, bool recordAdditions); void parseXcdFiles(int layer, rtl::OUString const & url); void parseXcsXcuLayer(int layer, rtl::OUString const & url); - void parseXcsXcuIniLayer(int layer, rtl::OUString const & url); + void parseXcsXcuIniLayer( + int layer, rtl::OUString const & url, bool recordAdditions); void parseModuleLayer(int layer, rtl::OUString const & url); diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index e12f9596940b..50466ca0532c 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -36,11 +36,13 @@ #include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/string.h" +#include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "additions.hxx" #include "data.hxx" #include "groupnode.hxx" #include "node.hxx" @@ -325,4 +327,46 @@ rtl::Reference< Node > Data::getTemplate( return findNode(layer, templates, fullName); } +Additions * Data::addExtensionXcuAdditions( + rtl::OUString const & url, int layer) +{ + rtl::Reference< ExtensionXcu > item(new ExtensionXcu); + ExtensionXcuAdditions::iterator i( + extensionXcuAdditions_.insert( + ExtensionXcuAdditions::value_type( + url, rtl::Reference< ExtensionXcu >())).first); + if (i->second.is()) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "already added extension xcu ")) + + url), + css::uno::Reference< css::uno::XInterface >()); + } + i->second = item; + item->layer = layer; + return &item->additions; +} + +rtl::Reference< Data::ExtensionXcu > Data::removeExtensionXcuAdditions( + rtl::OUString const & url) +{ + ExtensionXcuAdditions::iterator i(extensionXcuAdditions_.find(url)); + if (i == extensionXcuAdditions_.end()) { + // This can happen, as migration of pre OOo 3.3 UserInstallation + // extensions in dp_registry::backend::configuration::BackendImpl:: + // PackageImpl::processPackage_ can cause just-in-time creation of + // extension xcu files that are never added via addExtensionXcuAdditions + // (also, there might be url spelling differences between calls to + // addExtensionXcuAdditions and removeExtensionXcuAdditions?): + OSL_TRACE( + "unknown configmgr::Data::removeExtensionXcuAdditions(%s)", + rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()); + return rtl::Reference< ExtensionXcu >(); + } + rtl::Reference< ExtensionXcu > item(i->second); + extensionXcuAdditions_.erase(i); + return item; +} + } diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index 52353d066b67..8f5f7af0d86e 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -31,18 +31,20 @@ #include "sal/config.h" #include <climits> +#include <map> #include <vector> #include "boost/noncopyable.hpp" #include "rtl/ref.hxx" +#include "rtl/ustring.hxx" #include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "additions.hxx" #include "modifications.hxx" #include "nodemap.hxx" #include "path.hxx" -namespace rtl { class OUString; } - namespace configmgr { class Node; @@ -50,6 +52,11 @@ class Node; struct Data: private boost::noncopyable { enum { NO_LAYER = INT_MAX }; + struct ExtensionXcu: public salhelper::SimpleReferenceObject { + int layer; + Additions additions; + }; + NodeMap templates; NodeMap components; @@ -80,6 +87,18 @@ struct Data: private boost::noncopyable { rtl::Reference< Node > getTemplate( int layer, rtl::OUString const & fullName) const; + + Additions * addExtensionXcuAdditions( + rtl::OUString const & url, int layer); + + rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions( + rtl::OUString const & url); + +private: + typedef std::map< rtl::OUString, rtl::Reference< ExtensionXcu > > + ExtensionXcuAdditions; + + ExtensionXcuAdditions extensionXcuAdditions_; }; } diff --git a/configmgr/source/modifications.cxx b/configmgr/source/modifications.cxx index 2ad3b5ef8bd1..add18ceaa1ea 100644 --- a/configmgr/source/modifications.cxx +++ b/configmgr/source/modifications.cxx @@ -59,6 +59,27 @@ void Modifications::add(Path const & path) { p->children.clear(); } +void Modifications::remove(Path const & path) { + OSL_ASSERT(!path.empty()); + Node * p = &root_; + for (Path::const_iterator i(path.begin());;) { + Node::Children::iterator j(p->children.find(*i)); + if (j == p->children.end()) { + break; + } + if (++i == path.end()) { + p->children.erase(j); + if (p->children.empty()) { + Path parent(path); + parent.pop_back(); + remove(parent); + } + break; + } + p = &j->second; + } +} + Modifications::Node const & Modifications::getRoot() const { return root_; } diff --git a/configmgr/source/modifications.hxx b/configmgr/source/modifications.hxx index e29a10150148..c28b1aadd192 100644 --- a/configmgr/source/modifications.hxx +++ b/configmgr/source/modifications.hxx @@ -54,6 +54,8 @@ public: void add(Path const & path); + void remove(Path const & path); + Node const & getRoot() const; private: diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 4c1d59d5d054..403b761a5abd 100644 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -89,6 +89,9 @@ private: sal_Bool shared, rtl::OUString const & fileUri) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeExtensionXcuFile(rtl::OUString const & fileUri) + throw (css::uno::RuntimeException); + virtual void SAL_CALL insertModificationXcuFile( rtl::OUString const & fileUri, css::uno::Sequence< rtl::OUString > const & includedPaths, @@ -120,6 +123,20 @@ void Service::insertExtensionXcuFile( bc.send(); } +void Service::removeExtensionXcuFile(rtl::OUString const & fileUri) + throw (css::uno::RuntimeException) +{ + Broadcaster bc; + { + osl::MutexGuard g(lock); + Modifications mods; + Components::getSingleton().removeExtensionXcuFile(fileUri, &mods); + Components::getSingleton().initGlobalBroadcaster( + mods, rtl::Reference< RootAccess >(), &bc); + } + bc.send(); +} + void Service::insertModificationXcuFile( rtl::OUString const & fileUri, css::uno::Sequence< rtl::OUString > const & includedPaths, diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 498254b35644..ad774d5ca3e3 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -137,7 +137,7 @@ bool XcdParser::startElement( if (ns == XmlReader::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) { - nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0); + nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0); nesting_ = 1; return nestedParser_->startElement(reader, ns, name); } diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index 79e122759fc8..37b46494c6a7 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/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index cd1e6e55d085..91f3b244c5a8 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -68,12 +68,13 @@ namespace css = com::sun::star; XcuParser::XcuParser( int layer, Data & data, Partial const * partial, - Modifications * broadcastModifications): + Modifications * broadcastModifications, Additions * additions): valueParser_(layer), data_(data), partial_(partial), broadcastModifications_(broadcastModifications), - recordModifications_(layer == Data::NO_LAYER), + additions_(additions), recordModifications_(layer == Data::NO_LAYER), trackPath_( - partial_ != 0 || broadcastModifications_ != 0 || recordModifications_) + partial_ != 0 || broadcastModifications_ != 0 || additions_ != 0 || + recordModifications_) {} XcuParser::~XcuParser() {} @@ -624,7 +625,7 @@ void XcuParser::handleLocpropValue( pop = true; } if (trackPath_) { - recordModification(); + recordModification(false); if (pop) { path_.pop_back(); } @@ -638,7 +639,7 @@ void XcuParser::handleLocpropValue( locprop->getMembers().erase(i); } state_.push(State(true)); - recordModification(); + recordModification(false); break; default: throw css::uno::RuntimeException( @@ -750,7 +751,7 @@ void XcuParser::handleUnknownGroupProp( prop->setFinalized(valueParser_.getLayer()); } state_.push(State(prop, name, state_.top().locked)); - recordModification(); + recordModification(false); break; } // fall through @@ -800,7 +801,7 @@ void XcuParser::handlePlainGroupProp( property, (state_.top().locked || finalizedLayer < valueParser_.getLayer()))); - recordModification(); + recordModification(false); break; case OPERATION_REMOVE: if (!property->isExtension()) { @@ -814,7 +815,7 @@ void XcuParser::handlePlainGroupProp( } group->getMembers().erase(propertyIndex); state_.push(State(true)); // ignore children - recordModification(); + recordModification(false); break; } } @@ -863,7 +864,7 @@ void XcuParser::handleLocalizedGroupProp( replacement, name, (state_.top().locked || finalizedLayer < valueParser_.getLayer()))); - recordModification(); + recordModification(false); } break; case OPERATION_REMOVE: @@ -1070,7 +1071,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { member->setFinalized(finalizedLayer); member->setMandatory(mandatoryLayer); state_.push(State(member, name, false)); - recordModification(); + recordModification(i == set->getMembers().end()); } break; case OPERATION_FUSE: @@ -1084,7 +1085,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { member->setFinalized(finalizedLayer); member->setMandatory(mandatoryLayer); state_.push(State(member, name, false)); - recordModification(); + recordModification(true); } } else { state_.push( @@ -1104,15 +1105,18 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { set->getMembers().erase(i); } state_.push(State(true)); - recordModification(); + recordModification(false); break; } } -void XcuParser::recordModification() { +void XcuParser::recordModification(bool addition) { if (broadcastModifications_ != 0) { broadcastModifications_->add(path_); } + if (addition && additions_ != 0) { + additions_->push_back(path_); + } if (recordModifications_) { data_.modifications.add(path_); } diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx index 64108451b4ef..02ef4e5ff117 100644 --- a/configmgr/source/xcuparser.hxx +++ b/configmgr/source/xcuparser.hxx @@ -35,6 +35,7 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "additions.hxx" #include "node.hxx" #include "nodemap.hxx" #include "parser.hxx" @@ -59,7 +60,7 @@ class XcuParser: public Parser { public: XcuParser( int layer, Data & data, Partial const * partial, - Modifications * broadcastModifications); + Modifications * broadcastModifications, Additions * additions); private: virtual ~XcuParser(); @@ -108,7 +109,7 @@ private: void handleSetNode(XmlReader & reader, SetNode * set); - void recordModification(); + void recordModification(bool addition); struct State { rtl::Reference< Node > node; // empty iff ignore or <items> @@ -141,6 +142,7 @@ private: Data & data_; Partial const * partial_; Modifications * broadcastModifications_; + Additions * additions_; bool recordModifications_; bool trackPath_; rtl::OUString componentName_; diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index 3707b7fdb65d..d63c83524389 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -326,9 +326,16 @@ namespace dbtools ::rtl::OUString sStringValue; if ( m_pData->m_xColumn.is() ) { - sStringValue = DBTypeConversion::getValue( - m_pData->m_xColumn, m_pData->m_xFormatter, m_pData->m_aNullDate, m_pData->m_nFormatKey, m_pData->m_nKeyType - ); + if ( m_pData->m_bNumericField ) + { + sStringValue = DBTypeConversion::getValue( + m_pData->m_xColumn, m_pData->m_xFormatter, m_pData->m_aNullDate, m_pData->m_nFormatKey, m_pData->m_nKeyType + ); + } + else + { + sStringValue = m_pData->m_xColumn->getString(); + } } return sStringValue; } diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index 43de55e3505c..d598de8bc12d 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -578,7 +578,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, // StarView zu lang ist oder der Treiber kann die Laenge der // Daten nicht im voraus bestimmen - also als MemoryStream // speichern. - while ((pcbValue == SQL_NO_TOTAL ) || pcbValue > nMaxLen) + while ((pcbValue == SQL_NO_TOTAL ) || nLen > nMaxLen) { // Bei Strings wird der Puffer nie ganz ausgenutzt // (das letzte Byte ist immer ein NULL-Byte, das diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 8867a940a6ad..fa7550812bbe 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 b60af4ede03e..e0f976df34ed 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 2f0d4ab9e538..c06d94fd0812 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/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 3c6680065db5..1e7ee5bfac8a 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -139,7 +139,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data); ::boost::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url); - void deleteDataFromDb(OUString const & url); + OUString deleteDataFromDb(OUString const & url); ::std::list<OUString> getAllIniEntries(); public: @@ -240,10 +240,18 @@ void BackendImpl::addDataToDb( return data; } -void BackendImpl::deleteDataFromDb(OUString const & url) +OUString BackendImpl::deleteDataFromDb(OUString const & url) { - if (m_backendDb.get()) + OUString url2(url); + if (m_backendDb.get()) { + boost::optional< ConfigurationBackendDb::Data > data( + m_backendDb->getEntry(url)); + if (data) { + url2 = expandUnoRcTerm(data->iniEntry); + } m_backendDb->removeEntry(url); + } + return url2; } ::std::list<OUString> BackendImpl::getAllIniEntries() @@ -717,11 +725,11 @@ void BackendImpl::PackageImpl::processPackage_( //rebuilding the directory structure. rtl::OUString url2( rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); - ConfigurationBackendDb::Data data; if (url2 != url) { bool schema = i->second.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-schema"); OUString url_replaced(url2); + ConfigurationBackendDb::Data data; if (!schema) { const OUString sModFolder = that->createFolder(OUString(), xCmdEnv); @@ -734,6 +742,7 @@ void BackendImpl::PackageImpl::processPackage_( deleteTempFolder(sModFolder); } that->addToConfigmgrIni(schema, url_replaced, xCmdEnv); + data.iniEntry = dp_misc::makeRcTerm(url_replaced); that->addDataToDb(url2, data); } that->m_registeredPackages->erase(i->first); @@ -750,9 +759,12 @@ void BackendImpl::PackageImpl::processPackage_( OSL_ASSERT(0); } } - that->deleteDataFromDb(getURL()); - - //TODO: revoking at runtime, possible, sensible? + url = that->deleteDataFromDb(url); + if (!m_isSchema) { + com::sun::star::configuration::Update::get( + that->m_xComponentContext)->removeExtensionXcuFile( + expandUnoRcUrl(url)); + } } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index bc17a1f7163d..5a5efe825cfb 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -80,6 +80,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference<AbortChannel> const & abortChannel, Reference<XCommandEnvironment> const & xCmdEnv ); + bool extensionContainsCompiledHelp(); public: PackageImpl( ::rtl::Reference<PackageRegistryBackend> const & myBackend, @@ -100,7 +101,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XCommandEnvironment> const & xCmdEnv ); void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, - Reference<ucb::XCommandEnvironment> const & xCmdEnv); + bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); @@ -259,6 +260,57 @@ BackendImpl * BackendImpl::PackageImpl::getMyBackend() const return pBackend; } + +bool BackendImpl::PackageImpl::extensionContainsCompiledHelp() +{ + bool bCompiled = true; + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl(getURL()); + + ::osl::Directory helpFolder(aExpandedHelpURL); + if ( helpFolder.open() == ::osl::File::E_None) + { + //iterate over the contents of the help folder + //We assume that all folders withing the help folder contain language specific + //help files. If just one of them does not contain compiled help then this + //function returns false. + ::osl::DirectoryItem item; + ::osl::File::RC errorNext = ::osl::File::E_None; + while ((errorNext = helpFolder.getNextItem(item)) == ::osl::File::E_None) + { + //No find the language folders + ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileName |FileStatusMask_FileURL); + if (item.getFileStatus(stat) == ::osl::File::E_None) + { + if (stat.getFileType() != ::osl::FileStatus::Directory) + continue; + + //look if there is the folder help.idxl in the language folder + OUString compUrl(stat.getFileURL() + OUSTR("/help.idxl")); + ::osl::Directory compiledFolder(compUrl); + if (compiledFolder.open() != ::osl::File::E_None) + { + bCompiled = false; + break; + } + } + else + { + //Error + OSL_ASSERT(0); + bCompiled = false; + break; + } + } + if (errorNext != ::osl::File::E_NOENT + && errorNext != ::osl::File::E_None) + { + //Error + OSL_ASSERT(0); + bCompiled = false; + } + } + return bCompiled; +} //______________________________________________________________________________ beans::Optional< beans::Ambiguous<sal_Bool> > BackendImpl::PackageImpl::isRegistered_( @@ -289,7 +341,8 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl* that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv); + that->implProcessHelp( xThisPackage, doRegisterPackage, + extensionContainsCompiledHelp(), xCmdEnv); } beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL() @@ -316,213 +369,220 @@ static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) ); void BackendImpl::implProcessHelp -( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, +( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv) { OSL_ASSERT(xPackage.is()); if (doRegisterPackage) { HelpBackendDb::Data data; - const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); - data.dataUrl = sHelpFolder; - - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); - rtl::OUString aHelpURL = xPackage->getURL(); - rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); - rtl::OUString aName = xPackage->getName(); - if( !xSFA->isFolder( aExpandedHelpURL ) ) + + if (compiledHelp) { - rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); - aErrStr += rtl::OUString::createFromAscii( "No help folder" ); - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + data.dataUrl = xPackage->getURL(); } - - Reference<XComponentContext> const & xContext = getComponentContext(); - Reference< script::XInvocation > xInvocation; - if( xContext.is() ) + else { - try + const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); + data.dataUrl = sHelpFolder; + + Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + rtl::OUString aHelpURL = xPackage->getURL(); + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); + rtl::OUString aName = xPackage->getName(); + if( !xSFA->isFolder( aExpandedHelpURL ) ) { - xInvocation = Reference< script::XInvocation >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); + aErrStr += rtl::OUString::createFromAscii( "No help folder" ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } - catch (Exception &) + + Reference<XComponentContext> const & xContext = getComponentContext(); + Reference< script::XInvocation > xInvocation; + if( xContext.is() ) { - // i98680: Survive missing lucene + try + { + xInvocation = Reference< script::XInvocation >( + xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( + "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + } + catch (Exception &) + { + // i98680: Survive missing lucene + } } - } - // Scan languages - Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); - sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); - const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); - for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) - { - rtl::OUString aLangURL = pSeq[iLang]; - if( xSFA->isFolder( aLangURL ) ) + // Scan languages + Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); + sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); + const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); + for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) { - std::vector< rtl::OUString > aXhpFileVector; - - // calculate jar file URL - sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); - // for example "/en" - OUString langFolderURLSegment( - aLangURL.copy( - indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); - - //create the folder in the "temporary folder" - ::ucbhelper::Content langFolderContent; - const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); - const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); - ::dp_misc::create_folder( - &langFolderContent, - langFolderDest, xCmdEnv); - - rtl::OUString aJarFile( - makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + - OUSTR(".jar"))); - aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); - - rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( - aJarFile, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); - aDestBasePath += aEncodedJarFilePath; - aDestBasePath += rtl::OUString::createFromAscii( "/" ); - - sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; - - Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); - sal_Int32 nSubLangCount = aSubLangSeq.getLength(); - const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); - for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + rtl::OUString aLangURL = pSeq[iLang]; + if( xSFA->isFolder( aLangURL ) ) { - rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; - if( !xSFA->isFolder( aSubFolderURL ) ) - continue; + std::vector< rtl::OUString > aXhpFileVector; + + // calculate jar file URL + sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); + // for example "/en" + OUString langFolderURLSegment( + aLangURL.copy( + indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); + + //create the folder in the "temporary folder" + ::ucbhelper::Content langFolderContent; + const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); + const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); + ::dp_misc::create_folder( + &langFolderContent, + langFolderDest, xCmdEnv); + + rtl::OUString aJarFile( + makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + + OUSTR(".jar"))); + aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); + + rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( + aJarFile, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + aDestBasePath += aEncodedJarFilePath; + aDestBasePath += rtl::OUString::createFromAscii( "/" ); + + sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; + + Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); + sal_Int32 nSubLangCount = aSubLangSeq.getLength(); + const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); + for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + { + rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; + if( !xSFA->isFolder( aSubFolderURL ) ) + continue; - implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); + implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); - // Copy to package (later: move?) - rtl::OUString aDestPath = aDestBasePath; - rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; - xSFA->copy( aSubFolderURL, aDestPath ); - } + // Copy to package (later: move?) + rtl::OUString aDestPath = aDestBasePath; + rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); + aDestPath += aPureFolderName; + xSFA->copy( aSubFolderURL, aDestPath ); + } - // Call compiler - sal_Int32 nXhpFileCount = aXhpFileVector.size(); - rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - { - rtl::OUString aXhpFile = aXhpFileVector[iXhp]; - rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); - pXhpFiles[iXhp] = aXhpRelFile; - } + // Call compiler + sal_Int32 nXhpFileCount = aXhpFileVector.size(); + rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + { + rtl::OUString aXhpFile = aXhpFileVector[iXhp]; + rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); + pXhpFiles[iXhp] = aXhpRelFile; + } - rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); - rtl::OUString aOfficeHelpPathFileURL; - ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); + rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); + rtl::OUString aOfficeHelpPathFileURL; + ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); - HelpProcessingErrorInfo aErrorInfo; - bool bSuccess = compileExtensionHelp( - aOfficeHelpPathFileURL, aHelpStr, aLangURL, - nXhpFileCount, pXhpFiles, - langFolderDestExpanded, aErrorInfo ); + HelpProcessingErrorInfo aErrorInfo; + bool bSuccess = compileExtensionHelp( + aOfficeHelpPathFileURL, aHelpStr, aLangURL, + nXhpFileCount, pXhpFiles, + langFolderDestExpanded, aErrorInfo ); - if( bSuccess && xInvocation.is() ) - { - Sequence<uno::Any> aParamsSeq( 6 ); - - aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); - - rtl::OUString aLang; - sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); - if( nLastSlash != -1 ) - aLang = aLangURL.copy( nLastSlash + 1 ); - else - aLang = rtl::OUString::createFromAscii( "en" ); - aParamsSeq[1] = uno::makeAny( aLang ); - - aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); - aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); - - aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); - rtl::OUString aSystemPath; - osl::FileBase::getSystemPathFromFileURL( - langFolderDestExpanded, aSystemPath ); - aParamsSeq[5] = uno::makeAny( aSystemPath ); - - Sequence< sal_Int16 > aOutParamIndex; - Sequence< uno::Any > aOutParam; - uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), - aParamsSeq, aOutParamIndex, aOutParam ); - } - - if( !bSuccess ) - { - USHORT nErrStrId = 0; - switch( aErrorInfo.m_eErrorClass ) + if( bSuccess && xInvocation.is() ) { - case HELPPROCESSING_GENERAL_ERROR: - case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; - case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; - default: ; - }; - - rtl::OUString aErrStr; - if( nErrStrId != 0 ) + Sequence<uno::Any> aParamsSeq( 6 ); + + aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); + + rtl::OUString aLang; + sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); + if( nLastSlash != -1 ) + aLang = aLangURL.copy( nLastSlash + 1 ); + else + aLang = rtl::OUString::createFromAscii( "en" ); + aParamsSeq[1] = uno::makeAny( aLang ); + + aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); + aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); + + aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); + rtl::OUString aSystemPath; + osl::FileBase::getSystemPathFromFileURL( + langFolderDestExpanded, aSystemPath ); + aParamsSeq[5] = uno::makeAny( aSystemPath ); + + Sequence< sal_Int16 > aOutParamIndex; + Sequence< uno::Any > aOutParam; + uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), + aParamsSeq, aOutParamIndex, aOutParam ); + } + + if( !bSuccess ) { - aErrStr = getResourceString( nErrStrId ); - - // Remoce CR/LF - rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); - sal_Unicode nCR = 13, nLF = 10; - sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); - sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); - sal_Int32 nCopy; - if( nSearchCR != -1 || nSearchLF != -1 ) + USHORT nErrStrId = 0; + switch( aErrorInfo.m_eErrorClass ) { - if( nSearchCR == -1 ) - nCopy = nSearchLF; - else if( nSearchLF == -1 ) - nCopy = nSearchCR; - else - nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; - - aErrMsg = aErrMsg.copy( 0, nCopy ); - } - aErrStr += aErrMsg; - if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + case HELPPROCESSING_GENERAL_ERROR: + case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; + case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; + default: ; + }; + + rtl::OUString aErrStr; + if( nErrStrId != 0 ) { - aErrStr += rtl::OUString::createFromAscii( " in " ); - - rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, - rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - aErrStr += aDecodedFile; - if( aErrorInfo.m_nXMLParsingLine != -1 ) + aErrStr = getResourceString( nErrStrId ); + + // Remoce CR/LF + rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); + sal_Unicode nCR = 13, nLF = 10; + sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); + sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); + sal_Int32 nCopy; + if( nSearchCR != -1 || nSearchLF != -1 ) { - aErrStr += rtl::OUString::createFromAscii( ", line " ); - aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + if( nSearchCR == -1 ) + nCopy = nSearchLF; + else if( nSearchLF == -1 ) + nCopy = nSearchCR; + else + nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; + + aErrMsg = aErrMsg.copy( 0, nCopy ); + } + aErrStr += aErrMsg; + if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + { + aErrStr += rtl::OUString::createFromAscii( " in " ); + + rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, + rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aErrStr += aDecodedFile; + if( aErrorInfo.m_nXMLParsingLine != -1 ) + { + aErrStr += rtl::OUString::createFromAscii( ", line " ); + aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + } } } - } - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + } } } } - //Writing the data entry replaces writing the flag file. If we got to this //point the registration was successful. addDataToDb(xPackage->getURL(), data); - } + } //if (doRegisterPackage) else { deleteDataFromDb(xPackage->getURL()); diff --git a/desktop/util/verinfo.rc b/desktop/util/verinfo.rc index 038953f2aa79..7d589956ec83 100644..100755 --- a/desktop/util/verinfo.rc +++ b/desktop/util/verinfo.rc @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Oracle, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Oracle, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #endif } diff --git a/desktop/win32/source/applauncher/ooo/verinfo.rc b/desktop/win32/source/applauncher/ooo/verinfo.rc index ce698ba80333..c13e723527fc 100644..100755 --- a/desktop/win32/source/applauncher/ooo/verinfo.rc +++ b/desktop/win32/source/applauncher/ooo/verinfo.rc @@ -69,7 +69,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #else block "040904E4" @@ -81,7 +81,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #endif } diff --git a/desktop/win32/source/applauncher/verinfo.rc b/desktop/win32/source/applauncher/verinfo.rc index 0db55c58c4b2..c0ff71494014 100644..100755 --- a/desktop/win32/source/applauncher/verinfo.rc +++ b/desktop/win32/source/applauncher/verinfo.rc @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #endif } diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index 7c2dafc79bbb..b85a72555935 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/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index dc954de7bb2a..0d2be85f9872 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1206,7 +1206,12 @@ namespace drawinglayer mpOutputDevice->SetLineColor(Color(aHairlineColor)); mpOutputDevice->SetFillColor(); aHairLinePolyPolygon.transform(maCurrentTransformation); - LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth())); + + // #i113922# LineWidth needs to be transformed, too + const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(rLine.getWidth(), 0.0)); + const double fDiscreteLineWidth(aDiscreteUnit.getLength()); + + LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fDiscreteLineWidth)); aLineInfo.SetLineJoin(rLine.getLineJoin()); for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++) diff --git a/editeng/inc/editeng/unoipset.hxx b/editeng/inc/editeng/unoipset.hxx index 3cd3053e4c3e..8a28df5cbe28 100644 --- a/editeng/inc/editeng/unoipset.hxx +++ b/editeng/inc/editeng/unoipset.hxx @@ -64,6 +64,7 @@ public: sal_Bool AreThereOwnUsrAnys() const { return (pCombiList ? sal_True : sal_False); } ::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const; void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID); + void ClearAllUsrAny(); com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const; const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;} diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 569b80639b6b..e8a2aaad22e2 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 ede5acacc698..c8f5e2948665 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 5a54c054016b..46a0668394f2 100644..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 )); + + 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 + + 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 ) ) ) ); - Sequence <sal_Int32> aOffsets; - String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) ); + // 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 ) ) ) ); - if( ( nLen != aNewText.Len() ) || !pNode->Equals( aNewText, nCurrentStart, nLen ) ) + // 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 ); + } + + 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 ) ); + } +#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 ]; - ParaPortion* pParaPortion = GetParaPortions()[nNode]; - pParaPortion->MarkSelectionInvalid( nCurrentStart, std::max< USHORT >( nCurrentStart+nLen, nCurrentStart+aNewText.Len() ) ); + 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() ) ); } - nCurrentStart = nCurrentEnd; - } while( nCurrentEnd < nEndPos ); + } // 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 64343517c69f..f969a8033f08 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/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 39ab3507c5d3..6ba232010390 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -71,15 +71,7 @@ SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, Sfx //---------------------------------------------------------------------- SvxItemPropertySet::~SvxItemPropertySet() { -/* - if(pItemPool) - delete pItemPool; - pItemPool = NULL; -*/ - - if(pCombiList) - delete pCombiList; - pCombiList = NULL; + ClearAllUsrAny(); } //---------------------------------------------------------------------- @@ -111,6 +103,17 @@ void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID) pCombiList->Insert(pNew); } +//---------------------------------------------------------------------- + +void SvxItemPropertySet::ClearAllUsrAny() +{ + if(pCombiList) + delete pCombiList; + pCombiList = NULL; +} + +//---------------------------------------------------------------------- + sal_Bool SvxUnoCheckForPositiveValue( const uno::Any& rVal ) { sal_Bool bConvert = sal_True; // the default is that all metric items must be converted diff --git a/framework/inc/classes/framelistanalyzer.hxx b/framework/inc/classes/framelistanalyzer.hxx index 518870b354f1..4ab3c4532cdc 100644 --- a/framework/inc/classes/framelistanalyzer.hxx +++ b/framework/inc/classes/framelistanalyzer.hxx @@ -29,13 +29,6 @@ #define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ //_______________________________________________ -// my own includes - -#include <threadhelp/threadhelpbase.hxx> -#include <macros/debug.hxx> -#include <general.h> - -//_______________________________________________ // interface includes #include <com/sun/star/frame/XFrame.hpp> @@ -88,10 +81,10 @@ class FrameListAnalyzer public: /** provides access to the frame container, which should be analyzed. */ - const css::uno::Reference< css::frame::XFramesSupplier >& m_xSupplier; + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier; /** hold the reference frame, which is used e.g. to detect other frames with the same model. */ - const css::uno::Reference< css::frame::XFrame >& m_xReferenceFrame; + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame; /** enable/disable some special analyzing steps. see impl_analyze() for further informations. */ @@ -100,19 +93,19 @@ class FrameListAnalyzer /** contains all frames, which uses the same model like the reference frame. Will be filled only if m_eDetectMode has set the flag E_MODEL. The reference frame is never part of this list! */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lModelFrames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames; /** contains all frames, which does not contain the same model like the reference frame. Filling of it can't be supressed by m_eDetectMode. The reference frame is never part of this list! All frames inside this list are visible ones. */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames; /** contains all frames, which does not contain the same model like the reference frame. Filling of it can't be supressed by m_eDetectMode. The reference frame is never part of this list! All frames inside this list are hidden ones. */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames; /** points to the help frame. Will be set only, if any other frame (means different from the reference frame) @@ -137,7 +130,7 @@ class FrameListAnalyzer Analyzing of the help frame ignores the visible state of any frame. But note: a hidden help frame indicates a wrong state! */ - css::uno::Reference< css::frame::XFrame > m_xHelp; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp; /** points to the frame, which contains the backing component. Will be set only, if any other frame (means different from the reference frame) @@ -163,7 +156,7 @@ class FrameListAnalyzer Analyzing of the help frame ignores the visible state of any frame. But note: a hidden backing mode frame indicates a wrong state! */ - css::uno::Reference< css::frame::XFrame > m_xBackingComponent; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent; /** is set to true only, if the reference frame is a hidden one. This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */ @@ -200,8 +193,8 @@ class FrameListAnalyzer analyze steps. Note: Some member values will be undefined, if an analyze step will be disabled. */ - FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier , - const css::uno::Reference< css::frame::XFrame >& xReferenceFrame , + FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier , + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame , sal_uInt32 eDetectMode ); virtual ~FrameListAnalyzer(); diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx index 9c5f9c89afe6..856746139b68 100644 --- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx @@ -219,6 +219,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xModuleAcceleratorManager; }; } diff --git a/framework/prj/d.lst b/framework/prj/d.lst index 7f260f07cf65..fe6077f57bc8 100644 --- a/framework/prj/d.lst +++ b/framework/prj/d.lst @@ -42,6 +42,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar ..\inc\classes\menuextensionsupplier.hxx %_DEST%\inc%_EXT%\framework\menuextensionsupplier.hxx ..\inc\interaction\preventduplicateinteraction.hxx %_DEST%\inc%_EXT%\framework\preventduplicateinteraction.hxx ..\inc\helper\titlehelper.hxx %_DEST%\inc%_EXT%\framework\titlehelper.hxx +..\inc\classes\framelistanalyzer.hxx %_DEST%\inc%_EXT%\framework\framelistanalyzer.hxx ..\uiconfig\startmodule\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\menubar\*.xml ..\uiconfig\startmodule\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\toolbar\*.xml diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index b81ef5aecf0e..43772f5c4273 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -1248,11 +1248,12 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util: if (! xHAccess.is ()) return; - const sal_Int32 c = aEvent.Changes.getLength(); + css::util::ChangesEvent aReceivedEvents( aEvent ); + const sal_Int32 c = aReceivedEvents.Changes.getLength(); sal_Int32 i = 0; for (i=0; i<c; ++i) { - const css::util::ElementChange& aChange = aEvent.Changes[i]; + const css::util::ElementChange& aChange = aReceivedEvents.Changes[i]; // Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will // be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 99dd3107f162..75bcc4c4587f 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/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 193bd63b5ad5..607efce4d4d6 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -776,26 +776,29 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::u css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); - { - ResetableGuard aGuard( m_aLock ); - try - { - if ( m_xModuleImageManager.is() ) - m_xModuleImageManager->dispose(); - } - catch ( Exception& ) - { - } + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + ResetableGuard aGuard( m_aLock ); + Reference< XComponent > xModuleImageManager( m_xModuleImageManager ); + m_xModuleImageManager.clear(); + m_xModuleAcceleratorManager.clear(); + m_aUIElements[LAYER_USERDEFINED].clear(); + m_aUIElements[LAYER_DEFAULT].clear(); + m_xDefaultConfigStorage.clear(); + m_xUserConfigStorage.clear(); + m_xUserRootCommit.clear(); + m_bConfigRead = false; + m_bModified = false; + m_bDisposed = true; + aGuard.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - m_xModuleImageManager.clear(); - m_aUIElements[LAYER_USERDEFINED].clear(); - m_aUIElements[LAYER_DEFAULT].clear(); - m_xDefaultConfigStorage.clear(); - m_xUserConfigStorage.clear(); - m_xUserRootCommit.clear(); - m_bConfigRead = false; - m_bModified = false; - m_bDisposed = true; + try + { + if ( xModuleImageManager.is() ) + xModuleImageManager->dispose(); + } + catch ( Exception& ) + { } } @@ -1370,30 +1373,35 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() } return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY ); - -// return Reference< XInterface >(); } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) { ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + Reference< XMultiServiceFactory > xSMGR = m_xServiceManager; - ::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier; - aGuard.unlock(); + ::rtl::OUString aModule = m_aModuleIdentifier; - Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); - Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); + if ( !m_xModuleAcceleratorManager.is() ) + { + Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); + Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); - PropertyValue aProp; - aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier"); - aProp.Value <<= aModule; + PropertyValue aProp; + aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier"); + aProp.Value <<= aModule; - Sequence< Any > lArgs(1); - lArgs[0] <<= aProp; + Sequence< Any > lArgs(1); + lArgs[0] <<= aProp; - xInit->initialize(lArgs); + xInit->initialize(lArgs); + m_xModuleAcceleratorManager = Reference< XInterface >( xManager, UNO_QUERY ); + } - return xManager; + return m_xModuleAcceleratorManager; } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 91532cda76e2..edc5f67ce60a 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -50,7 +50,6 @@ LIB1OBJFILES= \ $(SLO)$/protocolhandlercache.obj \ $(SLO)$/networkdomain.obj \ $(SLO)$/configaccess.obj \ - $(SLO)$/framelistanalyzer.obj \ $(SLO)$/shareablemutex.obj \ $(SLO)$/itemcontainer.obj \ $(SLO)$/rootitemcontainer.obj \ @@ -99,6 +98,7 @@ LIB2OBJFILES= \ $(SLO)$/configimporter.obj \ $(SLO)$/menuextensionsupplier.obj \ $(SLO)$/preventduplicateinteraction.obj \ + $(SLO)$/framelistanalyzer.obj \ $(SLO)$/titlehelper.obj # --- import classes library --------------------------------------------------- diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index 76c4bb17782b..62d3fdcce85d 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 6ed51b2aa4c4..d79196b00927 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 fb6261bc06c0..3eb8337798d6 100644 --- a/oovbaapi/ooo/vba/excel/XWorksheet.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl @@ -66,12 +66,14 @@ interface XWorksheet [attribute, readonly] boolean ProtectionMode; [attribute, readonly] boolean ProtectContents; [attribute, readonly] boolean ProtectDrawingObjects; + [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( ); diff --git a/scripting/source/basprov/basmodnode.cxx b/scripting/source/basprov/basmodnode.cxx index 22f9e40571a4..fe6ed69fccab 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 abd61f6c1285..69cc6f40cd3d 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/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index 7468394d2617..89062d7b7263 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -94,7 +94,7 @@ public: USHORT GetViewFactoryCount() const; SfxViewFactory& GetViewFactory(USHORT i = 0) const; - /// returns the view factory whose GetViewName delivers the requested logical name + /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const; // Filter diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 48ffc5727dc1..0cb57e7a414d 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -320,7 +320,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/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index d376236bf830..affa836486e6 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -253,6 +253,7 @@ public: private: SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); + SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const USHORT i_nNewViewId ); /** loads the given existing document into the given frame diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 8465a238cd5b..ee8dfb1ca57c 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -123,13 +123,13 @@ public: \ static SfxViewFactory&Factory() { return *pFactory; } \ static void InitFactory() -#define SFX_IMPL_VIEWFACTORY(Class, rResId) \ +#define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \ SfxViewFactory* Class::pFactory; \ SfxViewShell* __EXPORT Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \ { return new Class(pFrame, pOldView); } \ void Class::RegisterFactory( USHORT nPrio ) \ { \ - pFactory = new SfxViewFactory(&CreateInstance,&InitFactory,nPrio,rResId);\ + pFactory = new SfxViewFactory(&CreateInstance,&InitFactory,nPrio,AsciiViewName);\ InitFactory(); \ } \ void Class::InitFactory() diff --git a/sfx2/inc/viewfac.hxx b/sfx2/inc/viewfac.hxx index 6f9ae1d3cb37..b0f0abdba3b3 100644 --- a/sfx2/inc/viewfac.hxx +++ b/sfx2/inc/viewfac.hxx @@ -46,24 +46,29 @@ class SFX2_DLLPUBLIC SfxViewFactory { public: SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, - USHORT nOrdinal, const ResId& aDescrResId ); + USHORT nOrdinal, const sal_Char* asciiViewName ); ~SfxViewFactory(); SfxViewShell *CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh); void InitFactory(); - String GetDescription() const - { return String( aDescription ); } USHORT GetOrdinal() const { return nOrd; } - /// returns an API-compatible view name. For the moment, this is "view" with an appended ordinal/ID - String GetViewName() const; + /// returns a legacy view name. This is "view" with an appended ordinal/ID. + String GetLegacyViewName() const; + + /** returns a API-compatible view name. + + For details on which view names are specified, see the XModel2.getAvailableViewControllerNames + documentation. + */ + String GetAPIViewName() const; private: SfxViewCtor fnCreate; SfxViewInit fnInit; USHORT nOrd; - ResId aDescription; + const String m_sViewName; }; #endif diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index f25485a1401c..30fe2460d512 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -253,10 +253,11 @@ namespace sfx2 pWindow->SetHelpId( HID_TASKPANE_WINDOW ); pWindow->SetOutputSizePixel( Size( 300, 450 ) ); - pWindow->Show(); dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo ); SetHideNotDelete( TRUE ); + + pWindow->Show(); } //------------------------------------------------------------------------------------------------------------------ @@ -584,6 +585,7 @@ namespace sfx2 return; ::rtl::OUString sFirstVisiblePanelResource; + ::rtl::OUString sFirstPanelResource; const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); @@ -594,6 +596,8 @@ namespace sfx2 if ( !impl_isToolPanelResource( *resource ) ) continue; + sFirstPanelResource = *resource; + ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); @@ -620,6 +624,9 @@ namespace sfx2 sFirstVisiblePanelResource = *resource; } + if ( sFirstVisiblePanelResource.getLength() == 0 ) + sFirstVisiblePanelResource = sFirstPanelResource; + if ( sFirstVisiblePanelResource.getLength() ) { ::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) ); diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 9625ea958830..df0781be8877 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/docfac.cxx b/sfx2/source/doc/docfac.cxx index bfd67210ec44..4311559f94af 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -159,6 +159,21 @@ void SfxObjectFactory::RegisterViewFactory SfxViewFactory &rFactory ) { +#if OSL_DEBUG_LEVEL > 0 + { + const String sViewName( rFactory.GetAPIViewName() ); + for ( sal_uInt16 i = 0; i < pImpl->aViewFactoryArr.Count(); ++i ) + { + if ( !pImpl->aViewFactoryArr[i]->GetAPIViewName().Equals( sViewName ) ) + continue; + ByteString sMessage( "SfxObjectFactory::RegisterViewFactory: duplicate view name '" ); + sMessage += ByteString( sViewName, RTL_TEXTENCODING_ASCII_US ); + sMessage += "'!"; + OSL_ENSURE( false, sMessage.GetBuffer() ); + break; + } + } +#endif sal_uInt16 nPos; for ( nPos = 0; nPos < pImpl->aViewFactoryArr.Count() && @@ -467,7 +482,9 @@ SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rVie ) { SfxViewFactory& rViewFac( GetViewFactory( nViewNo ) ); - if ( rViewFac.GetViewName() == i_rViewName ) + if ( ( rViewFac.GetAPIViewName() == i_rViewName ) + || ( rViewFac.GetLegacyViewName() == i_rViewName ) + ) return &rViewFac; } return NULL; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 1dea202e0d0e..29081e8e8418 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 b921f2d97f1f..71f3683c0006 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 addb648ef2e9..e386b2382acf 100755..100644 --- 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/objserv.cxx b/sfx2/source/doc/objserv.cxx index 066f366b09bd..bb0e6939ead8 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1344,8 +1344,13 @@ sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent ) void SfxObjectShell::ImplSign( sal_Bool bScriptingContent ) { // Check if it is stored in OASIS format... - if ( GetMedium() && GetMedium()->GetFilter() - && ( !GetMedium()->GetFilter()->IsOwnFormat() || !GetMedium()->HasStorage_Impl() ) ) + if ( GetMedium() + && GetMedium()->GetFilter() + && GetMedium()->GetName().Len() + && ( !GetMedium()->GetFilter()->IsOwnFormat() + || !GetMedium()->HasStorage_Impl() + ) + ) { // Only OASIS and OOo6.x formats will be handled further InfoBox( NULL, SfxResId( RID_XMLSEC_INFO_WRONGDOCFORMAT ) ).Execute(); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 6c4bdf56ba26..037493c61252 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" ) ) ); @@ -1917,7 +1917,25 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl( bResult = SaveCompleted( xTmpStorage ); if ( bResult ) + { pImp->pBasicManager->setStorage( xTmpStorage ); + + // Get rid of this workaround after issue i113914 is fixed + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImp->xBasicLibraries, uno::UNO_QUERY_THROW ); + xBasicLibraries->setRootStorage( xTmpStorage ); + } + catch( uno::Exception& ) + {} + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImp->xDialogLibraries, uno::UNO_QUERY_THROW ); + xDialogLibraries->setRootStorage( xTmpStorage ); + } + catch( uno::Exception& ) + {} + } } catch( uno::Exception& ) {} @@ -2063,6 +2081,22 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) // TODO/LATER: may be this code will be replaced, but not sure // Set storage in document library containers pImp->pBasicManager->setStorage( xStorage ); + + // Get rid of this workaround after issue i113914 is fixed + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImp->xBasicLibraries, uno::UNO_QUERY_THROW ); + xBasicLibraries->setRootStorage( xStorage ); + } + catch( uno::Exception& ) + {} + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImp->xDialogLibraries, uno::UNO_QUERY_THROW ); + xDialogLibraries->setRootStorage( xStorage ); + } + catch( uno::Exception& ) + {} } else { diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 7ef9fe0d2f19..846cc669b9a7 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 @@ -3811,7 +3812,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewCon Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) - aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetViewName(); + aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetAPIViewName(); return aViewNames; } @@ -3825,7 +3826,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef SfxModelGuard aGuard( *this ); const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); - const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName(); + const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetAPIViewName(); aGuard.clear(); diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index ed158ce009e3..df252b831803 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -650,7 +650,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // ensure the ID of the to-be-created view is in the descriptor, if possible const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); - const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() ); // if the document is created hidden, prevent it from being deleted until it is shown or disposed impl_lockHiddenDocument( *xDoc, aDescriptor ); diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index f5c24b195af7..cda5fd0bdd7d 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -118,6 +118,7 @@ using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::lang::DisposedException; using ::com::sun::star::awt::XWindow; using ::com::sun::star::frame::XController; @@ -579,7 +580,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run ::rtl::OUString sViewName; if ( nViewNo < rDocFac.GetViewFactoryCount() ) - sViewName = rDocFac.GetViewFactory( nViewNo ).GetViewName(); + sViewName = rDocFac.GetViewFactory( nViewNo ).GetAPIViewName(); return sViewName; } @@ -1421,20 +1422,52 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) // if so, forward it to the view/shell. if ( !bHasPluginMode && !bHasJumpMark ) { + // Note that this might not be the ideal place here. Restoring view data should, IMO, be the + // responsibility of the loader, not an implementation detail burried here deep within the controller's + // implementation. + // What I think should be done to replace the below code: + // - change SfxBaseController::restoreViewData to also accept a PropertyValue[] (it currently accepts + // a string only), and forward it to its ViewShell's ReadUserDataSequence + // - change the frame loader so that when a new document is loaded (as opposed to an existing + // document being loaded into a new frame), the model's view data is examine the very same + // way as below, and the proper view data is set via XController::restoreViewData + // - extend SfxViewFrame::SwitchToViewShell_Impl. Currently, it cares for the case where a non-PrintPreview + // view is exchanged, and sets the old view's data at the model. It should also care for the other + // way, were the PrintPreview view is left: in this case, the new view should also be initialized + // with the model's view data try { - Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData = xViewDataSupplier->getViewData(); - if ( xViewData.is() && xViewData->getCount() > 0 ) + Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData(), UNO_SET_THROW ); + + // find the view data item whose ViewId matches the ID of the view we're just connecting to + const SfxObjectFactory& rDocFactory( rDoc.GetFactory() ); + const sal_Int32 nCount = xViewData->getCount(); + sal_Int32 nViewDataIndex = 0; + for ( sal_Int32 i=0; i<nCount; ++i ) { - Sequence< PropertyValue > aViewData; - if ( ( xViewData->getByIndex( 0 ) >>= aViewData ) && ( aViewData.getLength() ) ) + const ::comphelper::NamedValueCollection aViewData( xViewData->getByIndex(i) ); + ::rtl::OUString sViewId( aViewData.getOrDefault( "ViewId", ::rtl::OUString() ) ); + if ( sViewId.getLength() == 0 ) + continue; + + const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId ); + if ( pViewFactory == NULL ) + continue; + + if ( pViewFactory->GetOrdinal() == pViewFrame->GetCurViewId() ) { - m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + nViewDataIndex = i; + break; } } + if ( nViewDataIndex < nCount ) + { + Sequence< PropertyValue > aViewData; + OSL_VERIFY( xViewData->getByIndex( nViewDataIndex ) >>= aViewData ); + if ( aViewData.getLength() > 0 ) + m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + } } catch( const Exception& ) { diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index b58bbc2840da..f9469e8a9f88 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -49,7 +49,7 @@ void SfxViewFactory::InitFactory() (*fnInit)(); } -String SfxViewFactory::GetViewName() const +String SfxViewFactory::GetLegacyViewName() const { ::rtl::OUStringBuffer aViewName; aViewName.appendAscii( "view" ); @@ -57,18 +57,27 @@ String SfxViewFactory::GetViewName() const return aViewName.makeStringAndClear(); } +String SfxViewFactory::GetAPIViewName() const +{ + if ( m_sViewName.Len() > 0 ) + return m_sViewName; + + if ( GetOrdinal() == 0 ) + return String::CreateFromAscii( "Default" ); + + return GetLegacyViewName(); +} + // CTOR / DTOR ----------------------------------------------------------- SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, - USHORT nOrdinal, const ResId& aDescrResId ): + USHORT nOrdinal, const sal_Char* asciiViewName ): fnCreate(fnC), fnInit(fnI), nOrd(nOrdinal), - aDescription(aDescrResId.GetId(), *aDescrResId.GetResMgr()) + m_sViewName( String::CreateFromAscii( asciiViewName ) ) { - aDescription.SetRT(aDescrResId.GetRT()); DBG_CTOR(SfxViewFactory, 0); -// SFX_APP()->RegisterViewFactory_Impl(*this); } SfxViewFactory::~SfxViewFactory() diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index dcda416a3d16..6222721d9b83 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -75,6 +75,8 @@ #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> #include <rtl/ustrbuf.hxx> #include <unotools/localfilehelper.hxx> @@ -96,6 +98,7 @@ #include <comphelper/storagehelper.hxx> #include <svtools/asynclink.hxx> #include <svl/sharecontrolfile.hxx> +#include <framework/framelistanalyzer.hxx> #include <boost/optional.hpp> @@ -106,6 +109,8 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using ::com::sun::star::awt::XWindow; using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexContainer; namespace css = ::com::sun::star; #ifndef GCC @@ -2085,7 +2090,25 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell { ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + + if ( !i_bHidden ) + { + try + { + // if there is a backing component, use it + Reference< XFramesSupplier > xTaskSupplier( xDesktop , css::uno::UNO_QUERY_THROW ); + ::framework::FrameListAnalyzer aAnalyzer( xTaskSupplier, Reference< XFrame >(), ::framework::FrameListAnalyzer::E_BACKINGCOMPONENT ); + + if ( aAnalyzer.m_xBackingComponent.is() ) + xFrame = aAnalyzer.m_xBackingComponent; + } + catch( uno::Exception& ) + {} + } + + if ( !xFrame.is() ) + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + bOwnFrame = true; } @@ -2235,6 +2258,72 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c //-------------------------------------------------------------------- +void SfxViewFrame::SaveCurrentViewData_Impl( const USHORT i_nNewViewId ) +{ + SfxViewShell* pCurrentShell = GetViewShell(); + ENSURE_OR_RETURN_VOID( pCurrentShell != NULL, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" ); + + // determine the logical (API) view name + const SfxObjectFactory& rDocFactory( pCurrentShell->GetObjectShell()->GetFactory() ); + const sal_uInt16 nCurViewNo = rDocFactory.GetViewNo_Impl( GetCurViewId(), 0 ); + const String sCurrentViewName = rDocFactory.GetViewFactory( nCurViewNo ).GetAPIViewName(); + const sal_uInt16 nNewViewNo = rDocFactory.GetViewNo_Impl( i_nNewViewId, 0 ); + const String sNewViewName = rDocFactory.GetViewFactory( nNewViewNo ).GetAPIViewName(); + if ( ( sCurrentViewName.Len() == 0 ) || ( sNewViewName.Len() == 0 ) ) + { + // can't say anything about the view, the respective application did not yet migrate its code to + // named view factories => bail out + OSL_ENSURE( false, "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" ); + return; + } + OSL_ENSURE( !sNewViewName.Equals( sCurrentViewName ), "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!" ); + + // save the view data only when we're moving from a non-print-preview to the print-preview view + if ( !sNewViewName.EqualsAscii( "PrintPreview" ) ) + return; + + // retrieve the view data from the view + Sequence< PropertyValue > aViewData; + pCurrentShell->WriteUserDataSequence( aViewData ); + + try + { + // retrieve view data (for *all* views) from the model + const Reference< XController > xController( pCurrentShell->GetController(), UNO_SET_THROW ); + const Reference< XViewDataSupplier > xViewDataSupplier( xController->getModel(), UNO_QUERY_THROW ); + const Reference< XIndexContainer > xViewData( xViewDataSupplier->getViewData(), UNO_QUERY_THROW ); + + // look up the one view data item which corresponds to our current view, and remove it + const sal_Int32 nCount = xViewData->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) + { + const ::comphelper::NamedValueCollection aCurViewData( xViewData->getByIndex(i) ); + ::rtl::OUString sViewId( aCurViewData.getOrDefault( "ViewId", ::rtl::OUString() ) ); + if ( sViewId.getLength() == 0 ) + continue; + + const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId ); + if ( pViewFactory == NULL ) + continue; + + if ( pViewFactory->GetOrdinal() == GetCurViewId() ) + { + xViewData->removeByIndex(i); + break; + } + } + + // then replace it with the most recent view data we just obtained + xViewData->insertByIndex( 0, makeAny( aViewData ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//-------------------------------------------------------------------- + sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( sal_uInt16 nViewIdOrNo, /* > 0 @@ -2297,6 +2386,9 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; + // save the view data of the old view, so it can be restored later on (when needed) + SaveCurrentViewData_Impl( nViewId ); + // create and load new ViewShell SfxViewShell* pNewSh = LoadViewIntoFrame_Impl( *GetObjectShell(), diff --git a/svx/source/dialog/checklbx.cxx b/svx/source/dialog/checklbx.cxx index c54634017392..80096ce70f32 100644 --- a/svx/source/dialog/checklbx.cxx +++ b/svx/source/dialog/checklbx.cxx @@ -212,7 +212,7 @@ void SvxCheckListBox::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() ) { - Point aPnt = rMEvt.GetPosPixel(); + const Point aPnt = rMEvt.GetPosPixel(); SvLBoxEntry* pEntry = GetEntry( aPnt ); if ( pEntry ) @@ -230,6 +230,13 @@ void SvxCheckListBox::MouseButtonDown( const MouseEvent& rMEvt ) { ToggleCheckButton( pEntry ); SvTreeListBox::MouseButtonDown( rMEvt ); + + // check if the entry below the mouse changed during the base method call. This is possible if, + // for instance, a handler invoked by the base class tampers with the list entries. + const SvLBoxEntry* pNewEntry = GetEntry( aPnt ); + if ( pNewEntry != pEntry ) + return; + if ( bCheck != ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) ) CheckButtonHdl(); return; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index d860f4973fd2..9c5affc38f9b 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -708,6 +708,7 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& // next entry ++aSrcIt; } + const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny(); } } diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index c13ec9d367c8..30f7e32f3828 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/ucb/XParameterizedContentProvider.hpp> #include <com/sun/star/ucb/XContentProviderFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/uno/Any.hxx> #include <ucbhelper/cancelcommandexecution.hxx> @@ -182,6 +183,63 @@ void makeAndAppendXMLName( } } +bool createContentProviderData( + const rtl::OUString & rProvider, + const uno::Reference< container::XHierarchicalNameAccess >& rxHierNameAccess, + ContentProviderData & rInfo) +{ + // Obtain service name. + rtl::OUStringBuffer aKeyBuffer (rProvider); + aKeyBuffer.appendAscii( "/ServiceName" ); + + rtl::OUString aValue; + try + { + if ( !( rxHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "UniversalContentBroker::getContentProviderData - " + "Error getting item value!" ); + } + } + catch (container::NoSuchElementException &) + { + return false; + } + + rInfo.ServiceName = aValue; + + // Obtain URL Template. + aKeyBuffer.append(rProvider); + aKeyBuffer.appendAscii( "/URLTemplate" ); + + if ( !( rxHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "UniversalContentBroker::getContentProviderData - " + "Error getting item value!" ); + } + + rInfo.URLTemplate = aValue; + + // Obtain Arguments. + aKeyBuffer.append(rProvider); + aKeyBuffer.appendAscii( "/Arguments" ); + + if ( !( rxHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "UniversalContentBroker::getContentProviderData - " + "Error getting item value!" ); + } + + rInfo.Arguments = aValue; + return true; +} + } //========================================================================= @@ -647,28 +705,10 @@ void SAL_CALL UniversalContentBroker::changesOccurred( const util::ChangesEvent& sal_Int32 nCount = Event.Changes.getLength(); if ( nCount ) { + uno::Reference< container::XHierarchicalNameAccess > xHierNameAccess; + Event.Base >>= xHierNameAccess; - uno::Reference< lang::XMultiServiceFactory > xConfigProv( - m_xSMgr->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.configuration.ConfigurationProvider" ) ), - uno::UNO_QUERY_THROW ); - - uno::Sequence< uno::Any > aArguments( 1 ); - beans::PropertyValue aProperty; - aProperty.Name - = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aProperty.Value <<= Event.Base; - aArguments[ 0 ] <<= aProperty; - - uno::Reference< uno::XInterface > xInterface( - xConfigProv->createInstanceWithArguments( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" ) ), - aArguments ) ); - - uno::Reference< container::XHierarchicalNameAccess > - xHierNameAccess( xInterface, uno::UNO_QUERY_THROW ); + OSL_ASSERT( xHierNameAccess.is() ); const util::ElementChange* pElementChanges = Event.Changes.getConstArray(); @@ -682,9 +722,18 @@ void SAL_CALL UniversalContentBroker::changesOccurred( const util::ChangesEvent& ContentProviderData aInfo; - createContentProviderData(aKey, xHierNameAccess, aInfo); - - aData.push_back(aInfo); + // Removal of UCPs from the configuration leads to changesOccurred + // notifications, too, but it is hard to tell for a given + // ElementChange whether it is an addition or a removal, so as a + // heuristic consider as removals those that cause a + // NoSuchElementException in createContentProviderData. + // + // For now, removal of UCPs from the configuration is simply ignored + // (and not reflected in the UCB's data structures): + if (createContentProviderData(aKey, xHierNameAccess, aInfo)) + { + aData.push_back(aInfo); + } } prepareAndRegister(aData); @@ -852,7 +901,10 @@ bool UniversalContentBroker::getContentProviderData( makeAndAppendXMLName( aElemBuffer, pElems[ n ] ); aElemBuffer.appendAscii( "']" ); - createContentProviderData(aElemBuffer.makeStringAndClear(), xHierNameAccess, aInfo); + OSL_VERIFY( + createContentProviderData( + aElemBuffer.makeStringAndClear(), xHierNameAccess, + aInfo)); rListToFill.push_back( aInfo ); } @@ -884,55 +936,6 @@ bool UniversalContentBroker::getContentProviderData( return true; } -void UniversalContentBroker::createContentProviderData( - const rtl::OUString & rProvider, - const uno::Reference< container::XHierarchicalNameAccess >& rxHierNameAccess, - ContentProviderData & rInfo) -{ - // Obtain service name. - rtl::OUStringBuffer aKeyBuffer (rProvider); - aKeyBuffer.appendAscii( "/ServiceName" ); - - rtl::OUString aValue; - if ( !( rxHierNameAccess->getByHierarchicalName( - aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) - { - OSL_ENSURE( false, - "UniversalContentBroker::getContentProviderData - " - "Error getting item value!" ); - } - - rInfo.ServiceName = aValue; - - // Obtain URL Template. - aKeyBuffer.append(rProvider); - aKeyBuffer.appendAscii( "/URLTemplate" ); - - if ( !( rxHierNameAccess->getByHierarchicalName( - aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) - { - OSL_ENSURE( false, - "UniversalContentBroker::getContentProviderData - " - "Error getting item value!" ); - } - - rInfo.URLTemplate = aValue; - - // Obtain Arguments. - aKeyBuffer.append(rProvider); - aKeyBuffer.appendAscii( "/Arguments" ); - - if ( !( rxHierNameAccess->getByHierarchicalName( - aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) - { - OSL_ENSURE( false, - "UniversalContentBroker::getContentProviderData - " - "Error getting item value!" ); - } - - rInfo.Arguments = aValue; -} - //========================================================================= // // ProviderListEntry_Impl implementation. diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx index 0e44c5bc99b5..d2f6e4e4c41e 100644 --- a/ucb/source/core/ucb.hxx +++ b/ucb/source/core/ucb.hxx @@ -40,7 +40,6 @@ #include <com/sun/star/util/XChangesListener.hpp> #include <com/sun/star/util/XChangesNotifier.hpp> #include <com/sun/star/container/XContainer.hpp> -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <rtl/ustrbuf.hxx> #include <cppuhelper/weak.hxx> @@ -204,11 +203,6 @@ private: void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData); - void createContentProviderData( - const rtl::OUString& rProvider, - const com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess >& rxHierNameAccess, - ucbhelper::ContentProviderData& rInfo); - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 6d65eb67055e..11f6627ed8b9 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -269,7 +269,7 @@ handleAuthenticationRequest_( aInfo.SetCanRememberPassword( ePreferredRememberMode != eAlternateRememberMode); aInfo.SetIsRememberPassword( - eDefaultRememberMode != ucb::RememberAuthentication_NO); + ePreferredRememberMode == eDefaultRememberMode); aInfo.SetIsRememberPersistent( ePreferredRememberMode == ucb::RememberAuthentication_PERSISTENT); diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx index a1eca84bbdf8..ccabb9114f2d 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 2a4cecfc2338..a1333e0a655b 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 7cd82dff9536..14f4e3ff1363 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(); diff --git a/xmlhelp/prj/d.lst b/xmlhelp/prj/d.lst index 1cfa107f73b9..67fe323757bb 100644 --- a/xmlhelp/prj/d.lst +++ b/xmlhelp/prj/d.lst @@ -4,4 +4,7 @@ ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.* ..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.* ..\util\ucpchelp.xml %_DEST%\xml%_EXT%\ucpchelp.xml +..\util\*.xsl %_DEST%\bin%_EXT%\*.* ..\%__SRC%\lib\ihelplinker.lib %_DEST%\lib%_EXT%\ihelplinker.lib +..\%__SRC%\bin\helpxsl.zip %_DEST%\pck%_EXT%\helpxsl.zip + diff --git a/xmlhelp/util/delzip b/xmlhelp/util/delzip new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/xmlhelp/util/delzip diff --git a/xmlhelp/util/embed.xsl b/xmlhelp/util/embed.xsl new file mode 100644 index 000000000000..3a4e3ef80f61 --- /dev/null +++ b/xmlhelp/util/embed.xsl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:output indent="yes" method="xml"/> + +<!-- SPECIFY YOUR FILE SYSTEM ROOT PATH TO THE HELP FILES --> +<xsl:param name="fsroot" select="'file:///handbuch/WORKBENCH/helpcontent2/source/'"/> + +<!-- +###################################################### +All others +###################################################### +--> +<xsl:template match="/"> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="*|@*|comment()|processing-instruction()|text()"> + <xsl:copy> + <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="*|@*|comment()|processing-instruction()|text()" mode="embedded"> + <xsl:copy> + <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()" mode="embedded"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="bookmark" mode="embedded" /> +<xsl:template match="ahelp" mode="embedded"> + <xsl:apply-templates mode="embedded"/> +</xsl:template> + +<xsl:template match="paragraph[@role='heading']"> + <title> + <xsl:apply-templates/> + </title> +</xsl:template> + +<xsl:template match="paragraph[@role=*]"> + <paragraph> + <xsl:apply-templates/> + </paragraph> +</xsl:template> + +<xsl:template match="sort"> + <xsl:apply-templates/> +</xsl:template> + + +<!-- +###################################################### +EMBED +###################################################### +--> +<xsl:template match="embed"> + + <xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/> + <xsl:if test="not($doc//section[@id=$anchor])"> <!-- fallback for embeds that actually should be embedvars --> + <paragraph role="paragraph"><xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/></paragraph> + </xsl:if> +</xsl:template> + +<!-- +###################################################### +EMBEDVAR +###################################################### +--> +<xsl:template match="embedvar"> + <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links --> + <xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:if> + + <!-- FPE: embedvars, that point to "text/shared/00/00000004.xml#wie" will only be resolved in the main_transform --> + +</xsl:template> +</xsl:stylesheet> diff --git a/xmlhelp/util/idxcaption.xsl b/xmlhelp/util/idxcaption.xsl new file mode 100644 index 000000000000..7570fa5c7870 --- /dev/null +++ b/xmlhelp/util/idxcaption.xsl @@ -0,0 +1,34 @@ +<xsl:stylesheet version="1.0" encoding="UTF-8" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:office="http://openoffice.org/2000/office" + xmlns:style="http://openoffice.org/2000/style" + xmlns:table="http://openoffice.org/2000/table" + xmlns:draw="http://openoffice.org/2000/drawing" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:meta="http://openoffice.org/2000/meta" + xmlns:number="http://openoffice.org/2000/datastyle" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:chart="http://openoffice.org/2000/chart" + xmlns:help="http://openoffice.org/2000/help" + xmlns:index="http://sun.com/2000/XMLSearch" + xmlns:text="http://openoffice.org/2000/text"> + +<xsl:param name="Language" select="'en-US'"/> +<xsl:output method="text" encoding="UTF-8"/> + +<xsl:template match="/"> + <xsl:apply-templates select="//title" mode="include"/> + <xsl:apply-templates select="//paragraph[@role='heading']" mode="include"/> +</xsl:template> + +<xsl:template match="*" mode="include"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="*"/> + +</xsl:stylesheet> + diff --git a/xmlhelp/util/idxcontent.xsl b/xmlhelp/util/idxcontent.xsl new file mode 100644 index 000000000000..aa371d7f9255 --- /dev/null +++ b/xmlhelp/util/idxcontent.xsl @@ -0,0 +1,104 @@ +<xsl:stylesheet version="1.0" encoding="UTF-8" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:office="http://openoffice.org/2000/office" + xmlns:style="http://openoffice.org/2000/style" + xmlns:table="http://openoffice.org/2000/table" + xmlns:draw="http://openoffice.org/2000/drawing" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:meta="http://openoffice.org/2000/meta" + xmlns:number="http://openoffice.org/2000/datastyle" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:chart="http://openoffice.org/2000/chart" + xmlns:help="http://openoffice.org/2000/help" + xmlns:index="http://sun.com/2000/XMLSearch" + xmlns:text="http://openoffice.org/2000/text"> + +<xsl:param name="Language" select="'en-US'"/> +<xsl:output method="text" encoding="UTF-8"/> + +<xsl:template match="helpdocument|body"> + <xsl:choose> + <xsl:when test="meta/topic[@indexer='exclude']"/> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="title"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="table"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="tablecell"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="tablerow"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="list"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="listitem"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="item"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="emph"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="paragraph"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="section"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="bookmark"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="bookmark_value"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="link"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="ahelp[@visibility='visible']"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="*"/> + +</xsl:stylesheet> + + diff --git a/xmlhelp/util/main_transform.xsl b/xmlhelp/util/main_transform.xsl new file mode 100644 index 000000000000..d9b6c3229696 --- /dev/null +++ b/xmlhelp/util/main_transform.xsl @@ -0,0 +1,972 @@ +<?xml version="1.0" encoding="UTF-8"?> + + +<!--*********************************************************************** + This is the main transformation style sheet for transforming. + Only use with OOo 2.0 + Owner: fpe@openoffice.org + ========================================================================= + Changes Log + May 24 2004 Created + Aug 24 2004 Fixed for help2 CWS + Aug 27 2004 Added css link, fixed missing embed-mode for variable + Removed width/height for images + Sep 03 2004 Modularized xsl, added some embedded modes + Oct 08 2004 Fixed bug wrong mode "embedded" for links + Added embedded modes for embed and embedvar (for cascaded embeds) + Added <p> tags around falsely embedded pars and vars + Dec 08 2004 #i38483#, fixed wrong handling of web links + #i37377#, fixed missing usage of Database parameter for switching + Jan 04 2005 #i38905#, fixed buggy branding replacement template + Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter + evaluate new localize attribute in images + May 10 2005 #i48785#, fixed wrong setting of distrib variable + Aug 16 2005 workaround for #i53365# + Aug 19 2005 fixed missing list processing in embedded sections + Aug 19 2005 #i53535#, fixed wrong handling of Database parameter + Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console + Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors +***********************************************************************//--> + +<!-- + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + Copyright 2000, 2010 Oracle and/or its affiliates. + + OpenOffice.org - a multi-platform office productivity suite + + This file is part of OpenOffice.org. + + OpenOffice.org is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + OpenOffice.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details + (a copy is included in the LICENSE file that accompanied this code). + + You should have received a copy of the GNU Lesser General Public License + version 3 along with OpenOffice.org. If not, see + <http://www.openoffice.org/license.html> + for a copy of the LGPLv3 License. + +--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:output indent="yes" method="html"/> + +<!-- +############################ +# Variables and Parameters # +############################ +//--> + +<!-- General Usage --> +<xsl:variable name="am" select="'&'"/> +<xsl:variable name="sl" select="'/'"/> +<xsl:variable name="qt" select="'"'"/> + +<!-- generic Icon alt text --> +<xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/> + +<!-- For calculating pixel sizes --> +<xsl:variable name="dpi" select="'96'"/> +<xsl:variable name="dpcm" select="'38'"/> + +<!-- Product brand variables used in the help files --> +<xsl:variable name="brand1" select="'$[officename]'"/> +<xsl:variable name="brand2" select="'$[officeversion]'"/> +<xsl:variable name="brand3" select="'%PRODUCTNAME'"/> +<xsl:variable name="brand4" select="'%PRODUCTVERSION'"/> + +<!-- meta data variables from the help file --> +<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/> +<xsl:variable name="topic_id" select="/helpdocument/meta/topic/@id"/> +<xsl:variable name="topic_status" select="/helpdocument/meta/topic/@status"/> +<xsl:variable name="title" select="/helpdocument/meta/topic/title"/> +<xsl:variable name="doclang" select="/helpdocument/meta/topic/title/@xml-lang"/> + +<!-- Module and the corresponding switching values--> +<xsl:param name="Database" select="'swriter'"/> +<xsl:variable name="module" select="$Database"/> +<xsl:variable name="appl"> + <xsl:choose> + <xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when> + <xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when> + <xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when> + <xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when> + <xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when> + <xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when> + <xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when> + </xsl:choose> +</xsl:variable> + + <!-- the other parameters given by the help caller --> +<xsl:param name="System" select="'WIN'"/> +<xsl:param name="productname" select="'Office'"/> +<xsl:param name="productversion" select="''"/> +<xsl:variable name="pversion"> + <xsl:value-of select="translate($productversion,' ','')"/> +</xsl:variable> +<!-- this is were the images are --> +<xsl:param name="imgrepos" select="''"/> +<xsl:param name="Id" /> +<!-- (lame) distinction between OS and Commercial --> +<xsl:param name="distrib"> + <xsl:choose> + <xsl:when test="starts-with($productname,'OpenOffice')"> + <xsl:value-of select="'OpenSource'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'COMMERCIAL'"/> + </xsl:otherwise> + </xsl:choose> +</xsl:param> +<xsl:param name="Language" select="'en-US'"/> +<xsl:variable name="lang" select="$Language"/> + +<xsl:param name="ExtensionId" select="''"/> +<xsl:param name="ExtensionPath" select="''"/> + + + <!-- parts of help and image urls --> +<xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/> +<xsl:variable name="img_url_prefix" select="concat('vnd.sun.star.zip://',$imgrepos,'/')"/> +<xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/> +<xsl:variable name="urlpre" select="$help_url_prefix" /> +<xsl:variable name="linkprefix" select="$urlpre"/> +<xsl:variable name="linkpostfix" select="$urlpost"/> + +<xsl:variable name="css" select="'default.css'"/> + +<!-- images for notes, tips and warnings --> +<xsl:variable name="note_img" select="concat($img_url_prefix,'res/helpimg/note.png')"/> +<xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/> +<xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/> + +<!-- +############# +# Templates # +############# +//--> + +<!-- Create the document skeleton --> +<xsl:template match="/"> + <xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/> + <html> + <head> + <title><xsl:value-of select="$title"/></title> + <link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link --> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> + </head> + <body lang="{$lang}"> + <xsl:apply-templates select="/helpdocument/body"/> + </body> + </html> +</xsl:template> + +<!-- AHELP --> +<xsl:template match="ahelp"> + <xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if> +</xsl:template> + +<!-- ALT --> +<xsl:template match="alt"/> + +<!-- BOOKMARK --> +<xsl:template match="bookmark"> + <a name="{@id}"></a> + <xsl:choose> + <xsl:when test="starts-with(@branch,'hid')" /> + <xsl:otherwise><xsl:apply-templates /></xsl:otherwise> + </xsl:choose> +</xsl:template> +<xsl:template match="bookmark" mode="embedded" /> + +<!-- BOOKMARK_VALUE --> +<xsl:template match="bookmark_value" /> + +<!-- BR --> +<xsl:template match="br"><br /></xsl:template> + +<!-- CAPTION --> +<xsl:template match="caption" /> + +<!-- CASE --> +<xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template> +<xsl:template match="case" mode="embedded"> + <xsl:call-template name="insertcase"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- CASEINLINE --> +<xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template> +<xsl:template match="caseinline" mode="embedded"> + <xsl:call-template name="insertcase"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- COMMENT --> +<xsl:template match="comment" /> +<xsl:template match="comment" mode="embedded"/> + +<!-- CREATED --> +<xsl:template match="created" /> + +<!-- DEFAULT --> +<xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template> +<xsl:template match="default" mode="embedded"> + <xsl:call-template name="insertdefault"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- DEFAULTINLINE --> +<xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template> +<xsl:template match="defaultinline" mode="embedded"> + <xsl:call-template name="insertdefault"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- EMBED --> +<xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template> +<xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template> + +<!-- EMBEDVAR --> +<xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template> +<xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template> + +<!-- EMPH --> +<xsl:template match="emph"> + <span class="emph"><xsl:apply-templates /></span> +</xsl:template> +<xsl:template match="emph" mode="embedded"> + <span class="emph"><xsl:apply-templates /></span> +</xsl:template> + +<!-- FILENAME --> +<xsl:template match="filename" /> + +<!-- HISTORY --> +<xsl:template match="history" /> + +<!-- IMAGE --> +<xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template> +<xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template> + +<!-- ITEM --> +<xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template> +<xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template> + +<!-- LASTEDITED --> +<xsl:template match="lastedited" /> + +<!-- LINK --> +<xsl:template match="link"> + <xsl:choose> <!-- don't insert the heading link to itself --> + <xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)"> + <xsl:apply-templates /> + </xsl:when> + <xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links --> + <xsl:call-template name="insert_howtoget"> + <xsl:with-param name="linkhref" select="@href"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="createlink" /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +<xsl:template match="link" mode="embedded"> + <xsl:call-template name="createlink"/> +</xsl:template> + +<!-- LIST --> +<xsl:template match="list"> + <xsl:choose> + <xsl:when test="@type='ordered'"> + <ol> + <xsl:if test="@startwith"> + <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute> + </xsl:if> + <xsl:apply-templates /> + </ol> + </xsl:when> + <xsl:otherwise> + <ul><xsl:apply-templates /></ul> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="list" mode="embedded"> + <xsl:choose> + <xsl:when test="@type='ordered'"> + <ol> + <xsl:if test="@startwith"> + <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="embedded"/> + </ol> + </xsl:when> + <xsl:otherwise> + <ul><xsl:apply-templates mode="embedded"/></ul> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<!-- LISTITEM --> +<xsl:template match="listitem"> + <li><xsl:apply-templates /></li> +</xsl:template> + +<xsl:template match="listitem" mode="embedded"> + <li><xsl:apply-templates mode="embedded"/></li> +</xsl:template> + +<!-- META, SEE HEADER --> +<xsl:template match="meta" /> + +<!-- OBJECT (UNUSED) --> +<xsl:template match="object" /> + +<!-- PARAGRAPH --> +<xsl:template match="paragraph"> + <xsl:choose> + + <xsl:when test="@role='heading'"> + <xsl:call-template name="insertheading"> + <xsl:with-param name="level" select="@level"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(' note warning tip ',@role)"> + <xsl:call-template name="insertnote"> + <xsl:with-param name="type" select="@role" /> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links --> + <xsl:apply-templates /> + </xsl:when> + + <xsl:otherwise> + <xsl:call-template name="insertpara" /> + </xsl:otherwise> + + </xsl:choose> +</xsl:template> + +<xsl:template match="paragraph" mode="embedded"> + <xsl:choose> + + <xsl:when test="@role='heading'"> <!-- increase the level of headings that are embedded --> + <!-- + The internal sablotron processor does not seem to support the number function. + Therefore, we need a workaround for + <xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable> + --> + <xsl:variable name="newlevel"> + <xsl:choose> + <xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when> + <xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when> + <xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when> + <xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when> + <xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:call-template name="insertheading"> + <xsl:with-param name="level" select="$newlevel"/> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(' note warning tip ',@role)"> + <xsl:call-template name="insertnote"> + <xsl:with-param name="type" select="@role" /> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links --> + <xsl:apply-templates /> + </xsl:when> + + <xsl:otherwise> + <xsl:call-template name="insertpara" /> + </xsl:otherwise> + + </xsl:choose> +</xsl:template> + + +<!-- SECTION --> +<xsl:template match="section"> + <a name="{@id}"></a> + + <xsl:choose> + + <xsl:when test="@id='relatedtopics'"> + <div class="relatedtopics"> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <p class="related"> + <xsl:apply-templates select="$doc//variable[@id=$anchor]"/> + </p> + <div class="relatedbody"> + <xsl:apply-templates /> + </div> + </div> + </xsl:when> + + <xsl:when test="@id='howtoget'"> + <xsl:call-template name="insert_howtoget" /> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + + </xsl:choose> + +</xsl:template> + + +<!-- SECTION --> +<xsl:template match="section" mode="embedded"> + <a name="{@id}"></a> + <xsl:apply-templates mode="embedded"/> +</xsl:template> + +<!-- SORT --> +<xsl:template match="sort" > + <!-- sorting disabled due to #i70462# + <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> + //--> + <xsl:apply-templates /> +</xsl:template> +<xsl:template match="sort" mode="embedded"> +<!-- sorting disabled due to #i70462# + <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> + //--> + <xsl:apply-templates /> +</xsl:template> + +<!-- SWITCH --> +<xsl:template match="switch"><xsl:apply-templates /></xsl:template> +<xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template> + +<!-- SWITCHINLINE --> +<xsl:template match="switchinline"><xsl:apply-templates /></xsl:template> +<xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template> + +<!-- TABLE --> +<xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template> +<xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template> + +<!-- TABLECELL --> +<xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template> +<xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template> +<xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template> + +<!-- TABLEROW --> +<xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template> +<xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template> +<xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template> + +<!-- TITLE --> +<xsl:template match="title"/> + +<!-- TOPIC --> +<xsl:template match="topic"/> + +<!-- VARIABLE --> +<xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template> +<xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template> + +<xsl:template match="text()"> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> +</xsl:template> + +<xsl:template match="text()" mode="embedded"> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> +</xsl:template> + +<!-- In case of missing help files --> +<xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template> + +<!-- +################### +# NAMED TEMPLATES # +################### +//--> + +<!-- Branding --> +<xsl:template name="brand" > + <xsl:param name="string"/> + + <xsl:choose> + + <xsl:when test="contains($string,$brand1)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand1)"/> + <xsl:value-of select="$productname"/> + <xsl:value-of select="substring-after($string,$brand1)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand2)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand2)"/> + <xsl:value-of select="$pversion"/> + <xsl:value-of select="substring-after($string,$brand2)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand3)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand3)"/> + <xsl:value-of select="$productname"/> + <xsl:value-of select="substring-after($string,$brand3)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand4)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand4)"/> + <xsl:value-of select="$pversion"/> + <xsl:value-of select="substring-after($string,$brand4)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + + +<!-- Insert Paragraph --> +<xsl:template name="insertpara"> + <xsl:variable name="role"> + <xsl:choose> + <xsl:when test="ancestor::table"> + <xsl:value-of select="concat(@role,'intable')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@role"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <p class="{$role}"><xsl:apply-templates /></p> +</xsl:template> + +<!-- Insert "How to get Link" --> +<xsl:template name="insert_howtoget"> + <xsl:param name="linkhref" /> + <xsl:variable name="archive" select="'shared'"/> + <xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable> + <xsl:variable name="tmp_doc" select="document($tmp_href)"/> + <table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0"> + <tr> + <td> + <p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p> + <div class="howtogetbody"> + <xsl:choose> + <xsl:when test="$linkhref = ''"> <!-- new style --> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> <!-- old style --> + <xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable> + <xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable> + <xsl:variable name="docum" select="document($href)"/> + + <xsl:call-template name="insertembed"> + <xsl:with-param name="doc" select="$docum" /> + <xsl:with-param name="anchor" select="$anc" /> + </xsl:call-template> + + </xsl:otherwise> + </xsl:choose> + </div> + </td> + </tr> + </table> + <br/> +</xsl:template> + +<!-- Create a link --> +<xsl:template name="createlink"> +<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> +<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> + <xsl:choose> + <xsl:when test="starts-with(@href,'http://')"> <!-- web links --> + <a href="{@href}"><xsl:apply-templates /></a> + </xsl:when> + <xsl:when test="contains(@href,'#')"> + <xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable> + <a href="{$href}"><xsl:apply-templates /></a> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable> + <a href="{$href}"><xsl:apply-templates /></a> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<!-- Insert Note, Warning, or Tip --> +<xsl:template name="insertnote"> + <xsl:param name="type" /> <!-- note, tip, or warning --> + <xsl:variable name="imgsrc"> + <xsl:choose> + <xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when> + <xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when> + <xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable> + <xsl:variable name="alt"> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:variable> + <div class="{$type}"> + <table border="0" class="{$type}" cellspacing="0" cellpadding="5"> + <tr> + <td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td> + <td><xsl:apply-templates /></td> + </tr> + </table> + </div> + <br/> +</xsl:template> + +<!-- Insert a heading --> +<xsl:template name="insertheading"> + <xsl:param name="level" /> + <xsl:param name="embedded" /> + <xsl:text disable-output-escaping="yes"><h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + <xsl:text disable-output-escaping="yes"></h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text> +</xsl:template> + +<!-- Evaluate a case or caseinline switch --> +<xsl:template name="insertcase"> + <xsl:param name="embedded" /> + <xsl:choose> + <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']"> + <xsl:if test="@select = $System"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']"> + <xsl:if test="@select = $appl"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']"> + <xsl:if test="@select = $distrib"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + </xsl:choose> +</xsl:template> + +<!-- Evaluate a default or defaultinline switch --> +<xsl:template name="insertdefault"> + <xsl:param name="embedded" /> + + <xsl:choose> + <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']"> + <xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']"> + <xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']"> + <xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + </xsl:choose> +</xsl:template> + +<!-- evaluate embeds --> +<xsl:template name="insertembed"> + <xsl:param name="doc" /> + <xsl:param name="anchor" /> + <!-- different embed targets (also falsely used embed instead embedvar) --> + <xsl:choose> + <xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name --> + <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/> + </xsl:when> + <xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name --> + <p class="embedded"> + <xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/> + </p> + </xsl:when> + <xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name --> + <p class="embedded"> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </p> + </xsl:when> + <xsl:otherwise> <!-- then give up --> + <p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<!-- Insert an image --> +<xsl:template name="insertimage"> + + <xsl:variable name="fpath"> + <xsl:call-template name="getfpath"> + <xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="fname"> + <xsl:call-template name="getfname"> + <xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="src"> + <xsl:choose> + <xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)"> + <xsl:value-of select="concat($ExtensionPath,'/',@src)"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="(@localize='true') and not($lang='en-US')"> + <xsl:value-of select="concat($img_url_prefix,$fpath,$lang,'/',$fname)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($img_url_prefix,$fpath,$fname)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>--> + <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable> + <xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size --> + <xsl:variable name="height" select="''"/><!-- Image don't all have the correct size --> + <img src="{$src}" alt="{$alt}" title="{$alt}"> + <xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if> + <xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if> + </img> +</xsl:template> + +<!-- Insert a Table --> +<xsl:template name="inserttable"> + <xsl:variable name="imgsrc"> <!-- see if we are in an image table --> + <xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/> + </xsl:variable> + + <xsl:choose> + + <xsl:when test="count(descendant::tablecell)=1"> + <table border="0" class="onecell" cellpadding="0" cellspacing="0"> + <xsl:apply-templates /> + </table> + </xsl:when> + + <xsl:when test="descendant::tablecell[1]/descendant::image"> + <table border="0" class="icontable" cellpadding="5" cellspacing="0"> + <xsl:apply-templates mode="icontable"/> + </table> + </xsl:when> + + <xsl:when test="@class='wide'"> + <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" > + <xsl:apply-templates /> + </table> + </xsl:when> + + <xsl:when test="not(@class='')"> + <table border="1" class="{@class}" cellpadding="0" cellspacing="0" > + <xsl:apply-templates /> + </table> + </xsl:when> + + <xsl:otherwise> + <table border="1" class="border" cellpadding="0" cellspacing="0" > + <xsl:apply-templates /> + </table> + </xsl:otherwise> + </xsl:choose> + + <br/> +</xsl:template> + +<xsl:template name="resolveembed"> + <div class="embedded"> + <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable> + <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="docum" select="document($href)"/> + + <xsl:call-template name="insertembed"> + <xsl:with-param name="doc" select="$docum" /> + <xsl:with-param name="anchor" select="$anc" /> + </xsl:call-template> + + </div> +</xsl:template> + +<xsl:template name="resolveembedvar"> + <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links --> + <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:choose> + <xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name --> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:when> + <xsl:otherwise> <!-- or give up --> + <span class="bug">[<xsl:value-of select="@href"/> not found].</span> + </xsl:otherwise> + </xsl:choose> + </xsl:if> +</xsl:template> + +<!-- Apply --> +<xsl:template name="apply"> + <xsl:param name="embedded" /> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="getfpath"> + <xsl:param name="s"/> + <xsl:param name="p"/> + <xsl:choose> + <xsl:when test="contains($s,'/')"> + <xsl:call-template name="getfpath"> + <xsl:with-param name="p"><xsl:value-of select="concat($p,substring-before($s,'/'),'/')"/></xsl:with-param> + <xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$p"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="getfname"> + <xsl:param name="s"/> + <xsl:choose> + <xsl:when test="contains($s,'/')"> + <xsl:call-template name="getfname"> + <xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$s"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="createDBpostfix"> + <xsl:param name="archive"/> + <xsl:variable name="newDB"> + <xsl:choose> + <xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat($am,'DbPAR=',$newDB)"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/xmlhelp/util/makefile.mk b/xmlhelp/util/makefile.mk index 10206670b5f8..66551f15bffc 100644 --- a/xmlhelp/util/makefile.mk +++ b/xmlhelp/util/makefile.mk @@ -74,5 +74,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ---------------------------------------------------------- +ZIP1TARGET=helpxsl +ZIP1FLAGS= -u -r +#ZIP1DIR=$(PRJ)$/source$/auxiliary +ZIP1LIST=main_transform*.xsl idxcaption.xsl idxcontent.xsl + + .INCLUDE: target.mk diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index f4843d54ace1..80238a075973 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3110,6 +3110,9 @@ namespace xmloff { namespace token { XML_DIAGONAL_BL_TR_WIDTHS, XML_DIAGONAL_TL_BR_WIDTHS, + XML_OUTSIDE_MINIMUM,//#i114142# + XML_OUTSIDE_MAXIMUM,//#i114142# + XML_TOKEN_END }; diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index 0616040148b5..79a59ab6910f 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -223,6 +223,8 @@ SvXMLEnumMapEntry aXMLChartAxisLabelPositionEnumMap[] = { ::xmloff::token::XML_NEAR_AXIS_OTHER_SIDE, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE }, { ::xmloff::token::XML_OUTSIDE_START, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START }, { ::xmloff::token::XML_OUTSIDE_END, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END }, + { ::xmloff::token::XML_OUTSIDE_MINIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START },//#i114142# + { ::xmloff::token::XML_OUTSIDE_MAXIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END },//#i114142# { ::xmloff::token::XML_TOKEN_INVALID, 0 } }; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index c4abc4172959..e6f6fc6d9340 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1688,20 +1688,16 @@ void SchXMLExportHelper_Impl::exportTable() { mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - // write the original range name as id into the local table - // to allow a correct re-association when copying via clipboard + exportText( *aIt ); + if( nC < nComplexCount ) + lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd ) { + // remind the original range to allow a correct re-association when copying via clipboard if ((*aColumnDescriptions_RangeIter).getLength()) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aColumnDescriptions_RangeIter); - } + SchXMLTools::exportRangeToSomewhere( mrExport, *aColumnDescriptions_RangeIter ); ++aColumnDescriptions_RangeIter; } - exportText( *aIt ); - if( nC < nComplexCount ) - lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); } OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd ); } // closing row and header-rows elements @@ -1725,17 +1721,15 @@ void SchXMLExportHelper_Impl::exportTable() SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); if( aRowDescriptionsIter != aData.aRowDescriptions.end()) { - // write the original range name as id into the local table - // to allow a correct re-association when copying via clipboard - if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aRowDescriptions_RangeIter++); - } exportText( *aRowDescriptionsIter ); ++aRowDescriptionsIter; if( nC < nComplexCount ) lcl_exportComplexLabel( rComplexRowDescriptions[nC++], mrExport ); + if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) + { + // remind the original range to allow a correct re-association when copying via clipboard + SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter++ ); + } } } @@ -1748,19 +1742,15 @@ void SchXMLExportHelper_Impl::exportTable() mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT ); mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - // write the original range name as id into the local table to - // allow a correct re-association when copying via clipboard + exportText( msString, false ); // do not convert tabs and lfs if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) && - ( mbRowSourceColumns || (aColIt == aRowIt->begin())) ) + ( mbRowSourceColumns || (aColIt == aRowIt->begin()) ) ) { + // remind the original range to allow a correct re-association when copying via clipboard if ((*aDataRangeIter).getLength()) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aDataRangeIter); - } + SchXMLTools::exportRangeToSomewhere( mrExport, *aDataRangeIter ); ++aDataRangeIter; } - exportText( msString, false ); // do not convert tabs and lfs } } } @@ -3063,6 +3053,10 @@ void SchXMLExportHelper_Impl::exportSeries( { // add style name attribute AddAutoStyleAttribute( aPropertyStates ); + + const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149# SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); } else // autostyles diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index d82970858ebe..d3f0670f672d 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -34,6 +34,7 @@ #include "SchXMLImport.hxx" #include "SchXMLTools.hxx" #include "transporttypes.hxx" +#include "XMLStringBufferImportContext.hxx" #include <tools/debug.hxx> #include <rtl/math.hxx> #include "xmlnmspe.hxx" @@ -687,6 +688,35 @@ SvXMLImportContext* SchXMLTableRowContext::CreateChildContext( return pContext; } +//--------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- + +class SchXMLRangeSomewhereContext : public SvXMLImportContext +{ +//#i113950# previously the range was exported to attribute text:id, +//but that attribute does not allow arbitrary strings anymore +//so we need to find an alternative to save that range info for copy/paste scenario ... +//-> use description at an empty group element for now + +private: + ::rtl::OUString& mrRangeString; + ::rtl::OUStringBuffer maRangeStringBuffer; + +public: + SchXMLRangeSomewhereContext( SvXMLImport& rImport, + const ::rtl::OUString& rLocalName, + ::rtl::OUString& rRangeString ); + virtual ~SchXMLRangeSomewhereContext(); + + virtual SvXMLImportContext* CreateChildContext( + USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +//--------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- // ======================================== // classes for cells and their content @@ -778,11 +808,18 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext( pContext = new SchXMLTextListContext( GetImport(), rLocalName, *rCell.pComplexString ); mbReadText = sal_False;//don't apply text from <text:p> } - // <text:p> element - read text and range-id + // <text:p> element - read text (and range from text:id old version) else if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) ) { pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId ); } + // <draw:g> element - read range + else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_G ) ) + { + //#i113950# previously the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore + //so we need to find an alternative to save that range info for copy/paste scenario ... -> use description at an empty group element for now + pContext = new SchXMLRangeSomewhereContext( GetImport(), rLocalName, maRangeId ); + } else { pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); @@ -1148,3 +1185,34 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( } } +//--------------------------------------------------------------------------------------------------- + +SchXMLRangeSomewhereContext::SchXMLRangeSomewhereContext( SvXMLImport& rImport, + const OUString& rLocalName, + OUString& rRangeString ) : + SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ), + mrRangeString( rRangeString ) +{ +} + +SchXMLRangeSomewhereContext::~SchXMLRangeSomewhereContext() +{ +} + +SvXMLImportContext* SchXMLRangeSomewhereContext::CreateChildContext( + USHORT nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& ) +{ + if( XML_NAMESPACE_SVG == nPrefix && IsXMLToken( rLocalName, XML_DESC ) ) + { + return new XMLStringBufferImportContext( + GetImport(), nPrefix, rLocalName, maRangeStringBuffer ); + } + return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); +} + +void SchXMLRangeSomewhereContext::EndElement() +{ + mrRangeString = maRangeStringBuffer.makeStringAndClear(); +} diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 582e5aead326..b2a90e534771 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -600,6 +600,29 @@ void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsL } } +void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ) +{ + //with issue #i366# and CWS chart20 ranges for error bars were introduced + //to keep them during copy paste from calc to impress for example it + //was necessary to introduce a mapping between the used ranges within calc and the data written to the local table + //this is why we write this ranges here + + //#i113950# first the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore within ODF 1.2 + //as an alternative the range info is now saved into the description at an empty group element (not very nice, but ODF conform) + + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion == SvtSaveOptions::ODFVER_010 || nCurrentODFVersion == SvtSaveOptions::ODFVER_011 ) + return;//svg:desc is not allowed at draw:g in ODF1.0; but as the ranges for error bars are anyhow not allowed within ODF1.0 nor ODF1.1 we do not need the information + + SvXMLElementExport aEmptyShapeGroup( rExport, XML_NAMESPACE_DRAW, + ::xmloff::token::GetXMLToken( ::xmloff::token::XML_G ), + sal_True, sal_False ); + SvXMLElementExport aDescription( rExport, XML_NAMESPACE_SVG, + ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DESC ), + sal_True, sal_False ); + rExport.GetDocHandler()->characters( rValue ); +} + Reference< chart2::XRegressionCurve > getRegressionCurve( const Reference< chart2::XDataSeries > & xDataSeries ) { diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index bcc39ae3d114..d8841bf3861b 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -105,6 +105,8 @@ namespace SchXMLTools void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs ); + void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ); + /** returns the properties of the equation of the first regression curve that is no mean-value line */ diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index a3d4a0c48d02..d65bafe583df 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3082,8 +3082,8 @@ namespace xmloff { namespace token { TOKEN( "axis-label-position", XML_AXIS_LABEL_POSITION ), TOKEN( "near-axis", XML_NEAR_AXIS ), TOKEN( "near-axis-other-side", XML_NEAR_AXIS_OTHER_SIDE ), - TOKEN( "outside-minimum", XML_OUTSIDE_START ), - TOKEN( "outside-maximum", XML_OUTSIDE_END ), + TOKEN( "outside-start", XML_OUTSIDE_START ), + TOKEN( "outside-end", XML_OUTSIDE_END ), TOKEN( "tick-mark-position", XML_TICK_MARK_POSITION ), TOKEN( "at-labels", XML_AT_LABELS ), TOKEN( "at-axis", XML_AT_AXIS ), @@ -3110,6 +3110,9 @@ namespace xmloff { namespace token { TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ), TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ), + TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ), + TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else |