diff options
254 files changed, 10860 insertions, 3029 deletions
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx index d75a2ada855e..3ec0803eb4a9 100644 --- a/basic/inc/basic/sbstar.hxx +++ b/basic/inc/basic/sbstar.hxx @@ -121,6 +121,7 @@ public: static void Error( SbError ); static void Error( SbError, const String& rMsg ); static void FatalError( SbError ); + static void FatalError( SbError, const String& rMsg ); static BOOL IsRunning(); static SbError GetErrBasic(); // #66536 make additional message accessible by RTL function Error diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 3fbcd592e5bb..7ff7cb76c7c5 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1357,6 +1357,12 @@ void StarBASIC::FatalError( SbError n ) pINST->FatalError( n ); } +void StarBASIC::FatalError( SbError _errCode, const String& _details ) +{ + if( pINST ) + pINST->FatalError( _errCode, _details ); +} + SbError StarBASIC::GetErrBasic() { if( pINST ) diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src index a17e3bce687c..214831b8da13 100644 --- a/basic/source/classes/sb.src +++ b/basic/source/classes/sb.src @@ -341,7 +341,7 @@ Resource RID_BASIC_START }; String SbERR_NO_METHOD & ERRCODE_RES_MASK { - Text [ en-US ] = "Property or method not found." ; + Text [ en-US ] = "Property or method not found: $(ARG1)." ; }; String SbERR_NEEDS_OBJECT & ERRCODE_RES_MASK { diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index dc6fb6d13cec..a1bdb687b002 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -68,7 +68,7 @@ #include <com/sun/star/reflection/XIdlArray.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/reflection/XIdlClassProvider.hpp> -#include <com/sun/star/reflection/XTypeDescription.hpp> +#include <com/sun/star/reflection/XServiceConstructorDescription.hpp> #include <com/sun/star/bridge/oleautomation/NamedArgument.hpp> #include <com/sun/star/bridge/oleautomation/Date.hpp> #include <com/sun/star/bridge/oleautomation/Decimal.hpp> @@ -104,6 +104,8 @@ TYPEINIT1(SbUnoMethod,SbxMethod) TYPEINIT1(SbUnoProperty,SbxProperty) TYPEINIT1(SbUnoObject,SbxObject) TYPEINIT1(SbUnoClass,SbxObject) +TYPEINIT1(SbUnoService,SbxObject) +TYPEINIT1(SbUnoServiceCtor,SbxMethod) typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper; @@ -2496,35 +2498,7 @@ SbUnoProperty::~SbUnoProperty() {} -// #72732 Spezielle SbxVariable, die beim put/get prueft, -// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst -// liegt eventuell ein Schreibfehler im Basic-Source vor. -BOOL UnoClassMemberVariable::Get( SbxValues& rRes ) const -{ - // Zugriff auf den Member einer UnoClass mit Parametern ist unsinnig - if( GetParameters() ) - { - if( mpRuntime ) - mpRuntime->Error( SbERR_NO_METHOD ); - } - return SbxVariable::Get( rRes ); -} - -BOOL UnoClassMemberVariable::Put( const SbxValues& rRes ) -{ - if( bInternalUse ) - { - return SbxVariable::Put( rRes ); - } - // Schreibzugriff auf den Member einer UnoClass ist immer falsch - mpRuntime->Error( SbERR_NO_METHOD ); - return FALSE; -} - -TYPEINIT1(UnoClassMemberVariable,SbxVariable) - - -SbxVariable* SbUnoObject::Find( const XubString& rName, SbxClassType t ) +SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t ) { static Reference< XIdlMethod > xDummyMethod; static Property aDummyProp; @@ -3201,16 +3175,16 @@ SbxVariable* getVBAConstant( const String& rName ) // Funktion, um einen globalen Bezeichner im // UnoScope zu suchen und fuer Sbx zu wrappen -SbxVariable* findUnoClass( const String& rName ) +SbUnoClass* findUnoClass( const String& rName ) { // #105550 Check if module exists SbUnoClass* pUnoClass = NULL; Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); - Reference< XTypeDescription > xTypeDesc; if( xTypeAccess->hasByHierarchicalName( rName ) ) { Any aRet = xTypeAccess->getByHierarchicalName( rName ); + Reference< XTypeDescription > xTypeDesc; aRet >>= xTypeDesc; if( xTypeDesc.is() ) @@ -3287,7 +3261,6 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t ) pRes = new SbxVariable( SbxVARIANT ); SbxObjectRef xWrapper = (SbxObject*)new SbUnoClass( aNewName, xClass ); pRes->PutObject( xWrapper ); - } } else @@ -3305,15 +3278,26 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t ) // Sonst wieder als Klasse annehmen if( !pRes ) { - SbxVariable* pNewClass = findUnoClass( aNewName ); + SbUnoClass* pNewClass = findUnoClass( aNewName ); if( pNewClass ) { - Reference< XIdlClass > xClass; pRes = new SbxVariable( SbxVARIANT ); SbxObjectRef xWrapper = (SbxObject*)pNewClass; pRes->PutObject( xWrapper ); } } + + // An UNO service? + if( !pRes ) + { + SbUnoService* pUnoService = findUnoService( aNewName ); + if( pUnoService ) + { + pRes = new SbxVariable( SbxVARIANT ); + SbxObjectRef xWrapper = (SbxObject*)pUnoService; + pRes->PutObject( xWrapper ); + } + } } } @@ -3334,6 +3318,266 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t ) } +SbUnoService* findUnoService( const String& rName ) +{ + SbUnoService* pSbUnoService = NULL; + + Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); + if( xTypeAccess->hasByHierarchicalName( rName ) ) + { + Any aRet = xTypeAccess->getByHierarchicalName( rName ); + Reference< XTypeDescription > xTypeDesc; + aRet >>= xTypeDesc; + + if( xTypeDesc.is() ) + { + TypeClass eTypeClass = xTypeDesc->getTypeClass(); + if( eTypeClass == TypeClass_SERVICE ) + { + Reference< XServiceTypeDescription2 > xServiceTypeDesc( xTypeDesc, UNO_QUERY ); + if( xServiceTypeDesc.is() ) + pSbUnoService = new SbUnoService( rName, xServiceTypeDesc ); + } + } + } + return pSbUnoService; +} + +SbxVariable* SbUnoService::Find( const String& rName, SbxClassType ) +{ + SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_METHOD ); + + if( !pRes ) + { + // Wenn es schon eine Klasse ist, nach einen Feld fragen + if( m_bNeedsInit && m_xServiceTypeDesc.is() ) + { + m_bNeedsInit = false; + + Sequence< Reference< XServiceConstructorDescription > > aSCDSeq = m_xServiceTypeDesc->getConstructors(); + const Reference< XServiceConstructorDescription >* pCtorSeq = aSCDSeq.getConstArray(); + int nCtorCount = aSCDSeq.getLength(); + for( int i = 0 ; i < nCtorCount ; ++i ) + { + Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i]; + + String aName( xCtor->getName() ); + if( !aName.Len() ) + { + if( xCtor->isDefaultConstructor() ) + aName = String::CreateFromAscii( "create" ); + } + + if( aName.Len() ) + { + // Create and insert SbUnoServiceCtor + SbxVariableRef xSbCtorRef = new SbUnoServiceCtor( aName, xCtor ); + QuickInsert( (SbxVariable*)xSbCtorRef ); + pRes = xSbCtorRef; + } + } + } + } + + return pRes; +} + +void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pParams = pVar->GetParameters(); + SbUnoServiceCtor* pUnoCtor = PTR_CAST(SbUnoServiceCtor,pVar); + if( pUnoCtor && pHint->GetId() == SBX_HINT_DATAWANTED ) + { + // Parameter count -1 because of Param0 == this + UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0; + Sequence<Any> args; + BOOL bOutParams = FALSE; + + Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc(); + Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters(); + const Reference< XParameter >* pParameterSeq = aParameterSeq.getConstArray(); + UINT32 nUnoParamCount = aParameterSeq.getLength(); + + // Default: Ignore not needed parameters + bool bParameterError = false; + + // Is the last parameter a rest parameter? + bool bRestParameterMode = false; + if( nUnoParamCount > 0 ) + { + Reference< XParameter > xLastParam = pParameterSeq[ nUnoParamCount - 1 ]; + if( xLastParam.is() ) + { + if( xLastParam->isRestParameter() ) + bRestParameterMode = true; + } + } + + // Too many parameters with context as first parameter? + USHORT nSbxParameterOffset = 1; + USHORT nParameterOffsetByContext = 0; + Reference < XComponentContext > xFirstParamContext; + if( nParamCount > nUnoParamCount ) + { + // Check if first parameter is a context and use it + // then in createInstanceWithArgumentsAndContext + Any aArg0 = sbxToUnoValue( pParams->Get( nSbxParameterOffset ) ); + if( (aArg0 >>= xFirstParamContext) && xFirstParamContext.is() ) + nParameterOffsetByContext = 1; + } + + UINT32 nEffectiveParamCount = nParamCount - nParameterOffsetByContext; + UINT32 nAllocParamCount = nEffectiveParamCount; + if( nEffectiveParamCount > nUnoParamCount ) + { + if( !bRestParameterMode ) + { + nEffectiveParamCount = nUnoParamCount; + nAllocParamCount = nUnoParamCount; + } + } + // Not enough parameters? + else if( nUnoParamCount > nEffectiveParamCount ) + { + // RestParameterMode only helps if one (the last) parameter is missing + int nDiff = nUnoParamCount - nEffectiveParamCount; + if( !bRestParameterMode || nDiff > 1 ) + { + bParameterError = true; + StarBASIC::Error( SbERR_NOT_OPTIONAL ); + } + } + + if( !bParameterError ) + { + if( nAllocParamCount > 0 ) + { + args.realloc( nAllocParamCount ); + Any* pAnyArgs = args.getArray(); + for( UINT32 i = 0 ; i < nEffectiveParamCount ; i++ ) + { + USHORT iSbx = (USHORT)(i + nSbxParameterOffset + nParameterOffsetByContext); + + // bRestParameterMode allows nEffectiveParamCount > nUnoParamCount + Reference< XParameter > xParam; + if( i < nUnoParamCount ) + { + xParam = pParameterSeq[i]; + if( !xParam.is() ) + continue; + + Reference< XTypeDescription > xParamTypeDesc = xParam->getType(); + if( !xParamTypeDesc.is() ) + continue; + com::sun::star::uno::Type aType( xParamTypeDesc->getTypeClass(), xParamTypeDesc->getName() ); + + // sbx paramter needs offset 1 + pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ), aType ); + + // Check for out parameter if not already done + if( !bOutParams ) + { + if( xParam->isOut() ) + bOutParams = TRUE; + } + } + else + { + pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ) ); + } + } + } + + // "Call" ctor using createInstanceWithArgumentsAndContext + Reference < XComponentContext > xContext; + if( xFirstParamContext.is() ) + { + xContext = xFirstParamContext; + } + else + { + Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + xContext.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW ); + } + Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); + + Any aRetAny; + if( xServiceMgr.is() ) + { + String aServiceName = GetName(); + Reference < XInterface > xRet; + try + { + xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext ); + } + catch( const Exception& ) + { + implHandleAnyException( ::cppu::getCaughtException() ); + } + aRetAny <<= xRet; + } + unoToSbxValue( pVar, aRetAny ); + + // Copy back out parameters? + if( bOutParams ) + { + const Any* pAnyArgs = args.getConstArray(); + + for( UINT32 j = 0 ; j < nUnoParamCount ; j++ ) + { + Reference< XParameter > xParam = pParameterSeq[j]; + if( !xParam.is() ) + continue; + + if( xParam->isOut() ) + unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pAnyArgs[ j ] ); + } + } + } + } + else + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + + + +static SbUnoServiceCtor* pFirstCtor = NULL; + +void clearUnoServiceCtors( void ) +{ + SbUnoServiceCtor* pCtor = pFirstCtor; + while( pCtor ) + { + pCtor->SbxValue::Clear(); + pCtor = pCtor->pNext; + } +} + +SbUnoServiceCtor::SbUnoServiceCtor( const String& aName_, Reference< XServiceConstructorDescription > xServiceCtorDesc ) + : SbxMethod( aName_, SbxOBJECT ) + , m_xServiceCtorDesc( xServiceCtorDesc ) +{ +} + +SbUnoServiceCtor::~SbUnoServiceCtor() +{ +} + +SbxInfo* SbUnoServiceCtor::GetInfo() +{ + SbxInfo* pRet = NULL; + + return pRet; +} + + + //======================================================================== //======================================================================== //======================================================================== @@ -3703,7 +3947,6 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite //======================================================================== // Creates a Basic wrapper object for a strongly typed Uno value // 1. parameter: Uno type as full qualified type name, e.g. "byte[]" -// void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) { (void)pBasic; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index a534209b0cfa..2a61557457b7 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -531,6 +531,7 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic ) { // #67781 Rueckgabewerte der Uno-Methoden loeschen clearUnoMethods(); + clearUnoServiceCtors();
ClearUnoObjectsInRTL_Impl_Rek( pBasic ); diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index e69551f364e5..701ecdd7bc16 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -701,12 +701,6 @@ SbiExprNode* SbiExpression::Comp() pNd = new SbiExprNode( pParser, pNd, eTok, Cat() ); nCount++; } - // Mehrere Operatoren hintereinander gehen nicht - if( nCount > 1 ) - { - pParser->Error( SbERR_SYNTAX ); - bError = TRUE; - } } return pNd; } diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 9cde971228d9..2cc496f9cb02 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -479,7 +479,17 @@ PrevLineCommentLbl: eoln: if( nCol && *--pLine == '_' ) { - pLine = NULL; return NextSym(); + pLine = NULL;
+ bool bRes = NextSym();
+ if( bVBASupportOn && aSym.GetBuffer()[0] == '.' )
+ {
+ // object _
+ // .Method
+ // ^^^ <- spaces is legal in MSO VBA
+ OSL_TRACE("*** resetting bSpaces***");
+ bSpaces = FALSE;
+ }
+ return bRes;
} else { diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index f9629445aa9e..31f99fb93169 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -220,10 +220,11 @@ public: SbiInstance( StarBASIC* ); ~SbiInstance(); - void Error( SbError ); // trappable Error + void Error( SbError ); // trappable Error void Error( SbError, const String& rMsg ); // trappable Error mit Message - void FatalError( SbError ); // non-trappable Error - void Abort(); // Abbruch mit aktuellem Fehlercode + void FatalError( SbError ); // non-trappable Error + void FatalError( SbError, const String& ); // non-trappable Error + void Abort(); // Abbruch mit aktuellem Fehlercode void Stop(); SbError GetErr() { return nErr; } @@ -270,30 +271,6 @@ struct RefSaveItem }; -// #72732 Spezielle SbxVariable, die beim put/get prueft, -// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst -// liegt eventuell ein Schreibfehler im Basic-Source vor. -class UnoClassMemberVariable : public SbxVariable -{ - SbiRuntime* mpRuntime; - BOOL bInternalUse; - -public: - UnoClassMemberVariable( SbiRuntime* pRuntime_, const SbxObjectRef& xWrapper ) - : SbxVariable( SbxVARIANT ), mpRuntime( pRuntime_ ) - { - bInternalUse = TRUE; - PutObject( xWrapper ); - bInternalUse = FALSE; - } - - virtual BOOL Get( SbxValues& ) const; - virtual BOOL Put( const SbxValues& ); - - TYPEINFO(); -}; - - // Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm // aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt // nur lokale Daten. @@ -467,8 +444,10 @@ public: SbiRuntime( SbModule*, SbMethod*, UINT32 ); ~SbiRuntime(); - void Error( SbError ); // Fehler setzen, falls != 0 - void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen + void Error( SbError ); // Fehler setzen, falls != 0 + void Error( SbError, const String& ); // Fehler setzen, falls != 0 + void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen + void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen void DumpPCode(); BOOL Step(); // Einzelschritt (ein Opcode) void Stop() { bRun = FALSE; } diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index ee7ac2176e41..6889aa196c54 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -43,6 +43,7 @@ #include <com/sun/star/beans/XIntrospection.hpp> #include <com/sun/star/script/XInvocation.hpp> #include <com/sun/star/reflection/XIdlClass.hpp> +#include <com/sun/star/reflection/XServiceTypeDescription2.hpp> #include <rtl/ustring.hxx> class SbUnoObject: public SbxObject @@ -149,7 +150,7 @@ public: }; // Wrapper fuer eine Uno-Klasse -class SbUnoClass: public SbxObject +class SbUnoClass : public SbxObject { const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > m_xClass; @@ -177,7 +178,55 @@ SV_DECL_IMPL_REF(SbUnoClass); // Funktion, um einen globalen Bezeichner im // UnoScope zu suchen und fuer Sbx zu wrappen -SbxVariable* findUnoClass( const String& rName ); +SbUnoClass* findUnoClass( const String& rName ); + + +// Wrapper for UNO Service +class SbUnoService : public SbxObject +{ + const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc; + bool m_bNeedsInit; + +public: + TYPEINFO(); + SbUnoService( const String& aName_, + const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 >& xServiceTypeDesc ) + : SbxObject( aName_ ) + , m_xServiceTypeDesc( xServiceTypeDesc ) + , m_bNeedsInit( true ) + {} + + virtual SbxVariable* Find( const String&, SbxClassType ); + + void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); +}; +SV_DECL_IMPL_REF(SbUnoService); + +SbUnoService* findUnoService( const String& rName ); + + +void clearUnoServiceCtors( void ); + +class SbUnoServiceCtor : public SbxMethod +{ + friend class SbUnoService; + friend void clearUnoServiceCtors( void ); + + ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > m_xServiceCtorDesc; + + SbUnoServiceCtor* pPrev; + SbUnoServiceCtor* pNext; + +public: + TYPEINFO(); + + SbUnoServiceCtor( const String& aName_, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > xServiceCtorDesc ); + virtual ~SbUnoServiceCtor(); + virtual SbxInfo* GetInfo(); + + ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > getServiceCtorDesc( void ) + { return m_xServiceCtorDesc; } +}; // #105565 Special Object to wrap a strongly typed Uno Any diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index d81cebe60fc6..cc276eea766b 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -430,6 +430,11 @@ void SbiInstance::FatalError( SbError n ) pRun->FatalError( n ); } +void SbiInstance::FatalError( SbError _errCode, const String& _details ) +{ + pRun->FatalError( _errCode, _details ); +} + void SbiInstance::Abort() { // Basic suchen, in dem der Fehler auftrat @@ -721,7 +726,7 @@ BOOL SbiRuntime::Step() pCode = pError; else bLetParentHandleThis = true; - } + } else { bLetParentHandleThis = true; @@ -795,12 +800,35 @@ void SbiRuntime::Error( SbError n ) nError = n; } +void SbiRuntime::Error( SbError _errCode, const String& _details ) +{ + if ( _errCode ) + { + OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" ); + if ( pInst->pRun == this ) + { + pInst->Error( _errCode, _details ); + OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" ); + } + else + { + nError = _errCode; + } + } +} + void SbiRuntime::FatalError( SbError n ) { StepSTDERROR(); Error( n ); } +void SbiRuntime::FatalError( SbError _errCode, const String& _details ) +{ + StepSTDERROR(); + Error( _errCode, _details ); +} + ////////////////////////////////////////////////////////////////////////// // // Parameter, Locals, Caller @@ -859,21 +887,13 @@ SbxVariableRef SbiRuntime::PopVar() BOOL SbiRuntime::ClearExprStack() { - // #74732 Hier kann ein Fehler gesetzt werden - BOOL bErrorSet = FALSE; - // Achtung: Clear() reicht nicht, da Methods geloescht werden muessen while ( nExprLvl ) { - SbxVariableRef xVar = PopVar(); - if( !nError && xVar->ISA( UnoClassMemberVariable ) ) - { - Error( SbERR_NO_METHOD ); - bErrorSet = TRUE; - } + PopVar(); } refExprStk->Clear(); - return bErrorSet; + return FALSE; } // Variable auf dem Expression-Stack holen, ohne sie zu entfernen diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 2a7c69b16323..413d3a6f4def 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -199,7 +199,7 @@ SbxVariable* SbiRuntime::FindElement } // #72382 VORSICHT! Liefert jetzt wegen unbekannten // Modulen IMMER ein Ergebnis! - SbxVariable* pUnoClass = findUnoClass( aName ); + SbUnoClass* pUnoClass = findUnoClass( aName ); if( pUnoClass ) { pElem = new SbxVariable( t ); @@ -255,7 +255,7 @@ SbxVariable* SbiRuntime::FindElement ClearArgvStack(); // Normalen Error setzen - Error( nNotFound ); + Error( nNotFound, aName ); } else { @@ -832,6 +832,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) // Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt, // hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist! BOOL bFatalExpr = FALSE; + String sUnknownMethodName; if( nExprLvl > 1 ) bFatalExpr = TRUE; else if( nExprLvl ) @@ -839,7 +840,10 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) SbxVariable* p = refExprStk->Get( 0 ); if( p->GetRefCount() > 1 && refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) ) + { + sUnknownMethodName = p->GetName(); bFatalExpr = TRUE; + } } // Der Expr-Stack ist nun nicht mehr notwendig ClearExprStack(); @@ -854,7 +858,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) // stimmen! if( bFatalExpr) { - StarBASIC::FatalError( SbERR_NO_METHOD ); + StarBASIC::FatalError( SbERR_NO_METHOD, sUnknownMethodName ); return; } pStmnt = pCode - 9; diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index b0fa4ea1822f..7c3bd3b057ba 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -1572,7 +1572,10 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const else { aL.eType = aR.eType = SbxDOUBLE; - if( Get( aL ) && rOp.Get( aR ) ) + //if( Get( aL ) && rOp.Get( aR ) ) + bool bGetL = Get( aL );
+ bool bGetR = rOp.Get( aR );
+ if( bGetL && bGetR )
switch( eOp ) { case SbxEQ: @@ -1590,6 +1593,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const default: SetError( SbxERR_NOTIMP ); } + // at least one value was got
+ // if this is VBA then a conversion error for one
+ // side will yield a false result of an equality test
+ else if ( bGetR || bGetL )
+ {
+ if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION )
+ {
+ ResetError();
+ bRes = FALSE;
+ }
+ }
} } if( eOld != SbxERR_OK ) diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index df875df23ad6..995c7e65e999 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -134,6 +134,7 @@ class Desktop : public Application static rtl::OUString GetLicensePath(); static sal_Bool LicenseNeedsAcceptance(); static sal_Bool IsFirstStartWizardNeeded(); + static sal_Bool CheckExtensionDependencies(); private: // Bootstrap methods diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index 4b6a5664e3d8..3aa56e273ff3 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -16,6 +16,7 @@ dt desktop\win32\source\guiloader nmake - w dt_guiloader dt_wrapper.w dt_inc N dt desktop\win32\source\guistdio nmake - w dt_guistdio dt_inc NULL dt desktop\win32\source\applauncher nmake - w dt_applauncher dt_inc NULL dt desktop\win32\source\applauncher\ooo nmake - w dt_applauncher_ooo dt_applauncher.w dt_inc NULL +dt desktop\win32\source\rebase nmake - w dt_rebase dt_inc NULL dt desktop\os2\source\applauncher nmake - p dt_applauncher dt_inc NULL dt desktop\unx\source\officeloader nmake - u dt_officeloader_unx dt_inc NULL dt desktop\source\pagein nmake - u dt_pagein dt_inc NULL @@ -35,5 +36,5 @@ dt desktop\source\deployment\registry\configuration nmake - all dt_dp_registry_c dt desktop\source\deployment\registry\help nmake - all dt_dp_registry_help dt_inc NULL dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_executable dt_inc NULL dt desktop\scripts nmake - u dt_scripts dt_inc NULL -dt desktop\util nmake - all dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr NULL +dt desktop\util nmake - all dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL dt desktop\zipintro nmake - all dt_zipintro NULL diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst index 78897216c386..eb0d93886e8a 100644 --- a/desktop/prj/d.lst +++ b/desktop/prj/d.lst @@ -82,6 +82,8 @@ mkdir: %_DEST%\bin%_EXT%\odf4ms ..\%__SRC%\bin\unopkga*.dll %_DEST%\bin%_EXT%\unopkga*.dll ..\%__SRC%\lib\libunopkgapp.dylib %_DEST%\lib%_EXT%\libunopkgapp.dylib ..\%__SRC%\lib\libunopkgapp.so %_DEST%\lib%_EXT%\libunopkgapp.so +..\%__SRC%\bin\rebasegui.exe %_DEST%\bin%_EXT%\rebasegui.exe +..\%__SRC%\bin\rebaseoo.exe %_DEST%\bin%_EXT%\rebaseoo.exe ..\%__SRC%\bin\pagein %_DEST%\bin%_EXT%\pagein ..\%__SRC%\misc\pagein-* %_DEST%\bin%_EXT%\pagein-* diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 8675d22e0aae..68577b3c1f1e 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1387,6 +1387,10 @@ void Desktop::Main() tools::InitTestToolLib(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} tools::InitTestToolLib" ); + bool bAbort = CheckExtensionDependencies(); + if ( bAbort ) + return; + // First Start Wizard allowed ? if ( ! pCmdLineArgs->IsNoFirstStartWizard()) { diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx new file mode 100644 index 000000000000..a66031184200 --- /dev/null +++ b/desktop/source/app/check_ext_deps.cxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2009 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include <rtl/bootstrap.hxx> +#include <rtl/ustring.hxx> +#include <unotools/configmgr.hxx> + +#include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> +#include <cppuhelper/bootstrap.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include "com/sun/star/deployment/XPackage.hpp" +#include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/task/XJobExecutor.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/util/XChangesBatch.hpp> + +#include "app.hxx" + +using rtl::OUString; +using namespace desktop; +using namespace com::sun::star; + +#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); +static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); + +//------------------------------------------------------------------------------ +static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > &xContext ) +{ + rtl::OUString sServiceName = UNISTRING("com.sun.star.deployment.ui.UpdateRequiredDialog"); + uno::Reference< uno::XInterface > xService; + sal_Int16 nRet = 0; + + uno::Reference< lang::XMultiComponentFactory > xServiceManager( xContext->getServiceManager() ); + if( !xServiceManager.is() ) + throw uno::RuntimeException( + UNISTRING( "impl_showExtensionDialog(): unable to obtain service manager from component context" ), uno::Reference< uno::XInterface > () ); + + xService = xServiceManager->createInstanceWithContext( sServiceName, xContext ); + uno::Reference< ui::dialogs::XExecutableDialog > xExecuteable( xService, uno::UNO_QUERY ); + if ( xExecuteable.is() ) + nRet = xExecuteable->execute(); + + return nRet; +} + +//------------------------------------------------------------------------------ +// Check dependencies of all packages +//------------------------------------------------------------------------------ +static bool impl_checkDependencies( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +{ + uno::Sequence< uno::Reference< deployment::XPackage > > packages; + + try { + packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); + } + catch ( deployment::DeploymentException & ) { /* handleGeneralError(e.Cause);*/ } + catch ( ucb::CommandFailedException & ) { /* handleGeneralError(e.Reason);*/ } + catch ( ucb::CommandAbortedException & ) {} + catch ( lang::IllegalArgumentException & e ) { + throw uno::RuntimeException( e.Message, e.Context ); + } + + for ( sal_Int32 i = 0; i < packages.getLength(); ++i ) + { + bool bRegistered = false; + try { + beans::Optional< beans::Ambiguous< sal_Bool > > option( packages[i]->isRegistered( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ) ); + if ( option.IsPresent ) + { + ::beans::Ambiguous< sal_Bool > const & reg = option.Value; + if ( reg.IsAmbiguous ) + bRegistered = false; + else + bRegistered = reg.Value ? true : false; + } + else + bRegistered = false; + } + catch ( uno::RuntimeException & ) { throw; } + catch ( uno::Exception & exc) { + (void) exc; + OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + bRegistered = false; + } + + if ( bRegistered ) + { + bool bDependenciesValid = false; + try { + bDependenciesValid = packages[i]->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() ); + } + catch ( deployment::DeploymentException & ) {} + if ( ! bDependenciesValid ) + { + return false; + } + } + } + return true; +} + +//------------------------------------------------------------------------------ +// resets the 'check needed' flag (needed, if aborted) +//------------------------------------------------------------------------------ +static void impl_setNeedsCompatCheck() +{ + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + + Sequence< Any > theArgs(1); + beans::NamedValue v( OUString::createFromAscii("NodePath"), + makeAny( OUString::createFromAscii("org.openoffice.Setup/Office") ) ); + theArgs[0] <<= v; + Reference< beans::XPropertySet > pset = Reference< beans::XPropertySet >( + theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), UNO_QUERY_THROW ); + + Any value = makeAny( OUString::createFromAscii("never") ); + + pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), value ); + Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges(); + } + catch (const Exception&) {} +} + +//------------------------------------------------------------------------------ +static bool impl_check() +{ + uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext(); + uno::Reference< deployment::XPackageManager > xManager; + bool bDependenciesValid = true; + + try { + xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("user") ); + } + catch ( ucb::CommandFailedException & ){} + catch ( uno::RuntimeException & ) {} + + if ( xManager.is() ) + bDependenciesValid = impl_checkDependencies( xManager ); + + if ( bDependenciesValid ) + { + try { + xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("shared") ); + } + catch ( ucb::CommandFailedException & ){} + catch ( uno::RuntimeException & ) {} + + if ( xManager.is() ) + bDependenciesValid = impl_checkDependencies( xManager ); + } + + short nRet = 0; + if ( !bDependenciesValid ) + nRet = impl_showExtensionDialog( xContext ); + + if ( nRet == -1 ) + { + impl_setNeedsCompatCheck(); + return true; + } + else + return false; +} + +//------------------------------------------------------------------------------ +// to check, if we need checking the dependencies of the extensions again, we compare +// the build id of the office with the one of the last check +//------------------------------------------------------------------------------ +static bool impl_needsCompatCheck() +{ + bool bNeedsCheck = false; + rtl::OUString aLastCheckBuildID; + rtl::OUString aCurrentBuildID( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); + rtl::Bootstrap::expandMacros( aCurrentBuildID ); + + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + + Sequence< Any > theArgs(1); + beans::NamedValue v( OUString::createFromAscii("NodePath"), + makeAny( OUString::createFromAscii("org.openoffice.Setup/Office") ) ); + theArgs[0] <<= v; + Reference< beans::XPropertySet > pset = Reference< beans::XPropertySet >( + theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), UNO_QUERY_THROW ); + + Any result = pset->getPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID") ); + + result >>= aLastCheckBuildID; + if ( aLastCheckBuildID != aCurrentBuildID ) + { + bNeedsCheck = true; + result <<= aCurrentBuildID; + pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), result ); + Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges(); + } + } + catch (const Exception&) {} + + return bNeedsCheck; +} + +//------------------------------------------------------------------------------ +// Do we need to check the dependencies of the extensions? +// When there are unresolved issues, we can't continue with startup +sal_Bool Desktop::CheckExtensionDependencies() +{ + sal_Bool bAbort = false; + + if ( impl_needsCompatCheck() ) + bAbort = impl_check(); + + return bAbort; +} + diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk index 18c2170d3f53..36993bfdf355 100644 --- a/desktop/source/app/makefile.mk +++ b/desktop/source/app/makefile.mk @@ -56,6 +56,7 @@ SHL1OBJS = \ $(SLO)$/appsys.obj \ $(SLO)$/cfgfilter.obj \ $(SLO)$/checkinstall.obj \ + $(SLO)$/check_ext_deps.obj \ $(SLO)$/cmdlineargs.obj \ $(SLO)$/cmdlinehelp.obj \ $(SLO)$/configinit.obj \ diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h index 65fc7635a6ec..7f2cb7a9626a 100644 --- a/desktop/source/deployment/gui/dp_gui.h +++ b/desktop/source/deployment/gui/dp_gui.h @@ -82,6 +82,7 @@ enum PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE }; class SelectedPackage: public salhelper::SimpleReferenceObject { public: + SelectedPackage() {} SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> &xPackageManager ) : m_xPackage( xPackage ), diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 412e6a067159..387072c98618 100644 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -32,7 +32,8 @@ #include "helpid.hrc" // Package Manager Dialog: -#define RID_DLG_PACKAGE_MANAGER RID_DEPLOYMENT_GUI_START +#define RID_DLG_EXTENSION_MANAGER RID_DEPLOYMENT_GUI_START +#define RID_DLG_UPDATE_REQUIRED (RID_DEPLOYMENT_GUI_START + 11) #define RID_EM_BTN_CLOSE 10 #define RID_EM_BTN_HELP 11 @@ -42,27 +43,9 @@ #define RID_EM_BTN_CANCEL 15 #define RID_EM_FT_GET_EXTENSIONS 20 #define RID_EM_FT_PROGRESS 21 +#define RID_EM_FT_MSG 22 // local RIDs: -#define RID_FT_PACKAGES 5 - -#define RID_BTN_CLOSE 10 -#define RID_BTN_HELP 11 - -#define RID_BTN_ADD 20 -#define RID_BTN_REMOVE 21 -#define RID_BTN_ENABLE 22 -#define RID_BTN_DISABLE 23 -#define RID_BTN_EXPORT 24 -#define RID_BTN_CHECK_UPDATES 25 -#define RID_BTN_OPTIONS 26 -#define RID_BTN_GET_EXTENSIONS 27 - -#define RID_IMG_PLUS 41 -#define RID_IMG_PLUS_HC 42 -#define RID_IMG_MINUS 43 -#define RID_IMG_MINUS_HC 44 - #define PB_LICENSE_DOWN 50 #define ML_LICENSE 51 #define BTN_LICENSE_DECLINE 53 @@ -145,18 +128,10 @@ #define RID_DLG_UPDATE_NOUPDATE 30 #define RID_DLG_UPDATE_VERSION 31 -#define RID_DLG_EXTENSION_MANAGER (RID_DEPLOYMENT_GUI_START + 6) - #define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20) #define RID_INFOBOX_UPDATE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START + 21) -#define RID_IMG_DEF_INSTALLATION (RID_DEPLOYMENT_GUI_START+50) -#define RID_IMG_DEF_INSTALLATION_HC (RID_DEPLOYMENT_GUI_START+51) -#define RID_IMG_DEF_DOCUMENT (RID_DEPLOYMENT_GUI_START+52) -#define RID_IMG_DEF_DOCUMENT_HC (RID_DEPLOYMENT_GUI_START+53) -#define RID_IMG_DEF_PACKAGE (RID_DEPLOYMENT_GUI_START+54) -#define RID_IMG_DEF_PACKAGE_HC (RID_DEPLOYMENT_GUI_START+55) #define RID_IMG_WARNING (RID_DEPLOYMENT_GUI_START+56) #define RID_IMG_WARNING_HC (RID_DEPLOYMENT_GUI_START+57) #define RID_IMG_LOCKED (RID_DEPLOYMENT_GUI_START+58) @@ -164,39 +139,26 @@ #define RID_IMG_EXTENSION (RID_DEPLOYMENT_GUI_START+60) #define RID_IMG_EXTENSION_HC (RID_DEPLOYMENT_GUI_START+61) - -#define RID_STR_USER_INSTALLATION (RID_DEPLOYMENT_GUI_START+60) -#define RID_STR_SHARED_INSTALLATION (RID_DEPLOYMENT_GUI_START+61) -#define RID_STR_ENABLED (RID_DEPLOYMENT_GUI_START+62) -#define RID_STR_DISABLED (RID_DEPLOYMENT_GUI_START+63) -#define RID_STR_UNKNOWN (RID_DEPLOYMENT_GUI_START+64) -#define RID_STR_PACKAGE (RID_DEPLOYMENT_GUI_START+65) -#define RID_STR_PACKAGE_STATUS (RID_DEPLOYMENT_GUI_START+66) -#define RID_STR_EXTENSION_VERSION (RID_DEPLOYMENT_GUI_START+67) - - #define RID_STR_ADD_PACKAGES (RID_DEPLOYMENT_GUI_START+70) -#define RID_STR_EXPORT_PACKAGE (RID_DEPLOYMENT_GUI_START+71) -#define RID_STR_EXPORT_PACKAGES (RID_DEPLOYMENT_GUI_START+72) - -#define RID_CTX_ITEM_ADD (RID_DEPLOYMENT_GUI_START+80) -#define RID_CTX_ITEM_REMOVE (RID_DEPLOYMENT_GUI_START+81) -#define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+82) -#define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+83) -#define RID_CTX_ITEM_EXPORT (RID_DEPLOYMENT_GUI_START+84) -#define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+85) -#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+86) - -#define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+90) -#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+91) -#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+92) -#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+93) -#define RID_STR_EXPORTING_PACKAGES (RID_DEPLOYMENT_GUI_START+94) - -#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+95) -#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+96) -#define RID_STR_PUBLISHER_LINK (RID_DEPLOYMENT_GUI_START+97) -#define RID_STR_ERROR_UNKNOWN_STATUS (RID_DEPLOYMENT_GUI_START+98) + +#define RID_CTX_ITEM_REMOVE (RID_DEPLOYMENT_GUI_START+80) +#define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+81) +#define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+82) +#define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+83) +#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+84) + +#define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+85) +#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+86) +#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+87) +#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+88) + +#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+90) +#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+91) +#define RID_STR_ERROR_UNKNOWN_STATUS (RID_DEPLOYMENT_GUI_START+92) +#define RID_STR_CLOSE_BTN (RID_DEPLOYMENT_GUI_START+93) +#define RID_STR_EXIT_BTN (RID_DEPLOYMENT_GUI_START+94) +#define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95) +#define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96) #define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100) diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index d3730a12536e..e7c785c86973 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -30,192 +30,10 @@ #include "svtools/controldims.hrc" #include "dp_gui.hrc" -ModelessDialog RID_DLG_PACKAGE_MANAGER -{ - HelpId = HID_PACKAGE_MANAGER; - Text [ en-US ] = "Extension Manager"; - - Size = MAP_APPFONT( 300, 200 ); - OutputSize = TRUE; - SVLook = TRUE; - Moveable = TRUE; - Closeable = TRUE; - Sizeable = TRUE; - Hide = TRUE; - - FixedText RID_FT_PACKAGES - { - Group = TRUE; - Left = TRUE; - NoLabel = TRUE; - Text [ en-US ] = "Browse extensions"; - }; - - PushButton RID_BTN_ADD - { - TabStop = TRUE; - Text [ en-US ] = "~Add..."; - }; - PushButton RID_BTN_REMOVE - { - TabStop = TRUE; - Text [ en-US ] = "~Remove"; - }; - PushButton RID_BTN_ENABLE - { - TabStop = TRUE; - Text [ en-US ] = "~Enable"; - }; - PushButton RID_BTN_DISABLE - { - TabStop = TRUE; - Text [ en-US ] = "~Disable"; - }; - PushButton RID_BTN_EXPORT - { - TabStop = TRUE; - Text [ en-US ] = "E~xport..."; - }; - PushButton RID_BTN_CHECK_UPDATES - { - Disable = TRUE; - TabStop = TRUE; - Text [ en-US ] = "~Updates..."; - }; - PushButton RID_BTN_OPTIONS - { - Disable = TRUE; - TabStop = TRUE; - Text [ en-US ] = "~Options..."; - }; - - - - FixedText RID_BTN_GET_EXTENSIONS - { - NoLabel = TRUE; - TabStop = TRUE; - Text [ en-US ] = "Get more extensions here..."; - }; - - OKButton RID_BTN_CLOSE - { - TabStop = TRUE; - DefButton = TRUE; - Text [ en-US ] = "Close"; - }; - HelpButton RID_BTN_HELP - { - TabStop = TRUE; - }; - - Image RID_IMG_PLUS - { - ImageBitmap = Bitmap { File = "plus.bmp"; }; - MASKCOLOR - }; - - Image RID_IMG_PLUS_HC - { - ImageBitmap = Bitmap { File = "plus_sch.bmp"; }; - MASKCOLOR - }; - Image RID_IMG_MINUS - { - ImageBitmap = Bitmap { File = "minus.bmp"; }; - MASKCOLOR - }; - Image RID_IMG_MINUS_HC - { - ImageBitmap = Bitmap { File = "minus_sch.bmp"; }; - MASKCOLOR - }; -}; - - -Image RID_IMG_DEF_INSTALLATION -{ - ImageBitmap = Bitmap { File = "harddisk_16.bmp"; }; - MASKCOLOR -}; -Image RID_IMG_DEF_INSTALLATION_HC -{ - ImageBitmap = Bitmap { File = "harddisk_16_h.bmp"; }; - MASKCOLOR -}; - -Image RID_IMG_DEF_DOCUMENT -{ - ImageBitmap = Bitmap { File = "sc05500.bmp"; }; - MASKCOLOR -}; -Image RID_IMG_DEF_DOCUMENT_HC -{ - ImageBitmap = Bitmap { File = "sch05500.bmp"; }; - MASKCOLOR -}; - -Image RID_IMG_DEF_PACKAGE -{ - ImageBitmap = Bitmap { File = "puzzleslice_16.bmp"; }; - MASKCOLOR -}; -Image RID_IMG_DEF_PACKAGE_HC -{ - ImageBitmap = Bitmap { File = "puzzleslice_16_h.bmp"; }; - MASKCOLOR -}; - - -String RID_STR_USER_INSTALLATION -{ - Text [ en-US ] = "My Extensions"; -}; - -String RID_STR_SHARED_INSTALLATION -{ - Text [ en-US ] = "%PRODUCTNAME Extensions"; -}; - -String RID_STR_PACKAGE -{ - Text [ en-US ] = "Extension"; -}; - -String RID_STR_PACKAGE_STATUS -{ - Text [ en-US ] = "Status"; -}; - -String RID_STR_EXTENSION_VERSION -{ - Text [ en-US ] = "Version"; -}; - String RID_STR_ADD_PACKAGES { Text [ en-US ] = "Add Extension(s)"; }; - -String RID_STR_ENABLED -{ - Text [ en-US ] = "Enabled"; -}; - -String RID_STR_DISABLED -{ - Text [ en-US ] = "Disabled"; -}; - -String RID_STR_UNKNOWN -{ - Text [ en-US ] = "Unknown"; -}; - -String RID_CTX_ITEM_ADD -{ - Text [ en-US ] = "~Add..."; -}; String RID_CTX_ITEM_REMOVE { Text [ en-US ] = "~Remove"; @@ -228,30 +46,15 @@ String RID_CTX_ITEM_DISABLE { Text [ en-US ] = "~Disable"; }; -String RID_CTX_ITEM_EXPORT -{ - Text [ en-US ] = "E~xport..."; -}; String RID_CTX_ITEM_CHECK_UPDATE { Text [ en-US ] = "~Update..."; }; - String RID_CTX_ITEM_OPTIONS { Text [ en-US ] = "~Options..."; }; -String RID_STR_EXPORT_PACKAGE -{ - Text [ en-US ] = "Export Extension"; -}; - -String RID_STR_EXPORT_PACKAGES -{ - Text [ en-US ] = "Export Extensions to..."; -}; - String RID_STR_ADDING_PACKAGES { Text [ en-US ] = "Adding %EXTENSION_NAME"; @@ -272,11 +75,6 @@ String RID_STR_DISABLING_PACKAGES Text [ en-US ] = "Disabling %EXTENSION_NAME"; }; -String RID_STR_EXPORTING_PACKAGES -{ - Text [ en-US ] = "Exporting Extension(s)"; -}; - String RID_STR_INSTALL_FOR_ALL { Text [ en-US ] = "~For all users"; @@ -287,14 +85,31 @@ String RID_STR_INSTALL_FOR_ME Text [ en-US ] = "~Only for me"; }; -String RID_STR_PUBLISHER_LINK +String RID_STR_ERROR_UNKNOWN_STATUS { - Text [ en-US ] = "Publisher"; + Text [ en-US ] = "Error: The status of this extension is unknown"; }; -String RID_STR_ERROR_UNKNOWN_STATUS +String RID_STR_CLOSE_BTN { - Text [ en-US ] = "Error: The status of this extension is unknown"; + Text [ en-US ] = "Close"; +}; + +String RID_STR_EXIT_BTN +{ + Text [ en-US ] = "Quit"; +}; + +String RID_STR_NO_ADMIN_PRIVILEGE +{ + Text [ en-US ] = "%PRODUCTNAME has been updated to a new version. " + "Some shared %PRODUCTNAME extensions are not compatible with this version and need to be updated before %PRODUCTNAME can be started.\n\n" + "Updating of shared extension requires administrator privileges. Contact your system administrator to update the following shared extensions:"; +}; + +String RID_STR_ERROR_MISSING_DEPENDENCIES +{ + Text [ en-US ] = "The extension cannot be enabled as the following system dependencies are not fulfilled:"; }; // Dialog layout diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 47bcd507cd90..f09d906a840e 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -36,7 +36,9 @@ #include "svtools/controldims.hrc" #include "svtools/svtools.hrc" +#include "dp_gui.h" #include "dp_gui_dialog2.hxx" +#include "dp_gui_extlistbox.hxx" #include "dp_gui_shared.hxx" #include "dp_gui_theextmgr.hxx" #include "dp_misc.h" @@ -55,7 +57,7 @@ #include "comphelper/anytostring.hxx" #include "cppuhelper/exc_hlp.hxx" -#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/bootstrap.hxx" #include "comphelper/processfactory.hxx" #include "ucbhelper/content.hxx" @@ -76,6 +78,8 @@ #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/deployment/thePackageManagerFactory.hpp" + #include <map> #include <vector> #include <boost/shared_ptr.hpp> @@ -91,11 +95,7 @@ using ::rtl::OUString; namespace dp_gui { #define ICON_OFFSET 50 -#define ICON_HEIGHT 42 -#define SMALL_ICON_SIZE 16 -#define RIGHT_ICON_OFFSET 5 #define TOP_OFFSET 3 -#define SPACE_BETWEEN 3 #define LINE_SIZE 4 #define PROGRESS_WIDTH 60 #define PROGRESS_HEIGHT 14 @@ -113,112 +113,18 @@ struct StrAllFiles : public rtl::StaticWithInit< const OUString, StrAllFiles > }; //------------------------------------------------------------------------------ -// struct Entry_Impl -//------------------------------------------------------------------------------ -struct Entry_Impl; - -typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl; - -struct Entry_Impl -{ - bool m_bActive; - bool m_bLocked; - bool m_bHasOptions; - bool m_bShared; - bool m_bNew; - bool m_bChecked; - PackageState m_eState; - String m_sTitle; - String m_sVersion; - String m_sDescription; - String m_sPublisher; - String m_sPublisherURL; - String m_sErrorText; - Image m_aIcon; - Image m_aIconHC; - svt::FixedHyperlink *m_pPublisher; - - uno::Reference< deployment::XPackage> m_xPackage; - uno::Reference< deployment::XPackageManager> m_xPackageManager; - - Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager, - PackageState eState ); - ~Entry_Impl(); - - StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const; -}; - -//------------------------------------------------------------------------------ -Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager, - PackageState eState ) : - m_bActive( false ), - m_bLocked( false ), - m_bHasOptions( false ), - m_bShared( false ), - m_bNew( false ), - m_bChecked( false ), - m_eState( eState ), - m_pPublisher( NULL ), +UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage, + const uno::Reference< deployment::XPackageManager > &xPackageManager ) : m_xPackage( xPackage ), m_xPackageManager( xPackageManager ) -{ - m_sTitle = xPackage->getDisplayName(); - m_sVersion = xPackage->getVersion(); - m_sDescription = xPackage->getDescription(); - - beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); - m_sPublisher = aInfo.First; - m_sPublisherURL = aInfo.Second; - - // get the icons for the package if there are any - uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); - if ( xGraphic.is() ) - m_aIcon = Image( xGraphic ); - - xGraphic = xPackage->getIcon( true ); - if ( xGraphic.is() ) - m_aIconHC = Image( xGraphic ); - else - m_aIconHC = m_aIcon; - - m_bLocked = m_xPackageManager->isReadOnly(); - - if ( eState == AMBIGUOUS ) - m_sErrorText = ExtMgrDialog::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); -} - -//------------------------------------------------------------------------------ -Entry_Impl::~Entry_Impl() -{ - delete m_pPublisher; -} +{} //------------------------------------------------------------------------------ -StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const -{ - StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle ); - if ( eCompare == COMPARE_EQUAL ) - { - eCompare = m_sVersion.CompareTo( pEntry->m_sVersion ); - if ( eCompare == COMPARE_EQUAL ) - { - if ( m_xPackageManager != pEntry->m_xPackageManager ) - { - sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() ); - if ( nCompare < 0 ) - eCompare = COMPARE_LESS; - else if ( nCompare > 0 ) - eCompare = COMPARE_GREATER; - } - } - } - return eCompare; -} +UpdateListEntry::~UpdateListEntry() +{} //------------------------------------------------------------------------------ -// ExtensionBox_Impl +// ExtBoxWithBtns_Impl //------------------------------------------------------------------------------ enum MENU_COMMAND @@ -230,63 +136,21 @@ enum MENU_COMMAND CMD_UPDATE }; -class ExtensionBox_Impl : public ::svt::IExtensionListBox, - public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > +class ExtBoxWithBtns_Impl : public ExtensionBox_Impl { - bool m_bHasScrollBar; - bool m_bHasActive; - bool m_bNeedsRecalc; - bool m_bHasNew; - bool m_bInCheckMode; - bool m_bInterfaceLocked; - //Must be guarded together with m_vEntries to ensure a valid index at all times. - //Use m_entriesMutex as guard. - long m_nActive; - long m_nTopIndex; - long m_nStdHeight; - long m_nActiveHeight; - long m_nBtnHeight; Size m_aOutputSize; - Image m_aLockedImage; - Image m_aLockedImageHC; - Image m_aWarningImage; - Image m_aWarningImageHC; - Image m_aDefaultImage; - Image m_aDefaultImageHC; + bool m_bInterfaceLocked; PushButton *m_pOptionsBtn; PushButton *m_pEnableBtn; PushButton *m_pRemoveBtn; - ScrollBar *m_pScrollBar; - - ExtMgrDialog *m_pParent; - TheExtensionManager *m_pManager; - //This mutex is used for synchronizing access to m_vEntries. - //Currently it is used to synchronize adding, removing entries and - //functions like getItemName, getItemDescription, etc. to prevent - //that m_vEntries is accessed at an invalid index. - //ToDo: There are many more places where m_vEntries is read and which may - //fail. For example the Paint method is probable called from the main thread - //while new entries are added / removed in a separate thread. - mutable ::osl::Mutex m_entriesMutex; - std::vector< TEntry_Impl > m_vEntries; - - lang::Locale *m_pLocale; - CollatorWrapper *m_pCollator; - - void CalcActiveHeight( const long nPos ); - long GetTotalHeight() const; - Rectangle GetEntryRect( const long nPos ) const; + + ExtMgrDialog *m_pParent; + void SetButtonPos( const Rectangle& rRect ); void SetButtonStatus( const TEntry_Impl pEntry ); - void SetupScrollBar(); - void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry ); bool HandleTabKey( bool bReverse ); - bool HandleCursorKey( USHORT nKeyCode ); MENU_COMMAND ShowPopupMenu( const Point &rPos, const long nPos ); - void RecalcAll(); - bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound ); - bool isHCMode(); //----------------- DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * ); @@ -296,115 +160,29 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox, DECL_DLLPRIVATE_LINK( HandleRemoveBtn, void * ); DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); - //Index starts with 1. - //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid. - void checkIndex(sal_Int32 pos) const; - - public: - ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ); - ~ExtensionBox_Impl(); + ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ); + ~ExtBoxWithBtns_Impl(); virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Paint( const Rectangle &rPaintRect ); - virtual void Resize(); virtual long Notify( NotifyEvent& rNEvt ); const Size GetMinOutputSizePixel() const; + virtual void RecalcAll(); + virtual void selectEntry( const long nPos ); //----------------- - long addEntry( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager ); - void selectEntry( const long nPos ); void enableButtons( bool bEnable ); - - void updateEntry( const uno::Reference< deployment::XPackage > &xPackage ); - - void prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr ); - void checkEntries(); - - TheExtensionManager* getExtensionManager() const { return m_pManager; } - - //=================================================================================== - //These functions are used for automatic testing - - /** @return The count of the entries in the list box. */ - virtual sal_Int32 getItemCount() const; - - /** @return The index of the first selected entry in the list box. - When nothing is selected, which is the case when getItemCount returns '0', - then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */ - virtual sal_Int32 getSelIndex() const; - - /** @return The item name of the entry with the given index - The index starts with 0. - Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ - virtual OUString getItemName( sal_Int32 index ) const; - - /** @return The version string of the entry with the given index - The index starts with 0. - Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ - virtual OUString getItemVersion( sal_Int32 index ) const; - - /** @return The description string of the entry with the given index - The index starts with 0. - Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ - virtual OUString getItemDescription( sal_Int32 index ) const; - - /** @return The publisher string of the entry with the given index - The index starts with 0. - Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ - virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const; - - /** @return The link behind the publisher text of the entry with the given index - The index starts with 0. - Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ - virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const; - - /** The entry at the given position will be selected - Index starts with 0. - Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ - virtual void select( sal_Int32 pos ); - - /** The first found entry with the given name will be selected - When there was no entry found with the name, the selection doesn't change. - Please note that there might be more than one entry with the same - name, because: - 1. the name is not unique - 2. one extension can be installed as user and shared extension. - */ - virtual void select( const OUString & sName ); - - //=================================================================================== - // XEventListener - virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt ) - throw (::com::sun::star::uno::RuntimeException); }; //------------------------------------------------------------------------------ -ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) : - IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ), - m_bHasScrollBar( false ), - m_bHasActive( false ), - m_bNeedsRecalc( true ), - m_bHasNew( false ), - m_bInCheckMode( false ), +ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) : + ExtensionBox_Impl( pParent, pManager ), m_bInterfaceLocked( false ), - m_nActive( 0 ), - m_nTopIndex( 0 ), - m_nActiveHeight( 0 ), - m_aLockedImage( ExtMgrDialog::getResId( RID_IMG_LOCKED ) ), - m_aLockedImageHC( ExtMgrDialog::getResId( RID_IMG_LOCKED_HC ) ), - m_aWarningImage( ExtMgrDialog::getResId( RID_IMG_WARNING ) ), - m_aWarningImageHC( ExtMgrDialog::getResId( RID_IMG_WARNING_HC ) ), - m_aDefaultImage( ExtMgrDialog::getResId( RID_IMG_EXTENSION ) ), - m_aDefaultImageHC( ExtMgrDialog::getResId( RID_IMG_EXTENSION_HC ) ), m_pOptionsBtn( NULL ), m_pEnableBtn( NULL ), m_pRemoveBtn( NULL ), - m_pScrollBar( NULL ), - m_pParent( pParent ), - m_pManager( pManager ) + m_pParent( pParent ) { m_pOptionsBtn = new PushButton( this, WB_TABSTOP ); m_pEnableBtn = new PushButton( this, WB_TABSTOP ); @@ -415,17 +193,13 @@ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE ); m_pRemoveBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_REMOVE ); - m_pOptionsBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleOptionsBtn ) ); - m_pEnableBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleEnableBtn ) ); - m_pRemoveBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleRemoveBtn ) ); + m_pOptionsBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleOptionsBtn ) ); + m_pEnableBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleEnableBtn ) ); + m_pRemoveBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleRemoveBtn ) ); - m_pScrollBar = new ScrollBar( this, WB_VERT ); - m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) ); - m_pScrollBar->EnableDrag(); - - m_pOptionsBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_OPTIONS ) ); - m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) ); - m_pRemoveBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_REMOVE ) ); + m_pOptionsBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_OPTIONS ) ); + m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); + m_pRemoveBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); Size aSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ), MapMode( MAP_APPFONT ) ); @@ -433,288 +207,69 @@ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager m_pEnableBtn->SetSizePixel( aSize ); m_pRemoveBtn->SetSizePixel( aSize ); - SetPaintTransparent( true ); - SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) ); - long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE; - long nTitleHeight = 2*TOP_OFFSET + GetTextHeight(); - if ( nIconHeight < nTitleHeight ) - m_nStdHeight = nTitleHeight; - else - m_nStdHeight = nIconHeight; - m_nStdHeight += GetTextHeight() + TOP_OFFSET; - - nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1; - if ( m_nStdHeight < nIconHeight ) - m_nStdHeight = nIconHeight; - - m_nActiveHeight = m_nStdHeight; - m_nBtnHeight = aSize.Height() + 2 * TOP_OFFSET; - - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetFieldColor() ); - - m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() ); - m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); - m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); + SetExtraSize( aSize.Height() + 2 * TOP_OFFSET ); - Show(); + SetScrollHdl( LINK( this, ExtBoxWithBtns_Impl, ScrollHdl ) ); } //------------------------------------------------------------------------------ -ExtensionBox_Impl::~ExtensionBox_Impl() +ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl() { - typedef std::vector< TEntry_Impl >::iterator ITER; - -// for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) -// (*iIndex)->m_xPackage->removeEventListener( this ); - - m_vEntries.clear(); - delete m_pOptionsBtn; delete m_pEnableBtn; delete m_pRemoveBtn; - delete m_pScrollBar; - - delete m_pLocale; - delete m_pCollator; } //------------------------------------------------------------------------------ -sal_Int32 ExtensionBox_Impl::getItemCount() const -{ - return static_cast< sal_Int32 >( m_vEntries.size() ); -} - //------------------------------------------------------------------------------ -sal_Int32 ExtensionBox_Impl::getSelIndex() const -{ - if ( m_bHasActive ) - { - OSL_ASSERT( m_nActive >= -1); - return static_cast< sal_Int32 >( m_nActive ); - } - else - return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); -} - //------------------------------------------------------------------------------ -void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const +const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const { - if ( nIndex < 0 ) - throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 ); - if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size()) - throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position." - "The position exceeds the number of available list entries"),0, 0 ); -} - -//------------------------------------------------------------------------------ -OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - checkIndex( nIndex ); - return m_vEntries[ nIndex ]->m_sTitle; -} - -//------------------------------------------------------------------------------ -OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - checkIndex( nIndex ); - return m_vEntries[ nIndex ]->m_sVersion; -} - -//------------------------------------------------------------------------------ -OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - checkIndex( nIndex ); - return m_vEntries[ nIndex ]->m_sDescription; -} - -//------------------------------------------------------------------------------ -OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - checkIndex( nIndex ); - return m_vEntries[ nIndex ]->m_sPublisher; -} - -//------------------------------------------------------------------------------ -OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - checkIndex( nIndex ); - return m_vEntries[ nIndex ]->m_sPublisherURL; -} - -//------------------------------------------------------------------------------ -void ExtensionBox_Impl::select( sal_Int32 nIndex ) -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - checkIndex( nIndex ); - selectEntry( nIndex ); -} - -//------------------------------------------------------------------------------ -void ExtensionBox_Impl::select( const OUString & sName ) -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - typedef ::std::vector< TEntry_Impl >::const_iterator It; - - for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ ) - { - if ( sName.equals( (*iIter)->m_sTitle ) ) - { - long nPos = iIter - m_vEntries.begin(); - selectEntry( nPos ); - break; - } - } -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -// Title + description + buttons height -void ExtensionBox_Impl::CalcActiveHeight( const long nPos ) -{ - // get title height - long aTextHeight; - long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE; - long nTitleHeight = 2*TOP_OFFSET + GetTextHeight(); - if ( nIconHeight < nTitleHeight ) - aTextHeight = nTitleHeight; - else - aTextHeight = nIconHeight; - - // calc description height - Size aSize = GetOutputSizePixel(); - if ( m_bHasScrollBar ) - aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); - - aSize.Width() -= ICON_OFFSET; - aSize.Height() = 10000; - - Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), - m_vEntries[ nPos ]->m_sDescription, - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - aTextHeight += aRect.GetHeight(); - - if ( aTextHeight < m_nStdHeight ) - aTextHeight = m_nStdHeight; - - m_nActiveHeight = aTextHeight + m_nBtnHeight; // button bar height -} - -//------------------------------------------------------------------------------ -const Size ExtensionBox_Impl::GetMinOutputSizePixel() const -{ - long nHeight = m_nStdHeight; + Size aMinSize( ExtensionBox_Impl::GetMinOutputSizePixel() ); + long nHeight = aMinSize.Height(); nHeight += m_pOptionsBtn->GetSizePixel().Height(); nHeight += 2 * TOP_OFFSET; long nWidth = m_pOptionsBtn->GetSizePixel().Width(); nWidth *= 3; - nWidth += 5*TOP_OFFSET; - nWidth += m_pScrollBar->GetSizePixel().Width(); + nWidth += 5*TOP_OFFSET + 20; return Size( nWidth, nHeight ); } -//------------------------------------------------------------------------------ -Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const +// ----------------------------------------------------------------------- +void ExtBoxWithBtns_Impl::RecalcAll() { - Size aSize( GetOutputSizePixel() ); + ExtensionBox_Impl::RecalcAll(); - if ( m_bHasScrollBar ) - aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + const sal_Int32 nActive = getSelIndex(); - if ( m_vEntries[ nPos ]->m_bActive ) - aSize.Height() = m_nActiveHeight; + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + SetButtonPos( GetEntryRect( nActive ) ); else - aSize.Height() = m_nStdHeight; - - Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight ); - if ( m_bHasActive && ( nPos < m_nActive ) ) - aPos.Y() += m_nActiveHeight - m_nStdHeight; - - return Rectangle( aPos, aSize ); + { + m_pOptionsBtn->Hide(); + m_pEnableBtn->Hide(); + m_pRemoveBtn->Hide(); + } } + //------------------------------------------------------------------------------ //This function may be called with nPos < 0 -void ExtensionBox_Impl::selectEntry( long nPos ) +void ExtBoxWithBtns_Impl::selectEntry( const long nPos ) { - //ToDo whe should not use the guard at such a big scope here. - //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be - //modified in this function. - //It would be probably best to always use a copy of m_vEntries - //and some other state variables from ExtensionBox_Impl for - //the whole painting operation. See issue i86993 - ::osl::ClearableMutexGuard guard(m_entriesMutex); - - if ( m_bInCheckMode ) + if ( HasActive() && ( nPos == getSelIndex() ) ) return; - if ( m_bHasActive ) - { - if ( nPos == m_nActive ) - return; - - m_bHasActive = false; - m_vEntries[ m_nActive ]->m_bActive = false; + ExtensionBox_Impl::selectEntry( nPos ); - if ( IsReallyVisible() ) - Invalidate(); - } - - if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) ) + if ( ( nPos >= 0 ) && ( nPos < GetEntryCount() ) ) { - m_bHasActive = true; - m_nActive = nPos; - m_vEntries[ nPos ]->m_bActive = true; - if ( IsReallyVisible() ) { - Invalidate(); - CalcActiveHeight( nPos ); - SetupScrollBar(); - Rectangle aEntryRect = GetEntryRect( nPos ); - - // If the top of the selected entry isn't visible, make it visible - if ( aEntryRect.Top() < 0 ) - { - m_nTopIndex += aEntryRect.Top(); - aEntryRect.Move( 0, -aEntryRect.Top() ); - } - - // If the bottom of the selected entry isn't visible, make it visible even if now the top - // isn't visible any longer ( the buttons are more important ) - Size aOutputSize = GetOutputSizePixel(); - if ( aEntryRect.Bottom() > aOutputSize.Height() ) - { - m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() ); - aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) ); - } - - // If there is unused space below the last entry but all entries don't fit into the box, - // move the content down to use the whole space - const long nTotalHeight = GetTotalHeight(); - if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) ) - { - long nOffset = m_nTopIndex; - m_nTopIndex = nTotalHeight - aOutputSize.Height(); - nOffset -= m_nTopIndex; - aEntryRect.Move( 0, nOffset ); - } - - if ( m_bHasScrollBar ) - m_pScrollBar->SetThumbPos( m_nTopIndex ); - - SetButtonPos( aEntryRect ); + SetButtonPos( GetEntryRect( nPos ) ); } - SetButtonStatus( m_vEntries[ nPos ] ); //dv + SetButtonStatus( GetEntryData( nPos) ); } else { @@ -722,12 +277,10 @@ void ExtensionBox_Impl::selectEntry( long nPos ) m_pEnableBtn->Hide(); m_pRemoveBtn->Hide(); } - guard.clear(); - } // ----------------------------------------------------------------------- -void ExtensionBox_Impl::SetButtonPos( const Rectangle& rRect ) +void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect ) { Size aBtnSize( m_pOptionsBtn->GetSizePixel() ); Point aBtnPos( rRect.Left() + ICON_OFFSET, @@ -741,20 +294,20 @@ void ExtensionBox_Impl::SetButtonPos( const Rectangle& rRect ) } // ----------------------------------------------------------------------- -void ExtensionBox_Impl::SetButtonStatus( const TEntry_Impl pEntry ) +void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) { if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) ) { - m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) ); + m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE ); } else { - m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_ENABLE ) ); + m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE ); } - if ( pEntry->m_eState == NOT_AVAILABLE ) + if ( ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps ) m_pEnableBtn->Hide(); else { @@ -775,183 +328,23 @@ void ExtensionBox_Impl::SetButtonStatus( const TEntry_Impl pEntry ) } // ----------------------------------------------------------------------- -void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry ) +bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( pEntry->m_bActive ) - SetTextColor( rStyleSettings.GetHighlightTextColor() ); - else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) ) - SetTextColor( rStyleSettings.GetDisableColor() ); - else if ( IsControlForeground() ) - SetTextColor( GetControlForeground() ); - else - SetTextColor( rStyleSettings.GetFieldTextColor() ); - - if ( pEntry->m_bActive ) - { - SetLineColor(); - SetFillColor( rStyleSettings.GetHighlightColor() ); - DrawRect( rRect ); - } - else - { - if( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetFieldColor() ); - - SetTextFillColor(); - Erase( rRect ); - } - - // Draw extension icon - Point aPos( rRect.TopLeft() ); - aPos += Point( TOP_OFFSET, TOP_OFFSET ); - Image aImage; - if ( ! pEntry->m_aIcon ) - aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage; - else - aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon; - Size aImageSize = aImage.GetSizePixel(); - if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) ) - DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage ); - else - DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage ); - - // Setup fonts - Font aStdFont( GetFont() ); - Font aBoldFont( aStdFont ); - aBoldFont.SetWeight( WEIGHT_BOLD ); - SetFont( aBoldFont ); - long aTextHeight = GetTextHeight(); - - // Init publisher link here - if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() ) - { - pEntry->m_pPublisher = new svt::FixedHyperlink( this ); - pEntry->m_pPublisher->SetBackground(); - pEntry->m_pPublisher->SetPaintTransparent( true ); - pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL ); - pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher ); - Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher ); - pEntry->m_pPublisher->SetSizePixel( aSize ); - pEntry->m_pPublisher->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleHyperlink ) ); - } - - // Get max title width - long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET; - nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN ); - if ( pEntry->m_pPublisher ) - { - nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN); - } - - long aVersionWidth = GetTextWidth( pEntry->m_sVersion ); - long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3); - - aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET ); - - if ( aTitleWidth > nMaxTitleWidth - aVersionWidth ) - { - aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3); - String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth ); - DrawText( aPos, aShortTitle ); - aTitleWidth += (aTextHeight / 3); - } - else - DrawText( aPos, pEntry->m_sTitle ); - - SetFont( aStdFont ); - DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion ); - - long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE; - long nTitleHeight = TOP_OFFSET + GetTextHeight(); - if ( nIconHeight < nTitleHeight ) - aTextHeight = nTitleHeight; - else - aTextHeight = nIconHeight; - - // draw description - String sDescription; - if ( pEntry->m_sErrorText.Len() ) - { - if ( pEntry->m_bActive ) - sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription; - else - sDescription = pEntry->m_sErrorText; - } - else - sDescription = pEntry->m_sDescription; - - aPos.Y() += aTextHeight; - if ( pEntry->m_bActive ) - { - DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nBtnHeight ), - sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - } - else - { - const long nWidth = GetTextWidth( sDescription ); - if ( nWidth > rRect.GetWidth() - aPos.X() ) - sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() ); - DrawText( aPos, sDescription ); - } - - // Draw publisher link - if ( pEntry->m_pPublisher ) - { - pEntry->m_pPublisher->Show(); - aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET ); - pEntry->m_pPublisher->SetPosPixel( aPos ); - } + sal_Int32 nIndex = getSelIndex(); - // Draw status icons - if ( pEntry->m_bShared ) - { - aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET ); - DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage ); - } - if ( pEntry->m_eState == AMBIGUOUS ) - { - aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET ); - DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage ); - } - - SetLineColor( Color( COL_LIGHTGRAY ) ); - DrawLine( rRect.BottomLeft(), rRect.BottomRight() ); -} - -// ----------------------------------------------------------------------- -void ExtensionBox_Impl::RecalcAll() -{ - if ( m_bHasActive ) - CalcActiveHeight( m_nActive ); - - SetupScrollBar(); - - if ( m_bHasActive ) - SetButtonPos( GetEntryRect( m_nActive ) ); - - m_bNeedsRecalc = false; -} - -// ----------------------------------------------------------------------- -bool ExtensionBox_Impl::HandleTabKey( bool bReverse ) -{ - if ( ! m_bHasActive ) + if ( nIndex == EXTENSION_LISTBOX_ENTRY_NOTFOUND ) return false; PushButton *pNext = NULL; if ( m_pOptionsBtn->HasFocus() ) { - if ( !bReverse && !m_vEntries[ m_nActive ]->m_bLocked ) + if ( !bReverse && !GetEntryData( nIndex )->m_bLocked ) pNext = m_pEnableBtn; } else if ( m_pEnableBtn->HasFocus() ) { if ( !bReverse ) pNext = m_pRemoveBtn; - else if ( m_vEntries[ m_nActive ]->m_bHasOptions ) + else if ( GetEntryData( nIndex )->m_bHasOptions ) pNext = m_pOptionsBtn; } else if ( m_pRemoveBtn->HasFocus() ) { @@ -960,14 +353,14 @@ bool ExtensionBox_Impl::HandleTabKey( bool bReverse ) } else { if ( !bReverse ) { - if ( m_vEntries[ m_nActive ]->m_bHasOptions ) + if ( GetEntryData( nIndex )->m_bHasOptions ) pNext = m_pOptionsBtn; - else if ( ! m_vEntries[ m_nActive ]->m_bLocked ) + else if ( ! GetEntryData( nIndex )->m_bLocked ) pNext = m_pEnableBtn; } else { - if ( ! m_vEntries[ m_nActive ]->m_bLocked ) + if ( ! GetEntryData( nIndex )->m_bLocked ) pNext = m_pRemoveBtn; - else if ( m_vEntries[ m_nActive ]->m_bHasOptions ) + else if ( GetEntryData( nIndex )->m_bHasOptions ) pNext = m_pOptionsBtn; } } @@ -982,194 +375,67 @@ bool ExtensionBox_Impl::HandleTabKey( bool bReverse ) } // ----------------------------------------------------------------------- -bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode ) -{ - if ( m_vEntries.empty() ) - return true; - - long nSelect = 0; - - if ( m_bHasActive ) - { - long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight; - if ( nPageSize < 2 ) - nPageSize = 2; - - if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) ) - nSelect = m_nActive + 1; - else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) ) - nSelect = m_nActive - 1; - else if ( nKeyCode == KEY_HOME ) - nSelect = 0; - else if ( nKeyCode == KEY_END ) - nSelect = m_vEntries.size() - 1; - else if ( nKeyCode == KEY_PAGEUP ) - nSelect = m_nActive - nPageSize + 1; - else if ( nKeyCode == KEY_PAGEDOWN ) - nSelect = m_nActive + nPageSize - 1; - } - else // when there is no selected entry, we will select the first or the last. - { - if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) ) - nSelect = 0; - else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) ) - nSelect = m_vEntries.size() - 1; - } - - if ( nSelect < 0 ) - nSelect = 0; - if ( nSelect >= (long) m_vEntries.size() ) - nSelect = m_vEntries.size() - 1; - - selectEntry( nSelect ); - - return true; -} - -// ----------------------------------------------------------------------- -MENU_COMMAND ExtensionBox_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) +MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( nPos >= (long) m_vEntries.size() ) + if ( nPos >= (long) getItemCount() ) return CMD_NONE; PopupMenu aPopup; - aPopup.InsertItem( CMD_UPDATE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - if ( ! m_vEntries[ nPos ]->m_bLocked ) + if ( ! GetEntryData( nPos )->m_bLocked ) { - if ( m_vEntries[ nPos ]->m_eState == REGISTERED ) - aPopup.InsertItem( CMD_DISABLE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) ); - else if ( m_vEntries[ nPos ]->m_eState != NOT_AVAILABLE ) - aPopup.InsertItem( CMD_ENABLE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_ENABLE ) ); + if ( GetEntryData( nPos )->m_eState == REGISTERED ) + aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); + else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) + aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); - aPopup.InsertItem( CMD_REMOVE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_REMOVE ) ); + aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); } return (MENU_COMMAND) aPopup.Execute( this, rPos ); } -// ----------------------------------------------------------------------- -void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ ) -{ - if ( m_bNeedsRecalc ) - RecalcAll(); - - Point aStart( 0, -m_nTopIndex ); - Size aSize( GetOutputSizePixel() ); - - if ( m_bHasScrollBar ) - aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); - - typedef std::vector< TEntry_Impl >::iterator ITER; - for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) - { - aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight; - Rectangle aEntryRect( aStart, aSize ); -// if ( aEntryRect.IsOver( rPaintRect ) ) - DrawRow( aEntryRect, *iIndex ); - aStart.Y() += aSize.Height(); - } -} - -// ----------------------------------------------------------------------- -long ExtensionBox_Impl::GetTotalHeight() const -{ - long nHeight = m_vEntries.size() * m_nStdHeight; - - if ( m_bHasActive ) - { - nHeight += m_nActiveHeight - m_nStdHeight; - } - - return nHeight; -} - -// ----------------------------------------------------------------------- -void ExtensionBox_Impl::SetupScrollBar() -{ - const Size aSize = GetOutputSizePixel(); - const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize(); - const long nTotalHeight = GetTotalHeight(); - const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() ); - - if ( bNeedsScrollBar ) - { - if ( m_nTopIndex + aSize.Height() > nTotalHeight ) - m_nTopIndex = nTotalHeight - aSize.Height(); - - m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), - Size( nScrBarSize, aSize.Height() ) ); - m_pScrollBar->SetRangeMax( nTotalHeight ); - m_pScrollBar->SetVisibleSize( aSize.Height() ); - m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 ); - m_pScrollBar->SetLineSize( m_nStdHeight ); - m_pScrollBar->SetThumbPos( m_nTopIndex ); - - if ( !m_bHasScrollBar ) - m_pScrollBar->Show(); - } - else if ( m_bHasScrollBar ) - { - m_pScrollBar->Hide(); - m_nTopIndex = 0; - } - - m_bHasScrollBar = bNeedsScrollBar; -} - -// ----------------------------------------------------------------------- -void ExtensionBox_Impl::Resize() -{ - RecalcAll(); -} - //------------------------------------------------------------------------------ -void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt ) +void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) { if ( m_bInterfaceLocked ) return; const Point aMousePos( rMEvt.GetPosPixel() ); - long nPos = ( aMousePos.Y() + m_nTopIndex ) / m_nStdHeight; - if ( m_bHasActive && ( nPos > m_nActive ) ) - { - if ( aMousePos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight ) - nPos = m_nActive; - else - nPos = ( aMousePos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight; - } + const long nPos = PointToPos( aMousePos ); if ( rMEvt.IsRight() ) { switch( ShowPopupMenu( aMousePos, nPos ) ) { case CMD_NONE: break; - case CMD_ENABLE: m_pParent->enablePackage( m_vEntries[ nPos ]->m_xPackageManager, - m_vEntries[ nPos ]->m_xPackage, true ); + case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager, + GetEntryData( nPos )->m_xPackage, true ); break; - case CMD_DISABLE: m_pParent->enablePackage( m_vEntries[ nPos ]->m_xPackageManager, - m_vEntries[ nPos ]->m_xPackage, false ); + case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager, + GetEntryData( nPos )->m_xPackage, false ); break; - case CMD_UPDATE: m_pParent->updatePackage( m_vEntries[ nPos ]->m_xPackageManager, - m_vEntries[ nPos ]->m_xPackage ); + case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackageManager, + GetEntryData( nPos )->m_xPackage ); break; - case CMD_REMOVE: m_pParent->removePackage( m_vEntries[ nPos ]->m_xPackageManager, - m_vEntries[ nPos ]->m_xPackage ); + case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackageManager, + GetEntryData( nPos )->m_xPackage ); break; } } else if ( rMEvt.IsLeft() ) { - if ( rMEvt.IsMod1() && m_bHasActive ) - selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one + if ( rMEvt.IsMod1() && HasActive() ) + selectEntry( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); // Selecting an not existing entry will deselect the current one else selectEntry( nPos ); } } //------------------------------------------------------------------------------ -long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt ) +long ExtBoxWithBtns_Impl::Notify( NotifyEvent& rNEvt ) { bool bHandled = false; @@ -1181,364 +447,259 @@ long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt ) if ( nKeyCode == KEY_TAB ) bHandled = HandleTabKey( aKeyCode.IsShift() ); - else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR ) - bHandled = HandleCursorKey( nKeyCode ); - } - - if ( rNEvt.GetType() == EVENT_COMMAND ) - { - if ( m_bHasScrollBar && - ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) ) - { - const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); - if ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) - { - long nThumbPos = m_pScrollBar->GetThumbPos(); - if ( pData->GetDelta() < 0 ) - m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight ); - else - m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight ); - bHandled = true; - } - } } if ( !bHandled ) - return Control::Notify( rNEvt ); + return ExtensionBox_Impl::Notify( rNEvt ); else return true; } //------------------------------------------------------------------------------ -bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart, - const long nEnd, long &nPos ) +void ExtBoxWithBtns_Impl::enableButtons( bool bEnable ) { - nPos = nStart; - if ( nStart > nEnd ) - return false; - - StringCompare eCompare; + m_bInterfaceLocked = ! bEnable; - if ( nStart == nEnd ) + if ( bEnable ) { - eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] ); - if ( eCompare == COMPARE_LESS ) - return false; - else if ( eCompare == COMPARE_EQUAL ) - { - //Workaround. See i86963. - if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage) - return false; - - if ( m_bInCheckMode ) - m_vEntries[ nStart ]->m_bChecked = true; - return true; - } - else - { - nPos = nStart + 1; - return false; - } + sal_Int32 nIndex = getSelIndex(); + if ( nIndex != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + SetButtonStatus( GetEntryData( nIndex ) ); } - - const long nMid = nStart + ( ( nEnd - nStart ) / 2 ); - eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] ); - - if ( eCompare == COMPARE_LESS ) - return FindEntryPos( pEntry, nStart, nMid-1, nPos ); - else if ( eCompare == COMPARE_GREATER ) - return FindEntryPos( pEntry, nMid+1, nEnd, nPos ); else { - //Workaround.See i86963. - if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage) - return false; - - if ( m_bInCheckMode ) - m_vEntries[ nMid ]->m_bChecked = true; - nPos = nMid; - return true; + m_pOptionsBtn->Enable( false ); + m_pRemoveBtn->Enable( false ); + m_pEnableBtn->Enable( false ); } } -//------------------------------------------------------------------------------ -long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager ) +// ----------------------------------------------------------------------- +IMPL_LINK( ExtBoxWithBtns_Impl, ScrollHdl, ScrollBar*, pScrBar ) { - long nPos = 0; - PackageState eState = m_pManager->getPackageState( xPackage ); - - TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) ); - xPackage->addEventListener( this ); - - ::osl::ClearableMutexGuard guard(m_entriesMutex); - if ( m_vEntries.empty() ) - { - pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager ); - pEntry->m_bNew = m_bInCheckMode; - m_vEntries.push_back( pEntry ); - } - else - { - if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) ) - { - pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager ); - pEntry->m_bNew = m_bInCheckMode; - m_vEntries.insert( m_vEntries.begin()+nPos, pEntry ); - } - else if ( !m_bInCheckMode ) - { - OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" ); - } - } - //access to m_nActive must be guarded - if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) ) - m_nActive += 1; + long nDelta = pScrBar->GetDelta(); - guard.clear(); + Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) ); + Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) ); + Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) ); - if ( IsReallyVisible() ) - Invalidate(); + DoScroll( nDelta ); - m_bNeedsRecalc = true; + m_pOptionsBtn->SetPosPixel( aNewOptPt ); + m_pRemoveBtn->SetPosPixel( aNewRemPt ); + m_pEnableBtn->SetPosPixel( aNewEnPt ); - return nPos; + return 1; } -//------------------------------------------------------------------------------ -void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage ) +// ----------------------------------------------------------------------- +IMPL_LINK( ExtBoxWithBtns_Impl, HandleOptionsBtn, void*, EMPTYARG ) { - typedef std::vector< TEntry_Impl >::iterator ITER; - for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + const sal_Int32 nActive = getSelIndex(); + + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { - if ( (*iIndex)->m_xPackage == xPackage ) + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + + if ( pFact ) { - PackageState eState = m_pManager->getPackageState( xPackage ); - (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - (*iIndex)->m_eState = eState; - (*iIndex)->m_sTitle = xPackage->getDisplayName(); - (*iIndex)->m_sVersion = xPackage->getVersion(); - (*iIndex)->m_sDescription = xPackage->getDescription(); - - if ( eState == AMBIGUOUS ) - (*iIndex)->m_sErrorText = ExtMgrDialog::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); - else - (*iIndex)->m_sErrorText = String(); + OUString sExtensionId = GetEntryData( nActive )->m_xPackage->getIdentifier().Value; + VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() ); - if ( IsReallyVisible() ) - Invalidate(); - break; + pDlg->Execute(); + + delete pDlg; } } + + return 1; } -//------------------------------------------------------------------------------ -void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr ) +// ----------------------------------------------------------------------- +IMPL_LINK( ExtBoxWithBtns_Impl, HandleEnableBtn, void*, EMPTYARG ) { - m_bInCheckMode = true; - typedef std::vector< TEntry_Impl >::iterator ITER; - for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + const sal_Int32 nActive = getSelIndex(); + + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { - if ( (*iIndex)->m_xPackageManager == xPackageMgr ) - (*iIndex)->m_bChecked = false; - else - (*iIndex)->m_bChecked = true; - (*iIndex)->m_bNew = false; + TEntry_Impl pEntry = GetEntryData( nActive ); + const bool bEnable( pEntry->m_eState != REGISTERED ); + + m_pParent->enablePackage( pEntry->m_xPackageManager, + pEntry->m_xPackage, + bEnable ); } + + return 1; } -//------------------------------------------------------------------------------ -void ExtensionBox_Impl::checkEntries() +// ----------------------------------------------------------------------- +IMPL_LINK( ExtBoxWithBtns_Impl, HandleRemoveBtn, void*, EMPTYARG ) { - long nNewPos = -1; - long nPos = 0; - bool bNeedsUpdate = false; + const sal_Int32 nActive = getSelIndex(); - ::osl::ClearableMutexGuard guard(m_entriesMutex); - typedef std::vector< TEntry_Impl >::iterator ITER; - ITER iIndex = m_vEntries.begin(); - while ( iIndex < m_vEntries.end() ) + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { - if ( (*iIndex)->m_bChecked == false ) - { - bNeedsUpdate = true; - nPos = iIndex-m_vEntries.begin(); - if ( (*iIndex)->m_bNew ) - { - if ( nNewPos == - 1) - nNewPos = nPos; - if ( nPos <= m_nActive ) - m_nActive += 1; - } - } - iIndex++; + TEntry_Impl pEntry = GetEntryData( nActive ); + m_pParent->removePackage( pEntry->m_xPackageManager, + pEntry->m_xPackage ); } - guard.clear(); - - m_bInCheckMode = false; - if ( nNewPos != - 1) - selectEntry( nNewPos ); + return 1; +} - if ( bNeedsUpdate ) - { - m_bNeedsRecalc = true; - if ( IsReallyVisible() ) - Invalidate(); - } +//------------------------------------------------------------------------------ +// DialogHelper +//------------------------------------------------------------------------------ +DialogHelper::DialogHelper( const uno::Reference< uno::XComponentContext > &xContext, + Dialog *pWindow ) : + m_pVCLWindow( pWindow ), + m_nEventID( 0 ), + m_bIsBusy( false ) +{ + m_xContext = xContext; } + //------------------------------------------------------------------------------ -bool ExtensionBox_Impl::isHCMode() +DialogHelper::~DialogHelper() { - return (bool)GetDisplayBackground().GetColor().IsDark(); + if ( m_nEventID ) + Application::RemoveUserEvent( m_nEventID ); } //------------------------------------------------------------------------------ -void ExtensionBox_Impl::enableButtons( bool bEnable ) +ResId DialogHelper::getResId( USHORT nId ) { - m_bInterfaceLocked = ! bEnable; + const ::vos::OGuard guard( Application::GetSolarMutex() ); + return ResId( nId, *DeploymentGuiResMgr::get() ); +} - if ( bEnable ) - { - if ( m_bHasActive ) - SetButtonStatus( m_vEntries[ m_nActive ] ); - } - else - { - m_pOptionsBtn->Enable( false ); - m_pRemoveBtn->Enable( false ); - m_pEnableBtn->Enable( false ); +//------------------------------------------------------------------------------ +String DialogHelper::getResourceString( USHORT id ) +{ + // init with non-acquired solar mutex: + BrandName::get(); + const ::vos::OGuard guard( Application::GetSolarMutex() ); + String ret( ResId( id, *DeploymentGuiResMgr::get() ) ); + if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) { + ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); } + return ret; } //------------------------------------------------------------------------------ -// XEventListener -void ExtensionBox_Impl::disposing( lang::EventObject const & rEvt ) - throw ( uno::RuntimeException ) +bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager ) { - uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY ); + if ( xPackageManager->getContext().equals( OUSTR("shared") ) ) + return true; + else + return false; +} - if ( xPackage.is() ) +//------------------------------------------------------------------------------ +bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager, + Window *pParent, + const USHORT nResID, + bool &bHadWarning ) +{ + if ( !bHadWarning && IsSharedPkgMgr( xPackageManager ) ) { - ::osl::ClearableMutexGuard aGuard( m_entriesMutex ); - typedef std::vector< TEntry_Impl >::iterator ITER; + const ::vos::OGuard guard( Application::GetSolarMutex() ); + WarningBox aInfoBox( pParent, getResId( nResID ) ); + String aMsgText = aInfoBox.GetMessText(); + aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + aInfoBox.SetMessText( aMsgText ); - for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) - { - if ( (*iIndex)->m_xPackage == xPackage ) - { - long nPos = iIndex - m_vEntries.begin(); - - m_vEntries.erase( iIndex ); - - if ( IsReallyVisible() ) - Invalidate(); - - if ( m_bHasActive ) - { - if ( nPos < m_nActive ) - m_nActive -= 1; - else if ( ( nPos == m_nActive ) && - ( nPos == (long) m_vEntries.size() ) ) - m_nActive -= 1; - - m_bHasActive = false; - //clear before calling out of this method - aGuard.clear(); - selectEntry( m_nActive ); - } - break; - } - } + bHadWarning = true; + + if ( RET_OK == aInfoBox.Execute() ) + return true; + else + return false; } + else + return true; } -// ----------------------------------------------------------------------- -IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar ) +//------------------------------------------------------------------------------ +void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle ) const { - long nDelta = pScrBar->GetDelta(); + if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty + return; - m_nTopIndex += nDelta; - Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) ); - Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) ); - Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) ); - Point aNewSBPt( m_pScrollBar->GetPosPixel() ); + try + { + uno::Reference< XSystemShellExecute > xSystemShellExecute( + m_xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), m_xContext), uno::UNO_QUERY_THROW); + //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException + xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS ); + } + catch ( uno::Exception& ) + { + uno::Any exc( ::cppu::getCaughtException() ); + OUString msg( ::comphelper::anyToString( exc ) ); + const ::vos::OGuard guard( Application::GetSolarMutex() ); + ErrorBox aErrorBox( NULL, WB_OK, msg ); + aErrorBox.SetText( sTitle ); + aErrorBox.Execute(); + } +} - Rectangle aScrRect( Point(), GetOutputSizePixel() ); - aScrRect.Right() -= pScrBar->GetSizePixel().Width(); - Scroll( 0, -nDelta, aScrRect ); +//------------------------------------------------------------------------------ +bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const +{ + const ::vos::OGuard guard( Application::GetSolarMutex() ); + WarningBox aInfo( m_pVCLWindow, getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) ); - m_pOptionsBtn->SetPosPixel( aNewOptPt ); - m_pRemoveBtn->SetPosPixel( aNewRemPt ); - m_pEnableBtn->SetPosPixel( aNewEnPt ); - m_pScrollBar->SetPosPixel( aNewSBPt ); + String sText( aInfo.GetMessText() ); + sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName ); + aInfo.SetMessText( sText ); - return 1; + return ( RET_OK == aInfo.Execute() ); } -// ----------------------------------------------------------------------- -IMPL_LINK( ExtensionBox_Impl, HandleOptionsBtn, void*, EMPTYARG ) +//------------------------------------------------------------------------------ +bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const { - if ( m_bHasActive ) - { - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - - if ( pFact ) - { - OUString sExtensionId = m_vEntries[ m_nActive ]->m_xPackage->getIdentifier().Value; - VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() ); + const ::vos::OGuard guard( Application::GetSolarMutex() ); + QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) ); - pDlg->Execute(); + String sMsgText = aQuery.GetMessText(); + sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + aQuery.SetMessText( sMsgText ); - delete pDlg; - } - } + USHORT nYesBtnID = aQuery.GetButtonId( 0 ); + USHORT nNoBtnID = aQuery.GetButtonId( 1 ); - return 1; -} + if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND ) + aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) ); + if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND ) + aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) ); -// ----------------------------------------------------------------------- -IMPL_LINK( ExtensionBox_Impl, HandleEnableBtn, void*, EMPTYARG ) -{ - if ( m_bHasActive ) - { - const bool bEnable( m_vEntries[ m_nActive ]->m_eState != REGISTERED ); + short nRet = aQuery.Execute(); - m_pParent->enablePackage( m_vEntries[ m_nActive ]->m_xPackageManager, - m_vEntries[ m_nActive ]->m_xPackage, - bEnable ); - } + if ( nRet == RET_CANCEL ) + return false; - return 1; + bInstallForAll = ( nRet == RET_NO ); + return true; } -// ----------------------------------------------------------------------- -IMPL_LINK( ExtensionBox_Impl, HandleRemoveBtn, void*, EMPTYARG ) +//------------------------------------------------------------------------------ +void DialogHelper::PostUserEvent( const Link& rLink, void* pCaller ) { - if ( m_bHasActive ) - { - m_pParent->removePackage( m_vEntries[ m_nActive ]->m_xPackageManager, - m_vEntries[ m_nActive ]->m_xPackage ); - } + if ( m_nEventID ) + Application::RemoveUserEvent( m_nEventID ); - return 1; + m_nEventID = Application::PostUserEvent( rLink, pCaller ); } -// ----------------------------------------------------------------------- -IMPL_LINK( ExtensionBox_Impl, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) -{ - m_pParent->openWebBrowser( pHyperlink->GetURL() ); - return 1; -} - - //------------------------------------------------------------------------------ // ExtMgrDialog //------------------------------------------------------------------------------ ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) : ModelessDialog( pParent, getResId( RID_DLG_EXTENSION_MANAGER ) ), + DialogHelper( pManager->getContext(), (Dialog*) this ), m_aAddBtn( this, getResId( RID_EM_BTN_ADD ) ), m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ), m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ), @@ -1557,14 +718,14 @@ ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) : m_bEnableWarning( false ), m_bDisableWarning( false ), m_bDeleteWarning( false ), - m_bIsBusy( false ), m_nProgress( 0 ), m_pManager( pManager ) { // free local resources (RID < 256): FreeResource(); - m_pExtensionBox = new ExtensionBox_Impl( this, pManager ); + m_pExtensionBox = new ExtBoxWithBtns_Impl( this, pManager ); + m_pExtensionBox->SetHyperlinkHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) ); m_aAddBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) ); m_aUpdateBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleUpdateBtn ) ); @@ -1608,35 +769,6 @@ ExtMgrDialog::~ExtMgrDialog() } //------------------------------------------------------------------------------ -ResId ExtMgrDialog::getResId( USHORT id ) -{ - const ::vos::OGuard guard( Application::GetSolarMutex() ); - return ResId( id, *DeploymentGuiResMgr::get() ); -} - -//------------------------------------------------------------------------------ -String ExtMgrDialog::getResourceString( USHORT id ) -{ - // init with non-acquired solar mutex: - BrandName::get(); - const ::vos::OGuard guard( Application::GetSolarMutex() ); - String ret( ResId( id, *DeploymentGuiResMgr::get() ) ); - if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) { - ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); - } - return ret; -} - -//------------------------------------------------------------------------------ -bool ExtMgrDialog::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager ) -{ - if ( xPackageManager->getContext().equals( OUSTR("shared") ) ) - return true; - else - return false; -} - -//------------------------------------------------------------------------------ void ExtMgrDialog::selectEntry( long nPos ) { m_pExtensionBox->selectEntry( nPos ); @@ -1671,96 +803,6 @@ void ExtMgrDialog::checkEntries() } //------------------------------------------------------------------------------ -bool ExtMgrDialog::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager, - const USHORT nResID, - bool &bHadWarning ) const -{ - if ( IsSharedPkgMgr( xPackageManager ) && !bHadWarning ) - { - const ::vos::OGuard guard( Application::GetSolarMutex() ); - WarningBox aInfoBox( const_cast< ExtMgrDialog* >(this), getResId( nResID ) ); - String aMsgText = aInfoBox.GetMessText(); - aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); - aInfoBox.SetMessText( aMsgText ); - - bHadWarning = true; - - if ( RET_OK == aInfoBox.Execute() ) - return true; - else - return false; - } - else - return true; -} - -//------------------------------------------------------------------------------ -void ExtMgrDialog::openWebBrowser( OUString const & sURL ) const -{ - if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty - return; - - try - { - uno::Reference< uno::XComponentContext > xContext = m_pManager->getContext(); - - uno::Reference< XSystemShellExecute > xSystemShellExecute( - xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), xContext), uno::UNO_QUERY_THROW); - //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException - xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - catch ( uno::Exception& ) - { - uno::Any exc( ::cppu::getCaughtException() ); - OUString msg( ::comphelper::anyToString( exc ) ); - const ::vos::OGuard guard( Application::GetSolarMutex() ); - ErrorBox aErrorBox( const_cast< ExtMgrDialog* >(this), WB_OK, msg ); - aErrorBox.SetText( GetText() ); - aErrorBox.Execute(); - } -} - -//------------------------------------------------------------------------------ -bool ExtMgrDialog::installForAllUsers( bool &bInstallForAll ) const -{ - const ::vos::OGuard guard( Application::GetSolarMutex() ); - QueryBox aQuery( const_cast< ExtMgrDialog* >(this), getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) ); - - String sMsgText = aQuery.GetMessText(); - sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); - aQuery.SetMessText( sMsgText ); - - USHORT nYesBtnID = aQuery.GetButtonId( 0 ); - USHORT nNoBtnID = aQuery.GetButtonId( 1 ); - - if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND ) - aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) ); - if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND ) - aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) ); - - short nRet = aQuery.Execute(); - - if ( nRet == RET_CANCEL ) - return false; - - bInstallForAll = ( nRet == RET_NO ); - return true; -} - -//------------------------------------------------------------------------------ -bool ExtMgrDialog::installExtensionWarn( const OUString &rExtensionName ) const -{ - const ::vos::OGuard guard( Application::GetSolarMutex() ); - WarningBox aInfo( const_cast< ExtMgrDialog* >(this), getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) ); - - String sText( aInfo.GetMessText() ); - sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName ); - aInfo.SetMessText( sText ); - - return ( RET_OK == aInfo.Execute() ); -} - -//------------------------------------------------------------------------------ bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const { const ::vos::OGuard guard( Application::GetSolarMutex() ); @@ -1783,12 +825,12 @@ bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackageMana if ( bEnable ) { - if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) ) + if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) ) return false; } else { - if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) ) + if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) ) return false; } @@ -1810,7 +852,7 @@ bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackageMana return false; } - if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) ) + if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) ) return false; m_pManager->removePackage( xPackageManager, xPackage ); @@ -1825,7 +867,11 @@ bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackageMana if ( !xPackageManager.is() || !xPackage.is() ) return false; - m_pManager->updatePackage( xPackageManager, xPackage ); + std::vector< TUpdateListEntry > vEntries; + TUpdateListEntry pEntry( new UpdateListEntry( xPackage, xPackageManager ) ); + vEntries.push_back( pEntry ); + + m_pManager->updatePackages( vEntries ); return true; } @@ -1932,7 +978,7 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface ) if ( m_aProgressBar.IsVisible() ) m_aProgressBar.SetValue( 100 ); m_xAbortChannel.clear(); -// bLockInterface = false; + OSL_TRACE( " startProgress handler: stop\n" ); } else @@ -1945,7 +991,8 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface ) m_aUpdateBtn.Enable( !bLockInterface && m_pExtensionBox->getItemCount() ); m_pExtensionBox->enableButtons( !bLockInterface ); -// pCond->set(); + clearEventID(); + return 0; } @@ -1969,10 +1016,7 @@ void ExtMgrDialog::showProgress( bool _bStart ) OSL_TRACE( "showProgress stop!\n" ); } - Application::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart ); -// ::osl::Condition cond; -// Application::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), &cond ); -// cond.wait(); + DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart ); } // ----------------------------------------------------------------------- @@ -2003,7 +1047,7 @@ void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage // ----------------------------------------------------------------------- IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG ) { - m_bIsBusy = true; + setBusy( true ); uno::Reference< deployment::XPackageManager > xUserPkgMgr = m_pManager->getUserPkgMgr(); uno::Sequence< OUString > aFileList = raiseAddPicker( xUserPkgMgr ); @@ -2013,7 +1057,7 @@ IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG ) m_pManager->installPackage( aFileList[0] ); } - m_bIsBusy = false; + setBusy( false ); return 1; } @@ -2028,7 +1072,7 @@ IMPL_LINK( ExtMgrDialog, HandleUpdateBtn, void*, EMPTYARG ) // ----------------------------------------------------------------------- IMPL_LINK( ExtMgrDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) { - openWebBrowser( pHyperlink->GetURL() ); + openWebBrowser( pHyperlink->GetURL(), GetText() ); return 1; } @@ -2191,6 +1235,554 @@ BOOL ExtMgrDialog::Close() return bRet; } +//------------------------------------------------------------------------------ +// UpdateRequiredDialog +//------------------------------------------------------------------------------ +UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager *pManager ) : + ModalDialog( pParent, getResId( RID_DLG_UPDATE_REQUIRED ) ), + DialogHelper( pManager->getContext(), (Dialog*) this ), + m_aUpdateNeeded( this, getResId( RID_EM_FT_MSG ) ), + m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ), + m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ), + m_aHelpBtn( this, getResId( RID_EM_BTN_HELP ) ), + m_aCancelBtn( this, getResId( RID_EM_BTN_CANCEL ) ), + m_aDivider( this ), + m_aProgressText( this, getResId( RID_EM_FT_PROGRESS ) ), + m_aProgressBar( this, WB_BORDER + WB_3DLOOK ), + m_sAddPackages( getResourceString( RID_STR_ADD_PACKAGES ) ), + m_sCloseText( getResourceString( RID_STR_CLOSE_BTN ) ), + m_bHasProgress( false ), + m_bProgressChanged( false ), + m_bStartProgress( false ), + m_bStopProgress( false ), + m_bUpdateWarning( false ), + m_bDisableWarning( false ), + m_bHasLockedEntries( false ), + m_nProgress( 0 ), + m_pManager( pManager ) +{ + // free local resources (RID < 256): + FreeResource(); + + m_pExtensionBox = new ExtensionBox_Impl( this, pManager ); + m_pExtensionBox->SetHyperlinkHdl( LINK( this, UpdateRequiredDialog, HandleHyperlink ) ); + + m_aUpdateBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) ); + m_aCloseBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) ); + m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) ); + + String aText = m_aUpdateNeeded.GetText(); + aText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + m_aUpdateNeeded.SetText( aText ); + + // resize update button + Size aBtnSize = m_aUpdateBtn.GetSizePixel(); + String sTitle = m_aUpdateBtn.GetText(); + long nWidth = m_aUpdateBtn.GetCtrlTextWidth( sTitle ); + nWidth += 2 * m_aUpdateBtn.GetTextHeight(); + if ( nWidth > aBtnSize.Width() ) + m_aUpdateBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) ); + + // resize update button + aBtnSize = m_aCloseBtn.GetSizePixel(); + sTitle = m_aCloseBtn.GetText(); + nWidth = m_aCloseBtn.GetCtrlTextWidth( sTitle ); + nWidth += 2 * m_aCloseBtn.GetTextHeight(); + if ( nWidth > aBtnSize.Width() ) + m_aCloseBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) ); + + // minimum size: + SetMinOutputSizePixel( + Size( // width: + (5 * m_aHelpBtn.GetSizePixel().Width()) + + (5 * RSC_SP_DLG_INNERBORDER_LEFT ), + // height: + (1 * m_aHelpBtn.GetSizePixel().Height()) + + (1 * m_aUpdateNeeded.GetSizePixel().Height()) + + (1 * m_pExtensionBox->GetMinOutputSizePixel().Height()) + + (3 * RSC_SP_DLG_INNERBORDER_LEFT) ) ); + + m_aDivider.Show(); + m_aProgressBar.Hide(); + m_aUpdateBtn.Enable( false ); + m_aCloseBtn.GrabFocus(); + + m_aTimeoutTimer.SetTimeout( 50 ); // mSec + m_aTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) ); +} + +//------------------------------------------------------------------------------ +UpdateRequiredDialog::~UpdateRequiredDialog() +{ + m_aTimeoutTimer.Stop(); + + delete m_pExtensionBox; +} + +//------------------------------------------------------------------------------ +long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage, + const uno::Reference< deployment::XPackageManager > &xPackageManager ) +{ + // We will only add entries to the list with unsatisfied dependencies + if ( !checkDependencies( xPackage ) ) + { + m_bHasLockedEntries |= (bool) xPackageManager->isReadOnly(); + m_aUpdateBtn.Enable( true ); + return m_pExtensionBox->addEntry( xPackage, xPackageManager ); + } + return 0; +} + +//------------------------------------------------------------------------------ +void UpdateRequiredDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +{ + if ( xPackageManager.is() ) + m_pExtensionBox->prepareChecking( xPackageManager ); +} + +//------------------------------------------------------------------------------ +void UpdateRequiredDialog::checkEntries() +{ + const ::vos::OGuard guard( Application::GetSolarMutex() ); + m_pExtensionBox->checkEntries(); + + if ( ! hasActiveEntries() ) + { + m_aCloseBtn.SetText( m_sCloseText ); + m_aCloseBtn.GrabFocus(); + } +} + +//------------------------------------------------------------------------------ +bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &, + const uno::Reference< deployment::XPackage > &xPackage, + bool bEnable ) +{ + m_pManager->enablePackage( xPackage, bEnable ); + + return true; +} + +//------------------------------------------------------------------------------ +IMPL_LINK( UpdateRequiredDialog, HandleCancelBtn, void*, EMPTYARG ) +{ + // m_dialog->m_cmdEnv->m_aborted = true; + if ( m_xAbortChannel.is() ) + { + try + { + m_xAbortChannel->sendAbort(); + } + catch ( uno::RuntimeException & ) + { + OSL_ENSURE( 0, "### unexpected RuntimeException!" ); + } + } + return 1; +} + +// ------------------------------------------------------------------------------ +IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + bool bLockInterface = (bool) _bLockInterface; + + if ( m_bStartProgress && !m_bHasProgress ) + m_aTimeoutTimer.Start(); + + if ( m_bStopProgress ) + { + if ( m_aProgressBar.IsVisible() ) + m_aProgressBar.SetValue( 100 ); + m_xAbortChannel.clear(); + OSL_TRACE( " startProgress handler: stop\n" ); + } + else + { + OSL_TRACE( " startProgress handler: start\n" ); + } + + m_aCancelBtn.Enable( bLockInterface ); + m_aUpdateBtn.Enable( false ); + clearEventID(); + + return 0; +} + +// ------------------------------------------------------------------------------ +void UpdateRequiredDialog::showProgress( bool _bStart ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + bool bStart = _bStart; + + if ( bStart ) + { + m_nProgress = 0; + m_bStartProgress = true; + OSL_TRACE( "showProgress start\n" ); + } + else + { + m_nProgress = 100; + m_bStopProgress = true; + OSL_TRACE( "showProgress stop!\n" ); + } + + DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), (void*) bStart ); +} + +// ----------------------------------------------------------------------- +void UpdateRequiredDialog::updateProgress( const long nProgress ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_nProgress = nProgress; +} + +// ----------------------------------------------------------------------- +void UpdateRequiredDialog::updateProgress( const OUString &rText, + const uno::Reference< task::XAbortChannel > &xAbortChannel) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_xAbortChannel = xAbortChannel; + m_sProgressText = rText; + m_bProgressChanged = true; +} + +//------------------------------------------------------------------------------ +void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage ) +{ + // We will remove all updated packages with satisfied dependencies, but + // we will show all disabled entries so the user sees the result + // of the 'disable all' button + if ( isEnabled( xPackage ) && checkDependencies( xPackage ) ) + m_pExtensionBox->removeEntry( xPackage ); + else + m_pExtensionBox->updateEntry( xPackage ); + + if ( ! hasActiveEntries() ) + { + m_aCloseBtn.SetText( m_sCloseText ); + m_aCloseBtn.GrabFocus(); + } +} + +// ----------------------------------------------------------------------- +IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG ) +{ + ::osl::ClearableMutexGuard aGuard( m_aMutex ); + + std::vector< TUpdateListEntry > vUpdateEntries; + sal_Int32 nCount = m_pExtensionBox->GetEntryCount(); + + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i ); + TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage, + pEntry->m_xPackageManager ) ); + vUpdateEntries.push_back( pUpdateEntry ); + } + + aGuard.clear(); + + m_pManager->updatePackages( vUpdateEntries ); + + return 1; +} + +// ----------------------------------------------------------------------- +IMPL_LINK( UpdateRequiredDialog, HandleCloseBtn, void*, EMPTYARG ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !isBusy() ) + { + if ( m_bHasLockedEntries ) + EndDialog( -1 ); + else if ( hasActiveEntries() ) + disableAllEntries(); + else + EndDialog( 0 ); + } + + return 1; +} + +// ----------------------------------------------------------------------- +IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) +{ + openWebBrowser( pHyperlink->GetURL(), GetText() ); + + return 1; +} + +// ----------------------------------------------------------------------- +IMPL_LINK( UpdateRequiredDialog, TimeOutHdl, Timer*, EMPTYARG ) +{ + if ( m_bStopProgress ) + { + m_bHasProgress = false; + m_bStopProgress = false; + m_aProgressText.Hide(); + m_aProgressBar.Hide(); + m_aCancelBtn.Hide(); + } + else + { + if ( m_bProgressChanged ) + { + m_bProgressChanged = false; + m_aProgressText.SetText( m_sProgressText ); + } + + if ( m_bStartProgress ) + { + m_bStartProgress = false; + m_bHasProgress = true; + m_aProgressBar.Show(); + m_aProgressText.Show(); + m_aCancelBtn.Enable(); + m_aCancelBtn.Show(); + } + + if ( m_aProgressBar.IsVisible() ) + m_aProgressBar.SetValue( (USHORT) m_nProgress ); + + m_aTimeoutTimer.Start(); + } + + return 1; +} + +//------------------------------------------------------------------------------ +// VCL::Window / Dialog +void UpdateRequiredDialog::Resize() +{ + Size aTotalSize( GetOutputSizePixel() ); + Size aBtnSize( m_aHelpBtn.GetSizePixel() ); + + Point aPos( RSC_SP_DLG_INNERBORDER_LEFT, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM - aBtnSize.Height() ); + + m_aHelpBtn.SetPosPixel( aPos ); + + aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - m_aCloseBtn.GetSizePixel().Width(); + m_aCloseBtn.SetPosPixel( aPos ); + + aPos.X() -= ( RSC_SP_CTRL_X + m_aUpdateBtn.GetSizePixel().Width() ); + m_aUpdateBtn.SetPosPixel( aPos ); + + Size aDivSize( aTotalSize.Width(), LINE_SIZE ); + aPos = Point( 0, aPos.Y() - LINE_SIZE - RSC_SP_DLG_INNERBORDER_BOTTOM ); + m_aDivider.SetPosSizePixel( aPos, aDivSize ); + + // Calc fixed text size + aPos = Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ); + Size aFTSize = m_aUpdateNeeded.CalcMinimumSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_SP_DLG_INNERBORDER_LEFT ); + m_aUpdateNeeded.SetPosSizePixel( aPos, aFTSize ); + + // Calc list box size + Size aSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT, + aTotalSize.Height() - 2*aBtnSize.Height() - LINE_SIZE - + 2*RSC_SP_DLG_INNERBORDER_TOP - 3*RSC_SP_DLG_INNERBORDER_BOTTOM - aFTSize.Height() ); + aPos.Y() += aFTSize.Height()+RSC_SP_DLG_INNERBORDER_TOP; + + m_pExtensionBox->SetPosSizePixel( aPos, aSize ); + + aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - aBtnSize.Width(); + aPos.Y() += aSize.Height()+RSC_SP_DLG_INNERBORDER_TOP; + m_aCancelBtn.SetPosPixel( aPos ); + + // Calc progress height + aFTSize = m_aProgressText.GetSizePixel(); + long nProgressHeight = aFTSize.Height(); + + if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) ) + { + ImplControlValue aValue; + bool bNativeOK; + Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) ); + Region aNativeControlRegion, aNativeContentRegion; + if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + CTRL_STATE_ENABLED, aValue, rtl::OUString(), + aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) + { + nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + } + } + + if ( nProgressHeight < PROGRESS_HEIGHT ) + nProgressHeight = PROGRESS_HEIGHT; + + aPos.X() -= ( RSC_SP_CTRL_GROUP_Y + PROGRESS_WIDTH ); + m_aProgressBar.SetPosSizePixel( Point( aPos.X(), aPos.Y() + ((aBtnSize.Height()-nProgressHeight)/2) ), + Size( PROGRESS_WIDTH, nProgressHeight ) ); + + aFTSize.Width() = aPos.X() - 2*RSC_SP_DLG_INNERBORDER_LEFT; + aPos.X() = RSC_SP_DLG_INNERBORDER_LEFT; + aPos.Y() += ( aBtnSize.Height() - aFTSize.Height() - 1 ) / 2; + m_aProgressText.SetPosSizePixel( aPos, aFTSize ); +} + +//------------------------------------------------------------------------------ +// VCL::Dialog +short UpdateRequiredDialog::Execute() +{ + if ( m_bHasLockedEntries ) + { + // Set other text, disable update btn, remove not shared entries from list; + m_aUpdateNeeded.SetText( DialogHelper::getResourceString( RID_STR_NO_ADMIN_PRIVILEGE ) ); + m_aCloseBtn.SetText( DialogHelper::getResourceString( RID_STR_EXIT_BTN ) ); + m_aUpdateBtn.Enable( false ); + m_pExtensionBox->RemoveUnlocked(); + Resize(); + } + + return Dialog::Execute(); +} + +//------------------------------------------------------------------------------ +// VCL::Dialog +BOOL UpdateRequiredDialog::Close() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !isBusy() ) + { + if ( m_bHasLockedEntries ) + EndDialog( -1 ); + else if ( hasActiveEntries() ) + disableAllEntries(); + else + EndDialog( 0 ); + } + + return false; +} + +//------------------------------------------------------------------------------ +// Check dependencies of all packages +//------------------------------------------------------------------------------ +bool UpdateRequiredDialog::isEnabled( const uno::Reference< deployment::XPackage > &xPackage ) const +{ + bool bRegistered = false; + try { + beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ) ); + if ( option.IsPresent ) + { + ::beans::Ambiguous< sal_Bool > const & reg = option.Value; + if ( reg.IsAmbiguous ) + bRegistered = false; + else + bRegistered = reg.Value ? true : false; + } + else + bRegistered = false; + } + catch ( uno::RuntimeException & ) { throw; } + catch ( uno::Exception & exc) { + (void) exc; + OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + bRegistered = false; + } + + return bRegistered; +} + +//------------------------------------------------------------------------------ +bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment::XPackage > &xPackage ) const +{ + if ( isEnabled( xPackage ) ) + { + bool bDependenciesValid = false; + try { + bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() ); + } + catch ( deployment::DeploymentException & ) {} + if ( ! bDependenciesValid ) + { + return false; + } + } + return true; +} + +//------------------------------------------------------------------------------ +bool UpdateRequiredDialog::hasActiveEntries() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + bool bRet = false; + long nCount = m_pExtensionBox->GetEntryCount(); + for ( long nIndex = 0; nIndex < nCount; nIndex++ ) + { + TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex ); + + if ( !checkDependencies( pEntry->m_xPackage ) ) + { + bRet = true; + break; + } + } + + return bRet; +} + +//------------------------------------------------------------------------------ +void UpdateRequiredDialog::disableAllEntries() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + setBusy( true ); + + long nCount = m_pExtensionBox->GetEntryCount(); + for ( long nIndex = 0; nIndex < nCount; nIndex++ ) + { + TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex ); + enablePackage( pEntry->m_xPackageManager, pEntry->m_xPackage, false ); + } + + setBusy( false ); + + if ( ! hasActiveEntries() ) + m_aCloseBtn.SetText( m_sCloseText ); +} + +//================================================================================= +// UpdateRequiredDialogService +//================================================================================= +UpdateRequiredDialogService::UpdateRequiredDialogService( uno::Sequence< uno::Any > const&, + uno::Reference< uno::XComponentContext > const& xComponentContext ) + : m_xComponentContext( xComponentContext ) +{ +} + +//------------------------------------------------------------------------------ +// XExecutableDialog +//------------------------------------------------------------------------------ +void UpdateRequiredDialogService::setTitle( OUString const & ) throw ( uno::RuntimeException ) +{ +} + +//------------------------------------------------------------------------------ +sal_Int16 UpdateRequiredDialogService::execute() throw ( uno::RuntimeException ) +{ + ::rtl::Reference< ::dp_gui::TheExtensionManager > xManager( TheExtensionManager::get( + m_xComponentContext, + uno::Reference< awt::XWindow >(), + OUString() ) ); + xManager->createDialog( true ); + sal_Int16 nRet = xManager->execute(); + + return nRet; +} + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ SelectedPackage::~SelectedPackage() {} } //namespace dp_gui diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index bab8d52828a9..7536aa403cfe 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -46,20 +46,71 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "cppuhelper/implbase1.hxx" + +#include "com/sun/star/awt/XWindow.hpp" #include "com/sun/star/deployment/XPackage.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" #include "com/sun/star/util/XModifyListener.hpp" namespace dp_gui { //============================================================================== +class ExtBoxWithBtns_Impl; class ExtensionBox_Impl; class TheExtensionManager; //============================================================================== -class ExtMgrDialog : public ModelessDialog +class DialogHelper { - ExtensionBox_Impl *m_pExtensionBox; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + Dialog* m_pVCLWindow; + ULONG m_nEventID; + bool m_bIsBusy; + +public: + DialogHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &, + Dialog *pWindow ); + virtual ~DialogHelper(); + + void openWebBrowser( const ::rtl::OUString & sURL, const ::rtl::OUString & sTitle ) const; + Dialog* getWindow() const { return m_pVCLWindow; }; + void PostUserEvent( const Link& rLink, void* pCaller ); + void clearEventID() { m_nEventID = 0; } + + virtual void showProgress( bool bStart ) = 0; + virtual void updateProgress( const ::rtl::OUString &rText, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) = 0; + virtual void updateProgress( const long nProgress ) = 0; + + virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0; + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ) = 0; + + virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ) = 0; + virtual void checkEntries() = 0; + + static ResId getResId( USHORT nId ); + static String getResourceString( USHORT id ); + static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &); + static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &, + Window *pParent, + const USHORT nResID, + bool &bHadWarning ); + + void setBusy( const bool bBusy ) { m_bIsBusy = bBusy; } + bool isBusy() const { return m_bIsBusy; } + bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const; + bool installForAllUsers( bool &bInstallForAll ) const; +}; + +//============================================================================== +class ExtMgrDialog : public ModelessDialog, + public DialogHelper +{ + ExtBoxWithBtns_Impl *m_pExtensionBox; PushButton m_aAddBtn; PushButton m_aUpdateBtn; OKButton m_aCloseBtn; @@ -81,16 +132,12 @@ class ExtMgrDialog : public ModelessDialog bool m_bEnableWarning; bool m_bDisableWarning; bool m_bDeleteWarning; - bool m_bIsBusy; long m_nProgress; Timer m_aTimeoutTimer; TheExtensionManager *m_pManager; ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel; - bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &, - const USHORT nResID, - bool &bHadWarning ) const; bool removeExtensionWarn( const ::rtl::OUString &rExtensionTitle ) const; DECL_DLLPRIVATE_LINK( HandleAddBtn, void * ); @@ -108,9 +155,16 @@ public: virtual long Notify( NotifyEvent& rNEvt ); virtual BOOL Close(); + virtual void showProgress( bool bStart ); + virtual void updateProgress( const ::rtl::OUString &rText, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel); + virtual void updateProgress( const long nProgress ); + + virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + void setGetExtensionsURL( const ::rtl::OUString &rURL ); void selectEntry( long nPos ); - long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ); bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, @@ -120,27 +174,102 @@ public: bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - bool isBusy() { return m_bIsBusy; } + virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + virtual void checkEntries(); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); +}; + +//============================================================================== +class UpdateRequiredDialog : public ModalDialog, + public DialogHelper +{ + ExtensionBox_Impl *m_pExtensionBox; + FixedText m_aUpdateNeeded; + PushButton m_aUpdateBtn; + PushButton m_aCloseBtn; + HelpButton m_aHelpBtn; + CancelButton m_aCancelBtn; + FixedLine m_aDivider; + FixedText m_aProgressText; + ProgressBar m_aProgressBar; + const String m_sAddPackages; + const String m_sCloseText; + String m_sProgressText; + ::osl::Mutex m_aMutex; + bool m_bHasProgress; + bool m_bProgressChanged; + bool m_bStartProgress; + bool m_bStopProgress; + bool m_bUpdateWarning; + bool m_bDisableWarning; + bool m_bHasLockedEntries; + long m_nProgress; + Timer m_aTimeoutTimer; + TheExtensionManager *m_pManager; + + ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel; + + DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * ); + DECL_DLLPRIVATE_LINK( HandleCloseBtn, void * ); + DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * ); + DECL_DLLPRIVATE_LINK( TimeOutHdl, Timer* ); + DECL_DLLPRIVATE_LINK( startProgress, void * ); + DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); - void showProgress( bool bStart ); - void updateProgress( const ::rtl::OUString &rText, + bool isEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; + bool checkDependencies( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; + bool hasActiveEntries(); + void disableAllEntries(); + +public: + UpdateRequiredDialog( Window * pParent, TheExtensionManager *pManager ); + virtual ~UpdateRequiredDialog(); + + virtual short Execute(); + virtual void Resize(); + virtual BOOL Close(); +// virtual long Notify( NotifyEvent& rNEvt ); + + virtual void showProgress( bool bStart ); + virtual void updateProgress( const ::rtl::OUString &rText, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel); - void updateProgress( const long nProgress ); - void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + virtual void updateProgress( const long nProgress ); - void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); - void checkEntries(); + virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + void selectEntry( long nPos ); + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ); + bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + bool bEnable ); + bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - void openWebBrowser( ::rtl::OUString const &sURL ) const; + virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + virtual void checkEntries(); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); bool installForAllUsers( bool &bInstallForAll ) const; bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const; +}; - static ResId getResId( USHORT id ); - static String getResourceString( USHORT id ); - static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &); +//============================================================================== +class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog > +{ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParent; + ::rtl::OUString m_sInitialTitle; + +public: + UpdateRequiredDialogService( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & args, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xComponentContext ); + + // XExecutableDialog + virtual void SAL_CALL setTitle( rtl::OUString const & title ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int16 SAL_CALL execute() throw ( ::com::sun::star::uno::RuntimeException ); }; } // namespace dp_gui diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src index e82e8c762a9e..0ca9f9e74362 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.src +++ b/desktop/source/deployment/gui/dp_gui_dialog2.src @@ -97,6 +97,66 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER }; }; +ModalDialog RID_DLG_UPDATE_REQUIRED +{ + HelpId = HID_PACKAGE_MANAGER_UPD_REQ; + Text [ en-US ] = "Extension Update Required"; + + Size = MAP_APPFONT( 300, 200 ); + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + Closeable = TRUE; + Sizeable = TRUE; + Hide = TRUE; + + FixedText RID_EM_FT_MSG + { + Text [ en-US ] = "%PRODUCTNAME has been updated to a new version. Some installed %PRODUCTNAME extensions are not compatible with this version and need to be updated before they can be used."; + WordBreak = TRUE; + NoLabel = TRUE; + Size = MAP_APPFONT( 280, 3*RSC_BS_CHARHEIGHT ); + Pos = MAP_APPFONT( 5, 5 ); + }; + + FixedText RID_EM_FT_PROGRESS + { + Hide = TRUE; + Right = TRUE; + Text [ en-US ] = "Adding %EXTENSION_NAME"; + Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ); + }; + + HelpButton RID_EM_BTN_HELP + { + TabStop = TRUE; + Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; + + PushButton RID_EM_BTN_CHECK_UPDATES + { + TabStop = TRUE; + Text [ en-US ] = "Check for ~Updates..."; + Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; + + PushButton RID_EM_BTN_CLOSE + { + TabStop = TRUE; + DefButton = TRUE; + Text [ en-US ] = "Disable all"; + Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; + + CancelButton RID_EM_BTN_CANCEL + { + TabStop = TRUE; + Hide = TRUE; + Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; + +}; + Image RID_IMG_WARNING { ImageBitmap = Bitmap { File = "caution_16.png"; }; diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 5a247729082d..889fdc04c9e1 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -136,7 +136,7 @@ class ProgressCmdEnv uno::Reference< uno::XComponentContext > m_xContext; uno::Reference< task::XAbortChannel> m_xAbortChannel; - ExtMgrDialog *m_pDialog; + DialogHelper *m_pDialogHelper; OUString m_sTitle; bool m_bAborted; bool m_bWarnUser; @@ -157,16 +157,16 @@ public: */ ProgressCmdEnv( const uno::Reference< uno::XComponentContext > rContext, - ExtMgrDialog *pDialog, + DialogHelper *pDialogHelper, const OUString &rTitle ) : m_xContext( rContext ), - m_pDialog( pDialog ), + m_pDialogHelper( pDialogHelper ), m_sTitle( rTitle ), m_bAborted( false ), m_bWarnUser( false ) {} - Dialog * activeDialog() { return m_pDialog; } + Dialog * activeDialog() { return m_pDialogHelper->getWindow(); } void setTitle( const OUString& rNewTitle ) { m_sTitle = rNewTitle; } void startProgress(); @@ -197,14 +197,14 @@ public: //------------------------------------------------------------------------------ struct ExtensionCmd { - enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATE, CHECK_FOR_UPDATES }; + enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES }; E_CMD_TYPE m_eCmdType; bool m_bWarnUser; OUString m_sExtensionURL; uno::Reference< deployment::XPackageManager > m_xPackageManager; uno::Reference< deployment::XPackage > m_xPackage; - uno::Sequence< uno::Reference< deployment::XPackageManager > > m_xPackageManagers; + std::vector< TUpdateListEntry > m_vExtensionList; ExtensionCmd( const E_CMD_TYPE eCommand, const uno::Reference< deployment::XPackageManager > &rPackageManager, @@ -227,10 +227,10 @@ struct ExtensionCmd m_bWarnUser( false ), m_xPackage( rPackage ) {}; ExtensionCmd( const E_CMD_TYPE eCommand, - const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers ) + const std::vector< TUpdateListEntry > &vExtensionList ) : m_eCmdType( eCommand ), m_bWarnUser( false ), - m_xPackageManagers( rPackageManagers ) {}; + m_vExtensionList( vExtensionList ) {}; }; typedef ::boost::shared_ptr< ExtensionCmd > TExtensionCmd; @@ -239,7 +239,7 @@ typedef ::boost::shared_ptr< ExtensionCmd > TExtensionCmd; class ExtensionCmdQueue::Thread: public dp_gui::Thread { public: - Thread( ExtMgrDialog *pDialog, + Thread( DialogHelper *pDialogHelper, TheExtensionManager *pManager, const uno::Reference< uno::XComponentContext > & rContext ); @@ -250,9 +250,7 @@ public: const uno::Reference< deployment::XPackage > &rPackage ); void enableExtension( const uno::Reference< deployment::XPackage > &rPackage, const bool bEnable ); - void checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers ); - void checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ); + void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ); void stop(); bool hasTerminated(); bool isBusy(); @@ -280,16 +278,14 @@ private: const uno::Reference< deployment::XPackage > &xPackage ); void _disableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); - void _checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers, - const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage ); + void _checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ); enum Input { NONE, START, STOP }; uno::Reference< uno::XComponentContext > m_xContext; std::queue< TExtensionCmd > m_queue; - ExtMgrDialog *m_pDialog; + DialogHelper *m_pDialogHelper; TheExtensionManager *m_pManager; const OUString m_sEnablingPackages; @@ -310,13 +306,15 @@ void ProgressCmdEnv::startProgress() { m_nCurrentProgress = 0; - m_pDialog->showProgress( true ); + if ( m_pDialogHelper ) + m_pDialogHelper->showProgress( true ); } //------------------------------------------------------------------------------ void ProgressCmdEnv::stopProgress() { - m_pDialog->showProgress( false ); + if ( m_pDialogHelper ) + m_pDialogHelper->showProgress( false ); } //------------------------------------------------------------------------------ @@ -327,8 +325,11 @@ void ProgressCmdEnv::progressSection( const OUString &rText, if (! m_bAborted) { m_nCurrentProgress = 0; - m_pDialog->updateProgress( rText, xAbortChannel ); - m_pDialog->updateProgress( 5 ); + if ( m_pDialogHelper ) + { + m_pDialogHelper->updateProgress( rText, xAbortChannel ); + m_pDialogHelper->updateProgress( 5 ); + } } } @@ -338,7 +339,8 @@ void ProgressCmdEnv::updateProgress() if ( ! m_bAborted ) { long nProgress = ((m_nCurrentProgress*5) % 100) + 5; - m_pDialog->updateProgress( nProgress ); + if ( m_pDialogHelper ) + m_pDialogHelper->updateProgress( nProgress ); } } @@ -434,7 +436,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & } { vos::OGuard guard(Application::GetSolarMutex()); - short n = DependencyDialog( m_pDialog, deps ).Execute(); + short n = DependencyDialog( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, deps ).Execute(); // Distinguish between closing the dialog and programatically // canceling the dialog (headless VCL): approve = n == RET_OK @@ -445,19 +447,19 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ResId warnId(WARNINGBOX_NOSHAREDALLOWED, *DeploymentGuiResMgr::get()); - WarningBox warn( m_pDialog, warnId); + WarningBox warn( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, warnId); String msgText = warn.GetMessText(); msgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); msgText.SearchAndReplaceAllAscii("%NAME", licAgreementExc.ExtensionName); warn.SetMessText(msgText); warn.Execute(); - abort = true; + abort = true; } else if (request >>= licExc) { uno::Reference< ui::dialogs::XExecutableDialog > xDialog( deployment::ui::LicenseDialog::create( - m_xContext, VCLUnoHelper::GetInterface( m_pDialog ), licExc.Text ) ); + m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ), licExc.Text ) ); sal_Int16 res = xDialog->execute(); if ( res == ui::dialogs::ExecutableDialogResults::CANCEL ) abort = true; @@ -488,7 +490,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & verExc.Deployed->getDisplayName()); { vos::OGuard guard(Application::GetSolarMutex()); - WarningBox box( m_pDialog, ResId(id, *DeploymentGuiResMgr::get())); + WarningBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get())); String s; if (bEqualNames) { @@ -526,9 +528,14 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & } else { - vos::OGuard guard(Application::GetSolarMutex()); + if ( m_pDialogHelper ) + { + vos::OGuard guard(Application::GetSolarMutex()); - approve = m_pDialog->installExtensionWarn( instExc.New->getDisplayName() ); + approve = m_pDialogHelper->installExtensionWarn( instExc.New->getDisplayName() ); + } + else + approve = false; abort = !approve; } } @@ -537,7 +544,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & vos::OGuard guard( Application::GetSolarMutex() ); String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get() ) ); sMsg.SearchAndReplaceAllAscii( "%Name", platExc.package->getDisplayName() ); - ErrorBox box( m_pDialog, WB_OK, sMsg ); + ErrorBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, sMsg ); box.Execute(); approve = true; } @@ -609,7 +616,7 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus ) text = ::comphelper::anyToString( rStatus ); // fallback const ::vos::OGuard aGuard( Application::GetSolarMutex() ); - const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialog, WB_OK, text ) ); + const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, text ) ); aBox->Execute(); } ++m_nCurrentProgress; @@ -631,23 +638,23 @@ void ProgressCmdEnv::pop() } //------------------------------------------------------------------------------ -ExtensionCmdQueue::Thread::Thread( ExtMgrDialog *pDialog, +ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper, TheExtensionManager *pManager, const uno::Reference< uno::XComponentContext > & rContext ) : m_xContext( rContext ), - m_pDialog( pDialog ), + m_pDialogHelper( pDialogHelper ), m_pManager( pManager ), - m_sEnablingPackages( ExtMgrDialog::getResourceString( RID_STR_ENABLING_PACKAGES ) ), - m_sDisablingPackages( ExtMgrDialog::getResourceString( RID_STR_DISABLING_PACKAGES ) ), - m_sAddingPackages( ExtMgrDialog::getResourceString( RID_STR_ADDING_PACKAGES ) ), - m_sRemovingPackages( ExtMgrDialog::getResourceString( RID_STR_REMOVING_PACKAGES ) ), - m_sDefaultCmd( ExtMgrDialog::getResourceString( RID_STR_ADD_PACKAGES ) ), + m_sEnablingPackages( DialogHelper::getResourceString( RID_STR_ENABLING_PACKAGES ) ), + m_sDisablingPackages( DialogHelper::getResourceString( RID_STR_DISABLING_PACKAGES ) ), + m_sAddingPackages( DialogHelper::getResourceString( RID_STR_ADDING_PACKAGES ) ), + m_sRemovingPackages( DialogHelper::getResourceString( RID_STR_REMOVING_PACKAGES ) ), + m_sDefaultCmd( DialogHelper::getResourceString( RID_STR_ADD_PACKAGES ) ), m_eInput( NONE ), m_bTerminated( false ), m_bStopped( false ), m_bWorking( false ) { - OSL_ASSERT( pDialog ); + OSL_ASSERT( pDialogHelper ); } //------------------------------------------------------------------------------ @@ -713,41 +720,21 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers ) +void ExtensionCmdQueue::Thread::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ) { ::osl::MutexGuard aGuard( m_mutex ); - //If someone called stop then we do not remove the extension -> game over! + //If someone called stop then we do not update the extension -> game over! if ( m_bStopped ) return; - TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATES, rPackageManagers ) ); + TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATES, vExtensionList ) ); m_queue.push( pEntry ); m_eInput = START; m_wakeup.set(); } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ) -{ - ::osl::MutexGuard aGuard( m_mutex ); - - //If someone called stop then we do not remove the extension -> game over! - if ( m_bStopped ) - return; - - if ( rPackageManager.is() && rPackage.is() ) - { - TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATE, rPackageManager, rPackage ) ); - - m_queue.push( pEntry ); - m_eInput = START; - m_wakeup.set(); - } -} - -//------------------------------------------------------------------------------ //Stopping this thread will not abort the installation of extensions. void ExtensionCmdQueue::Thread::stop() { @@ -779,7 +766,7 @@ void ExtensionCmdQueue::Thread::execute() { #ifdef WNT //Needed for use of the service "com.sun.star.system.SystemShellExecute" in - //ExtMgrDialog::openWebBrowser + //DialogHelper::openWebBrowser CoUninitialize(); HRESULT r = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); #endif @@ -813,7 +800,7 @@ void ExtensionCmdQueue::Thread::execute() if ( eInput == STOP ) break; - ::rtl::Reference< ProgressCmdEnv > currentCmdEnv( new ProgressCmdEnv( m_xContext, m_pDialog, m_sDefaultCmd ) ); + ::rtl::Reference< ProgressCmdEnv > currentCmdEnv( new ProgressCmdEnv( m_xContext, m_pDialogHelper, m_sDefaultCmd ) ); // Do not lock the following part with addExtension. addExtension may be called in the main thread. // If the message box "Do you want to install the extension (or similar)" is shown and then @@ -836,8 +823,7 @@ void ExtensionCmdQueue::Thread::execute() m_queue.pop(); } - if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATE ) && - ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) ) + if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) ) { currentCmdEnv->startProgress(); bStartProgress = false; @@ -856,9 +842,8 @@ void ExtensionCmdQueue::Thread::execute() case ExtensionCmd::DISABLE : _disableExtension( currentCmdEnv, pEntry->m_xPackage ); break; - case ExtensionCmd::CHECK_FOR_UPDATE : case ExtensionCmd::CHECK_FOR_UPDATES : - _checkForUpdates( pEntry->m_xPackageManagers, pEntry->m_xPackageManager, pEntry->m_xPackage ); + _checkForUpdates( pEntry->m_vExtensionList ); break; } } @@ -908,7 +893,8 @@ void ExtensionCmdQueue::Thread::execute() const ::vos::OGuard guard( Application::GetSolarMutex() ); ::std::auto_ptr<ErrorBox> box( new ErrorBox( currentCmdEnv->activeDialog(), WB_OK, msg ) ); - box->SetText( m_pDialog->GetText() ); + if ( m_pDialogHelper ) + box->SetText( m_pDialogHelper->getWindow()->GetText() ); box->Execute(); //Continue with installation of the remaining extensions } @@ -1009,21 +995,14 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers, - const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage ) +void ExtensionCmdQueue::Thread::_checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ) { UpdateDialog* pUpdateDialog; std::vector< UpdateData > vData; const ::vos::OGuard guard( Application::GetSolarMutex() ); - if ( xPackageManager.is() && xPackage.is() ) - pUpdateDialog = new UpdateDialog( m_xContext, m_pDialog, new SelectedPackage( xPackage, xPackageManager ), - uno::Sequence< uno::Reference< deployment::XPackageManager > >(), &vData ); - else - pUpdateDialog = new UpdateDialog( m_xContext, m_pDialog, rtl::Reference< SelectedPackage >(), - rPackageManagers, &vData ); + pUpdateDialog = new UpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, vExtensionList, &vData ); pUpdateDialog->notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon @@ -1046,7 +1025,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Refe short nDialogResult = RET_OK; if ( !dataDownload.empty() ) { - nDialogResult = UpdateInstallDialog( m_pDialog, dataDownload, m_xContext ).Execute(); + nDialogResult = UpdateInstallDialog( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, dataDownload, m_xContext ).Execute(); pUpdateDialog->notifyMenubar( false, true ); // Check, if there are still pending updates to be notified via menu bar icon } else @@ -1057,8 +1036,8 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Refe { for ( cit i = vData.begin(); i < vData.end(); i++ ) { - if ( i->sWebsiteURL.getLength() > 0 ) - m_pDialog->openWebBrowser( i->sWebsiteURL ); + if ( m_pDialogHelper && ( i->sWebsiteURL.getLength() > 0 ) ) + m_pDialogHelper->openWebBrowser( i->sWebsiteURL, m_pDialogHelper->getWindow()->GetText() ); } } } @@ -1082,7 +1061,8 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE try { xPackage->registerPackage( xAbortChannel, rCmdEnv.get() ); - m_pDialog->updatePackageInfo( xPackage ); + if ( m_pDialogHelper ) + m_pDialogHelper->updatePackageInfo( xPackage ); } catch ( ::ucb::CommandAbortedException & ) {} @@ -1102,7 +1082,8 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd try { xPackage->revokePackage( xAbortChannel, rCmdEnv.get() ); - m_pDialog->updatePackageInfo( xPackage ); + if ( m_pDialogHelper ) + m_pDialogHelper->updatePackageInfo( xPackage ); } catch ( ::ucb::CommandAbortedException & ) {} @@ -1139,10 +1120,10 @@ OUString ExtensionCmdQueue::Thread::searchAndReplaceAll( const OUString &rSource //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -ExtensionCmdQueue::ExtensionCmdQueue( ExtMgrDialog * pDialog, +ExtensionCmdQueue::ExtensionCmdQueue( DialogHelper * pDialogHelper, TheExtensionManager *pManager, const uno::Reference< uno::XComponentContext > &rContext ) - : m_thread( new Thread( pDialog, pManager, rContext ) ) + : m_thread( new Thread( pDialogHelper, pManager, rContext ) ) { m_thread->launch(); } @@ -1170,15 +1151,9 @@ void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPack m_thread->enableExtension( rPackage, bEnable ); } -void ExtensionCmdQueue::checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers ) -{ - m_thread->checkForUpdates( rPackageManagers ); -} - -void ExtensionCmdQueue::checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ) +void ExtensionCmdQueue::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ) { - m_thread->checkForUpdate( rPackageManager, rPackage ); + m_thread->checkForUpdates( vExtensionList ); } void ExtensionCmdQueue::stop() diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx index 06ecefd7749b..2d24f00e3c8e 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -32,19 +32,14 @@ #ifndef INCLUDED_DP_GUI_EXTENSIONCMDQUEUE_HXX #define INCLUDED_DP_GUI_EXTENSIONCMDQUEUE_HXX -#ifndef _SAL_CONFIG_H_ #include "sal/config.h" -#endif -#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ #include "com/sun/star/uno/Reference.hxx" -#endif -#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ -#include "com/sun/star/uno/Sequence.hxx" -#endif -#ifndef _RTL_REF_HXX_ #include "rtl/ref.hxx" -#endif + +#include <vector> + +#include "dp_gui_updatedata.hxx" /// @HTML @@ -56,7 +51,7 @@ namespace com { namespace sun { namespace star { namespace dp_gui { -class ExtMgrDialog; +class DialogHelper; class TheExtensionManager; /** @@ -79,7 +74,7 @@ public: /** Create an instance. */ - ExtensionCmdQueue( ExtMgrDialog * pDialog, + ExtensionCmdQueue( DialogHelper * pDialogHelper, TheExtensionManager *pManager, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext); @@ -94,9 +89,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); void enableExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage, const bool bEnable ); - void checkForUpdates( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > > &rPackageManagers ); - void checkForUpdate( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); + void checkForUpdates( const std::vector< TUpdateListEntry > &vList ); /** This call does not block. It signals the internal thread that it should install the remaining extensions and then terminate. diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx new file mode 100644 index 000000000000..f4473c2c6fd8 --- /dev/null +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -0,0 +1,1175 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_desktop.hxx"
+
+#include "svtools/controldims.hrc"
+
+#include "dp_gui.h"
+#include "dp_gui_extlistbox.hxx"
+#include "dp_gui_theextmgr.hxx"
+#include "dp_gui_dialog2.hxx"
+#include "dp_dependencies.hxx"
+
+#include "comphelper/processfactory.hxx"
+#include "com/sun/star/i18n/CollatorOptions.hpp"
+#include "com/sun/star/deployment/DependencyException.hpp"
+#include "com/sun/star/deployment/DeploymentException.hpp"
+
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+using namespace ::com::sun::star;
+
+namespace dp_gui {
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager,
+ PackageState eState ) :
+ m_bActive( false ),
+ m_bLocked( false ),
+ m_bHasOptions( false ),
+ m_bShared( false ),
+ m_bNew( false ),
+ m_bChecked( false ),
+ m_bMissingDeps( false ),
+ m_eState( eState ),
+ m_pPublisher( NULL ),
+ m_xPackage( xPackage ),
+ m_xPackageManager( xPackageManager )
+{
+ m_sTitle = xPackage->getDisplayName();
+ m_sVersion = xPackage->getVersion();
+ m_sDescription = xPackage->getDescription();
+
+ beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
+ m_sPublisher = aInfo.First;
+ m_sPublisherURL = aInfo.Second;
+
+ // get the icons for the package if there are any
+ uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
+ if ( xGraphic.is() )
+ m_aIcon = Image( xGraphic );
+
+ xGraphic = xPackage->getIcon( true );
+ if ( xGraphic.is() )
+ m_aIconHC = Image( xGraphic );
+ else
+ m_aIconHC = m_aIcon;
+
+ m_bLocked = m_xPackageManager->isReadOnly();
+
+ if ( eState == AMBIGUOUS )
+ m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else if ( eState == NOT_REGISTERED )
+ checkDependencies();
+}
+
+//------------------------------------------------------------------------------
+Entry_Impl::~Entry_Impl()
+{}
+
+//------------------------------------------------------------------------------
+StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
+{
+ StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ if ( m_xPackageManager != pEntry->m_xPackageManager )
+ {
+ sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
+ if ( nCompare < 0 )
+ eCompare = COMPARE_LESS;
+ else if ( nCompare > 0 )
+ eCompare = COMPARE_GREATER;
+ }
+ }
+ }
+ return eCompare;
+}
+
+//------------------------------------------------------------------------------
+void Entry_Impl::checkDependencies()
+{
+ try {
+ m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException &e )
+ {
+ deployment::DependencyException depExc;
+ if ( e.Cause >>= depExc )
+ {
+ rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
+ for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
+ {
+ aMissingDep += OUSTR("\n");
+ aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
+ }
+ aMissingDep += OUSTR("\n");
+ m_sErrorText = aMissingDep;
+ m_bMissingDeps = true;
+ }
+ }
+}
+//------------------------------------------------------------------------------
+// ExtensionRemovedListener
+//------------------------------------------------------------------------------
+void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt )
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
+
+ if ( xPackage.is() )
+ {
+ m_pParent->removeEntry( xPackage );
+ }
+}
+
+//------------------------------------------------------------------------------
+ExtensionRemovedListener::~ExtensionRemovedListener()
+{
+}
+
+//------------------------------------------------------------------------------
+// ExtensionBox_Impl
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) :
+ IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
+ m_bHasScrollBar( false ),
+ m_bHasActive( false ),
+ m_bNeedsRecalc( true ),
+ m_bHasNew( false ),
+ m_bInCheckMode( false ),
+ m_bAdjustActive( false ),
+ m_bInDelete( false ),
+ m_nActive( 0 ),
+ m_nTopIndex( 0 ),
+ m_nActiveHeight( 0 ),
+ m_nExtraHeight( 2 ),
+ m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ),
+ m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ),
+ m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ),
+ m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ),
+ m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ),
+ m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ),
+ m_pScrollBar( NULL ),
+ m_pManager( pManager )
+{
+ SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
+
+ m_pScrollBar = new ScrollBar( this, WB_VERT );
+ m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
+ m_pScrollBar->EnableDrag();
+
+ SetPaintTransparent( true );
+ SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ m_nStdHeight = nTitleHeight;
+ else
+ m_nStdHeight = nIconHeight;
+ m_nStdHeight += GetTextHeight() + TOP_OFFSET;
+
+ nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
+ if ( m_nStdHeight < nIconHeight )
+ m_nStdHeight = nIconHeight;
+
+ m_nActiveHeight = m_nStdHeight;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ m_xRemoveListener = new ExtensionRemovedListener( this );
+
+ m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
+ m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
+ m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
+
+ Show();
+}
+
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::~ExtensionBox_Impl()
+{
+ if ( ! m_bInDelete )
+ DeleteRemoved();
+
+ m_bInDelete = true;
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+ }
+
+ m_vEntries.clear();
+
+ delete m_pScrollBar;
+
+ m_xRemoveListener.clear();
+
+ delete m_pLocale;
+ delete m_pCollator;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getItemCount() const
+{
+ return static_cast< sal_Int32 >( m_vEntries.size() );
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getSelIndex() const
+{
+ if ( m_bHasActive )
+ {
+ OSL_ASSERT( m_nActive >= -1);
+ return static_cast< sal_Int32 >( m_nActive );
+ }
+ else
+ return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
+{
+ if ( nIndex < 0 )
+ throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
+ if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
+ throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
+ "The position exceeds the number of available list entries"),0, 0 );
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sTitle;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sVersion;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sDescription;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisher;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisherURL;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( sal_Int32 nIndex )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ selectEntry( nIndex );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( const rtl::OUString & sName )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ typedef ::std::vector< TEntry_Impl >::const_iterator It;
+
+ for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
+ {
+ if ( sName.equals( (*iIter)->m_sTitle ) )
+ {
+ long nPos = iIter - m_vEntries.begin();
+ selectEntry( nPos );
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+// Title + description
+void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ // get title height
+ long aTextHeight;
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // calc description height
+ Size aSize = GetOutputSizePixel();
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ aSize.Width() -= ICON_OFFSET;
+ aSize.Height() = 10000;
+
+ rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
+ aText += m_vEntries[ nPos ]->m_sDescription;
+
+ Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
+ TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ aTextHeight += aRect.GetHeight();
+
+ if ( aTextHeight < m_nStdHeight )
+ aTextHeight = m_nStdHeight;
+
+ m_nActiveHeight = aTextHeight + m_nExtraHeight;
+}
+
+//------------------------------------------------------------------------------
+const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
+{
+ return Size( 200, 80 );
+}
+
+//------------------------------------------------------------------------------
+Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ if ( m_vEntries[ nPos ]->m_bActive )
+ aSize.Height() = m_nActiveHeight;
+ else
+ aSize.Height() = m_nStdHeight;
+
+ Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
+ if ( m_bHasActive && ( nPos < m_nActive ) )
+ aPos.Y() += m_nActiveHeight - m_nStdHeight;
+
+ return Rectangle( aPos, aSize );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::DeleteRemoved()
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ m_bInDelete = true;
+
+ if ( ! m_vRemovedEntries.empty() )
+ {
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ }
+
+ m_vRemovedEntries.clear();
+ }
+
+ m_bInDelete = false;
+}
+
+//------------------------------------------------------------------------------
+//This function may be called with nPos < 0
+void ExtensionBox_Impl::selectEntry( const long nPos )
+{
+ //ToDo whe should not use the guard at such a big scope here.
+ //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
+ //modified in this function.
+ //It would be probably best to always use a copy of m_vEntries
+ //and some other state variables from ExtensionBox_Impl for
+ //the whole painting operation. See issue i86993
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+
+ if ( m_bInCheckMode )
+ return;
+
+ if ( m_bHasActive )
+ {
+ if ( nPos == m_nActive )
+ return;
+
+ m_bHasActive = false;
+ m_vEntries[ m_nActive ]->m_bActive = false;
+ }
+
+ if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
+ {
+ m_bHasActive = true;
+ m_nActive = nPos;
+ m_vEntries[ nPos ]->m_bActive = true;
+
+ if ( IsReallyVisible() )
+ {
+ m_bNeedsRecalc = true;
+ m_bAdjustActive = true;
+ }
+ }
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ guard.clear();
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( pEntry->m_bActive )
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
+ SetTextColor( rStyleSettings.GetDisableColor() );
+ else if ( IsControlForeground() )
+ SetTextColor( GetControlForeground() );
+ else
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+
+ if ( pEntry->m_bActive )
+ {
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( rRect );
+ }
+ else
+ {
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ SetTextFillColor();
+ Erase( rRect );
+ }
+
+ // Draw extension icon
+ Point aPos( rRect.TopLeft() );
+ aPos += Point( TOP_OFFSET, TOP_OFFSET );
+ Image aImage;
+ if ( ! pEntry->m_aIcon )
+ aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
+ else
+ aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
+ Size aImageSize = aImage.GetSizePixel();
+ if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
+ DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
+ else
+ DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
+
+ // Setup fonts
+ Font aStdFont( GetFont() );
+ Font aBoldFont( aStdFont );
+ aBoldFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aBoldFont );
+ long aTextHeight = GetTextHeight();
+
+ // Init publisher link here
+ if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
+ {
+ pEntry->m_pPublisher = new svt::FixedHyperlink( this );
+ pEntry->m_pPublisher->SetBackground();
+ pEntry->m_pPublisher->SetPaintTransparent( true );
+ pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
+ pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
+ Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
+ pEntry->m_pPublisher->SetSizePixel( aSize );
+
+ if ( m_aClickHdl.IsSet() )
+ pEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
+ }
+
+ // Get max title width
+ long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
+ nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
+ if ( pEntry->m_pPublisher )
+ {
+ nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
+ }
+
+ long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
+ long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
+
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
+
+ if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
+ {
+ aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
+ String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
+ DrawText( aPos, aShortTitle );
+ aTitleWidth += (aTextHeight / 3);
+ }
+ else
+ DrawText( aPos, pEntry->m_sTitle );
+
+ SetFont( aStdFont );
+ DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
+
+ long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // draw description
+ String sDescription;
+ if ( pEntry->m_sErrorText.Len() )
+ {
+ if ( pEntry->m_bActive )
+ sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
+ else
+ sDescription = pEntry->m_sErrorText;
+ }
+ else
+ sDescription = pEntry->m_sDescription;
+
+ aPos.Y() += aTextHeight;
+ if ( pEntry->m_bActive )
+ {
+ DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
+ sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ }
+ else
+ {
+ const long nWidth = GetTextWidth( sDescription );
+ if ( nWidth > rRect.GetWidth() - aPos.X() )
+ sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
+ DrawText( aPos, sDescription );
+ }
+
+ // Draw publisher link
+ if ( pEntry->m_pPublisher )
+ {
+ pEntry->m_pPublisher->Show();
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
+ pEntry->m_pPublisher->SetPosPixel( aPos );
+ }
+
+ // Draw status icons
+ if ( pEntry->m_bShared )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
+ }
+ if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
+ }
+
+ SetLineColor( Color( COL_LIGHTGRAY ) );
+ DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::RecalcAll()
+{
+ if ( m_bHasActive )
+ CalcActiveHeight( m_nActive );
+
+ SetupScrollBar();
+
+ if ( m_bHasActive )
+ {
+ Rectangle aEntryRect = GetEntryRect( m_nActive );
+
+ if ( m_bAdjustActive )
+ {
+ m_bAdjustActive = false;
+
+ // If the top of the selected entry isn't visible, make it visible
+ if ( aEntryRect.Top() < 0 )
+ {
+ m_nTopIndex += aEntryRect.Top();
+ aEntryRect.Move( 0, -aEntryRect.Top() );
+ }
+
+ // If the bottom of the selected entry isn't visible, make it visible even if now the top
+ // isn't visible any longer ( the buttons are more important )
+ Size aOutputSize = GetOutputSizePixel();
+ if ( aEntryRect.Bottom() > aOutputSize.Height() )
+ {
+ m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
+ aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
+ }
+
+ // If there is unused space below the last entry but all entries don't fit into the box,
+ // move the content down to use the whole space
+ const long nTotalHeight = GetTotalHeight();
+ if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
+ {
+ long nOffset = m_nTopIndex;
+ m_nTopIndex = nTotalHeight - aOutputSize.Height();
+ nOffset -= m_nTopIndex;
+ aEntryRect.Move( 0, nOffset );
+ }
+
+ if ( m_bHasScrollBar )
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+ }
+ }
+
+ m_bNeedsRecalc = false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleTabKey( bool )
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
+{
+ if ( m_vEntries.empty() )
+ return true;
+
+ long nSelect = 0;
+
+ if ( m_bHasActive )
+ {
+ long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
+ if ( nPageSize < 2 )
+ nPageSize = 2;
+
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
+ nSelect = m_nActive + 1;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
+ nSelect = m_nActive - 1;
+ else if ( nKeyCode == KEY_HOME )
+ nSelect = 0;
+ else if ( nKeyCode == KEY_END )
+ nSelect = m_vEntries.size() - 1;
+ else if ( nKeyCode == KEY_PAGEUP )
+ nSelect = m_nActive - nPageSize + 1;
+ else if ( nKeyCode == KEY_PAGEDOWN )
+ nSelect = m_nActive + nPageSize - 1;
+ }
+ else // when there is no selected entry, we will select the first or the last.
+ {
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
+ nSelect = 0;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
+ nSelect = m_vEntries.size() - 1;
+ }
+
+ if ( nSelect < 0 )
+ nSelect = 0;
+ if ( nSelect >= (long) m_vEntries.size() )
+ nSelect = m_vEntries.size() - 1;
+
+ selectEntry( nSelect );
+
+ return true;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ if ( m_bNeedsRecalc )
+ RecalcAll();
+
+ Point aStart( 0, -m_nTopIndex );
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
+ Rectangle aEntryRect( aStart, aSize );
+ DrawRow( aEntryRect, *iIndex );
+ aStart.Y() += aSize.Height();
+ }
+}
+
+// -----------------------------------------------------------------------
+long ExtensionBox_Impl::GetTotalHeight() const
+{
+ long nHeight = m_vEntries.size() * m_nStdHeight;
+
+ if ( m_bHasActive )
+ {
+ nHeight += m_nActiveHeight - m_nStdHeight;
+ }
+
+ return nHeight;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::SetupScrollBar()
+{
+ const Size aSize = GetOutputSizePixel();
+ const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ const long nTotalHeight = GetTotalHeight();
+ const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
+
+ if ( bNeedsScrollBar )
+ {
+ if ( m_nTopIndex + aSize.Height() > nTotalHeight )
+ m_nTopIndex = nTotalHeight - aSize.Height();
+
+ m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
+ Size( nScrBarSize, aSize.Height() ) );
+ m_pScrollBar->SetRangeMax( nTotalHeight );
+ m_pScrollBar->SetVisibleSize( aSize.Height() );
+ m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
+ m_pScrollBar->SetLineSize( m_nStdHeight );
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+
+ if ( !m_bHasScrollBar )
+ m_pScrollBar->Show();
+ }
+ else if ( m_bHasScrollBar )
+ {
+ m_pScrollBar->Hide();
+ m_nTopIndex = 0;
+ }
+
+ m_bHasScrollBar = bNeedsScrollBar;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Resize()
+{
+ RecalcAll();
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::PointToPos( const Point& rPos )
+{
+ long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight;
+
+ if ( m_bHasActive && ( nPos > m_nActive ) )
+ {
+ if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
+ nPos = m_nActive;
+ else
+ nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
+ }
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ long nPos = PointToPos( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.IsMod1() && m_bHasActive )
+ selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
+ else
+ selectEntry( nPos );
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ bool bHandled = false;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( nKeyCode == KEY_TAB )
+ bHandled = HandleTabKey( aKeyCode.IsShift() );
+ else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
+ bHandled = HandleCursorKey( nKeyCode );
+ }
+
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ if ( m_bHasScrollBar &&
+ ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ long nThumbPos = m_pScrollBar->GetThumbPos();
+ if ( pData->GetDelta() < 0 )
+ m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
+ else
+ m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
+ bHandled = true;
+ }
+ }
+ }
+
+ if ( !bHandled )
+ return Control::Notify( rNEvt );
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
+ const long nEnd, long &nPos )
+{
+ nPos = nStart;
+ if ( nStart > nEnd )
+ return false;
+
+ StringCompare eCompare;
+
+ if ( nStart == nEnd )
+ {
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
+ if ( eCompare == COMPARE_LESS )
+ return false;
+ else if ( eCompare == COMPARE_EQUAL )
+ {
+ //Workaround. See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nStart ]->m_bChecked = true;
+ return true;
+ }
+ else
+ {
+ nPos = nStart + 1;
+ return false;
+ }
+ }
+
+ const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
+
+ if ( eCompare == COMPARE_LESS )
+ return FindEntryPos( pEntry, nStart, nMid-1, nPos );
+ else if ( eCompare == COMPARE_GREATER )
+ return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
+ else
+ {
+ //Workaround.See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nMid ]->m_bChecked = true;
+ nPos = nMid;
+ return true;
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ long nPos = 0;
+ PackageState eState = m_pManager->getPackageState( xPackage );
+
+ TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
+ xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ if ( m_vEntries.empty() )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.push_back( pEntry );
+ }
+ else
+ {
+ if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
+ }
+ else if ( !m_bInCheckMode )
+ {
+ OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
+ }
+ }
+ //access to m_nActive must be guarded
+ if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
+ m_nActive += 1;
+
+ guard.clear();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ m_bNeedsRecalc = true;
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ PackageState eState = m_pManager->getPackageState( xPackage );
+ (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ (*iIndex)->m_eState = eState;
+ (*iIndex)->m_sTitle = xPackage->getDisplayName();
+ (*iIndex)->m_sVersion = xPackage->getVersion();
+ (*iIndex)->m_sDescription = xPackage->getDescription();
+
+ if ( eState == AMBIGUOUS )
+ (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else
+ (*iIndex)->m_sErrorText = String();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ if ( ! m_bInDelete )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ long nPos = iIndex - m_vEntries.begin();
+
+ // Entries mustn't removed here, because they contain a hyperlink control
+ // which can only be deleted when the thread has the solar mutex. Therefor
+ // the entry will be moved into the m_vRemovedEntries list which will be
+ // cleared on the next paint event
+ m_vRemovedEntries.push_back( *iIndex );
+ m_vEntries.erase( iIndex );
+
+ m_bNeedsRecalc = true;
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ if ( m_bHasActive )
+ {
+ if ( nPos < m_nActive )
+ m_nActive -= 1;
+ else if ( ( nPos == m_nActive ) &&
+ ( nPos == (long) m_vEntries.size() ) )
+ m_nActive -= 1;
+
+ m_bHasActive = false;
+ //clear before calling out of this method
+ aGuard.clear();
+ selectEntry( m_nActive );
+ }
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::RemoveUnlocked()
+{
+ bool bAllRemoved = false;
+
+ while ( ! bAllRemoved )
+ {
+ bAllRemoved = true;
+
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( !(*iIndex)->m_bLocked )
+ {
+ bAllRemoved = false;
+ uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage;
+ aGuard.clear();
+ removeEntry( xPackage );
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+{
+ m_bInCheckMode = true;
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackageManager == xPackageMgr )
+ (*iIndex)->m_bChecked = false;
+ else
+ (*iIndex)->m_bChecked = true;
+ (*iIndex)->m_bNew = false;
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkEntries()
+{
+ long nNewPos = -1;
+ long nPos = 0;
+ bool bNeedsUpdate = false;
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ ITER iIndex = m_vEntries.begin();
+ while ( iIndex < m_vEntries.end() )
+ {
+ if ( (*iIndex)->m_bChecked == false )
+ {
+ bNeedsUpdate = true;
+ nPos = iIndex-m_vEntries.begin();
+ if ( (*iIndex)->m_bNew )
+ {
+ if ( nNewPos == - 1)
+ nNewPos = nPos;
+ if ( nPos <= m_nActive )
+ m_nActive += 1;
+ }
+ }
+ iIndex++;
+ }
+ guard.clear();
+
+ m_bInCheckMode = false;
+
+ if ( nNewPos != - 1)
+ selectEntry( nNewPos );
+
+ if ( bNeedsUpdate )
+ {
+ m_bNeedsRecalc = true;
+ if ( IsReallyVisible() )
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::isHCMode()
+{
+ return (bool)GetDisplayBackground().GetColor().IsDark();
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::SetScrollHdl( const Link& rLink )
+{
+ if ( m_pScrollBar )
+ m_pScrollBar->SetScrollHdl( rLink );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DoScroll( long nDelta )
+{
+ m_nTopIndex += nDelta;
+ Point aNewSBPt( m_pScrollBar->GetPosPixel() );
+
+ Rectangle aScrRect( Point(), GetOutputSizePixel() );
+ aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width();
+ Scroll( 0, -nDelta, aScrRect );
+
+ m_pScrollBar->SetPosPixel( aNewSBPt );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
+{
+ DoScroll( pScrBar->GetDelta() );
+
+ return 1;
+}
+
+} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx new file mode 100644 index 000000000000..e1a17bb06dc9 --- /dev/null +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -0,0 +1,271 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_gui_dialog2.cxx,v $
+ *
+ * $Revision: 1.8.4.8 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "rtl/ustring.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/dialog.hxx"
+
+#include "svtools/extensionlistbox.hxx"
+#include "svtools/fixedhyper.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "unotools/collatorwrapper.hxx"
+
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+
+#include <boost/shared_ptr.hpp>
+
+namespace dp_gui {
+
+#define SMALL_ICON_SIZE 16
+#define TOP_OFFSET 3
+#define ICON_HEIGHT 42
+#define ICON_OFFSET 50
+#define RIGHT_ICON_OFFSET 5
+#define SPACE_BETWEEN 3
+
+class TheExtensionManager;
+
+typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink;
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+struct Entry_Impl;
+
+typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
+
+struct Entry_Impl
+{
+ bool m_bActive;
+ bool m_bLocked;
+ bool m_bHasOptions;
+ bool m_bShared;
+ bool m_bNew;
+ bool m_bChecked;
+ bool m_bMissingDeps;
+ PackageState m_eState;
+ String m_sTitle;
+ String m_sVersion;
+ String m_sDescription;
+ String m_sPublisher;
+ String m_sPublisherURL;
+ String m_sErrorText;
+ Image m_aIcon;
+ Image m_aIconHC;
+ svt::FixedHyperlink *m_pPublisher;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
+
+ Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ PackageState eState );
+ ~Entry_Impl();
+
+ StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
+ void checkDependencies();
+};
+
+//------------------------------------------------------------------------------
+// class ExtensionBox_Impl
+//------------------------------------------------------------------------------
+
+class ExtensionBox_Impl;
+
+//------------------------------------------------------------------------------
+class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+ ExtensionBox_Impl *m_pParent;
+
+public:
+
+ ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; }
+ ~ExtensionRemovedListener();
+
+ //===================================================================================
+ // XEventListener
+ virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+//------------------------------------------------------------------------------
+class ExtensionBox_Impl : public ::svt::IExtensionListBox
+{
+ bool m_bHasScrollBar;
+ bool m_bHasActive;
+ bool m_bNeedsRecalc;
+ bool m_bHasNew;
+ bool m_bInCheckMode;
+ bool m_bAdjustActive;
+ bool m_bInDelete;
+ //Must be guarded together with m_vEntries to ensure a valid index at all times.
+ //Use m_entriesMutex as guard.
+ long m_nActive;
+ long m_nTopIndex;
+ long m_nStdHeight;
+ long m_nActiveHeight;
+ long m_nExtraHeight;
+ Size m_aOutputSize;
+ Image m_aLockedImage;
+ Image m_aLockedImageHC;
+ Image m_aWarningImage;
+ Image m_aWarningImageHC;
+ Image m_aDefaultImage;
+ Image m_aDefaultImageHC;
+ Link m_aClickHdl;
+
+ ScrollBar *m_pScrollBar;
+
+ com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
+
+ TheExtensionManager *m_pManager;
+ //This mutex is used for synchronizing access to m_vEntries.
+ //Currently it is used to synchronize adding, removing entries and
+ //functions like getItemName, getItemDescription, etc. to prevent
+ //that m_vEntries is accessed at an invalid index.
+ //ToDo: There are many more places where m_vEntries is read and which may
+ //fail. For example the Paint method is probable called from the main thread
+ //while new entries are added / removed in a separate thread.
+ mutable ::osl::Mutex m_entriesMutex;
+ std::vector< TEntry_Impl > m_vEntries;
+ std::vector< TEntry_Impl > m_vRemovedEntries;
+
+ ::com::sun::star::lang::Locale *m_pLocale;
+ CollatorWrapper *m_pCollator;
+
+ void CalcActiveHeight( const long nPos );
+ long GetTotalHeight() const;
+ void SetupScrollBar();
+ void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
+ bool HandleTabKey( bool bReverse );
+ bool HandleCursorKey( USHORT nKeyCode );
+ bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
+ bool isHCMode();
+ void DeleteRemoved();
+
+ //-----------------
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
+
+ //Index starts with 1.
+ //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
+ void checkIndex(sal_Int32 pos) const;
+
+
+public:
+ ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager );
+ ~ExtensionBox_Impl();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle &rPaintRect );
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ const Size GetMinOutputSizePixel() const;
+ void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
+ TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
+ long GetEntryCount() { return (long) m_vEntries.size(); }
+ Rectangle GetEntryRect( const long nPos ) const;
+ bool HasActive() { return m_bHasActive; }
+ long PointToPos( const Point& rPos );
+ void SetScrollHdl( const Link& rLink );
+ void DoScroll( long nDelta );
+ void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; }
+ virtual void RecalcAll();
+ void RemoveUnlocked();
+
+ //-----------------
+ virtual void selectEntry( const long nPos );
+ long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+
+ void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
+ void checkEntries();
+
+ TheExtensionManager* getExtensionManager() const { return m_pManager; }
+
+ //===================================================================================
+ //These functions are used for automatic testing
+
+ /** @return The count of the entries in the list box. */
+ virtual sal_Int32 getItemCount() const;
+
+ /** @return The index of the first selected entry in the list box.
+ When nothing is selected, which is the case when getItemCount returns '0',
+ then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
+ virtual sal_Int32 getSelIndex() const;
+
+ /** @return The item name of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemName( sal_Int32 index ) const;
+
+ /** @return The version string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const;
+
+ /** @return The description string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const;
+
+ /** @return The publisher string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
+
+ /** @return The link behind the publisher text of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
+
+ /** The entry at the given position will be selected
+ Index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual void select( sal_Int32 pos );
+
+ /** The first found entry with the given name will be selected
+ When there was no entry found with the name, the selection doesn't change.
+ Please note that there might be more than one entry with the same
+ name, because:
+ 1. the name is not unique
+ 2. one extension can be installed as user and shared extension.
+ */
+ virtual void select( const ::rtl::OUString & sName );
+};
+
+}
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 6e61e95f07cb..ee8c5d26c24f 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -48,6 +48,7 @@ #include "boost/bind.hpp" #include "license_dialog.hxx" +#include "dp_gui_dialog2.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -271,27 +272,28 @@ void ServiceImpl::startExecuteModal( { const ::vos::OGuard guard( Application::GetSolarMutex() ); - ::rtl::Reference< ::dp_gui::TheExtensionManager > dialog( + ::rtl::Reference< ::dp_gui::TheExtensionManager > myExtMgr( ::dp_gui::TheExtensionManager::get( m_xComponentContext, m_parent ? *m_parent : Reference<awt::XWindow>(), m_extensionURL ? *m_extensionURL : OUString() ) ); + myExtMgr->createDialog( false ); if (m_initialTitle.getLength() > 0) { - dialog->SetText( m_initialTitle ); + myExtMgr->SetText( m_initialTitle ); m_initialTitle = OUString(); } if ( m_bShowUpdateOnly ) { - dialog->checkUpdates( true, !bCloseDialog ); + myExtMgr->checkUpdates( true, !bCloseDialog ); if ( bCloseDialog ) - dialog->Close(); + myExtMgr->Close(); else - dialog->ToTop( TOTOP_RESTOREWHENMIN ); + myExtMgr->ToTop( TOTOP_RESTOREWHENMIN ); } else { - dialog->Show(); - dialog->ToTop( TOTOP_RESTOREWHENMIN ); + myExtMgr->Show(); + myExtMgr->ToTop( TOTOP_RESTOREWHENMIN ); } } @@ -331,6 +333,12 @@ sdecl::ServiceDecl const licenseDecl( licenseSI, "com.sun.star.comp.deployment.ui.LicenseDialog", "com.sun.star.deployment.ui.LicenseDialog" ); + +sdecl::class_<UpdateRequiredDialogService, sdecl::with_args<true> > updateSI; +sdecl::ServiceDecl const updateDecl( + updateSI, + "com.sun.star.comp.deployment.ui.UpdateRequiredDialog", + "com.sun.star.deployment.ui.UpdateRequiredDialog" ); } // namespace dp_gui extern "C" { @@ -346,7 +354,7 @@ sal_Bool SAL_CALL component_writeInfo( registry::XRegistryKey * pRegistryKey ) { return component_writeInfoHelper( - pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl ); + pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl ); } void * SAL_CALL component_getFactory( @@ -355,7 +363,7 @@ void * SAL_CALL component_getFactory( registry::XRegistryKey * pRegistryKey ) { return component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl ); + pImplName, pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl ); } } // extern "C" diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 721d67c8f35b..3d994f31c395 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -66,7 +66,10 @@ namespace dp_gui { TheExtensionManager::TheExtensionManager( Window *pParent, const uno::Reference< uno::XComponentContext > &xContext ) : - m_xContext( xContext ) + m_xContext( xContext ), + m_pParent( pParent ), + m_pExtMgrDialog( NULL ), + m_pUpdReqDialog( NULL ) { if ( dp_misc::office_is_running() ) { @@ -76,10 +79,6 @@ TheExtensionManager::TheExtensionManager( Window *pParent, m_xDesktop->addTerminateListener( this ); } - m_pDialog = new ExtMgrDialog( pParent, this ); - - m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pDialog, this, xContext ) ); - m_sPackageManagers.realloc(2); m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") ); m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );; @@ -110,21 +109,43 @@ TheExtensionManager::TheExtensionManager( Window *pParent, uno::Sequence< uno::Any >( args, 1 )), uno::UNO_QUERY_THROW); try { //throws css::container::NoSuchElementException, css::lang::WrappedTargetException - OUString sURL; uno::Any value = xNameAccessRepositories->getByName( OUSTR( "WebsiteLink" ) ); - sURL = value.get< OUString > (); - m_pDialog->setGetExtensionsURL( sURL ); + m_sGetExtensionsURL = value.get< OUString > (); } catch ( uno::Exception& ) {} - - createPackageList(); } //------------------------------------------------------------------------------ TheExtensionManager::~TheExtensionManager() { - delete m_pDialog; + if ( m_pUpdReqDialog ) + delete m_pUpdReqDialog; + if ( m_pExtMgrDialog ) + delete m_pExtMgrDialog; +} + +//------------------------------------------------------------------------------ +void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) +{ + const ::vos::OGuard guard( Application::GetSolarMutex() ); + + if ( bCreateUpdDlg ) + { + if ( !m_pUpdReqDialog ) + { + m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this ); + m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ) ); + createPackageList(); + } + } + else if ( !m_pExtMgrDialog ) + { + m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this ); + m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ) ); + m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); + createPackageList(); + } } //------------------------------------------------------------------------------ @@ -132,7 +153,7 @@ void TheExtensionManager::Show() { const ::vos::OGuard guard( Application::GetSolarMutex() ); - m_pDialog->Show(); + getDialog()->Show(); } //------------------------------------------------------------------------------ @@ -140,7 +161,7 @@ void TheExtensionManager::SetText( const ::rtl::OUString &rTitle ) { const ::vos::OGuard guard( Application::GetSolarMutex() ); - m_pDialog->SetText( rTitle ); + getDialog()->SetText( rTitle ); } //------------------------------------------------------------------------------ @@ -148,25 +169,69 @@ void TheExtensionManager::ToTop( USHORT nFlags ) { const ::vos::OGuard guard( Application::GetSolarMutex() ); - m_pDialog->ToTop( nFlags ); + getDialog()->ToTop( nFlags ); } //------------------------------------------------------------------------------ bool TheExtensionManager::Close() { - return m_pDialog->Close(); + if ( m_pExtMgrDialog ) + return m_pExtMgrDialog->Close(); + else if ( m_pUpdReqDialog ) + return m_pUpdReqDialog->Close(); + else + return true; +} + +//------------------------------------------------------------------------------ +sal_Int16 TheExtensionManager::execute() +{ + sal_Int16 nRet = 0; + + if ( m_pUpdReqDialog ) + { + nRet = m_pUpdReqDialog->Execute(); + delete m_pUpdReqDialog; + m_pUpdReqDialog = NULL; + } + + return nRet; } //------------------------------------------------------------------------------ bool TheExtensionManager::isVisible() { - return m_pDialog->IsVisible(); + return getDialog()->IsVisible(); } //------------------------------------------------------------------------------ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bParentVisible*/ ) { - m_pExecuteCmdQueue->checkForUpdates( m_sPackageManagers ); + std::vector< TUpdateListEntry > vEntries; + + for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i ) + { + uno::Sequence< uno::Reference< deployment::XPackage > > xPackages; + try { + xPackages = m_sPackageManagers[i]->getDeployedPackages( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); + for ( sal_Int32 k = 0; k < xPackages.getLength(); ++k ) + { + TUpdateListEntry pEntry( new UpdateListEntry( xPackages[k], m_sPackageManagers[i] ) ); + vEntries.push_back( pEntry ); + } + } catch ( deployment::DeploymentException & ) { + continue; + } catch ( ucb::CommandFailedException & ) { + continue; + } catch ( ucb::CommandAbortedException & ) { + return true; + } catch ( lang::IllegalArgumentException & e ) { + throw uno::RuntimeException( e.Message, e.Context ); + } + } + + m_pExecuteCmdQueue->checkForUpdates( vEntries ); return true; } @@ -189,10 +254,9 @@ bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPack } //------------------------------------------------------------------------------ -bool TheExtensionManager::updatePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage ) +bool TheExtensionManager::updatePackages( const std::vector< TUpdateListEntry > &vList ) { - m_pExecuteCmdQueue->checkForUpdate( xPackageManager, xPackage ); + m_pExecuteCmdQueue->checkForUpdates( vList ); return true; } @@ -203,6 +267,8 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar if ( rPackageURL.getLength() == 0 ) return false; + createDialog( false ); + uno::Reference< deployment::XPackageManager > xUserPkgMgr = getUserPkgMgr(); uno::Reference< deployment::XPackageManager > xSharedPkgMgr = getSharedPkgMgr(); @@ -210,7 +276,7 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar bool bInstallForAll = false; if ( !bWarnUser && ! xSharedPkgMgr->isReadOnly() ) - bInstall = m_pDialog->installForAllUsers( bInstallForAll ); + bInstall = getDialogHelper()->installForAllUsers( bInstallForAll ); if ( !bInstall ) return false; @@ -239,8 +305,10 @@ void TheExtensionManager::terminateDialog() if ( ! dp_misc::office_is_running() ) { const ::vos::OGuard guard( Application::GetSolarMutex() ); - delete m_pDialog; - m_pDialog = NULL; + delete m_pExtMgrDialog; + m_pExtMgrDialog = NULL; + delete m_pUpdReqDialog; + m_pUpdReqDialog = NULL; Application::Quit(); } } @@ -252,7 +320,7 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X try { packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ); + uno::Reference< ucb::XCommandEnvironment >() ); } catch ( deployment::DeploymentException & ) { //handleGeneralError(e.Cause); return true; @@ -267,7 +335,7 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X for ( sal_Int32 j = 0; j < packages.getLength(); ++j ) { - m_pDialog->addPackageToList( packages[j], xPackageManager ); + getDialogHelper()->addPackageToList( packages[j], xPackageManager ); } return true; @@ -381,8 +449,10 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt ) if ( dp_misc::office_is_running() ) { const ::vos::OGuard guard( Application::GetSolarMutex() ); - delete m_pDialog; - m_pDialog = NULL; + delete m_pExtMgrDialog; + m_pExtMgrDialog = NULL; + delete m_pUpdReqDialog; + m_pUpdReqDialog = NULL; } s_ExtMgr.clear(); } @@ -393,15 +463,22 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt ) void TheExtensionManager::queryTermination( ::lang::EventObject const & ) throw ( frame::TerminationVetoException, uno::RuntimeException ) { - if ( m_pExecuteCmdQueue->isBusy() || ( m_pDialog && m_pDialog->isBusy() ) ) + DialogHelper *pDialogHelper = getDialogHelper(); + + if ( m_pExecuteCmdQueue->isBusy() || ( pDialogHelper && pDialogHelper->isBusy() ) ) { ToTop( TOTOP_RESTOREWHENMIN ); throw frame::TerminationVetoException( OUSTR("The office cannot be closed while the Extension Manager is running"), uno::Reference<XInterface>(static_cast<frame::XTerminateListener*>(this), uno::UNO_QUERY)); } - else if ( m_pDialog ) - m_pDialog->Close(); + else + { + if ( m_pExtMgrDialog ) + m_pExtMgrDialog->Close(); + if ( m_pUpdReqDialog ) + m_pUpdReqDialog->Close(); + } } //------------------------------------------------------------------------------ @@ -419,9 +496,9 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt ) uno::Reference< deployment::XPackageManager > xPackageManager( rEvt.Source, uno::UNO_QUERY ); if ( xPackageManager.is() ) { - m_pDialog->prepareChecking( xPackageManager ); + getDialogHelper()->prepareChecking( xPackageManager ); createPackageList( xPackageManager ); - m_pDialog->checkEntries(); + getDialogHelper()->checkEntries(); } } @@ -433,7 +510,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt ) if ( s_ExtMgr.is() ) { OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - s_ExtMgr->installPackage( extensionURL, true ); + if ( extensionURL.getLength() ) + s_ExtMgr->installPackage( extensionURL, true ); return s_ExtMgr; } @@ -450,7 +528,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt ) s_ExtMgr = that; } - s_ExtMgr->installPackage( extensionURL, true ); + if ( extensionURL.getLength() ) + s_ExtMgr->installPackage( extensionURL, true ); return s_ExtMgr; } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 21516c683cc8..4ce6005a9346 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -44,12 +44,13 @@ #include "com/sun/star/util/XModifyListener.hpp" #include "dp_gui.h" +#include "dp_gui_dialog2.hxx" +#include "dp_gui_updatedata.hxx" //============================================================================== namespace dp_gui { //------------------------------------------------------------------------------ -class ExtMgrDialog; class ExtensionCmdQueue; //------------------------------------------------------------------------------ @@ -65,7 +66,11 @@ private: ::std::auto_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue; - ExtMgrDialog *m_pDialog; + Window *m_pParent; + ExtMgrDialog *m_pExtMgrDialog; + UpdateRequiredDialog *m_pUpdReqDialog; + + ::rtl::OUString m_sGetExtensionsURL; // liste der packages ( xpackage?, mit parent manager, ... ) @@ -79,6 +84,12 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext ); ~TheExtensionManager(); + void createDialog( const bool bCreateUpdDlg ); + sal_Int16 execute(); + + Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; } + DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; } + void SetText( const ::rtl::OUString &rTitle ); void Show(); void ToTop( USHORT nFlags ); @@ -87,12 +98,12 @@ public: //----------------- bool checkUpdates( bool showUpdateOnly, bool parentVisible ); + bool updatePackages( const std::vector< TUpdateListEntry > &vList ); + bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false ); bool queryTermination(); diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index ba78112a26f7..610960b99734 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -34,6 +34,8 @@ #include "rtl/ustring.hxx" #include "com/sun/star/uno/Reference.hxx" +#include <boost/shared_ptr.hpp> + namespace com { namespace sun { namespace star { namespace deployment { class XPackageManager; @@ -46,6 +48,19 @@ namespace com { namespace sun { namespace star { namespace xml { namespace dom { namespace dp_gui { +struct UpdateListEntry +{ + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager; + + UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + ~UpdateListEntry(); +}; + +typedef ::boost::shared_ptr< UpdateListEntry > TUpdateListEntry; + + struct UpdateData { ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage; diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 370d11c0de63..0e1955359bbc 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -229,9 +229,7 @@ public: Thread( css::uno::Reference< css::uno::XComponentContext > const & context, UpdateDialog & dialog, - rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage, - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > const & packageManagers); + const std::vector< TUpdateListEntry > &vExtensionList); void stop(); @@ -285,9 +283,7 @@ private: css::uno::Reference< css::uno::XComponentContext > m_context; UpdateDialog & m_dialog; - rtl::Reference< dp_gui::SelectedPackage > m_selectedPackage; - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > m_packageManagers; + std::vector< dp_gui::TUpdateListEntry > m_vExtensionList; css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation; @@ -299,13 +295,10 @@ private: UpdateDialog::Thread::Thread( css::uno::Reference< css::uno::XComponentContext > const & context, UpdateDialog & dialog, - rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage, - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > const & packageManagers): + const std::vector< dp_gui::TUpdateListEntry > &vExtensionList): m_context(context), m_dialog(dialog), - m_selectedPackage(selectedPackage), - m_packageManagers(packageManagers), + m_vExtensionList(vExtensionList), m_updateInformation( css::deployment::UpdateInformationProvider::create(context)), m_stop(false) @@ -336,55 +329,28 @@ UpdateDialog::Thread::Entry::Entry( UpdateDialog::Thread::~Thread() {} -void UpdateDialog::Thread::execute() { - OSL_ASSERT(m_selectedPackage.is() != (m_packageManagers.getLength() != 0)); +void UpdateDialog::Thread::execute() +{ + OSL_ASSERT( ! m_vExtensionList.empty() ); Map map; - if (m_selectedPackage.is()) { - css::uno::Reference< css::deployment::XPackage > p = m_selectedPackage->getPackage(); - css::uno::Reference< css::deployment::XPackageManager > m= m_selectedPackage->getPackageManager(); + + typedef std::vector< TUpdateListEntry >::const_iterator ITER; + for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex ) + { + css::uno::Reference< css::deployment::XPackage > p = (*iIndex)->m_xPackage; + css::uno::Reference< css::deployment::XPackageManager > m = (*iIndex)->m_xPackageManager; if ( p.is() ) { - handle(p, m, &map); - } - } else { - for (sal_Int32 i = 0; i < m_packageManagers.getLength(); ++i) { - css::uno::Reference< css::task::XAbortChannel > abort( - m_packageManagers[i]->createAbortChannel()); { - vos::OGuard g(Application::GetSolarMutex()); - if (m_stop) { + vos::OGuard g( Application::GetSolarMutex() ); + if ( m_stop ) { return; } - m_abort = abort; - } - css::uno::Sequence< - css::uno::Reference< css::deployment::XPackage > > ps; - try { - ps = m_packageManagers[i]->getDeployedPackages( - abort, - css::uno::Reference< css::ucb::XCommandEnvironment >()); - } catch (css::deployment::DeploymentException & e) { - handleGeneralError(e.Cause); - continue; - } catch (css::ucb::CommandFailedException & e) { - handleGeneralError(e.Reason); - continue; - } catch (css::ucb::CommandAbortedException &) { - return; - } catch (css::lang::IllegalArgumentException & e) { - throw css::uno::RuntimeException(e.Message, e.Context); - } - for (sal_Int32 j = 0; j < ps.getLength(); ++j) { - { - vos::OGuard g(Application::GetSolarMutex()); - if (m_stop) { - return; - } - } - handle(ps[j], m_packageManagers[i], &map); } + handle( p, m, &map ); } } + if (!map.empty()) { const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL()); if (sDefaultURL.getLength()) @@ -597,9 +563,7 @@ bool UpdateDialog::Thread::update( UpdateDialog::UpdateDialog( css::uno::Reference< css::uno::XComponentContext > const & context, Window * parent, - rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage, - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > const & packageManagers, + const std::vector< dp_gui::TUpdateListEntry > &vExtensionList, std::vector< dp_gui::UpdateData > * updateData): ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)), m_context(context), @@ -636,14 +600,12 @@ UpdateDialog::UpdateDialog( m_updateData(*updateData), m_thread( new UpdateDialog::Thread( - context, *this, selectedPackage, - packageManagers)), + context, *this, vExtensionList)), m_nFirstLineDelta(0), m_nOneLineMissing(0) // TODO: check! // , // m_extensionManagerDialog(extensionManagerDialog) - { OSL_ASSERT(updateData != NULL); css::uno::Reference< css::awt::XToolkit > toolkit; @@ -1310,4 +1272,3 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) return 1; } - diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index b038c0ef042f..578ad6b6f01d 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -48,6 +48,7 @@ #include <svtools/fixedhyper.hxx> #include "descedit.hxx" +#include "dp_gui_updatedata.hxx" /// @HTML @@ -56,18 +57,14 @@ class KeyEvent; class MouseEvent; class ResId; class Window; + namespace com { namespace sun { namespace star { namespace awt { class XThrobber; } namespace deployment { class XPackageManager; } namespace uno { class XComponentContext; } } } } -namespace dp_gui { - class SelectedPackage; - struct UpdateData; -} namespace dp_gui { - /** The modal “Check for Updates” dialog. */ @@ -92,13 +89,9 @@ public: if non-null, check for updates for all managed packages */ UpdateDialog( - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > - const & context, + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context, Window * parent, - rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage, - com::sun::star::uno::Sequence< com::sun::star::uno::Reference< - com::sun::star::deployment::XPackageManager > > const & - packageManagers, + const std::vector< dp_gui::TUpdateListEntry > &vExtensionList, std::vector< dp_gui::UpdateData > * updateData); ~UpdateDialog(); diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk index e3211ab7f73f..4d563ae1591a 100644 --- a/desktop/source/deployment/gui/makefile.mk +++ b/desktop/source/deployment/gui/makefile.mk @@ -50,6 +50,7 @@ DLLPRE = SLOFILES = \ $(SLO)$/dp_gui_service.obj \ + $(SLO)$/dp_gui_extlistbox.obj \ $(SLO)$/dp_gui_dialog2.obj \ $(SLO)$/dp_gui_theextmgr.obj \ $(SLO)$/license_dialog.obj \ diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 7f6d003f8577..aa67536bd425 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -296,6 +296,7 @@ sal_Bool Package::isBundle() throw (RuntimeException) return false; // default } +//______________________________________________________________________________ ::sal_Bool Package::checkPrerequisites( const css::uno::Reference< css::task::XAbortChannel >&, const css::uno::Reference< css::ucb::XCommandEnvironment >&, @@ -308,6 +309,16 @@ sal_Bool Package::isBundle() throw (RuntimeException) return true; } +//______________________________________________________________________________ +::sal_Bool Package::checkDependencies( + const css::uno::Reference< css::ucb::XCommandEnvironment >& ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::uno::RuntimeException) +{ + return true; +} + //______________________________________________________________________________ Sequence< Reference<deployment::XPackage> > Package::getBundle( diff --git a/desktop/source/deployment/registry/help/dp_help.src b/desktop/source/deployment/registry/help/dp_help.src index ed65707badbd..be85542dc3b0 100644 --- a/desktop/source/deployment/registry/help/dp_help.src +++ b/desktop/source/deployment/registry/help/dp_help.src @@ -42,6 +42,6 @@ String RID_STR_HELPPROCESSING_GENERAL_ERROR String RID_STR_HELPPROCESSING_XMLPARSING_ERROR { - Text [ en-US ] = "The extension will not be installed because an error occured in the Help files:\n"; + Text [ en-US ] = "The extension will not be installed because an error occurred in the Help files:\n"; }; diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 02e1d79ce2c3..256d4680d795 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -177,6 +177,12 @@ public: css::ucb::CommandAbortedException, css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL checkDependencies( + const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::uno::RuntimeException); + virtual void SAL_CALL registerPackage( css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel, css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv ) diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index e39f5e80fc31..14075d0fca38 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -205,6 +205,12 @@ class BackendImpl : public ImplBaseT css::ucb::CommandAbortedException, css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL checkDependencies( + const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::uno::RuntimeException); + virtual beans::Optional<OUString> SAL_CALL getIdentifier() throw (RuntimeException); @@ -702,6 +708,22 @@ bool BackendImpl::PackageImpl::checkDependencies( && checkLicense(xCmdEnv, *spDescription, bInstalled, aContextName); } +::sal_Bool BackendImpl::PackageImpl::checkDependencies( + const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::uno::RuntimeException) +{ + std::auto_ptr<ExtensionDescription> spDescription; + try { + spDescription.reset( + new ExtensionDescription( getMyBackend()->getComponentContext(), m_url_expanded, xCmdEnv )); + } catch (NoDescriptionException& ) { + return sal_True; + } + return checkDependencies(xCmdEnv, *spDescription); +} + beans::Optional<OUString> BackendImpl::PackageImpl::getIdentifier() throw (RuntimeException) { diff --git a/desktop/source/inc/helpid.hrc b/desktop/source/inc/helpid.hrc index 3978df5c73f6..e6263609f8bd 100644 --- a/desktop/source/inc/helpid.hrc +++ b/desktop/source/inc/helpid.hrc @@ -66,7 +66,11 @@ #define HID_EXTENSION_MANAGER_LISTBOX_DISABLE (HID_DESKTOP_START + 26) #define HID_EXTENSION_MANAGER_LISTBOX_REMOVE (HID_DESKTOP_START + 27) -#define ACT_DESKTOP_HID_END HID_EXTENSION_MANAGER_LISTBOX_REMOVE +#define HID_EXTENSION_DEPENDENCIES (HID_DESKTOP_START + 28) + +#define HID_PACKAGE_MANAGER_UPD_REQ (HID_DESKTOP_START + 29) + +#define ACT_DESKTOP_HID_END HID_PACKAGE_MANAGER_UPD_REQ // check bounds: #if ACT_DESKTOP_HID_END > HID_DESKTOP_END diff --git a/desktop/util/hidother.src b/desktop/util/hidother.src index f4d06d3fa72b..6f5a86159d75 100644 --- a/desktop/util/hidother.src +++ b/desktop/util/hidother.src @@ -36,6 +36,8 @@ hidspecial HID_PACKAGE_MANAGER_TREELISTBOX { HelpID = HID_PACKAGE_MANAGER_TREELI hidspecial HID_PACKAGE_MANAGER_PROGRESS { HelpID = HID_PACKAGE_MANAGER_PROGRESS; }; hidspecial HID_PACKAGE_MANAGER_PROGRESS_CANCEL { HelpID = HID_PACKAGE_MANAGER_PROGRESS_CANCEL; }; +hidspecial HID_PACKAGE_MANAGER_UPD_REQ { HelpID = HID_PACKAGE_MANAGER_UPD_REQ; }; + hidspecial HID_FIRSTSTART_PREV { HelpId = HID_FIRSTSTART_PREV;}; hidspecial HID_FIRSTSTART_NEXT { HelpId = HID_FIRSTSTART_NEXT;}; hidspecial HID_FIRSTSTART_CANCEL { HelpId = HID_FIRSTSTART_CANCEL;}; @@ -45,7 +47,7 @@ hidspecial UID_FIRSTSTART_HELP { HelpId = UID_FIRSTSTART_HELP;}; hidspecial UID_BTN_LICENSE_ACCEPT { HelpId = UID_BTN_LICENSE_ACCEPT;}; hidspecial HID_DEPLOYMENT_GUI_UPDATE { HelpId = HID_DEPLOYMENT_GUI_UPDATE;}; -hidspecial HID_DEPLOYMENT_GUI_UPDATE { HelpId = HID_DEPLOYMENT_GUI_UPDATEINSTALL;}; +hidspecial HID_DEPLOYMENT_GUI_UPDATEINSTALL { HelpId = HID_DEPLOYMENT_GUI_UPDATEINSTALL;}; hidspecial HID_EXTENSION_MANAGER_LISTBOX { HelpId = HID_EXTENSION_MANAGER_LISTBOX; }; hidspecial HID_EXTENSION_MANAGER_LISTBOX_OPTIONS { HelpId = HID_EXTENSION_MANAGER_LISTBOX_OPTIONS; }; diff --git a/desktop/win32/source/rebase/Resource.h b/desktop/win32/source/rebase/Resource.h new file mode 100644 index 000000000000..2ebbc5c5bfb7 --- /dev/null +++ b/desktop/win32/source/rebase/Resource.h @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: Resource.h,v $ + * $Revision: 1.7 $ + * + * 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 _RESOURCE_H +#define _RESOURCE_H + +#define IDS_APP_TITLE 10 +#define IDS_MSG_OPTIMIZED_FOR_CLIENT 11 +#define IDS_MSG_OPTIMIZED_FOR_SERVER 12 +#define IDS_MSG_NO_INSTALLATION_FOUND 13 + +#define IDI_REBASEGUI 99 + +#endif diff --git a/desktop/win32/source/rebase/makefile.mk b/desktop/win32/source/rebase/makefile.mk new file mode 100644 index 000000000000..dbab5a5d0921 --- /dev/null +++ b/desktop/win32/source/rebase/makefile.mk @@ -0,0 +1,93 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=desktop +TARGET=rebasegui +LIBTARGET=NO +TARGETTYPE=GUI +UWINAPILIB= + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +OBJFILES = \ + $(OBJ)$/rebase.obj \ + $(OBJ)$/rebasegui.obj + +ULFFILES= rebasegui.ulf + +.IF "$(WITH_LANG)"!="" +ULFDIR:=$(COMMONMISC)$/$(TARGET) +.ELSE # "$(WITH_LANG)"!="" +ULFDIR:=. +.ENDIF # "$(WITH_LANG)"!="" + +RCFILES= $(RES)$/$(TARGET).rc + +# --- Targets ------------------------------------------------------ + +APP1NOSAL= TRUE +APP1TARGET= rebaseoo + +APP1STDLIBS= $(SHELL32LIB) $(SOLARLIBDIR)$/pathutils-obj.obj +.IF "$(COM)"=="GCC" + APP1STDLIBS+=$(PSDK_HOME)$/lib$/imagehlp.lib +.ELSE + APP1STDLIBS+=imagehlp.lib +.ENDIF + +APP1OBJS= $(OBJ)$/rebase.obj + +APP1RPATH= BRAND + +APP2NOSAL= TRUE +APP2TARGET= rebasegui +APP2STDLIBS= $(SHELL32LIB) $(SOLARLIBDIR)$/pathutils-obj.obj + +APP2OBJS= $(OBJ)$/rebasegui.obj + +APP2DEF= $(MISC)$/$(TARGET).def +APP2RPATH= BRAND + +APP2RES= $(RES)$/$(TARGET).res +APP2NOSVRES= $(RES)$/$(TARGET).res + +# --- setup -------------------------------------------------------------- + +.INCLUDE : target.mk + +$(RCFILES) : $(ULFDIR)$/rebasegui.ulf makefile.mk rcfooter.txt rcheader.txt rctmpl.txt + $(LNGCONVEX) -ulf $(ULFDIR)$/rebasegui.ulf -rc $(RCFILES) -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt diff --git a/desktop/win32/source/rebase/rcfooter.txt b/desktop/win32/source/rebase/rcfooter.txt new file mode 100644 index 000000000000..3237729437f5 --- /dev/null +++ b/desktop/win32/source/rebase/rcfooter.txt @@ -0,0 +1,2 @@ + +// The end diff --git a/desktop/win32/source/rebase/rcheader.txt b/desktop/win32/source/rebase/rcheader.txt new file mode 100644 index 000000000000..56afc5377920 --- /dev/null +++ b/desktop/win32/source/rebase/rcheader.txt @@ -0,0 +1,39 @@ +#if defined(_MSC_VER) && (_MSC_VER < 1500) +#include <winres.h> +#else +#define WINVER 0x0500 +#include <winresrc.h> +#define IDC_STATIC (-1) +#endif +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,1,1,0 + PRODUCTVERSION 1,1,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x9L +#else + FILEFLAGS 0x8L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + diff --git a/desktop/win32/source/rebase/rctmpl.txt b/desktop/win32/source/rebase/rctmpl.txt new file mode 100644 index 000000000000..97a2775e9b02 --- /dev/null +++ b/desktop/win32/source/rebase/rctmpl.txt @@ -0,0 +1,9 @@ +// String Table + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE %APP_TITLE% + IDS_MSG_OPTIMIZED_FOR_CLIENT %MSG_OPTIMIZED_FOR_CLIENT% + IDS_MSG_OPTIMIZED_FOR_SERVER %MSG_OPTIMIZED_FOR_SERVER% + IDS_MSG_NO_INSTALLATION_FOUND %MSG_NO_INSTALLATION_FOUND% +END diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx new file mode 100644 index 000000000000..e651ad0affcc --- /dev/null +++ b/desktop/win32/source/rebase/rebase.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: md5.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ +
+#include "precompiled_desktop.hxx"
+#define UNICODE
+#define _UNICODE
+
+#define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#include <shellapi.h>
+#include <imagehlp.h>
+#include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+
+const int FORMAT_MESSAGE_SIZE = 4096;
+const DWORD PE_Signature = 0x00004550;
+const DWORD BASEVIRTUALADDRESS = 0x10000000;
+
+namespace
+{
+
+bool IsValidHandle( HANDLE handle )
+{
+ return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle));
+}
+
+void fail()
+{
+ LPWSTR buf = NULL;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+ MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+ LocalFree(buf);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase)
+{
+ ULONG ulOldImageSize;
+ ULONG_PTR lpOldImageBase;
+ ULONG ulNewImageSize;
+ ULONG_PTR lpNewImageBase = nNewImageBase;
+ ULONG ulDateTimeStamp = 0;
+ bool bResult(false);
+
+ char cszFilePath[_MAX_PATH+1] = {0};
+ int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL);
+
+ if (nResult != 0)
+ {
+ BOOL bResult = ReBaseImage(
+ cszFilePath,
+ "",
+ TRUE,
+ FALSE,
+ FALSE,
+ 0,
+ &ulOldImageSize,
+ &lpOldImageBase,
+ &ulNewImageSize,
+ &lpNewImageBase,
+ ulDateTimeStamp );
+ }
+
+ return bResult;
+}
+
+wchar_t* getBrandPath(wchar_t * path)
+{
+ DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
+ if (n == 0 || n >= MAX_PATH) {
+ exit(EXIT_FAILURE);
+ }
+ return tools::filename(path);
+}
+
+void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
+{
+ wchar_t szPattern[MAX_PATH];
+ wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
+ if ( lpLastSlash )
+ {
+ size_t len = lpLastSlash - pszFolder + 1;
+ wcsncpy( szPattern, pszFolder, len );
+ wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
+ }
+
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( szPattern, &aFindFileData );
+
+ if ( IsValidHandle(hFind) )
+ {
+ BOOL fSuccess = false;
+
+ do
+ {
+ wchar_t szLibFilePath[MAX_PATH];
+ wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
+ if ( lpLastSlash )
+ {
+ size_t len = lpLastSlash - pszFolder + 1;
+ wcsncpy( szLibFilePath, pszFolder, len );
+ wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
+ }
+
+ rebaseImage( szLibFilePath, nNewImageBase );
+ fSuccess = FindNextFile( hFind, &aFindFileData );
+ }
+ while ( fSuccess );
+
+ FindClose( hFind );
+ }
+}
+
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
+{
+ wchar_t path[MAX_PATH];
+
+ wchar_t * pathEnd = getBrandPath(path);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if ( pathEnd == NULL )
+ return 0;
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if ( pathEnd == NULL )
+ return 0;
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL)
+ fail();
+ rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
+
+ return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.cxx b/desktop/win32/source/rebase/rebasegui.cxx new file mode 100644 index 000000000000..feba7556b74c --- /dev/null +++ b/desktop/win32/source/rebase/rebasegui.cxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: md5.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ +
+#include "precompiled_desktop.hxx"
+
+#define UNICODE 1
+#define _UNICODE 1
+
+#ifndef _WINDOWS_
+# define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+# include <windows.h>
+# include <shellapi.h>
+# include <wchar.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#include "Resource.h"
+#include <time.h>
+#include "sal/config.h"
+#include "tools/pathutils.hxx"
+
+const DWORD PE_Signature = 0x00004550;
+
+#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
+#define MY_STRING(s) (s), MY_LENGTH(s)
+#define MAX_STR_CAPTION 256
+#define MAX_TEXT_LENGTH 1024
+
+static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg)
+{
+ MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static void fail()
+{
+ LPWSTR buf = NULL;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
+ MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
+ LocalFree(buf);
+ TerminateProcess(GetCurrentProcess(), 255);
+}
+
+static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath )
+{
+ HANDLE hFile;
+ HANDLE hFileMapping;
+ LPVOID lpFileBase = 0;
+ PIMAGE_DOS_HEADER lpDosHeader;
+ PIMAGE_NT_HEADERS lpNTHeader;
+
+ hFile = CreateFile(pszFilePath,
+ GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+ 0);
+
+ if ( hFile == INVALID_HANDLE_VALUE )
+ {
+ return NULL;
+ }
+
+ hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if ( hFileMapping == 0 )
+ {
+ CloseHandle(hFile);
+ return NULL;
+ }
+
+ lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
+ if ( lpFileBase == 0 )
+ {
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ return NULL;
+ }
+
+ lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
+ if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
+ {
+ lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew);
+ if (lpNTHeader->Signature == PE_Signature )
+ lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase );
+ }
+
+ UnmapViewOfFile(lpFileBase);
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+
+ return lpFileBase;
+}
+
+static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA)
+{
+ LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath);
+ if ( lpImageVBA == lpVBA )
+ return true;
+ else
+ return false;
+}
+
+static wchar_t* getBrandPath(wchar_t * pszPath)
+{
+ DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH);
+ if (n == 0 || n >= MAX_PATH) {
+ exit(EXIT_FAILURE);
+ }
+ return tools::filename(pszPath);
+}
+
+extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int )
+{
+ wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ];
+ pAppTitle[0] = '\0';
+ LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION );
+
+ wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextServer[0] = '\0';
+ LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH );
+
+ wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextClient[0] = '\0';
+ LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH );
+
+ wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ];
+ pTextNoInstallation[0] = '\0';
+ LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH );
+
+ LPVOID VBA = (void*)0x10000000;
+ wchar_t path[MAX_PATH];
+
+ wchar_t * pathEnd = getBrandPath(path);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL)
+ fail();
+ bool bFast = checkImageVirtualBaseAddress(path, VBA);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if (pathEnd == NULL)
+ failPath(pAppTitle, pTextNoInstallation);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL)
+ fail();
+ bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
+ fail();
+ pathEnd = tools::resolveLink(path);
+
+ if (pathEnd == NULL)
+ failPath(pAppTitle, pTextNoInstallation);
+
+ if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL)
+ fail();
+ bFast &= checkImageVirtualBaseAddress(path, VBA);
+
+ const wchar_t* pOutput = pTextClient;
+ if (!bFast)
+ pOutput = pTextServer;
+
+ MessageBoxW( NULL, pOutput, pAppTitle, MB_OK );
+
+ return 0;
+}
diff --git a/desktop/win32/source/rebase/rebasegui.ulf b/desktop/win32/source/rebase/rebasegui.ulf new file mode 100644 index 000000000000..ee6b6e828ac1 --- /dev/null +++ b/desktop/win32/source/rebase/rebasegui.ulf @@ -0,0 +1,11 @@ +[%APP_TITLE%] +en-US = "Installation Status" + +[%MSG_OPTIMIZED_FOR_CLIENT%] +en-US = "Installation is optimized for clients." + +[%MSG_OPTIMIZED_FOR_SERVER%] +en-US = "Installation is optimized for servers." + +[%MSG_NO_INSTALLATION_FOUND%] +en-US = "Cannot find Office installation." diff --git a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx index bcd321d2fab3..b2697abece66 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx @@ -48,8 +48,8 @@ namespace drawinglayer class LineGeometryExtractor2D : public BaseProcessor2D { private: - basegfx::B2DPolyPolygon maExtractedHairlines; - basegfx::B2DPolyPolygon maExtractedLineFills; + std::vector< basegfx::B2DPolygon > maExtractedHairlines; + std::vector< basegfx::B2DPolyPolygon > maExtractedLineFills; // bitfield unsigned mbInLineGeometry : 1; @@ -61,8 +61,8 @@ namespace drawinglayer LineGeometryExtractor2D(const geometry::ViewInformation2D& rViewInformation); virtual ~LineGeometryExtractor2D(); - const basegfx::B2DPolyPolygon& getExtractedHairlines() const { return maExtractedHairlines; } - const basegfx::B2DPolyPolygon& getExtractedLineFills() const { return maExtractedLineFills; } + const std::vector< basegfx::B2DPolygon >& getExtractedHairlines() const { return maExtractedHairlines; } + const std::vector< basegfx::B2DPolyPolygon >& getExtractedLineFills() const { return maExtractedLineFills; } }; } // end of namespace processor2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index b1f42b5a4eff..b5212da54688 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -239,17 +239,19 @@ namespace drawinglayer { if(getB2DPolygon().count()) { + // #i102241# try to simplify before usage + const basegfx::B2DPolygon aB2DPolygon(basegfx::tools::simplifyCurveSegments(getB2DPolygon())); basegfx::B2DPolyPolygon aHairLinePolyPolygon; if(0.0 == getStrokeAttribute().getFullDotDashLen()) { // no line dashing, just copy - aHairLinePolyPolygon.append(getB2DPolygon()); + aHairLinePolyPolygon.append(aB2DPolygon); } else { // apply LineStyle - basegfx::tools::applyLineDashing(getB2DPolygon(), getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); + basegfx::tools::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); } const sal_uInt32 nCount(aHairLinePolyPolygon.count()); @@ -263,12 +265,9 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - // AW: New version of createAreaGeometry; now creates bezier polygons + // New version of createAreaGeometry; now creates bezier polygons aAreaPolyPolygon.append(basegfx::tools::createAreaGeometry( aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin)); - //const basegfx::B2DPolyPolygon aNewPolyPolygon(basegfx::tools::createAreaGeometryForPolygon( - // aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin, fMiterMinimumAngle)); - //aAreaPolyPolygon.append(aNewPolyPolygon); } // prepare return value diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index f4a8a7b5282d..a60162de6ee0 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -2106,7 +2106,10 @@ namespace drawinglayer mpOutputDevice->Push(PUSH_MAPMODE); mpOutputDevice->SetMapMode(maOriginalMapMode); - if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice)) + if(!renderChartPrimitive2D( + rChartPrimitive, + *mpOutputDevice, + getViewInformation2D())) { // fallback to decomposition (MetaFile) process(rChartPrimitive.get2DDecomposition(getViewInformation2D())); diff --git a/drawinglayer/source/processor2d/helperchartrenderer.cxx b/drawinglayer/source/processor2d/helperchartrenderer.cxx index c2d99604469b..ffa8917ddec8 100644 --- a/drawinglayer/source/processor2d/helperchartrenderer.cxx +++ b/drawinglayer/source/processor2d/helperchartrenderer.cxx @@ -41,6 +41,7 @@ #include <svtools/chartprettypainter.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <drawinglayer/geometry/viewinformation2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +51,10 @@ using namespace com::sun::star; namespace drawinglayer { - bool renderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate, OutputDevice& rOutputDevice) + bool renderChartPrimitive2D( + const primitive2d::ChartPrimitive2D& rChartCandidate, + OutputDevice& rOutputDevice, + const geometry::ViewInformation2D& rViewInformation2D) { bool bChartRendered(false); @@ -73,14 +77,74 @@ namespace drawinglayer if( pPrettyPainter ) { - // create logic object range + // create logic object range; do NOT use ObjectTransformation for this + // (rViewInformation2D.getObjectTransformation()), only the logic object + // size is wanted basegfx::B2DRange aObjectRange(0.0, 0.0, 1.0, 1.0); aObjectRange.transform(rChartCandidate.getTransformation()); const Rectangle aRectangle( (sal_Int32)aObjectRange.getMinX(), (sal_Int32)aObjectRange.getMinY(), (sal_Int32)aObjectRange.getMaxX(), (sal_Int32)aObjectRange.getMaxY()); - bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle); + // #i101811# + if(rViewInformation2D.getObjectTransformation().isIdentity()) + { + // no embedding in another transfromation, just paint with existing + // MapMode. This is just a shortcut; using the below code will also + // work; it has just a neutral ObjectTransformation + bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle); + } + else + { + // rViewInformation2D.getObjectTransformation() is used and + // needs to be expressed in the MapMode for the PrettyPainter; + // else it would call ChartModelHelper::setPageSize(...) with the + // changed size what really will change the chart model and leads + // to re-layouts and re-formattings + const MapMode aOldMapMode(rOutputDevice.GetMapMode()); + basegfx::B2DVector aVTScale, aScale, aTranslate; + double fRotate, fShearX; + + // get basic scaling with current MapMode (aVTScale), containing + // mapping for set MapUnit (e.g. for 100th mm, the basic scale is + // not 1.0, 1.0). This is needed since this scale is included in + // the ObjectToView Transformation and needs to be removed (see + // correction below) to re-create a MapMode + rOutputDevice.SetMapMode(aOldMapMode.GetMapUnit()); + rOutputDevice.GetViewTransformation().decompose(aVTScale, aTranslate, fRotate, fShearX); + + // get complete ObjectToView Transformation scale and translate from current + // transformation chain (combined view and object transform) + rViewInformation2D.getObjectToViewTransformation().decompose(aScale, aTranslate, fRotate, fShearX); + + // assert when shear and/or rotation is used + OSL_ENSURE(basegfx::fTools::equalZero(fRotate), "Chart PrettyPrinting with unsupportable rotation (!)"); + OSL_ENSURE(basegfx::fTools::equalZero(fShearX), "Chart PrettyPrinting with unsupportable shear (!)"); + + // clean scale and translate from basic scaling (DPI, etc...) + // since this will implicitely be part of the to-be-created MapMode + const basegfx::B2DTuple aBasicCleaner( + basegfx::fTools::equalZero(aVTScale.getX()) ? 1.0 : 1.0 / aVTScale.getX(), + basegfx::fTools::equalZero(aVTScale.getY()) ? 1.0 : 1.0 / aVTScale.getY()); + aScale *= aBasicCleaner; + aTranslate *= aBasicCleaner; + + // for MapMode, take scale out of translation + const basegfx::B2DTuple aScaleRemover( + basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(), + basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY()); + aTranslate *= aScaleRemover; + + // build new MapMode + const MapMode aNewMapMode(aOldMapMode.GetMapUnit(), + Point(basegfx::fround(aTranslate.getX()), basegfx::fround(aTranslate.getY())), + Fraction(aScale.getX()), Fraction(aScale.getY())); + + // use, paint, restore + rOutputDevice.SetMapMode(aNewMapMode); + bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle); + rOutputDevice.SetMapMode(aOldMapMode); + } } } } diff --git a/drawinglayer/source/processor2d/helperchartrenderer.hxx b/drawinglayer/source/processor2d/helperchartrenderer.hxx index de13431c79c0..4677698129c2 100644 --- a/drawinglayer/source/processor2d/helperchartrenderer.hxx +++ b/drawinglayer/source/processor2d/helperchartrenderer.hxx @@ -43,16 +43,21 @@ class OutputDevice; -namespace drawinglayer { namespace primitive2d { - class ChartPrimitive2D; -}} +namespace drawinglayer { namespace primitive2d { class ChartPrimitive2D; }} +namespace drawinglayer { namespace geometry { class ViewInformation2D; }} ////////////////////////////////////////////////////////////////////////////// // support chart PrettyPrinter usage from primitives namespace drawinglayer { - bool renderChartPrimitive2D(const primitive2d::ChartPrimitive2D& rChartCandidate, OutputDevice& rOutputDevice); + // #i101811# + // Added current ViewInformation2D to take evtl. changed + // ObjectTransformation into account + bool renderChartPrimitive2D( + const primitive2d::ChartPrimitive2D& rChartCandidate, + OutputDevice& rOutputDevice, + const geometry::ViewInformation2D& rViewInformation2D); } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx index 89e0999d361d..5f0ab63ee1b3 100644 --- a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx +++ b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx @@ -86,7 +86,7 @@ namespace drawinglayer const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate)); basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(getViewInformation2D().getObjectTransformation()); - maExtractedHairlines.append(aLocalPolygon); + maExtractedHairlines.push_back(aLocalPolygon); } break; } @@ -98,7 +98,7 @@ namespace drawinglayer const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate)); basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); aLocalPolyPolygon.transform(getViewInformation2D().getObjectTransformation()); - maExtractedLineFills.append(aLocalPolyPolygon); + maExtractedLineFills.push_back(aLocalPolyPolygon); } break; } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 172413105b1c..24f54d3ddc58 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -247,8 +247,8 @@ namespace drawinglayer if(rB2DPolygon.count() && !mnSvtGraphicStrokeCount) { basegfx::BColor aStrokeColor; - PolyPolygon aStartPolyPolygon; - PolyPolygon aEndPolyPolygon; + basegfx::B2DPolyPolygon aStartArrow; + basegfx::B2DPolyPolygon aEndArrow; if(pColor) { @@ -271,11 +271,9 @@ namespace drawinglayer { fPolyLength = basegfx::tools::getLength(rB2DPolygon); - const basegfx::B2DPolyPolygon aStartArrow(basegfx::tools::createAreaGeometryForLineStartEnd( + aStartArrow = basegfx::tools::createAreaGeometryForLineStartEnd( rB2DPolygon, pStart->getB2DPolyPolygon(), true, pStart->getWidth(), - fPolyLength, pStart->isCentered() ? 0.5 : 0.0, 0)); - - aStartPolyPolygon = PolyPolygon(aStartArrow); + fPolyLength, pStart->isCentered() ? 0.5 : 0.0, 0); } if(pEnd && pEnd->isActive()) @@ -285,11 +283,9 @@ namespace drawinglayer fPolyLength = basegfx::tools::getLength(rB2DPolygon); } - const basegfx::B2DPolyPolygon aEndArrow(basegfx::tools::createAreaGeometryForLineStartEnd( + aEndArrow = basegfx::tools::createAreaGeometryForLineStartEnd( rB2DPolygon, pEnd->getB2DPolyPolygon(), false, pEnd->getWidth(), - fPolyLength, pEnd->isCentered() ? 0.5 : 0.0, 0)); - - aEndPolyPolygon = PolyPolygon(aEndArrow); + fPolyLength, pEnd->isCentered() ? 0.5 : 0.0, 0); } } @@ -341,10 +337,23 @@ namespace drawinglayer aDashArray = pStrokeAttribute->getDotDashArray(); } + // #i101734# apply current object transformation to created geometry. + // This is a partial fix. When a object transformation is used which + // e.g. contains a scaleX != scaleY, an unproportional scaling would + // have to be applied to the evtl. existing fat line. The current + // concept of PDF export and SvtGraphicStroke usage does simply not + // allow handling such definitions. The only clean way would be to + // add the transformation to SvtGraphicStroke and to handle it there + basegfx::B2DPolygon aB2DPolygon(rB2DPolygon); + + aB2DPolygon.transform(maCurrentTransformation); + aStartArrow.transform(maCurrentTransformation); + aEndArrow.transform(maCurrentTransformation); + pRetval = new SvtGraphicStroke( - Polygon(rB2DPolygon), - aStartPolyPolygon, - aEndPolyPolygon, + Polygon(aB2DPolygon), + PolyPolygon(aStartArrow), + PolyPolygon(aEndArrow), mfCurrentUnifiedTransparence, fLineWidth, SvtGraphicStroke::capButt, @@ -1001,7 +1010,68 @@ namespace drawinglayer adaptLineToFillDrawMode(); impStartSvtGraphicStroke(pSvtGraphicStroke); - process(rCandidate.get2DDecomposition(getViewInformation2D())); + + // #i101491# + // Change default of fat line generation for MetaFiles: Create MetaPolyLineAction + // instead of decomposing all geometries when the polygon has more than given amount of + // points; else the decomposition will get too expensive quiclky. OTOH + // the decomposition provides the better quality e.g. taking edge roundings + // into account which will NOT be taken into account with LineInfo-based actions + const sal_uInt32 nSubPolygonCount(rStrokePrimitive.getB2DPolygon().count()); + bool bDone(0 == nSubPolygonCount); + + if(!bDone && nSubPolygonCount > 1000) + { + // create MetaPolyLineActions, but without LINE_DASH + const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute(); + + if(basegfx::fTools::more(rLine.getWidth(), 0.0)) + { + const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute(); + basegfx::B2DPolyPolygon aHairLinePolyPolygon; + + if(0.0 == rStroke.getFullDotDashLen()) + { + aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon()); + } + else + { + basegfx::tools::applyLineDashing( + rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(), + &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen()); + } + + const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLine.getColor())); + mpOutputDevice->SetLineColor(Color(aHairlineColor)); + mpOutputDevice->SetFillColor(); + + aHairLinePolyPolygon.transform(maCurrentTransformation); + + const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth())); + + for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aHairLinePolyPolygon.getB2DPolygon(a)); + + if(aCandidate.count() > 1) + { + const Polygon aToolsPolygon(aCandidate); + + mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); + } + } + + bDone = true; + } + } + + if(!bDone) + { + // use decomposition (creates line geometry as filled polygon + // geometry) + process(rCandidate.get2DDecomposition(getViewInformation2D())); + } + impEndSvtGraphicStroke(pSvtGraphicStroke); // restore DrawMode @@ -1623,7 +1693,10 @@ namespace drawinglayer // ChartPrimitive2D const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate); - if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice)) + if(!renderChartPrimitive2D( + rChartPrimitive, + *mpOutputDevice, + getViewInformation2D())) { // fallback to decomposition (MetaFile) process(rChartPrimitive.get2DDecomposition(getViewInformation2D())); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 229319f11f75..8e2f89bb82a6 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -426,7 +426,10 @@ namespace drawinglayer mpOutputDevice->Push(PUSH_MAPMODE); mpOutputDevice->SetMapMode(maOriginalMapMode); - if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice)) + if(!renderChartPrimitive2D( + rChartPrimitive, + *mpOutputDevice, + getViewInformation2D())) { // fallback to decomposition (MetaFile) process(rChartPrimitive.get2DDecomposition(getViewInformation2D())); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 08dba659a6a0..0c5299c9c99d 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1011,6 +1011,8 @@ namespace drawinglayer void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate) { + // #i101491# method restructured to clearly use the DrawPolyLine + // calls starting from a deined line width const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute(); const double fLineWidth(rLineAttribute.getWidth()); bool bDone(false); @@ -1019,154 +1021,160 @@ namespace drawinglayer { const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0)); const double fDiscreteLineWidth(aDiscreteUnit.getLength()); - const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing()); - const double fAllowedUpperBound(bAntiAliased ? 3.0 : 2.5); + const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute(); + const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor())); + basegfx::B2DPolyPolygon aHairlinePolyPolygon; - if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, fAllowedUpperBound)) + mpOutputDevice->SetLineColor(Color(aHairlineColor)); + mpOutputDevice->SetFillColor(); + + if(0.0 == rStrokeAttribute.getFullDotDashLen()) + { + // no line dashing, just copy + aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon()); + } + else { - // force to hairline - const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute(); - const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor())); - basegfx::B2DPolyPolygon aHairlinePolyPolygon; + // else apply LineStyle + basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(), + rStrokeAttribute.getDotDashArray(), + &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen()); + } - mpOutputDevice->SetLineColor(Color(aHairlineColor)); - mpOutputDevice->SetFillColor(); + const sal_uInt32 nCount(aHairlinePolyPolygon.count()); - if(0.0 == rStrokeAttribute.getFullDotDashLen()) - { - // no line dashing, just copy - aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon()); - } - else - { - // else apply LineStyle - basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(), - rStrokeAttribute.getDotDashArray(), - &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen()); - } - - const sal_uInt32 nCount(aHairlinePolyPolygon.count()); + if(nCount) + { + const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing()); + aHairlinePolyPolygon.transform(maCurrentTransformation); - if(nCount) + for(sal_uInt32 a(0); a < nCount; a++) { - aHairlinePolyPolygon.transform(maCurrentTransformation); + basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); if(bAntiAliased) { - for(sal_uInt32 a(0); a < nCount; a++) + if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0)) { - basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); - - if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0)) - { - // line in range ]0.0 .. 1.0[ - // paint as simple hairline - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } - else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0)) - { - // line in range [1.0 .. 2.0[ - // paint as 2x2 with dynamic line distance - basegfx::B2DHomMatrix aMat; - const double fDistance(fDiscreteLineWidth - 1.0); - const double fHalfDistance(fDistance * 0.5); - - aMat.set(0, 2, -fHalfDistance); - aMat.set(1, 2, -fHalfDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, fDistance); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, 0.0); - aMat.set(1, 2, fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, -fDistance); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } - else - { - // line in range [2.0 .. 3.0] - // paint as cross in a 3x3 with dynamic line distance - basegfx::B2DHomMatrix aMat; - const double fDistance((fDiscreteLineWidth - 1.0) * 0.5); - - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, -fDistance); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, fDistance); - aMat.set(1, 2, -fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, fDistance); - aMat.set(1, 2, fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, -fDistance); - aMat.set(1, 2, fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } + // line in range ]0.0 .. 1.0[ + // paint as simple hairline + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0)) + { + // line in range [1.0 .. 2.0[ + // paint as 2x2 with dynamic line distance + basegfx::B2DHomMatrix aMat; + const double fDistance(fDiscreteLineWidth - 1.0); + const double fHalfDistance(fDistance * 0.5); + + aMat.set(0, 2, -fHalfDistance); + aMat.set(1, 2, -fHalfDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, fDistance); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, 0.0); + aMat.set(1, 2, fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, -fDistance); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0)) + { + // line in range [2.0 .. 3.0] + // paint as cross in a 3x3 with dynamic line distance + basegfx::B2DHomMatrix aMat; + const double fDistance((fDiscreteLineWidth - 1.0) * 0.5); + + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, -fDistance); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, fDistance); + aMat.set(1, 2, -fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, fDistance); + aMat.set(1, 2, fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, -fDistance); + aMat.set(1, 2, fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else + { + // #i101491# line width above 3.0 } } else { - if(basegfx::fTools::more(fDiscreteLineWidth, 1.5)) + if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5)) + { + // line width below 1.5, draw the basic hairline polygon + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5)) { // line width is in range ]1.5 .. 2.5], use four hairlines // drawn in a square basegfx::B2DHomMatrix aMat; + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - for(sal_uInt32 a(0); a < nCount; a++) - { - basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, 1.0); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); + aMat.set(0, 2, 1.0); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - aMat.set(0, 2, 0.0); - aMat.set(1, 2, 1.0); - aCandidate.transform(aMat); + aMat.set(0, 2, 0.0); + aMat.set(1, 2, 1.0); + aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - aMat.set(0, 2, -1.0); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); + aMat.set(0, 2, -1.0); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; } else { - for(sal_uInt32 a(0); a < nCount; a++) - { - // draw the basic hairline polygon - const basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } + // #i101491# line width is above 2.5 } } - } - bDone = true; + if(!bDone && rPolygonStrokeCandidate.getB2DPolygon().count() > 1000) + { + // #i101491# If the polygon complexity uses more than a given amount, do + // use OuputDevice::DrawPolyLine directly; this will avoid buffering all + // decompositions in primtives (memory) and fallback to old line painting + // for very complex polygons, too + mpOutputDevice->DrawPolyLine(aCandidate, fDiscreteLineWidth, rLineAttribute.getLineJoin()); + bDone = true; + } + } } } diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 24015903de4c..0a15ff224073 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -141,6 +141,10 @@ namespace } aRetval = BitmapEx(aContent, aAlpha); + + // #i101811# set PrefMapMode and PrefSize at newly created Bitmap + aRetval.SetPrefMapMode(MAP_100TH_MM); + aRetval.SetPrefSize(Size(nWidth, nHeight)); } return aRetval; diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx index 3db1e6d49a94..5be54237a956 100644 --- a/formula/inc/formula/IFunctionDescription.hxx +++ b/formula/inc/formula/IFunctionDescription.hxx @@ -153,6 +153,7 @@ namespace formula virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0; + virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0; virtual void setDispatcherLock( BOOL bLock ) = 0; virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked) = 0; diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index ed9337c4762e..1e5b55b7b67f 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -497,6 +497,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) if ( m_aTokenList.getLength() ) { const uno::Reference< sheet::XFormulaParser > xParser(m_pHelper->getFormulaParser()); + const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); const sheet::FormulaToken* pIter = m_aTokenList.getConstArray(); const sheet::FormulaToken* pEnd = pIter + m_aTokenList.getLength(); @@ -509,7 +510,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) const sal_Int32 eOp = pIter->OpCode; uno::Sequence<sheet::FormulaToken> aArgs(1); aArgs[0] = *pIter; - const String aString = xParser->printFormula(aArgs); + const String aString = xParser->printFormula(aArgs, aRefPos); const sheet::FormulaToken* pNextToken = pIter + 1; if(!bUserMatrixFlag && FormulaCompiler::IsMatrixFunction((OpCode)eOp) ) @@ -533,7 +534,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) if ( pNextToken != pEnd ) { aArgs[0] = *pNextToken; - const String a2String = xParser->printFormula(aArgs); + const String a2String = xParser->printFormula(aArgs, aRefPos); const xub_StrLen n3 = aFormString.Search(a2String,nXXX); if ( n3 < nTokPos ) nTokPos = n3; @@ -681,7 +682,8 @@ void FormulaDlg_Impl::MakeTree(IStructHelper* _pTree,SvLBoxEntry* pParent,Formul aArgs[0] = m_aTokenMap.find(pOrigToken)->second; try { - const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs); + const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); + const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs, aRefPos); if ( nParas > 0 ) { @@ -749,7 +751,8 @@ void FormulaDlg_Impl::UpdateTokenArray( const String& rStrExp) m_aTokenList.realloc(0); try { - m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp); + const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); + m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp, aRefPos); } catch(const uno::Exception&) { @@ -962,7 +965,8 @@ String FormulaDlg_Impl::RepairFormula(const String& aFormula) if ( m_aTokenList.getLength() ) { - const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList)); + const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); + const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList, aRefPos)); if ( !sFormula.Len() || sFormula.GetChar(0) != '=' ) aResult += sFormula; else diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst index 87084f1b6656..434f22660f33 100644 --- a/fpicker/prj/build.lst +++ b/fpicker/prj/build.lst @@ -3,6 +3,7 @@ fp fpicker\inc nmake - all fp_inc NULL fp fpicker\source\generic nmake - all fp_generic fp_inc NULL fp fpicker\source\office nmake - all fp_office fp_inc NULL fp fpicker\source\unx\gnome nmake - u fp_gnome_filepicker fp_inc NULL +fp fpicker\source\unx\kde4 nmake - u fp_kde4_filepicker fp_inc NULL fp fpicker\source\aqua nmake - u fp_macosx_filepicker NULL fp fpicker\source\win32\filepicker nmake - w fp_win32_filepicker fp_inc NULL fp fpicker\source\win32\folderpicker nmake - w fp_win32_folderpicker fp_inc NULL diff --git a/fpicker/prj/d.lst b/fpicker/prj/d.lst index 05ab72c01208..7c4e0bf6024a 100644 --- a/fpicker/prj/d.lst +++ b/fpicker/prj/d.lst @@ -10,4 +10,5 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid ..\source\win32\filepicker\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\win32\folderpicker\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\unx\gnome\fps-gnome-ucd.txt %_DEST%\bin%_EXT%\fps-gnome-ucd.txt +..\source\unx\kde4\fps-kde4-ucd.txt %_DEST%\bin%_EXT%\fps-kde4-ucd.txt ..\source\aqua\fps-aqua-ucd.txt %_DEST%\bin%_EXT%\fps-aqua-ucd.txt diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx index dec3488211c5..9bdb870ebcc8 100644 --- a/fpicker/source/generic/fpicker.cxx +++ b/fpicker/source/generic/fpicker.cxx @@ -60,6 +60,8 @@ static OUString FilePicker_getSystemPickerServiceName() return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFilePicker")); else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDEFilePicker")); + else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde4")) + return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDE4FilePicker")); else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFilePicker")); else diff --git a/fpicker/source/unx/kde4/FPServiceInfo.hxx b/fpicker/source/unx/kde4/FPServiceInfo.hxx new file mode 100644 index 000000000000..d0a465102768 --- /dev/null +++ b/fpicker/source/unx/kde4/FPServiceInfo.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * + * + * + * + * + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#pragma once + +// the service names +#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" + +// the implementation names +#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" + +// the registry key names +// a key under which this service will be registered, +// Format: -> "/ImplName/UNO/SERVICES/ServiceName" +// <Implementation-Name></UNO/SERVICES/><Service-Name> +#define FILE_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.KDE4FilePickerImpl/UNO/SERVICES/com.sun.star.ui.dialogs.KDE4FilePicker" diff --git a/fpicker/source/unx/kde4/KDE4FPEntry.cxx b/fpicker/source/unx/kde4/KDE4FPEntry.cxx new file mode 100644 index 000000000000..268c01b600b3 --- /dev/null +++ b/fpicker/source/unx/kde4/KDE4FPEntry.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * + * + * + * + * + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <cppuhelper/factory.hxx> + +#include <com/sun/star/container/XSet.hpp> + +#include <osl/diagnose.h> + +#include "KDE4FilePicker.hxx" +#include "FPServiceInfo.hxx" + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; +using namespace ::cppu; +using ::com::sun::star::ui::dialogs::XFilePicker; + +static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager ) +{ + return Reference< XInterface >(static_cast< XFilePicker* >( new KDE4FilePicker( serviceManager ) ) ); +} + +// the three uno functions that will be exported +extern "C" +{ + void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) + { + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) + { + sal_Bool bRetVal = sal_True; + + if ( pRegistryKey ) + { + try + { + Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) ); + pXNewKey->createKey( OUString::createFromAscii( FILE_PICKER_REGKEY_NAME ) ); + } + catch( InvalidRegistryException& ) + { + OSL_ENSURE( sal_False, "InvalidRegistryException caught" ); + bRetVal = sal_False; + } + } + + return bRetVal; + } + + void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) + { + void* pRet = 0; + + if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) ) + { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME ); + + Reference< XSingleServiceFactory > xFactory ( createSingleFactory( + reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + OUString::createFromAscii( pImplName ), + createInstance, + aSNS ) ); + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; + } +} diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx new file mode 100644 index 000000000000..d6d852c71d93 --- /dev/null +++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx @@ -0,0 +1,717 @@ +/************************************************************************* + * + * + * + * + * + * + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): Jan Holesovsky <kendy@openoffice.org> + * + * + ************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// includes +////////////////////////////////////////////////////////////////////////// + +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <cppuhelper/interfacecontainer.h> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ControlActions.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> + +#include <svtools/svtools.hrc> + +#include <vos/mutex.hxx> + +#include <vcl/svapp.hxx> +#include <vcl/sysdata.hxx> +#include <vcl/syswin.hxx> + +#include "KDE4FilePicker.hxx" +#include "FPServiceInfo.hxx" + +/* ********* Hack, but needed because of conflicting types... */ +#define Region QtXRegion + +//kde has an enum that uses this...OO does too +#undef SETTINGS_MOUSE + +#include <kfiledialog.h> +#include <kwindowsystem.h> +#include <kapplication.h> +#include <kfilefiltercombo.h> + +#include <QWidget> +#include <QCheckBox> +#include <QGridLayout> + +#undef Region + +using namespace ::com::sun::star; + +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::ui::dialogs::TemplateDescription; + +using namespace ::com::sun::star; +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::ui::dialogs::TemplateDescription; +using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; +using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; + +////////////////////////////////////////////////////////////////////////// +// helper functions +////////////////////////////////////////////////////////////////////////// + +namespace +{ + // controling event notifications + const bool STARTUP_SUSPENDED = true; + const bool STARTUP_ALIVE = false; + + uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() + { + uno::Sequence<rtl::OUString> aRet(3); + aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker"); + aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker"); + aRet[2] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.KDE4FilePicker"); + return aRet; + } +} + +rtl::OUString toOUString(const QString& s) +{ + return rtl::OUString(s.toUtf8().data(), s.length(), RTL_TEXTENCODING_UTF8); +} + +QString toQString(const rtl::OUString& s) +{ + return QString::fromUtf16(s.getStr(), s.getLength()); +} + +////////////////////////////////////////////////////////////////////////// +// KDE4FilePicker +////////////////////////////////////////////////////////////////////////// + +KDE4FilePicker::KDE4FilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) + : cppu::WeakComponentImplHelper8< + XFilterManager, + XFilterGroupManager, + XFilePickerControlAccess, + XFilePickerNotifier, +// TODO XFilePreview, + lang::XInitialization, + util::XCancellable, + lang::XEventListener, + lang::XServiceInfo>( _helperMutex ), + m_xServiceMgr( xServiceMgr ), + _resMgr( CREATEVERSIONRESMGR( fps_office ) ) +{ + _extraControls = new QWidget(); + + _layout = new QGridLayout(_extraControls); + + _dialog = new KFileDialog(KUrl(""), QString(""), 0, _extraControls); + _dialog->setMode(KFile::File | KFile::LocalOnly); + + //default mode + _dialog->setOperationMode(KFileDialog::Opening); +} + +KDE4FilePicker::~KDE4FilePicker() +{ + delete _resMgr; + delete _dialog; +} + +void SAL_CALL KDE4FilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) + throw( uno::RuntimeException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + m_xListener = xListener; +} + +void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& ) + throw( uno::RuntimeException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + m_xListener.clear(); +} + +void SAL_CALL KDE4FilePicker::setTitle( const rtl::OUString &title ) + throw( uno::RuntimeException ) +{ + _dialog->setCaption(toQString(title)); +} + +sal_Int16 SAL_CALL KDE4FilePicker::execute() + throw( uno::RuntimeException ) +{ + //get the window id of the main OO window to set it for the dialog as a parent + Window *pParentWin = Application::GetDefDialogParent(); + if ( pParentWin ) + { + const SystemEnvData* pSysData = ((SystemWindow *)pParentWin)->GetSystemData(); + if ( pSysData ) + { + KWindowSystem::setMainWindow( _dialog, pSysData->aWindow); // unx only + } + } + + _dialog->setFilter(_filter); + _dialog->exec(); + + //nasty hack to get a local qt event loop going to process the dialog + //otherwise the dialog returns immediately + while (_dialog->isVisible()) + { + kapp->processEvents(QEventLoop::WaitForMoreEvents); + } + + //block and wait for user input + if (_dialog->result() == KFileDialog::Accepted) + { + return ExecutableDialogResults::OK; + } + + return ExecutableDialogResults::CANCEL; +} + +void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect ) + throw( uno::RuntimeException ) +{ + if (multiSelect) + { + _dialog->setMode(KFile::Files | KFile::LocalOnly); + } + else + { + _dialog->setMode(KFile::File | KFile::LocalOnly); + } +} + +void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &name ) + throw( uno::RuntimeException ) +{ + const QString url = toQString(name); + _dialog->setSelection(url); +} + +void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &dir ) + throw( uno::RuntimeException ) +{ + const QString url = toQString(dir); + _dialog->setStartDir(KUrl(url)); +} + +rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory() + throw( uno::RuntimeException ) +{ + QString dir = _dialog->baseUrl().url(); + return toOUString(dir); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() + throw( uno::RuntimeException ) +{ + QStringList files = _dialog->selectedFiles(); + + uno::Sequence< ::rtl::OUString > seq(files.size()); + + for (int i=0 ; i<files.size() ; ++i) + { + const QString fileName = "file:" + files[i]; + seq[i] = toOUString(fileName); + } + + return seq; +} + +void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const ::rtl::OUString &filter ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + QString t = toQString(title); + QString f = toQString(filter); + + if (!_filter.isNull()) + { + _filter.append("\n"); + } + + //add to hash map for reverse lookup in getCurrentFilter + _filters.insert(f, t); + + // '/' meed to be escaped to else they are assumed to be mime types by kfiledialog + //see the docs + t.replace("/", "\\/"); + + _filter.append(QString("%1|%2").arg(f).arg(t)); +} + +void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + QString filter = toQString(title); + filter.replace("/", "\\/"); + _dialog->filterWidget()->setCurrentFilter(filter); +} + +rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter() + throw( uno::RuntimeException ) +{ + QString filter = _filters[_dialog->currentFilter()]; + + //default if not found + if (filter.isNull()) + { + filter = "ODF Text Document (.odt)"; + } + + return toOUString(filter); +} + +void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString&, const uno::Sequence<beans::StringPair>& ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + //TODO +} + +void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const uno::Any &value ) + throw( uno::RuntimeException ) +{ + QWidget* widget = _customWidgets[controlId]; + + if (widget) + { + switch (controlId) + { + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: + case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: + case ExtendedFilePickerElementIds::CHECKBOX_READONLY: + case ExtendedFilePickerElementIds::CHECKBOX_LINK: + case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); + cb->setChecked(value.getValue()); + break; + } + case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + case ExtendedFilePickerElementIds::LISTBOX_VERSION: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: + break; + } + } +} + +uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 ) + throw( uno::RuntimeException ) +{ + uno::Any res(false); + + QWidget* widget = _customWidgets[controlId]; + + if (widget) + { + switch (controlId) + { + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: + case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: + case ExtendedFilePickerElementIds::CHECKBOX_READONLY: + case ExtendedFilePickerElementIds::CHECKBOX_LINK: + case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); + res = uno::Any(cb->isChecked()); + break; + } + case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + case ExtendedFilePickerElementIds::LISTBOX_VERSION: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: + break; + } + } + + return res; +} + +void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable ) + throw( uno::RuntimeException ) +{ + QWidget* widget = _customWidgets[controlId]; + + if (widget) + { + widget->setEnabled(enable); + } +} + +void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const ::rtl::OUString &label ) + throw( uno::RuntimeException ) +{ + QWidget* widget = _customWidgets[controlId]; + + if (widget) + { + switch (controlId) + { + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: + case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: + case ExtendedFilePickerElementIds::CHECKBOX_READONLY: + case ExtendedFilePickerElementIds::CHECKBOX_LINK: + case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); + cb->setText(toQString(label)); + break; + } + case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + case ExtendedFilePickerElementIds::LISTBOX_VERSION: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: + break; + } + } +} + +rtl::OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId) + throw ( uno::RuntimeException ) +{ + QWidget* widget = _customWidgets[controlId]; + QString label; + + if (widget) + { + switch (controlId) + { + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: + case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: + case ExtendedFilePickerElementIds::CHECKBOX_READONLY: + case ExtendedFilePickerElementIds::CHECKBOX_LINK: + case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); + label = cb->text(); + break; + } + case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + case ExtendedFilePickerElementIds::LISTBOX_VERSION: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: + break; + } + } + return toOUString(label); +} + +void KDE4FilePicker::addCustomControl(sal_Int16 controlId) +{ + QWidget* widget = 0; + sal_Int32 resId = -1; + + switch (controlId) + { + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + resId = STR_SVT_FILEPICKER_AUTO_EXTENSION; + break; + case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: + resId = STR_SVT_FILEPICKER_PASSWORD; + break; + case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: + resId = STR_SVT_FILEPICKER_FILTER_OPTIONS; + break; + case ExtendedFilePickerElementIds::CHECKBOX_READONLY: + resId = STR_SVT_FILEPICKER_READONLY; + break; + case ExtendedFilePickerElementIds::CHECKBOX_LINK: + resId = STR_SVT_FILEPICKER_INSERT_AS_LINK; + break; + case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: + resId = STR_SVT_FILEPICKER_SHOW_PREVIEW; + break; + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: + resId = STR_SVT_FILEPICKER_SELECTION; + break; + case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + resId = STR_SVT_FILEPICKER_PLAY; + break; + case ExtendedFilePickerElementIds::LISTBOX_VERSION: + resId = STR_SVT_FILEPICKER_VERSION; + break; + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: + resId = STR_SVT_FILEPICKER_TEMPLATES; + break; + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE; + break; + case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: + break; + } + + switch (controlId) + { + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: + case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: + case ExtendedFilePickerElementIds::CHECKBOX_READONLY: + case ExtendedFilePickerElementIds::CHECKBOX_LINK: + case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: + { + QString label; + + if (_resMgr && resId != -1) + { + rtl::OUString s = String(ResId( resId, *_resMgr )); + label = toQString(s); + label.replace("~", "&"); + } + + widget = new QCheckBox(label, _extraControls); + + break; + } + case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: + case ExtendedFilePickerElementIds::LISTBOX_VERSION: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: + case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: + break; + } + + if (widget) + { + _layout->addWidget(widget); + _customWidgets.insert(controlId, widget); + } +} + +void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) + throw( uno::Exception, uno::RuntimeException ) +{ + _filter.clear(); + _filters.clear(); + + // parameter checking + uno::Any arg; + if (args.getLength() == 0) + { + throw lang::IllegalArgumentException( + rtl::OUString::createFromAscii( "no arguments" ), + static_cast< XFilePicker* >( this ), 1 ); + } + + arg = args[0]; + + if (( arg.getValueType() != ::getCppuType((sal_Int16*)0)) && + ( arg.getValueType() != ::getCppuType((sal_Int8*)0))) + { + throw lang::IllegalArgumentException( + rtl::OUString::createFromAscii( "invalid argument type" ), + static_cast< XFilePicker* >( this ), 1 ); + } + + sal_Int16 templateId = -1; + arg >>= templateId; + + //default is opening + KFileDialog::OperationMode operationMode = KFileDialog::Opening; + + switch ( templateId ) + { + case FILEOPEN_SIMPLE: + break; + + case FILESAVE_SIMPLE: + operationMode = KFileDialog::Saving; + break; + + case FILESAVE_AUTOEXTENSION: + operationMode = KFileDialog::Saving; + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + break; + + case FILESAVE_AUTOEXTENSION_PASSWORD: + { + operationMode = KFileDialog::Saving; + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); + break; + } + case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: + { + operationMode = KFileDialog::Saving; + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS ); + break; + } + case FILESAVE_AUTOEXTENSION_SELECTION: + operationMode = KFileDialog::Saving; + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_SELECTION ); + break; + + case FILESAVE_AUTOEXTENSION_TEMPLATE: + operationMode = KFileDialog::Saving; + addCustomControl( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE ); + break; + + case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW ); + addCustomControl( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE ); + break; + + case FILEOPEN_PLAY: + addCustomControl( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY ); + break; + + case FILEOPEN_READONLY_VERSION: + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_READONLY ); + addCustomControl( ExtendedFilePickerElementIds::LISTBOX_VERSION ); + break; + + case FILEOPEN_LINK_PREVIEW: + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW ); + break; + + default: + throw lang::IllegalArgumentException( + rtl::OUString::createFromAscii( "Unknown template" ), + static_cast< XFilePicker* >( this ), + 1 ); + } + + _dialog->setOperationMode(operationMode); +} + +void SAL_CALL KDE4FilePicker::cancel() + throw ( uno::RuntimeException ) +{ + +} + +void SAL_CALL KDE4FilePicker::disposing( const lang::EventObject &rEvent ) + throw( uno::RuntimeException ) +{ + uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY ); + + if ( xFilePickerListener.is() ) + { + removeFilePickerListener( xFilePickerListener ); + } +} + +rtl::OUString SAL_CALL KDE4FilePicker::getImplementationName() + throw( uno::RuntimeException ) +{ + return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME ); +} + +sal_Bool SAL_CALL KDE4FilePicker::supportsService( const rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames(); + + for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) + { + if ( SupportedServicesNames[n].compareTo( ServiceName ) == 0 ) + return sal_True; + } + + return sal_False; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + return FilePicker_getSupportedServiceNames(); +} diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.hxx b/fpicker/source/unx/kde4/KDE4FilePicker.hxx new file mode 100644 index 000000000000..da355852798a --- /dev/null +++ b/fpicker/source/unx/kde4/KDE4FilePicker.hxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * + * + * + * + * + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): Jan Holesovsky <kendy@openoffice.org> + * + * + ************************************************************************/ + +#pragma once + +#include <cppuhelper/compbase8.hxx> + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> +#include <com/sun/star/ui/dialogs/XFilterManager.hpp> +#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +//#include <com/sun/star/ui/dialogs/XFilePreview.hpp> +#include <com/sun/star/util/XCancellable.hpp> + +#include <osl/conditn.hxx> +#include <osl/mutex.hxx> + +#include <rtl/ustrbuf.hxx> + +#include <QString> +#include <QHash> + +class KFileDialog; +class QWidget; +class QLayout; + +class ResMgr; + +class KDE4FilePicker : + public cppu::WeakComponentImplHelper8< + ::com::sun::star::ui::dialogs::XFilterManager, + ::com::sun::star::ui::dialogs::XFilterGroupManager, + ::com::sun::star::ui::dialogs::XFilePickerControlAccess, + ::com::sun::star::ui::dialogs::XFilePickerNotifier, +// TODO ::com::sun::star::ui::dialogs::XFilePreview, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::util::XCancellable, + ::com::sun::star::lang::XEventListener, + ::com::sun::star::lang::XServiceInfo > +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; // to instanciate own services + + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener; + + ResMgr *_resMgr; + + //the dialog to display + KFileDialog* _dialog; + + osl::Mutex _helperMutex; + + //running filter string to add to dialog + QString _filter; + + //filter for reverse lookup of filter text + QHash<QString, QString> _filters; + + //mapping of SAL control ID's to created custom controls + QHash<sal_Int16, QWidget*> _customWidgets; + + //widget to contain extra custom controls + QWidget* _extraControls; + + //layout for extra custom controls + QLayout* _layout; + +public: + KDE4FilePicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr ); + virtual ~KDE4FilePicker(); + + // XFilePickerNotifier + + virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ); + + // XExecutableDialog functions + + virtual void SAL_CALL setTitle( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException ); + + // XFilePicker functions + + virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setDefaultName( const ::rtl::OUString &rName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString &rDirectory ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException ); + + // XFilterManager functions + + virtual void SAL_CALL appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException ); + + // XFilterGroupManager functions + + virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString &rGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > &rFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XFilePickerControlAccess functions + + virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const ::com::sun::star::uno::Any &rValue ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) throw (::com::sun::star::uno::RuntimeException); + + /* TODO XFilePreview + + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any &rImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getShowState( ) throw (::com::sun::star::uno::RuntimeException); + */ + + // XInitialization + + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &rArguments ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); + + // XCancellable + + virtual void SAL_CALL cancel( ) throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject &rEvent ) throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &rServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + +private: + // prevent copy and assignment + KDE4FilePicker( const KDE4FilePicker& ); + KDE4FilePicker& operator=( const KDE4FilePicker& ); + + //add a custom control widget to the file dialog + void addCustomControl(sal_Int16 controlId); + +}; diff --git a/fpicker/source/unx/kde4/fps-kde4-ucd.txt b/fpicker/source/unx/kde4/fps-kde4-ucd.txt new file mode 100644 index 000000000000..8ecc4e0a0a52 --- /dev/null +++ b/fpicker/source/unx/kde4/fps-kde4-ucd.txt @@ -0,0 +1,6 @@ +[ComponentDescriptor] +ImplementationName=com.sun.star.ui.dialogs.KDE4FilePicker +ComponentName=fps_kde4.uno.so +LoaderName=com.sun.star.loader.SharedLibrary +[SupportedServices] +com.sun.star.ui.dialogs.KDE4FilePicker diff --git a/fpicker/source/unx/kde4/fps_kde4.xml b/fpicker/source/unx/kde4/fps_kde4.xml new file mode 100644 index 000000000000..a12bf894186a --- /dev/null +++ b/fpicker/source/unx/kde4/fps_kde4.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>fps_kde4</module-name> + <component-description> + <author> Jan Holesovsky </author> + <name> com.sun.star.comp.ui.dialogs.FilePicker </name> + <description> + The KDE implementation of the FilePicker service. + </description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language> c++ </language> + <status value="beta"/> + <supported-service> com.sun.star.ui.dialogs.FilePicker </supported-service> + <service-dependency>...</service-dependency> + <type> com.sun.star.ui.dialogs.XExecutableDialog </type> + <type> com.sun.star.ui.dialogs.XFilePicker </type> + <type> com.sun.star.ui.dialogs.XFilterManager </type> + <type> com.sun.star.ui.dialogs.XFilterGroupManager </type> + <type> com.sun.star.ui.dialogs.XFilePickerListener </type> + <type> com.sun.star.ui.dialogs.ExecutableDialogException </type> + <type> com.sun.star.ui.dialogs.XFilePickerNotifier </type> + <type> com.sun.star.ui.dialogs.XFilePickerControlAccess </type> + <type> com.sun.star.ui.dialogs.XFilePreview </type> + <type> com.sun.star.ui.dialogs.ExtendedFilePickerElementIds </type> + <type> com.sun.star.ui.dialogs.ExecutableDialogResults </type> + <type> com.sun.star.ui.dialogs.FilePickerEvent </type> + <type> com.sun.star.ui.dialogs.CommonFilePickerElementIds </type> + <type> com.sun.star.ui.dialogs.ListboxControlActions </type> + <type> com.sun.star.ui.dialogs.TemplateDescription </type> + <type> com.sun.star.ui.dialogs.FilePreviewImageFormats </type> + <type> com.sun.star.util.XCancellable </type> + <type> com.sun.star.lang.XComponent </type> + <type> com.sun.star.lang.XMultiServiceFactory </type> + <type> com.sun.star.lang.XSingleServiceFactory </type> + <type> com.sun.star.lang.XServiceInfo </type> + <type> com.sun.star.lang.XTypeProvider </type> + <type> com.sun.star.lang.IllegalArgumentException </type> + <type> com.sun.star.uno.TypeClass </type> + <type> com.sun.star.uno.XWeak </type> + <type> com.sun.star.uno.XAggregation </type> + <type> com.sun.star.registry.XRegistryKey </type> + <type> com.sun.star.container.XSet </type> + </component-description> + <project-build-dependency> cppuhelper </project-build-dependency> + <project-build-dependency> cppu </project-build-dependency> + <project-build-dependency> sal </project-build-dependency> + <runtime-module-dependency> cppuhelper </runtime-module-dependency> + <runtime-module-dependency> cppu2 </runtime-module-dependency> + <runtime-module-dependency> sal2 </runtime-module-dependency> +</module-description> diff --git a/fpicker/source/unx/kde4/makefile.mk b/fpicker/source/unx/kde4/makefile.mk new file mode 100644 index 000000000000..6f9db777bcb6 --- /dev/null +++ b/fpicker/source/unx/kde4/makefile.mk @@ -0,0 +1,117 @@ +#************************************************************************* +# +# +# +# +# +# +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=fpicker +TARGET=fps_kde4.uno +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +DLLPRE= + +# ------------------------------------------------------------------ + +# Currently just KDE is supported... +.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE4)" != "TRUE" + +dummy: + @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE4 is not set" + +.ELSE # we build for KDE + +CFLAGS+= $(KDE4_CFLAGS) + +# --- Files -------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/KDE4FilePicker.obj \ + $(SLO)$/KDE4FilePicker.moc.obj \ + $(SLO)$/KDE4FPEntry.obj + +SHL1NOCHECK=TRUE +SHL1TARGET=$(TARGET) +SHL1STDLIBS=$(CPPULIB)\ + $(CPPUHELPERLIB)\ + $(SALLIB)\ + $(VCLLIB)\ + $(TOOLSLIB) \ + $(KDE4_LIBS) -lkio -lkfile + + +SHL1OBJS=$(SLOFILES) +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEF1VERSIONMAP=exports.map + +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +$(MISC)$/KDE4FilePicker.moc.cxx : KDE4FilePicker.hxx + $(MOC4) $< -o $@ diff --git a/fpicker/source/win32/filepicker/FPentry.cxx b/fpicker/source/win32/filepicker/FPentry.cxx index 48cc3cc53a50..bc3d020baaad 100644 --- a/fpicker/source/win32/filepicker/FPentry.cxx +++ b/fpicker/source/win32/filepicker/FPentry.cxx @@ -66,9 +66,9 @@ static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) { Reference< XInterface > xDlg; - bool bVista = IsWindowsVista(); + bool bVistaOrNewer = IsWindowsVistaOrNewer(); - if (bVista) + if (bVistaOrNewer) { fprintf(stdout, "use special (vista) system file picker ...\n"); xDlg.set( diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx new file mode 100644 index 000000000000..3c446f412e46 --- /dev/null +++ b/fpicker/source/win32/filepicker/SolarMutex.cxx @@ -0,0 +1,58 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asynceventnotifier.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <osl/thread.hxx>
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId)
+{
+ int nAcquireCount = 0;
+ vos::IMutex& rSolarMutex = Application::GetSolarMutex();
+ vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier();
+
+ if ( nMainThreadId == nThreadId )
+ {
+ ::vos::IMutex& rMutex = Application::GetSolarMutex();
+ if ( rMutex.tryToAcquire() )
+ nAcquireCount = Application::ReleaseSolarMutex() - 1;
+ }
+
+ return nAcquireCount;
+}
+
+void AcquireSolarMutex(int nAcquireCount)
+{
+ if ( nAcquireCount )
+ Application::AcquireSolarMutex( nAcquireCount );
+}
diff --git a/fpicker/source/win32/filepicker/SolarMutex.hxx b/fpicker/source/win32/filepicker/SolarMutex.hxx new file mode 100644 index 000000000000..95dcf13ecc3b --- /dev/null +++ b/fpicker/source/win32/filepicker/SolarMutex.hxx @@ -0,0 +1,33 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asynceventnotifier.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId);
+
+void AcquireSolarMutex(int nAcquireCount);
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx index eb26f23952d7..84d17dbbc0b1 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/configurationhelper.hxx> #include <osl/diagnose.h> #include <osl/mutex.hxx> #include <osl/file.hxx> @@ -294,9 +295,24 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const ::rtl::OUString& sDirec throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { + const ::rtl::OUString aPackage( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")); + const ::rtl::OUString aRelPath( RTL_CONSTASCII_USTRINGPARAM("Path/Info")); + const ::rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")); + + css::uno::Any aValue = ::comphelper::ConfigurationHelper::readDirectKey( + m_xSMGR, aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY); + + bool bChanged(false); + if (( aValue >>= bChanged ) && bChanged ) + { + ::comphelper::ConfigurationHelper::writeDirectKey( + m_xSMGR, aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD); + } + RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_SET_DIRECTORY); rRequest->setArgument(PROP_DIRECTORY, sDirectory); + rRequest->setArgument(PROP_FORCE, bChanged); m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED); } diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index a22ef2bea143..23467f148f4b 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -40,6 +40,7 @@ #include <comphelper/sequenceasvector.hxx> #include <osl/file.hxx> #include <osl/mutex.hxx> +#include "..\misc\WinImplHelper.hxx" inline bool is_current_process_window(HWND hwnd) { @@ -401,7 +402,6 @@ void VistaFilePickerImpl::impl_sta_CreateOpenDialog(const RequestRef& rRequest) nFlags |= FOS_FILEMUSTEXIST; nFlags |= FOS_OVERWRITEPROMPT; nFlags |= FOS_DONTADDTORECENT; - nFlags |= FOS_ALLOWMULTISELECT; iDialog->SetOptions ( nFlags ); @@ -462,6 +462,14 @@ static const ::sal_Int32 GROUP_IMAGETEMPLATE = 3; static const ::sal_Int32 GROUP_CHECKBOXES = 4; //------------------------------------------------------------------------------- +static void setLabelToControl(CResourceProvider& rResourceProvider, TFileDialogCustomize iCustom, sal_uInt16 nControlId) +{ + ::rtl::OUString aLabel = rResourceProvider.getResString(nControlId); + aLabel = SOfficeToWindowsLabel(aLabel); + iCustom->SetControlLabel(nControlId, reinterpret_cast<LPCWSTR>(aLabel.getStr()) ); +} + +//------------------------------------------------------------------------------- void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_Int32 nTemplate) { GUID aGUID = {}; @@ -536,23 +544,48 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I iCustom->StartVisualGroup (GROUP_CHECKBOXES, L""); + sal_uInt16 nControlId(0); if ((nFeatures & FEATURE_AUTOEXTENSION) == FEATURE_AUTOEXTENSION) - iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, L"Auto Extension", true); + { + nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION; + iCustom->AddCheckButton (nControlId, L"Auto Extension", true); + setLabelToControl(m_ResProvider, iCustom, nControlId); + } if ((nFeatures & FEATURE_PASSWORD) == FEATURE_PASSWORD) - iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, L"Password", false); + { + nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD; + iCustom->AddCheckButton (nControlId, L"Password", false); + setLabelToControl(m_ResProvider, iCustom, nControlId); + } if ((nFeatures & FEATURE_READONLY) == FEATURE_READONLY) - iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY, L"Readonly", false); + { + nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY; + iCustom->AddCheckButton (nControlId, L"Readonly", false); + setLabelToControl(m_ResProvider, iCustom, nControlId); + } if ((nFeatures & FEATURE_FILTEROPTIONS) == FEATURE_FILTEROPTIONS) - iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, L"Filter Options", false); + { + nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS; + iCustom->AddCheckButton (nControlId, L"Filter Options", false); + setLabelToControl(m_ResProvider, iCustom, nControlId); + } if ((nFeatures & FEATURE_LINK) == FEATURE_LINK) - iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, L"Link", false); + { + nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK; + iCustom->AddCheckButton (nControlId, L"Link", false); + setLabelToControl(m_ResProvider, iCustom, nControlId); + } if ((nFeatures & FEATURE_SELECTION) == FEATURE_SELECTION) - iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, L"Selection", false); + { + nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION; + iCustom->AddCheckButton (nControlId, L"Selection", false); + setLabelToControl(m_ResProvider, iCustom, nControlId); + } /* can be ignored ... new COM dialog supports preview native now ! if ((nFeatures & FEATURE_PREVIEW) == FEATURE_PREVIEW) @@ -620,8 +653,9 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const RequestRef& rRequest) void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest) { ::rtl::OUString sDirectory = rRequest->getArgumentOrDefault(PROP_DIRECTORY, ::rtl::OUString()); + bool bForce = rRequest->getArgumentOrDefault(PROP_FORCE, false); - if( !m_bInExecute ) + if( !m_bInExecute) { // Vista stores last used folders for file dialogs // so we don't want the application to change the folder @@ -629,7 +663,6 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest) // Store the requested folder in the mean time and decide later // what to do m_sDirectory = sDirectory; - return; } // SYNCHRONIZED-> @@ -647,7 +680,13 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest) if ( FAILED(hResult) ) return; - iDialog->SetFolder(pFolder); + if ( m_bInExecute || bForce ) + iDialog->SetFolder(pFolder); + else + { + // Use set default folder as Microsoft recommends in the IFileDialog documentation. + iDialog->SetDefaultFolder(pFolder); + } } void VistaFilePickerImpl::impl_sta_GetDirectory(const RequestRef& rRequest) @@ -815,21 +854,62 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest) aLock.clear(); // <- SYNCHRONIZED + // we set the directory only if we have a save dialog and a filename + // for the other cases, the file dialog remembers its last location + // according to its client guid. if( m_sDirectory.getLength()) { - // we set the directory only if we have a save dialog and a filename - // for the other cases, the file dialog remembers its last location - // according to its client guid. - if (iSave.is() && m_sFilename.getLength()) + ComPtr< IShellItem > pFolder; + #ifdef __MINGW32__ + HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) ); + #else + HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) ); + #endif + if ( SUCCEEDED(hResult) ) { - ComPtr< IShellItem > pFolder; - #ifdef __MINGW32__ - HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) ); - #else - HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) ); - #endif - if ( SUCCEEDED(hResult) ) - iDialog->SetFolder(pFolder); + if (m_sFilename.getLength()) + { + ::rtl::OUString aFileURL(m_sDirectory);
+ sal_Int32 nIndex = aFileURL.lastIndexOf('/');
+ if (nIndex != aFileURL.getLength()-1)
+ aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/"));
+ aFileURL += m_sFilename;
+
+ TFileDialogCustomize iCustom = impl_getCustomizeInterface(); + + BOOL bValue = FALSE; + HRESULT hResult = iCustom->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue); + if ( bValue ) + { + ::rtl::OUString aExt;
+ UINT nFileType;
+ hResult = iDialog->GetFileTypeIndex(&nFileType);
+ if ( SUCCEEDED(hResult) ) + {
+ ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters); + LPCWSTR lpFilterExt = lFilters[nFileType].pszSpec; + + lpFilterExt = wcsrchr( lpFilterExt, '.' ); + if ( lpFilterExt ) + aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt); + }
+ } + + // Check existence of file. Set folder only for this special case + ::rtl::OUString aSystemPath; + osl_getSystemPathFromFileURL( aFileURL.pData, &aSystemPath.pData ); + + WIN32_FIND_DATA aFindFileData; + HANDLE hFind = FindFirstFile( reinterpret_cast<LPCWSTR>(aSystemPath.getStr()), &aFindFileData ); + if (hFind != INVALID_HANDLE_VALUE)
+ iDialog->SetFolder(pFolder);
+ else
+ hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
+
+ FindClose( hFind ); + }
+ else
+ hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
} } @@ -1048,7 +1128,7 @@ void VistaFilePickerImpl::impl_sta_SetControlLabel(const RequestRef& rRequest) } //------------------------------------------------------------------------------- -void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& rRequest) +void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& /*rRequest*/) { } diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx index 6046876207fc..b15b5c24c52d 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx @@ -42,6 +42,7 @@ #include "FilterContainer.hxx" #include "VistaFilePickerEventHandler.hxx" #include "IVistaFilePickerInternalNotify.hxx" +#include "..\misc\resourceprovider.hxx" #include <com/sun/star/uno/Sequence.hxx> @@ -101,6 +102,7 @@ static const ::rtl::OUString PROP_FEATURES = ::rtl::OUString::createF static const ::rtl::OUString PROP_TEMPLATE_DESCR = ::rtl::OUString::createFromAscii("templatedescription"); // [sal_Int32] static const ::rtl::OUString PROP_FILTER_TITLE = ::rtl::OUString::createFromAscii("filter_title" ); // [OUString] static const ::rtl::OUString PROP_FILTER_VALUE = ::rtl::OUString::createFromAscii("filter_value" ); // [OUString] +static const ::rtl::OUString PROP_FORCE = ::rtl::OUString::createFromAscii("force" ); // [sal_Bool] static const ::rtl::OUString PROP_CONTROL_ID = ::rtl::OUString::createFromAscii("control_id" ); // [sal_Int16] static const ::rtl::OUString PROP_CONTROL_ACTION = ::rtl::OUString::createFromAscii("control_action" ); // [sal_Int16] @@ -334,6 +336,9 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex // ::rtl::OUString m_sFilename; + + // Resource provider + CResourceProvider m_ResProvider; }; } // namespace vista diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx index a780eeaea52d..b715457b76dd 100644 --- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx +++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx @@ -41,6 +41,7 @@ #include <process.h> #include <memory> +#include "SolarMutex.hxx" //------------------------------------------------ // @@ -159,7 +160,9 @@ bool SAL_CALL CAsyncEventNotifier::startup(bool bCreateSuspended) void SAL_CALL CAsyncEventNotifier::shutdown() { - OSL_PRECOND(GetCurrentThreadId() != m_ThreadId, "Method called in wrong thread context!"); + unsigned nThreadId = GetCurrentThreadId(); + + OSL_PRECOND(nThreadId != m_ThreadId, "Method called in wrong thread context!"); osl::ResettableMutexGuard aGuard(m_Mutex); diff --git a/fpicker/source/win32/filepicker/asyncrequests.cxx b/fpicker/source/win32/filepicker/asyncrequests.cxx index 17352345eb2b..dad19a629f7f 100644 --- a/fpicker/source/win32/filepicker/asyncrequests.cxx +++ b/fpicker/source/win32/filepicker/asyncrequests.cxx @@ -30,6 +30,7 @@ #include "asyncrequests.hxx" #include <vcl/svapp.hxx> +#include <vos/mutex.hxx> //----------------------------------------------------------------------------- // namespace @@ -68,6 +69,7 @@ void Request::wait(::sal_Int32 nMilliSeconds) void Request::waitProcessMessages() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); while (!m_aJoiner.check()) Application::Yield(); } diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx index ee7cd363794e..bd945a2d7939 100644 --- a/fpicker/source/win32/filepicker/filepickerstate.cxx +++ b/fpicker/source/win32/filepicker/filepickerstate.cxx @@ -220,6 +220,26 @@ OUString MatchFixBrokenPath(const OUString& path) return path; } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +static ::rtl::OUString trimTrailingSpaces(const ::rtl::OUString& rString) +{ + rtl::OUString aResult(rString); + + sal_Int32 nIndex = rString.lastIndexOf(' '); + if (nIndex == rString.getLength()-1) + { + while (nIndex >= 0 && rString[nIndex] == ' ') + nIndex--; + if (nIndex >= 0) + aResult = rString.copy(0,nIndex+1); + else + aResult = ::rtl::OUString(); + } + return aResult; +} + Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog ) { OSL_PRECOND( aFileOpenDialog, "invalid parameter" ); @@ -258,8 +278,9 @@ Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDia for ( sal_Int32 i = 0; i < lenFileList; i++ ) { + aFilePath = trimTrailingSpaces(aFilePathList[i]); rc = ::osl::FileBase::getFileURLFromSystemPath( - aFilePathList[i], aFilePathURL ); + aFilePath, aFilePathURL ); // we do return all or nothing, that means // in case of failures we destroy the sequence diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk index c23c08108e42..de192879b629 100644 --- a/fpicker/source/win32/filepicker/makefile.mk +++ b/fpicker/source/win32/filepicker/makefile.mk @@ -79,7 +79,8 @@ SLOFILES=$(SLO)$/FileOpenDlg.obj\ $(SLO)$/asyncrequests.obj\ $(SLO)$/VistaFilePickerEventHandler.obj\ $(SLO)$/VistaFilePickerImpl.obj\ - $(SLO)$/VistaFilePicker.obj + $(SLO)$/VistaFilePicker.obj\ + $(SLO)$/SolarMutex.obj # --- Targets ------------------------------------------------------ diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx index 573036c74252..147e0ef09cdd 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.cxx +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -448,34 +448,22 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUStri if ( !aDirectory.getLength( ) ) return NULL; - IMallocPtr pIMalloc; - SHGetMalloc(&pIMalloc); + LPITEMIDLIST lpItemIdList(NULL); - LPITEMIDLIST lpItemIdList = static_cast<LPITEMIDLIST>( - pIMalloc->Alloc(sizeof(ITEMIDLIST))); + IShellFolderPtr pIShellFolder; + SHGetDesktopFolder(&pIShellFolder); - if (lpItemIdList) + if (pIShellFolder.is()) { - IShellFolderPtr pIShellFolder; - SHGetDesktopFolder(&pIShellFolder); - - if (pIShellFolder.is()) - { - pIShellFolder->ParseDisplayName( - NULL, - NULL, - reinterpret_cast<LPOLESTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )), - NULL, - &lpItemIdList, - NULL ); - } + pIShellFolder->ParseDisplayName( + NULL, + NULL, + reinterpret_cast<LPWSTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )), + NULL, + &lpItemIdList, + NULL ); } - if (pIMalloc.is()) - pIMalloc->Free(lpItemIdList); - - lpItemIdList = NULL; - return lpItemIdList; } diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx index befd02352243..e253385a3c3d 100644 --- a/fpicker/source/win32/misc/WinImplHelper.cxx +++ b/fpicker/source/win32/misc/WinImplHelper.cxx @@ -69,6 +69,7 @@ const sal_Unicode AMPERSAND_SIGN = L'&'; // Windows 2000 VER_PLATFORM_WIN32_NT 5 0 // Windows XP VER_PLATFORM_WIN32_NT 5 1 // Windows Vista VER_PLATFORM_WIN32_NT 6 0 +// Windows 7 VER_PLATFORM_WIN32_NT 6 1 // Windows 95 VER_PLATFORM_WIN32_WINDOWS 4 0 // Windows 98 VER_PLATFORM_WIN32_WINDOWS 4 10 // Windows ME VER_PLATFORM_WIN32_WINDOWS 4 90 @@ -94,25 +95,47 @@ bool SAL_CALL IsWindowsVersion(unsigned int PlatformId, unsigned int MajorVersio } //------------------------------------------------------------ -// determine if we are running under Win2000 +// determine if we are running under Vista or newer OS //------------------------------------------------------------ -bool SAL_CALL IsWindowsVista() +bool SAL_CALL IsWindowsVistaOrNewer() { - return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0); + OSVERSIONINFO osvi; + osvi.dwOSVersionInfoSize = sizeof(osvi); + + if(!GetVersionEx(&osvi)) + return false; + + bool bRet = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) && + (osvi.dwMajorVersion >= 6); + + bRet = bRet && + (osvi.dwMinorVersion >= + sal::static_int_cast< unsigned int >(0)); + + return bRet; } //------------------------------------------------------------ -// determine if we are running under Win2000 +// determine if we are running under Windows 7 //------------------------------------------------------------ -bool SAL_CALL IsWindows2000() +bool SAL_CALL IsWindows7() { - return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0); + return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 1); } //------------------------------------------------------------ -// +// determine if we are running under Windows Vista +//------------------------------------------------------------ + +bool SAL_CALL IsWindowsVista() +{ + return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0); +} + +//------------------------------------------------------------ +// determine if we are running under Windows XP //------------------------------------------------------------ bool SAL_CALL IsWindowsXP() @@ -121,6 +144,15 @@ bool SAL_CALL IsWindowsXP() } //------------------------------------------------------------ +// determine if we are running under Windows 2000 +//------------------------------------------------------------ + +bool SAL_CALL IsWindows2000() +{ + return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0); +} + +//------------------------------------------------------------ // //------------------------------------------------------------ diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx index 3a8bd3179c81..6f29a2bb1226 100644 --- a/fpicker/source/win32/misc/WinImplHelper.hxx +++ b/fpicker/source/win32/misc/WinImplHelper.hxx @@ -53,6 +53,8 @@ // deklarations //------------------------------------------------------------------------ +bool SAL_CALL IsWindowsVistaOrNewer(); +bool SAL_CALL IsWindows7(); bool SAL_CALL IsWindowsVista(); bool SAL_CALL IsWindows2000(); bool SAL_CALL IsWindowsXP(); diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 427c2b4dc6d6..3d7b28697dd9 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -350,6 +350,15 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR css::lang::IllegalArgumentException , css::uno::RuntimeException ) { + { + // If the frame is closed the call might lead to crash even with target "_blank", + // so the DisposedException should be thrown in this case + // It still looks to be too dangerous to set the transaction for the whole loading process + // so the guard is used in scopes to let the standard check be used + + TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + } + ReadGuard aReadLock(m_aLock); css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory; diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index a85cee3178c3..a105f7b281a1 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -336,11 +336,21 @@ void ToolBarManager::Destroy() delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId )); } - /* #i99167# removed change for i93173 since there is some weird crash + /* #i99167# removed change for i93173 since there is some weird crash */ // #i93173# delete toolbar lazily as we can still be in one of its handlers m_pToolBar->doLazyDelete(); - */ - delete m_pToolBar; + + Link aEmpty; + m_pToolBar->SetSelectHdl( aEmpty ); + m_pToolBar->SetActivateHdl( aEmpty ); + m_pToolBar->SetDeactivateHdl( aEmpty ); + m_pToolBar->SetClickHdl( aEmpty ); + m_pToolBar->SetDropdownClickHdl( aEmpty ); + m_pToolBar->SetDoubleClickHdl( aEmpty ); + m_pToolBar->SetStateChangedHdl( aEmpty ); + m_pToolBar->SetDataChangedHdl( aEmpty ); + +// delete m_pToolBar; m_pToolBar = 0; } diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index f1df871618f8..bb63e9bb8c8b 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -191,7 +191,7 @@ static sal_Int32 lcl_SkipWhiteSpaces( const OUString &rText, sal_Int32 nStartPos static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nStartPos ) { - // note having nStartPos point right behind the string is OK since that one + // note: having nStartPos point right behind the string is OK since that one // is a correct end-of-sentence position to be returned from a grammar checker... const sal_Int32 nLen = rText.getLength(); @@ -215,14 +215,16 @@ static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nSta sal_Int32 nPosBefore = nStartPos - 1; const sal_Unicode *pStart = rText.getStr(); if (0 <= nPosBefore && nPosBefore < nLen && lcl_IsWhiteSpace( pStart[ nPosBefore ] )) - nStartPos = nPosBefore; - if (0 <= nStartPos && nStartPos < nLen) { - const sal_Unicode *pText = rText.getStr() + nStartPos; - while (pText > pStart && lcl_IsWhiteSpace( *pText )) - --pText; - // now add 1 since we wnat to point to the first char after the last char in the sentence... - nRes = pText - pStart + 1; + nStartPos = nPosBefore; + if (0 <= nStartPos && nStartPos < nLen) + { + const sal_Unicode *pText = rText.getStr() + nStartPos; + while (pText > pStart && lcl_IsWhiteSpace( *pText )) + --pText; + // now add 1 since we want to point to the first char after the last char in the sentence... + nRes = pText - pStart + 1; + } } DBG_ASSERT( 0 <= nRes && nRes <= nLen, "lcl_BacktraceWhiteSpaces return value out of range" ); @@ -577,6 +579,7 @@ void GrammarCheckingIterator::DequeueAndCheck() sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex; sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale ); + DBG_ASSERT( nSuggestedEnd > nStartPos, "nSuggestedEndOfSentencePos calculation failed?" ); linguistic2::ProofreadingResult aRes; @@ -586,6 +589,15 @@ void GrammarCheckingIterator::DequeueAndCheck() aGuard.clear(); uno::Sequence< beans::PropertyValue > aEmptyProps; aRes = xGC->doProofreading( aCurDocId, aCurTxt, aCurLocale, nStartPos, nSuggestedEnd, aEmptyProps ); + + //!! work-around to prevent looping if the grammar checker + //!! failed to properly identify the sentence end + if (aRes.nBehindEndOfSentencePosition <= nStartPos) + { + DBG_ASSERT( 0, "!! Grammarchecker failed to provide end of sentence !!" ); + aRes.nBehindEndOfSentencePosition = nSuggestedEnd; + } + aRes.xFlatParagraph = xFlatPara; aRes.nStartOfSentencePosition = nStartPos; } @@ -718,6 +730,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) ::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() ); aDocId = GetOrCreateDocId( xComponent ); nSuggestedEndOfSentencePos = GetSuggestedEndOfSentence( rText, nStartPos, aCurLocale ); + DBG_ASSERT( nSuggestedEndOfSentencePos > nStartPos, "nSuggestedEndOfSentencePos calculation failed?" ); xGC = GetGrammarChecker( aCurLocale ); } @@ -727,6 +740,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) { uno::Sequence< beans::PropertyValue > aEmptyProps; aTmpRes = xGC->doProofreading( aDocId, rText, aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aEmptyProps ); + + //!! work-around to prevent looping if the grammar checker + //!! failed to properly identify the sentence end + if (aTmpRes.nBehindEndOfSentencePosition <= nStartPos) + { + DBG_ASSERT( 0, "!! Grammarchecker failed to provide end of sentence !!" ); + aTmpRes.nBehindEndOfSentencePosition = nSuggestedEndOfSentencePos; + } + aTmpRes.xFlatParagraph = xFlatPara; aTmpRes.nStartOfSentencePosition = nStartPos; nEndPos = aTmpRes.nBehindEndOfSentencePosition; diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index 46abbb8aa3d0..104fb106836c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -1925,7 +1925,12 @@ <value>1</value> </prop> </node> - <node oor:name=".uno:InsertColumns" oor:op="replace"> + <node oor:name=".uno:InsertRowDialog" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Rows...</value> + </prop> + </node> + <node oor:name=".uno:InsertColumns" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="de">Spalte einfügen</value> <value xml:lang="en-US">Insert Column</value> @@ -1934,7 +1939,12 @@ <value>1</value> </prop> </node> - <node oor:name=".uno:DeleteRows" oor:op="replace"> + <node oor:name=".uno:InsertColumnDialog" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Columns...</value> + </prop> + </node> + <node oor:name=".uno:DeleteRows" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="de">Zeile löschen</value> <value xml:lang="en-US">Delete Row</value> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 52045f4f9e62..a9f0b854198e 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1455,6 +1455,18 @@ Dymamic border coloring means that when the mouse is hovered over a control, and <author>MBA</author> <desc>Contains the current and default path settings used by the Office.</desc> </info> + <group oor:name="Info"> + <info> + <author>CD</author> + <desc>Contains various properties information purpose only.</desc> + </info> + <prop oor:name="WorkPathChanged" oor:type="xs:boolean"> + <info> + <desc>A flag which is set by the tools options dialog whenever a user changed the work path.</desc> + </info> + <value>true</value> + </prop> + </group> <group oor:name="Current"> <info> <author>MBA</author> @@ -2334,6 +2346,13 @@ Dymamic border coloring means that when the mouse is hovered over a control, and </info> <value>true</value> </prop> + <prop oor:name="ShowOfficeUpdateDialog" oor:type="xs:boolean"> + <info> + <author>MAV</author> + <desc>Specifies whether the office update dialog should be shown in case the loaded document has newer ODF version than the maximal supported one.</desc> + </info> + <value>true</value> + </prop> </group> <group oor:name="Security"> <info> diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index 7572879528da..ad6b4d9ce425 100644 --- a/officecfg/registry/schema/org/openoffice/Setup.xcs +++ b/officecfg/registry/schema/org/openoffice/Setup.xcs @@ -352,6 +352,13 @@ </info> <value>false</value> </prop> + <prop oor:name="LastCompatibilityCheckID" oor:type="xs:string"> + <info> + <author>DV</author> + <desc>The build ID of the office. On startup the office will compare this ID with the current build id to decide if the extensions dependencies need to be checked.</desc> + </info> + <value>not checked</value> + </prop> <set oor:name="Factories" oor:node-type="Factory"> <info> <author>AS</author> diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index ceac3c18ba5e..99deee0c97a3 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -262,6 +262,7 @@ public: BOOL bActivate, BOOL bForbidVisible = FALSE, const String* pPostStr = 0); + void ResetLastDir(); //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static SfxApplication* Is_Impl() { return pApp;} diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index c93af303158c..f9377f9908ea 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -229,8 +229,16 @@ public: void SetTitle( const String& rNewTitle ); String GetPath() const; + /** @deprected: Don't use this method to retrieve the selected files + There are file picker which can provide multiple selected file which belong + to different folders. As this method always provides the root folder for all selected + files this cannot work. + */ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetMPath() const; + /** Provides the selected files with full path information */ + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const; + void AddFilter( const String& rFilterName, const String& rExtension ); void SetCurrentFilter( const String& rFilter ); diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index b7f0ab91feee..d74bbd0961d9 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -460,6 +460,14 @@ void SfxApplication::SetLastDir_Impl //-------------------------------------------------------------------- +void SfxApplication::ResetLastDir() +{ + String aEmpty; + pAppData_Impl->aLastDir = aEmpty; +} + +//-------------------------------------------------------------------- + SfxDispatcher* SfxApplication::GetDispatcher_Impl() { return pAppData_Impl->pViewFrame? pAppData_Impl->pViewFrame->GetDispatcher(): pAppData_Impl->pAppDispat; diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 89314944c18d..60beac537e53 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -807,6 +807,9 @@ sal_Bool SfxChildWindow::QueryClose() bAllow = xCtrl->suspend( sal_True ); } + if ( bAllow ) + bAllow = !GetWindow()->IsInModalMode(); + return bAllow; } diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 3dddea833123..995b8250e072 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -495,8 +495,12 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR } #ifdef WNT - LeaveModalMode(); + // #103346 Destroy dialog to prevent problems with custom controls + delete pThis->m_pFileDlg; + pThis->m_pFileDlg = NULL; #endif + + LeaveModalMode(); return 0; } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 64aa1a7d9d26..190cc47dc2f6 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -765,6 +765,8 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util sal_Bool bFailure = sal_False; const SfxPoolItem* pItem = NULL; SfxShell* pShell( 0 ); + // #i102619# Retrieve metric from shell before execution - the shell could be destroyed after execution + SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM ); if ( pDispatcher->GetBindings() ) { if ( !pDispatcher->IsLocked( GetId() ) ) @@ -783,6 +785,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util lNewArgs[nIndex].Value = makeAny( SfxDispatchController_Impl::getSlaveCommand( aDispatchURL )); } + eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() ); SfxAllItemSet aSet( pShell->GetPool() ); TransformParameters( GetId(), lNewArgs, aSet, pSlot ); if ( aSet.Count() ) @@ -811,6 +814,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util } else { + eMapUnit = GetCoreMetric( SFX_APP()->GetPool(), GetId() ); // AppDispatcher SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( GetId(), lNewArgs, aSet ); @@ -850,13 +854,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch; if ( bSuccess && pItem && !pItem->ISA(SfxVoidItem) ) { - // Retrieve metric from pool to have correct sub ID when calling QueryValue - SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM ); - if ( pShell ) - eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() ); - else - eMapUnit = GetCoreMetric( SFX_APP()->GetPool(), GetId() ); - USHORT nSubId( 0 ); if ( eMapUnit == SFX_MAPUNIT_TWIP ) nSubId |= CONVERT_TWIPS; diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index cf2ea488c126..33359a45ec96 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -87,6 +87,7 @@ #endif #include <svtools/pickerhelper.hxx> #include <svtools/docpasswdrequest.hxx> +#include <svtools/docmspasswdrequest.hxx> #include <ucbhelper/content.hxx> #include <ucbhelper/commandenvironment.hxx> #include <comphelper/storagehelper.hxx> @@ -556,6 +557,15 @@ void FileDialogHelper_Impl::updateSelectionBox() } // ------------------------------------------------------------------------ +struct CheckMSPasswordCapability +{ + sal_Bool operator() ( const String rFilterName ) + { + return rFilterName.EqualsAscii("MS Word 97"); + } +}; + +// ------------------------------------------------------------------------ struct CheckPasswordCapability { sal_Bool operator() ( const SfxFilter* _pFilter ) @@ -572,8 +582,9 @@ struct CheckPasswordCapability return true; #endif - return _pFilter->IsOwnFormat() && _pFilter->UsesStorage() - && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() ); + return ( _pFilter->IsOwnFormat() && _pFilter->UsesStorage() + && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() ) ) + || CheckMSPasswordCapability()( _pFilter->GetFilterName() ); } }; @@ -1358,6 +1369,7 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute() //On MacOSX the native file picker has to run in the primordial thread because of drawing issues //On Linux the native gtk file picker, when backed by gnome-vfs2, needs to be run in the same //primordial thread as the ucb gnome-vfs2 provider was initialized in. +/* #ifdef WNT if ( mbSystemPicker ) { @@ -1371,9 +1383,18 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute() } else #endif +*/ { try { +#ifdef WNT + if ( mbSystemPicker ) + { + OReleaseSolarMutex aSolarMutex; + nRet = mxFileDlg->execute(); + } + else +#endif nRet = mxFileDlg->execute(); } catch( const Exception& ) @@ -1650,15 +1671,30 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if( xInteractionHandler.is() ) { // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter. - RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( - ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); - - uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); - xInteractionHandler->handle( rRequest ); - if ( pPasswordRequest->isPassword() ) - rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + if ( CheckMSPasswordCapability()( rFilter ) ) + { + RequestMSDocumentPassword* pMSPasswordRequest = new RequestMSDocumentPassword( + ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); + + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pMSPasswordRequest ); + xInteractionHandler->handle( rRequest ); + if ( pMSPasswordRequest->isPassword() ) + rpSet->Put( SfxStringItem( SID_PASSWORD, pMSPasswordRequest->getPassword() ) ); + else + return ERRCODE_ABORT; + } else - return ERRCODE_ABORT; + { + RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( + ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); + + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); + xInteractionHandler->handle( rRequest ); + if ( pPasswordRequest->isPassword() ) + rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + else + return ERRCODE_ABORT; + } } } } @@ -2582,6 +2618,46 @@ Sequence < OUString > FileDialogHelper::GetMPath() const } // ------------------------------------------------------------------------ +Sequence< ::rtl::OUString > FileDialogHelper::GetSelectedFiles() const +{ + // a) the new way (optional!) + uno::Sequence< ::rtl::OUString > aResultSeq; + uno::Reference< XFilePicker2 > xPickNew(mpImp->mxFileDlg, UNO_QUERY); + if (xPickNew.is()) + { + aResultSeq = xPickNew->getSelectedFiles(); + } + // b) the olde way ... non optional. + else + { + uno::Reference< XFilePicker > xPickOld(mpImp->mxFileDlg, UNO_QUERY_THROW); + Sequence< OUString > lFiles = xPickOld->getFiles(); + ::sal_Int32 nFiles = lFiles.getLength(); + if ( nFiles > 1 ) + { + aResultSeq = Sequence< ::rtl::OUString >( nFiles-1 ); + + INetURLObject aPath( lFiles[0] ); + aPath.setFinalSlash(); + + for (::sal_Int32 i = 1; i < nFiles; i++) + { + if (i == 1) + aPath.Append( lFiles[i] ); + else + aPath.setName( lFiles[i] ); + + aResultSeq[i-1] = ::rtl::OUString(aPath.GetMainURL( INetURLObject::NO_DECODE )); + } + } + else + aResultSeq = lFiles; + } + + return aResultSeq; +} + +// ------------------------------------------------------------------------ String FileDialogHelper::GetDisplayDirectory() const { return mpImp->getPath(); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 21a629eec09e..23093bfa066f 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -576,32 +576,29 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate ) || pImp->m_aDateTime.Month != aInitDate.Month || pImp->m_aDateTime.Year != aInitDate.Year ) { - if ( !IsSystemFileLockingUsed() ) - { - uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); + uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - if ( xHandler.is() ) + if ( xHandler.is() ) + { + try { - try - { - ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( - document::ChangedByOthersRequest() ) ); - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); - xInteractionRequestImpl->setContinuations( aContinuations ); + ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( + document::ChangedByOthersRequest() ) ); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); + aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); + aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); + xInteractionRequestImpl->setContinuations( aContinuations ); - xHandler->handle( xInteractionRequestImpl.get() ); + xHandler->handle( xInteractionRequestImpl.get() ); - ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection(); - if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() ) - { - SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - } + ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection(); + if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() ) + { + SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } - catch ( uno::Exception& ) - {} } + catch ( uno::Exception& ) + {} } } } diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 8fae29a1847c..ecd9ae7aee42 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -177,33 +177,17 @@ void impl_FillURLList( sfx2::FileDialogHelper* _pFileDlg, SvStringsDtor*& _rpURL { DBG_ASSERT( _pFileDlg, "DocumentInserter::fillURLList(): invalid file dialog" ); DBG_ASSERT( !_rpURLList, "DocumentInserter::fillURLList(): URLList already exists" ); - Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetMPath(); + Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetSelectedFiles(); if ( aPathSeq.getLength() ) { _rpURLList = new SvStringsDtor; - if ( aPathSeq.getLength() == 1 ) + for ( USHORT i = 0; i < aPathSeq.getLength(); ++i ) { - ::rtl::OUString sFileURL( aPathSeq[0] ); - String* pURL = new String( sFileURL ); - _rpURLList->Insert( pURL, 0 ); - } - else - { - INetURLObject aPathObj( aPathSeq[0] ); - aPathObj.setFinalSlash(); - - for ( USHORT i = 1; i < aPathSeq.getLength(); ++i ) - { - if ( i == 1 ) - aPathObj.Append( aPathSeq[i] ); - else - aPathObj.setName( aPathSeq[i] ); - - String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) ); - _rpURLList->Insert( pURL, _rpURLList->Count() ); - } + INetURLObject aPathObj( aPathSeq[i] ); + String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) ); + _rpURLList->Insert( pURL, _rpURLList->Count() ); } } } diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 731c04c1086d..7df93afaa63e 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2064,7 +2064,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName, Content aResultContent; if ( Content::create( aNewTemplateTargetURL, xEnv, aResultContent ) ) { - ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadonly" ) ); + ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ); uno::Any aProperty; sal_Bool bReadOnly = sal_False; if ( getProperty( aResultContent, aPropertyName, aProperty ) && ( aProperty >>= bReadOnly ) && bReadOnly ) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 8e1c618f65cd..a7910c463cf9 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -84,6 +84,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> +#include <comphelper/configurationhelper.hxx> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -2251,6 +2252,33 @@ sal_Bool SfxObjectShell::UseInteractionToHandleError( return bResult; } +sal_Bool SfxObjectShell_Impl::NeedsOfficeUpdateDialog() +{ + // if the configuration is not available for any reason, the default behavior is to show the message + sal_Bool bResult = sal_True; + + try + { + uno::Reference< lang::XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW ); + uno::Reference< uno::XInterface > xCommonConfig( + ::comphelper::ConfigurationHelper::openConfig( + xServiceManager, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), + ::comphelper::ConfigurationHelper::E_STANDARD ), + uno::UNO_SET_THROW ); + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCommonConfig, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Load/" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowOfficeUpdateDialog" ) ) ) >>= bResult; + } + catch( uno::Exception& ) + { + } + + return bResult; +} + sal_Int16 SfxObjectShell_Impl::getCurrentMacroExecMode() const { sal_Int16 nImposedExecMode( MacroExecMode::NEVER_EXECUTE ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 7cd33667c2ac..89f2fe74e2f9 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -828,37 +828,28 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) } } - uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() ); - if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater ) - { - // scan the generator string (within meta.xml) - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentProperties> xDocProps - = xDPS->getDocumentProperties(); - if ( xDocProps.is() ) + if ( pMedium->HasStorage_Impl() ) + { + uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() ); + if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater ) { - uno::Reference<beans::XPropertySet> xUserDefinedProps( - xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - uno::Any aAny; + uno::Reference<beans::XPropertySet> xStorageProps( pMedium->GetStorage(), uno::UNO_QUERY_THROW ); + ::rtl::OUString sVersion; try { - aAny = xUserDefinedProps->getPropertyValue( - DEFINE_CONST_UNICODE("ODFVersion")); + xStorageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= sVersion; } catch( const uno::Exception& ) { // Custom Property "ODFVersion" does not exist } - ::rtl::OUString sVersion; - if ( (aAny >>= sVersion) && sVersion.getLength() ) + if ( sVersion.getLength() ) { double nVersion = sVersion.toDouble(); - if ( nVersion > 1.20001 ) + if ( nVersion > 1.20001 && SfxObjectShell_Impl::NeedsOfficeUpdateDialog() ) // ODF version greater than 1.2 - added some decimal places to be safe against floating point conversion errors (hack) { - ::rtl::OUString sDocumentURL( pMedium->GetOrigURL() ); ::rtl::OUString aSystemFileURL; if ( osl::FileBase::getSystemPathFromFileURL( sDocumentURL, aSystemFileURL ) == osl::FileBase::E_None ) @@ -2100,6 +2091,7 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) } pMedium->ClearBackup_Impl(); + pMedium->LockOrigFileOnDemand( sal_True, sal_False ); return bOk; } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index fc0440535a47..eb8719435406 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -174,6 +174,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); + static sal_Bool NeedsOfficeUpdateDialog(); + // IMacroDocumentAccess overridables virtual sal_Int16 getCurrentMacroExecMode() const; virtual sal_Bool setCurrentMacroExecMode( sal_uInt16 nMacroMode ); diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx index 47f7a9b82c40..4da8b7fa95be 100644 --- a/shell/inc/internal/basereader.hxx +++ b/shell/inc/internal/basereader.hxx @@ -50,6 +50,8 @@ public: protected: // protected because its only an implementation relevant class CBaseReader( const std::string& DocumentName ); + CBaseReader( void* stream, zlib_filefunc_def* fa );
+ virtual void start_document(); virtual void end_document(); diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx index 41491df9fa8b..d8b2d77d28c0 100644 --- a/shell/inc/internal/contentreader.hxx +++ b/shell/inc/internal/contentreader.hxx @@ -43,6 +43,9 @@ public: //CContentReader( const std::string& DocumentName ); CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale ); + CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
+ + /** Get the chunkbuffer. @return diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx index 62248beb845f..1e004b5a3727 100644 --- a/shell/inc/internal/metainforeader.hxx +++ b/shell/inc/internal/metainforeader.hxx @@ -45,6 +45,9 @@ public: virtual ~CMetaInfoReader(); CMetaInfoReader( const std::string& DocumentName ); + + CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+ /** check if the Tag is in the target meta.xml file. @param TagName diff --git a/shell/inc/internal/propsheets.hxx b/shell/inc/internal/propsheets.hxx index 3b14dc574fe3..0ebafcf0aa3a 100644 --- a/shell/inc/internal/propsheets.hxx +++ b/shell/inc/internal/propsheets.hxx @@ -92,7 +92,6 @@ private: private: long m_RefCnt; char m_szFileName[MAX_PATH]; - std::auto_ptr<CMetaInfoReader> m_pMetaInfo; }; #endif diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx index 316a5e716d5b..730263060041 100644 --- a/shell/inc/internal/types.hxx +++ b/shell/inc/internal/types.hxx @@ -36,6 +36,9 @@ #include <utility> #include <vector> #include <stack> +#include <external/zlib/zlib.h>
+#include <external/zlib/ioapi.h>
+ typedef std::vector<std::wstring> StringList_t; diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx index 81da437544fe..2a860bb4c6cd 100644 --- a/shell/inc/internal/zipfile.hxx +++ b/shell/inc/internal/zipfile.hxx @@ -35,7 +35,9 @@ #define _WINDOWS #endif -#include <external/zlib/unzip.h> +
+#include <external/zlib/unzip.h>
+
#include <string> #include <vector> @@ -69,6 +71,9 @@ public: */ static bool IsZipFile(const std::string& FileName); + static bool IsZipFile(void* stream);
+ + /** Returns wheter the version of the specified zip file may be uncompressed with the currently used zlib version or not @@ -86,6 +91,7 @@ public: */ static bool IsValidZipFileVersionNumber(const std::string& FileName); + static bool IsValidZipFileVersionNumber(void* stream);
public: @@ -103,6 +109,9 @@ public: */ ZipFile(const std::string& FileName); + ZipFile(void* stream, zlib_filefunc_def* fa);
+ + /** Destroys a zip file */ ~ZipFile(); diff --git a/shell/prj/build.lst b/shell/prj/build.lst index 01077cbcb87d..7a2e91f973ba 100644 --- a/shell/prj/build.lst +++ b/shell/prj/build.lst @@ -31,6 +31,7 @@ sl shell\source\backends\wininetbe nmake - w sl_backends_w sl shell\source\backends\macbe nmake - u sl_backends_macbe sl_inc NULL sl shell\source\backends\gconfbe nmake - u sl_backends_gconfbe sl_inc NULL sl shell\source\backends\kdebe nmake - u sl_backends_kdebe sl_inc NULL +sl shell\source\backends\kde4be nmake - u sl_backends_kde4be sl_inc NULL sl shell\source\backends\desktopbe nmake - u sl_backends_desktopbe sl_inc NULL sl shell\source\win32\shlxthandler\ooofilt nmake - w sl_win32_shlxthandler_ooofilt sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_util.w sl_all sl_inc NULL sl shell\source\win32\shlxthandler\ooofilt\proxy nmake - w sl_win32_ooofiltproxy sl_inc NULL diff --git a/shell/source/all/makefile.mk b/shell/source/all/makefile.mk index 3695abae798c..623aad6d69c1 100755 --- a/shell/source/all/makefile.mk +++ b/shell/source/all/makefile.mk @@ -35,6 +35,7 @@ PRJNAME=shell TARGET=xmlparser ENABLE_EXCEPTIONS=TRUE + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -61,6 +62,7 @@ CFLAGS+=-DSYSTEM_EXPAT .ENDIF SLOFILES=$(SLO)$/xml_parser.obj + .IF "$(BUILD_X64)"!="" SLOFILES_X64=$(SLO_X64)$/xml_parser.obj .ENDIF # "$(BUILD_X64)"!="" diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx index 8412de36e458..d9be6740f057 100644 --- a/shell/source/all/ooofilereader/basereader.cxx +++ b/shell/source/all/ooofilereader/basereader.cxx @@ -50,6 +50,15 @@ m_ZipFile( DocumentName ) // //------------------------------ +CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
+m_ZipFile( sw , fa )
+{
+}
+
+//------------------------------
+//
+//------------------------------
+ CBaseReader::~CBaseReader() { } diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx index f1990c741721..111647e70ad6 100644 --- a/shell/source/all/ooofilereader/contentreader.cxx +++ b/shell/source/all/ooofilereader/contentreader.cxx @@ -61,6 +61,29 @@ CBaseReader( DocumentName ) } } +CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
+CBaseReader( stream, fa )
+{
+try
+ {
+ m_DefaultLocale = DocumentLocale;
+ Initialize( DOC_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+}
+ + /** destructor. */ diff --git a/shell/source/all/ooofilereader/makefile.mk b/shell/source/all/ooofilereader/makefile.mk index 1e9788cf3f17..b893db45d849 100644 --- a/shell/source/all/ooofilereader/makefile.mk +++ b/shell/source/all/ooofilereader/makefile.mk @@ -35,6 +35,7 @@ TARGET=ooofilereader LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -65,7 +66,7 @@ LIB1TARGET=$(SLB)$/$(TARGET).lib LIB1OBJFILES=$(SLOFILES) LIB1FILES=$(SLB)$/zipfile.lib\ $(SLB)$/xmlparser.lib - + .IF "$(BUILD_X64)"!="" SLOFILES_X64=$(SLO_X64)$/basereader.obj\ $(SLO_X64)$/metainforeader.obj\ diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx index f09d8b3e41d0..cec17b59d3c9 100644 --- a/shell/source/all/ooofilereader/metainforeader.cxx +++ b/shell/source/all/ooofilereader/metainforeader.cxx @@ -80,6 +80,48 @@ CBaseReader( DocumentName ) } } +CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
+CBaseReader( stream, fa)
+{
+try
+ {
+ m_pKeywords_Builder = new CKeywordsTag( );
+ m_pSimple_Builder = new CSimpleTag( );
+ m_pDummy_Builder = new CDummyTag( );
+
+ //retrieve all infomation that is useful
+ m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG;
+
+ m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG;
+
+ Initialize( META_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+
+}
+
/** destructor. */ diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk index a7f9c95b95cf..9f294ce7aad0 100644 --- a/shell/source/all/zipfile/makefile.mk +++ b/shell/source/all/zipfile/makefile.mk @@ -33,6 +33,9 @@ PRJ=..$/..$/.. PRJNAME=shell TARGET=zipfile ENABLE_EXCEPTIONS=TRUE +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+ + # --- Settings ----------------------------------------------------- @@ -45,8 +48,8 @@ SLOFILES=$(SLO)$/zipfile.obj\ $(SLO)$/zipexcptn.obj SLOFILES_X64=$(SLO_X64)$/zipfile.obj\ - $(SLO_X64)$/zipexcptn.obj - + $(SLO_X64)$/zipexcptn.obj + # --- Targets ------------------------------------------------------ .INCLUDE : set_wntx64.mk diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx index b174c7a023e3..06fb6cc934d3 100644 --- a/shell/source/all/zipfile/zipfile.cxx +++ b/shell/source/all/zipfile/zipfile.cxx @@ -79,6 +79,12 @@ bool ZipFile::IsZipFile(const std::string& /*FileName*/) return true; } +bool ZipFile::IsZipFile(void* /*stream*/)
+{
+ return true;
+}
+ + /** Returns wheter the version of the specified zip file may be uncompressed with the currently used zlib version or not @@ -99,6 +105,12 @@ bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/) return true; } +bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
+{
+ return true;
+}
+ + /** Constructs a zip file from a zip file @precond The given parameter must be a string with length > 0 @@ -119,6 +131,16 @@ ZipFile::ZipFile(const std::string& FileName) throw IOException(-1); } +ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa)
+{
+ fa->opaque = stream;
+ m_uzFile = unzOpen2((const char *)NULL, fa);
+
+ if (0 == m_uzFile)
+ throw IOException(-1);
+}
+ + /** Destroys a zip file */ ZipFile::~ZipFile() diff --git a/shell/source/backends/kde4be/exports.map b/shell/source/backends/kde4be/exports.map new file mode 100644 index 000000000000..ba501f9ae076 --- /dev/null +++ b/shell/source/backends/kde4be/exports.map @@ -0,0 +1,10 @@ +UDK_3_0_0 { + global: + GetVersionInfo; + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +}; diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx new file mode 100644 index 000000000000..7eb093bf7217 --- /dev/null +++ b/shell/source/backends/kde4be/kde4backend.cxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4backend.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" + +#include "kde4backend.hxx" +#include "kde4commonlayer.hxx" +#include "kde4inetlayer.hxx" +#include "kde4vcllayer.hxx" +#include "kde4pathslayer.hxx" + +//------------------------------------------------------------------------------ + +KDEBackend* KDEBackend::mInstance= 0; + +KDEBackend* KDEBackend::createInstance(const uno::Reference<uno::XComponentContext>& xContext) +{ + if (mInstance == 0) + { + mInstance = new KDEBackend (xContext); + } + + return mInstance; +} + +//------------------------------------------------------------------------------ + +KDEBackend::KDEBackend(const uno::Reference<uno::XComponentContext>& xContext) + throw (backend::BackendAccessException) + : BackendBase(mMutex), m_xContext(xContext) +{ +} + +//------------------------------------------------------------------------------ + +KDEBackend::~KDEBackend(void) +{ +} + +//------------------------------------------------------------------------------ + +uno::Reference<backend::XLayer> SAL_CALL KDEBackend::getLayer( + const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */) + throw (backend::BackendAccessException, lang::IllegalArgumentException) +{ + uno::Reference<backend::XLayer> xLayer; + + if( aComponent.equalsAscii("org.openoffice.Office.Common" ) ) + { + xLayer = new KDECommonLayer(m_xContext); + } + else if( aComponent.equalsAscii("org.openoffice.Inet" ) ) + { + xLayer = new KDEInetLayer(m_xContext); + } + else if( aComponent.equalsAscii("org.openoffice.VCL" ) ) + { + xLayer = new KDEVCLLayer(m_xContext); + } + else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) ) + { + xLayer = new KDEPathsLayer(m_xContext); + } + + return xLayer; +} + +//------------------------------------------------------------------------------ + +uno::Reference<backend::XUpdatableLayer> SAL_CALL +KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */) + throw (backend::BackendAccessException,lang::NoSupportException, + lang::IllegalArgumentException) +{ + throw lang::NoSupportException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ), + *this) ; +} + +//------------------------------------------------------------------------------ + +rtl::OUString SAL_CALL KDEBackend::getBackendName(void) +{ + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDE4Backend") ); +} + +//------------------------------------------------------------------------------ + +rtl::OUString SAL_CALL KDEBackend::getImplementationName(void) + throw (uno::RuntimeException) +{ + return getBackendName() ; +} + +//------------------------------------------------------------------------------ + +uno::Sequence<rtl::OUString> SAL_CALL KDEBackend::getBackendServiceNames(void) +{ + uno::Sequence<rtl::OUString> aServices(1) ; + aServices[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDE4Backend")) ; + + return aServices ; +} + +//------------------------------------------------------------------------------ + +sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName) + throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > const svc = getBackendServiceNames(); + + for(sal_Int32 i = 0; i < svc.getLength(); ++i ) + if(svc[i] == aServiceName) + return true; + + return false; +} + +//------------------------------------------------------------------------------ + +uno::Sequence<rtl::OUString> +SAL_CALL KDEBackend::getSupportedServiceNames(void) + throw (uno::RuntimeException) +{ + return getBackendServiceNames() ; +} + +// --------------------------------------------------------------------------------------- diff --git a/shell/source/backends/kde4be/kde4backend.hxx b/shell/source/backends/kde4be/kde4backend.hxx new file mode 100644 index 000000000000..01599c41a74d --- /dev/null +++ b/shell/source/backends/kde4be/kde4backend.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4backend.hxx,v $ + * $Revision: 1.4 $ + * + * 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. + * + ************************************************************************/ + +#pragma once + +#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp> +#include <com/sun/star/configuration/backend/CannotConnectException.hpp> +#include <cppuhelper/compbase2.hxx> + +#ifndef INCLUDED_MAP +#include <map> +#define INCLUDED_MAP +#endif + +namespace css = com::sun::star ; +namespace uno = css::uno ; +namespace lang = css::lang ; +namespace backend = css::configuration::backend ; + + +//------------------------------------------------------------------------------ +typedef cppu::WeakComponentImplHelper2<backend::XSingleLayerStratum, + lang::XServiceInfo> BackendBase ; + +/** + Implements the SingleLayerStratum service for KDE access. + */ +class KDEBackend : public BackendBase { + public : + + static KDEBackend* createInstance(const uno::Reference<uno::XComponentContext>& xContext); + + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName( ) + throw (uno::RuntimeException) ; + + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& aServiceName ) + throw (uno::RuntimeException) ; + + virtual uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames( ) + throw (uno::RuntimeException) ; + + /** + Provides the implementation name. + + @return implementation name + */ + static rtl::OUString SAL_CALL getBackendName(void) ; + + /** + Provides the supported services names + + @return service names + */ + static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ; + + //XSingleLayerStratum + virtual uno::Reference<backend::XLayer> SAL_CALL + getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp ) + throw (backend::BackendAccessException, lang::IllegalArgumentException) ; + + virtual uno::Reference<backend::XUpdatableLayer> SAL_CALL + getUpdatableLayer( const rtl::OUString& aLayerId ) + throw (backend::BackendAccessException, lang::NoSupportException, + lang::IllegalArgumentException) ; + + protected: + /** + Service constructor from a service factory. + + @param xContext component context + */ + KDEBackend(const uno::Reference<uno::XComponentContext>& xContext) + throw (backend::BackendAccessException); + + /** Destructor */ + ~KDEBackend(void) ; + + private: + + /** Build KDE/OO mapping table */ + void initializeMappingTable (); + + + /** The component context */ + uno::Reference<uno::XComponentContext> m_xContext; + + /** Mutex for reOOurces protection */ + osl::Mutex mMutex ; + + static KDEBackend* mInstance; +}; diff --git a/shell/source/backends/kde4be/kde4be.xml b/shell/source/backends/kde4be/kde4be.xml new file mode 100644 index 000000000000..ea2d9be6dd6b --- /dev/null +++ b/shell/source/backends/kde4be/kde4be.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>kde4be</module-name> + <component-description> + <author> Éric Bischoff </author> + <name>com.sun.star.comp.configuration.backend.KDE4Backend</name> + <description> The KDE4 configuration backend </description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta"/> + <supported-service>com.sun.star.comp.configuration.backend.KDE4Backend</supported-service> + <service-dependency>...</service-dependency> + <type>com.sun.star.configuration.backend.XBackendChangesListener</type> + <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type> + <type>com.sun.star.configuration.backend.XLayerHandler</type> + <type>com.sun.star.configuration.backend.XSingleLayerStratum</type> + <type>com.sun.star.lang.XMultiComponentFactory</type> + <type>com.sun.star.lang.XServiceInfo</type> + <type>com.sun.star.lang.XSingleComponentFactory</type> + <type>com.sun.star.lang.XTypeProvider</type> + <type>com.sun.star.uno.TypeClass</type> + <type>com.sun.star.uno.XAggregation</type> + <type>com.sun.star.uno.XComponentContext</type> + <type>com.sun.star.uno.XCurrentContext</type> + <type>com.sun.star.uno.XWeak</type> + <type>com.sun.star.registry.XRegistryKey</type> + </component-description> + <project-build-dependency>cppuhelper</project-build-dependency> + <project-build-dependency>cppu</project-build-dependency> + <project-build-dependency>sal</project-build-dependency> + <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency> + <runtime-module-dependency>cppu3</runtime-module-dependency> + <runtime-module-dependency>sal3</runtime-module-dependency> +</module-description> diff --git a/shell/source/backends/kde4be/kde4be1-ucd.txt b/shell/source/backends/kde4be/kde4be1-ucd.txt new file mode 100644 index 000000000000..9671199b26e3 --- /dev/null +++ b/shell/source/backends/kde4be/kde4be1-ucd.txt @@ -0,0 +1,6 @@ +[ComponentDescriptor] +ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend +ComponentName=kde4be1.uno.so +LoaderName=com.sun.star.loader.SharedLibrary +[SupportedServices] +com.sun.star.configuration.backend.KDE4Backend diff --git a/shell/source/backends/kde4be/kde4becdef.cxx b/shell/source/backends/kde4be/kde4becdef.cxx new file mode 100644 index 000000000000..da0d22ead22e --- /dev/null +++ b/shell/source/backends/kde4be/kde4becdef.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4becdef.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" +#include "kde4backend.hxx" + +#include <kapplication.h> + +#include <cppuhelper/implementationentry.hxx> + +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include "uno/current_context.hxx" + +namespace css = com::sun::star ; +namespace uno = css::uno ; +namespace lang = css::lang ; +namespace backend = css::configuration::backend ; + +//============================================================================== + +static uno::Reference<uno::XInterface> SAL_CALL createKDEBackend(const uno::Reference<uno::XComponentContext>& xContext) +{ + try { + uno::Reference< uno::XCurrentContext > xCurrentContext(uno::getCurrentContext()); + + if (xCurrentContext.is()) + { + uno::Any aValue = xCurrentContext->getValueByName( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) ); + + rtl::OUString aDesktopEnvironment; + if ( (aValue >>= aDesktopEnvironment) && (aDesktopEnvironment.equalsAscii("KDE")) && (KApplication::kApplication() != NULL) ) + return * KDEBackend::createInstance(xContext); + } + + return uno::Reference<uno::XInterface>(); + + } catch (uno::RuntimeException e) { + return uno::Reference<uno::XInterface>(); + } + +} + +//============================================================================== + +static const cppu::ImplementationEntry kImplementations_entries[] = +{ + { + createKDEBackend, + KDEBackend::getBackendName, + KDEBackend::getBackendServiceNames, + cppu::createSingleComponentFactory, + NULL, + 0 + }, + { NULL, NULL, NULL, NULL, NULL, 0 } +} ; +//------------------------------------------------------------------------------ + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **aEnvTypeName, + uno_Environment **) { + *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; +} + +//------------------------------------------------------------------------------ + +extern "C" sal_Bool SAL_CALL component_writeInfo(void *, + void *pRegistryKey) { + + using namespace ::com::sun::star::registry; + if (pRegistryKey) + { + try + { + uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + KDEBackend::getBackendName() + ); + + // Register associated service names + uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") ) + ); + + uno::Sequence<rtl::OUString> sServiceNames = KDEBackend::getBackendServiceNames(); + for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i) + xServicesKey->createKey(sServiceNames[i]); + + return sal_True; + } + + catch( InvalidRegistryException& ) + { + OSL_ENSURE(sal_False, "InvalidRegistryException caught"); + } + } + + return sal_False; +} + +//------------------------------------------------------------------------------ + +extern "C" void *component_getFactory(const sal_Char *aImplementationName, + void *aServiceManager, + void *aRegistryKey) { + + return cppu::component_getFactoryHelper( + aImplementationName, + aServiceManager, + aRegistryKey, + kImplementations_entries) ; +} +//------------------------------------------------------------------------------ diff --git a/shell/source/backends/kde4be/kde4commonlayer.cxx b/shell/source/backends/kde4be/kde4commonlayer.cxx new file mode 100644 index 000000000000..1ce844672225 --- /dev/null +++ b/shell/source/backends/kde4be/kde4commonlayer.cxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4commonlayer.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" + +#include "kde4commonlayer.hxx" + +#include <kemailsettings.h> +#include <kglobalsettings.h> + +#include <QFont> + +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#define SPACE ' ' + +//============================================================================== + +KDECommonLayer::KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber; + uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); + if( xServiceManager.is() ) + { + m_xLayerContentDescriber = LayerDescriber::query( + xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); + } + else + { + OSL_TRACE("Could not retrieve ServiceManager"); + } +} + +//------------------------------------------------------------------------------ + +void SAL_CALL KDECommonLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, lang::NullPointerException, + lang::WrappedTargetException, uno::RuntimeException) +{ + if( ! m_xLayerContentDescriber.is() ) + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" + ) ), static_cast < backend::XLayer * > (this) ); + } + + uno::Sequence<backend::PropertyInfo> aPropInfoList(3); + sal_Int32 nProperties = 0; + + // Email client settings + KEMailSettings aEmailSettings; + QString aClientProgram; + ::rtl::OUString sClientProgram; + + aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); + if ( aClientProgram.isEmpty() ) + aClientProgram = "kmail"; + else + aClientProgram = aClientProgram.section(SPACE, 0, 0); + sClientProgram = (const sal_Unicode *) aClientProgram.utf16(); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sClientProgram ); + + // Source code font settings + QFont aFixedFont; + QString aFontName; + :: rtl::OUString sFontName; + short nFontHeight; + + aFixedFont = KGlobalSettings::fixedFont(); + aFontName = aFixedFont.family(); + sFontName = (const sal_Unicode *) aFontName.utf16(); + nFontHeight = aFixedFont.pointSize(); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontName") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sFontName ); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontHeight") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "short" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( nFontHeight ); + + if( nProperties > 0 ) + { + aPropInfoList.realloc(nProperties); + m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); + } +} + +//------------------------------------------------------------------------------ + +rtl::OUString SAL_CALL KDECommonLayer::getTimestamp(void) + throw (uno::RuntimeException) +{ + // Return the value as timestamp to avoid regenerating the binary cache + // on each office launch. + + KEMailSettings aEmailSettings; + QString aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram ); + aClientProgram = aClientProgram.section(SPACE, 0, 0); + + QString aFixedFont = KGlobalSettings::fixedFont().toString(); + + ::rtl::OUString sTimeStamp, + sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); + + sTimeStamp = (const sal_Unicode *) aClientProgram.utf16(); + sTimeStamp += sep; + sTimeStamp += (const sal_Unicode *) aFixedFont.utf16(); + + return sTimeStamp; +} diff --git a/shell/source/backends/kde4be/kde4commonlayer.hxx b/shell/source/backends/kde4be/kde4commonlayer.hxx new file mode 100644 index 000000000000..9ce4cd4dc962 --- /dev/null +++ b/shell/source/backends/kde4be/kde4commonlayer.hxx @@ -0,0 +1,51 @@ +#pragma once + +#include "kde4backend.hxx" +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> +#include <cppuhelper/implbase2.hxx> + +namespace css = com::sun::star ; +namespace uno = css::uno ; +namespace lang = css::lang ; +namespace backend = css::configuration::backend ; +namespace util = css::util ; + +/** + Implementation of the XLayer interface for the KDE values mapped into + the org.openoffice.Office.Common configuration component. + */ +class KDECommonLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, + lang::NullPointerException, + lang::WrappedTargetException, + uno::RuntimeException) ; + + // XTimeStamped + virtual rtl::OUString SAL_CALL getTimestamp(void) + throw (uno::RuntimeException); + + protected: + + /** Destructor */ + ~KDECommonLayer(void) {} + + private : + uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ; +}; diff --git a/shell/source/backends/kde4be/kde4inetlayer.cxx b/shell/source/backends/kde4be/kde4inetlayer.cxx new file mode 100644 index 000000000000..bc661a093fb7 --- /dev/null +++ b/shell/source/backends/kde4be/kde4inetlayer.cxx @@ -0,0 +1,255 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4inetlayer.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" + +#include <kprotocolmanager.h> + +#include "kde4inetlayer.hxx" +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#define COMMA ',' +#define SEMI_COLON ';' + +//============================================================================== + +KDEInetLayer::KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber; + uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); + if( xServiceManager.is() ) + { + m_xLayerContentDescriber = LayerDescriber::query( + xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); + } + else + { + OSL_TRACE("Could not retrieve ServiceManager"); + } +} + +//------------------------------------------------------------------------------ + +void SAL_CALL KDEInetLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, lang::NullPointerException, + lang::WrappedTargetException, uno::RuntimeException) +{ + if( ! m_xLayerContentDescriber.is() ) + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" + ) ), static_cast < backend::XLayer * > (this) ); + } + + uno::Sequence<backend::PropertyInfo> aPropInfoList(8); + sal_Int32 nProperties = 0; + + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: // Proxies are manually configured + setProxy(aPropInfoList, nProperties, 1, + KProtocolManager::noProxyFor(), + KProtocolManager::proxyFor( "HTTP" ), + KProtocolManager::proxyFor( "FTP" ), + KProtocolManager::proxyFor( "HTTPS" )); + break; + case KProtocolManager::PACProxy: // A proxy configuration URL has been given + case KProtocolManager::WPADProxy: // A proxy should be automatically discovered + case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables +// In such cases, the proxy address is not stored in KDE, but determined dynamically. +// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind... +// The best we can do here is to ask the current value for a given address. + setProxy(aPropInfoList, nProperties, 1, + KProtocolManager::noProxyFor(), + KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ), + KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ), + KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") )); + break; + default: // No proxy is used + setProxy(aPropInfoList, nProperties, 0); + } + + if ( nProperties > 0 ) + { + aPropInfoList.realloc(nProperties); + m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); + } +} + +//------------------------------------------------------------------------------ + +rtl::OUString SAL_CALL KDEInetLayer::getTimestamp(void) + throw (uno::RuntimeException) +{ + // Return the value as timestamp to avoid regenerating the binary cache + // on each office launch. + + QString aProxyType, aNoProxyFor, aHTTPProxy, aHTTPSProxy, aFTPProxy; + + switch ( KProtocolManager::proxyType() ) + { + case KProtocolManager::ManualProxy: + aProxyType = '1'; + aNoProxyFor = KProtocolManager::noProxyFor(); + aHTTPProxy = KProtocolManager::proxyFor( "HTTP" ); + aHTTPProxy = KProtocolManager::proxyFor( "HTTPS" ); + aFTPProxy = KProtocolManager::proxyFor( "FTP" ); + break; + case KProtocolManager::PACProxy: + case KProtocolManager::WPADProxy: + case KProtocolManager::EnvVarProxy: + aProxyType = '1'; + aNoProxyFor = KProtocolManager::noProxyFor(); + aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ); + aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") ); + aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ); + break; + default: + aProxyType = '0'; + } + + ::rtl::OUString sTimeStamp, + sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); + + sTimeStamp = (const sal_Unicode *) aProxyType.utf16(); + sTimeStamp += sep; + sTimeStamp += (const sal_Unicode *) aNoProxyFor.utf16(); + sTimeStamp += sep; + sTimeStamp += (const sal_Unicode *) aHTTPProxy.utf16(); + sTimeStamp += sep; + sTimeStamp += (const sal_Unicode *) aHTTPSProxy.utf16(); + sTimeStamp += sep; + sTimeStamp += (const sal_Unicode *) aFTPProxy.utf16(); + + return sTimeStamp; +} + +//------------------------------------------------------------------------------ + +void SAL_CALL KDEInetLayer::setProxy + (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties, + int nProxyType, const QString &aNoProxy, const QString &aHTTPProxy, const QString &aFTPProxy, const QString &aHTTPSProxy ) const +{ + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "int" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( (sal_Int32) nProxyType ); + + if (nProxyType == 0) return; + + if ( !aNoProxy.isEmpty() ) + { + QString aNoProxyFor(aNoProxy); + ::rtl::OUString sNoProxyFor; + + aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON ); + sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16(); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sNoProxyFor ); + } + + if ( !aHTTPProxy.isEmpty() ) + { + KUrl aProxy(aHTTPProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); + sal_Int32 nPort = aProxy.port(); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "int" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); + } + + if ( !aHTTPSProxy.isEmpty() ) + { + KUrl aProxy(aHTTPSProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); + sal_Int32 nPort = aProxy.port(); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "int" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); + } + + if ( !aFTPProxy.isEmpty() ) + { + KUrl aProxy(aFTPProxy); + ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16(); + sal_Int32 nPort = aProxy.port(); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sProxy ); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "int" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( nPort ); + } +} + diff --git a/shell/source/backends/kde4be/kde4inetlayer.hxx b/shell/source/backends/kde4be/kde4inetlayer.hxx new file mode 100644 index 000000000000..64d00fec45fc --- /dev/null +++ b/shell/source/backends/kde4be/kde4inetlayer.hxx @@ -0,0 +1,59 @@ +#pragma once + +#include <QString> + +#include "kde4backend.hxx" + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> +#include <cppuhelper/implbase2.hxx> + +namespace css = com::sun::star ; +namespace uno = css::uno ; +namespace lang = css::lang ; +namespace backend = css::configuration::backend ; +namespace util = css::util ; + +/** + Implementation of the XLayer interface for the KDE values mapped into + the org.openoffice.Inet configuration component. + */ +class KDEInetLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, + lang::NullPointerException, + lang::WrappedTargetException, + uno::RuntimeException) ; + + // XTimeStamped + virtual rtl::OUString SAL_CALL getTimestamp(void) + throw (uno::RuntimeException); + + protected: + + /** Destructor */ + ~KDEInetLayer(void) {} + +private : + uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ; + + void SAL_CALL setProxy + (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties, + int nProxyType, const QString &aNoProxyfor = QString(), + const QString &aHTTPProxy = QString(), const QString &aFTPProxy = QString(), const QString &aHTTPSProxy = QString()) const; +}; diff --git a/shell/source/backends/kde4be/kde4pathslayer.cxx b/shell/source/backends/kde4be/kde4pathslayer.cxx new file mode 100644 index 000000000000..2511d0b57405 --- /dev/null +++ b/shell/source/backends/kde4be/kde4pathslayer.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4pathslayer.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" + +#include "kde4pathslayer.hxx" + +#include <QString> +#include <kglobalsettings.h> + +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> + +#include <osl/security.hxx> +#include <osl/file.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#define SPACE ' ' + +//============================================================================== + +KDEPathsLayer::KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber; + uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); + if( xServiceManager.is() ) + { + m_xLayerContentDescriber = LayerDescriber::query( + xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); + } + else + { + OSL_TRACE("Could not retrieve ServiceManager"); + } +} + +//------------------------------------------------------------------------------ + +void SAL_CALL KDEPathsLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, lang::NullPointerException, + lang::WrappedTargetException, uno::RuntimeException) +{ + if( ! m_xLayerContentDescriber.is() ) + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" + ) ), static_cast < backend::XLayer * > (this) ); + } + + uno::Sequence<backend::PropertyInfo> aPropInfoList(1); + sal_Int32 nProperties = 0; + + QString aDocumentsDir( KGlobalSettings::documentPath() ); + rtl::OUString sDocumentsDir; + rtl::OUString sDocumentsURL; + if ( aDocumentsDir.endsWith(QChar('/')) ) + aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); + sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16(); + osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); + + aPropInfoList[nProperties].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") ); + aPropInfoList[nProperties].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[nProperties].Protected = sal_False; + aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL ); + + if( nProperties > 0 ) + { + aPropInfoList.realloc(nProperties); + m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); + } +} + +//------------------------------------------------------------------------------ + +rtl::OUString SAL_CALL KDEPathsLayer::getTimestamp(void) + throw (uno::RuntimeException) +{ + // Return the value as timestamp to avoid regenerating the binary cache + // on each office launch. + + ::rtl::OUString sTimeStamp, + sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) ); + + QString aDocumentsDir; + aDocumentsDir = KGlobalSettings::documentPath(); + + sTimeStamp += (const sal_Unicode *) aDocumentsDir.utf16(); + + return sTimeStamp; +} diff --git a/shell/source/backends/kde4be/kde4pathslayer.hxx b/shell/source/backends/kde4be/kde4pathslayer.hxx new file mode 100644 index 000000000000..40d31a73c4f9 --- /dev/null +++ b/shell/source/backends/kde4be/kde4pathslayer.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4pathslayer.hxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +#pragma once + +#include "kde4backend.hxx" +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> + +#include <cppuhelper/implbase2.hxx> + +namespace css = com::sun::star ; +namespace uno = css::uno ; +namespace lang = css::lang ; +namespace backend = css::configuration::backend ; +namespace util = css::util ; + +/** + Implementation of the XLayer interface for the KDE values mapped into + the org.openoffice.Office.Paths configuration component. + */ +class KDEPathsLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, + lang::NullPointerException, + lang::WrappedTargetException, + uno::RuntimeException) ; + + // XTimeStamped + virtual rtl::OUString SAL_CALL getTimestamp(void) + throw (uno::RuntimeException); + + protected: + + /** Destructor */ + ~KDEPathsLayer(void) {} + + private : + uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ; +}; diff --git a/shell/source/backends/kde4be/kde4vcllayer.cxx b/shell/source/backends/kde4be/kde4vcllayer.cxx new file mode 100644 index 000000000000..780c3e4e7ce1 --- /dev/null +++ b/shell/source/backends/kde4be/kde4vcllayer.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: kde4vcllayer.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" + +#include "kde4vcllayer.hxx" + +#include <com/sun/star/configuration/backend/PropertyInfo.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +//============================================================================== + +KDEVCLLayer::KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext) +{ + //Create instance of LayerContentDescriber Service + rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.configuration.backend.LayerDescriber")); + + typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber; + uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager(); + if( xServiceManager.is() ) + { + m_xLayerContentDescriber = LayerDescriber::query( + xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext)); + } + else + { + OSL_TRACE("Could not retrieve ServiceManager"); + } +} + +//------------------------------------------------------------------------------ + +void SAL_CALL KDEVCLLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, lang::NullPointerException, + lang::WrappedTargetException, uno::RuntimeException) +{ + if( ! m_xLayerContentDescriber.is() ) + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service" + ) ), static_cast < backend::XLayer * > (this) ); + } + + uno::Sequence<backend::PropertyInfo> aPropInfoList(1); + +/* + Commenting out, does not make much sense without an accessibility bridge +=========================================================================== +#if defined(QT_ACCESSIBILITY_SUPPORT) +// Accessibility tools under Qt for UNIX are available starting with Qt 4.0 + int nVersionMajor = 0; + const char *q = qVersion(); // "3.1.0" for example + while ('0' <= *q && *q <= '9') + nVersionMajor = nVersionMajor * 10 + *q++ - '0'; + sal_Bool ATToolSupport = (sal_Bool) (nVersionMajor >= 4); +#else + sal_Bool ATToolSupport = sal_False; +#endif +=========================================================================== + End of commented out section +*/ sal_Bool ATToolSupport = sal_False; + + aPropInfoList[0].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.VCL/Settings/Accessibility/EnableATToolSupport") ); + aPropInfoList[0].Type = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "string" ) ); + aPropInfoList[0].Protected = sal_False; + aPropInfoList[0].Value = uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ); + + m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList); +} + +//------------------------------------------------------------------------------ + +rtl::OUString SAL_CALL KDEVCLLayer::getTimestamp(void) + throw (uno::RuntimeException) +{ + // Return the value as timestamp to avoid regenerating the binary cache + // on each office launch. + + ::rtl::OUString sTimeStamp( + RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) ); + + return sTimeStamp; +} diff --git a/shell/source/backends/kde4be/kde4vcllayer.hxx b/shell/source/backends/kde4be/kde4vcllayer.hxx new file mode 100644 index 000000000000..16036ee89122 --- /dev/null +++ b/shell/source/backends/kde4be/kde4vcllayer.hxx @@ -0,0 +1,53 @@ +#pragma once + +#include "kde4backend.hxx" + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/configuration/backend/XLayer.hpp> +#include <com/sun/star/configuration/backend/BackendAccessException.hpp> +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp> +#include <com/sun/star/util/XTimeStamped.hpp> + +#include <cppuhelper/implbase2.hxx> + +namespace css = com::sun::star ; +namespace uno = css::uno ; +namespace lang = css::lang ; +namespace backend = css::configuration::backend ; +namespace util = css::util ; + +/** + Implementation of the XLayer interface for the KDE values mapped into + the org.openoffice.VCL configuration component. + */ +class KDEVCLLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped> +{ +public : + /** + Constructor given the component context + + @param xContext The component context + */ + + KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext); + + // XLayer + virtual void SAL_CALL readData( + const uno::Reference<backend::XLayerHandler>& xHandler) + throw ( backend::MalformedDataException, + lang::NullPointerException, + lang::WrappedTargetException, + uno::RuntimeException) ; + + // XTimeStamped + virtual rtl::OUString SAL_CALL getTimestamp(void) + throw (uno::RuntimeException); + + protected: + + /** Destructor */ + ~KDEVCLLayer(void) {} + + private : + uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ; +}; diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk new file mode 100644 index 000000000000..6f92762e5ae1 --- /dev/null +++ b/shell/source/backends/kde4be/makefile.mk @@ -0,0 +1,94 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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. +# +#************************************************************************* +PRJ=..$/..$/.. + +PRJNAME=shell +TARGET=kde4be + +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +COMP1TYPELIST=$(TARGET) +COMPRDB=$(SOLARBINDIR)$/types.rdb +UNOUCROUT=$(OUT)$/inc$/$(TARGET) +INCPRE=$(UNOUCROUT) + +# --- Settings --- + +.INCLUDE : settings.mk + +# For some of the included external KDE headers, GCC complains about shadowed +# symbols in instantiated template code only at the end of a compilation unit, +# so the only solution is to disable that warning here: +.IF "$(COM)" == "GCC" +CFLAGSCXX+=-Wno-shadow +.ENDIF + +UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt + +# no "lib" prefix +DLLPRE = + +.IF "$(ENABLE_KDE4)" == "TRUE" + +CFLAGS+=$(KDE4_CFLAGS) + +# --- Files --- + +SLOFILES=\ + $(SLO)$/kde4backend.obj \ + $(SLO)$/kde4commonlayer.obj \ + $(SLO)$/kde4inetlayer.obj \ + $(SLO)$/kde4vcllayer.obj \ + $(SLO)$/kde4pathslayer.obj \ + $(SLO)$/kde4becdef.obj + +SHL1NOCHECK=TRUE +SHL1TARGET=$(TARGET)1.uno +SHL1OBJS=$(SLOFILES) +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +SHL1IMPLIB=i$(SHL1TARGET) +SHL1STDLIBS= \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) \ + $(KDE4_LIBS) -lkio + +SHL1VERSIONMAP=exports.map +SHL1DEF=$(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) + +.ENDIF + +# --- Targets --- + +.INCLUDE : target.mk diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk index 74ecf35ac5fc..22127bc8ddac 100644 --- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk +++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk @@ -36,6 +36,13 @@ LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE USE_DEFFILE=TRUE +# Do not use the dynamic STLport library. +# NO_DEFAULT_STL=YES + +# Do not use the uwinapi library +UWINAPILIB= + + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -43,11 +50,10 @@ USE_DEFFILE=TRUE CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 CDEFS+=-D_WIN32_IE=0x501 +# SCPCDEFS+=-D_STLP_USE_STATIC_LIB # --- Files -------------------------------------------------------- -#UWINAPILIB= - SLOFILES=$(SLO)$/ooofilt.obj\ $(SLO)$/propspec.obj @@ -71,10 +77,12 @@ SHL1STDLIBS+=$(OLE32LIB)\ $(SHELL32LIB)\ $(KERNEL32LIB)\ $(OLDNAMESLIB) - + +# $(LIBSTLPORTST) + SHL1LIBS+=$(SLB)$/util.lib\ $(SLB)$/ooofilereader.lib - + SHL1DEPN= SHL1OBJS=$(SLOFILES) SHL1DEF=$(MISC)$/$(SHL1TARGET).def diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx index e22fb89f94cf..ac8dd676c3b1 100644 --- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx @@ -46,7 +46,7 @@ //-------------------------------------------------------------------------- #include "internal/contentreader.hxx" #include "internal/metainforeader.hxx" -#include "internal/utilities.hxx" +//#include "internal/utilities.hxx" #include "internal/registry.hxx" #include "internal/fileextensions.hxx" @@ -78,6 +78,8 @@ #include <ntquery.h> #include "assert.h" #include "ooofilt.hxx" +#include <objidl.h>
+#include <stdio.h>
#include "propspec.hxx" #ifdef __MINGW32__ #include <algorithm> @@ -117,7 +119,9 @@ COooFilter::COooFilter() : m_fEof(FALSE), m_ChunkPosition(0), m_cAttributes(0), - m_pAttributes(0) + m_pAttributes(0), + m_pStream(NULL)
+ { InterlockedIncrement( &g_lInstances ); } @@ -172,6 +176,8 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface( pUnkTemp = (IUnknown *)(IPersistFile *)this; else if ( IID_IPersist == riid ) pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this; + else if (IID_IPersistStream == riid)
+ pUnkTemp = (IUnknown *)(IPersistStream *)this;
else if ( IID_IUnknown == riid ) pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this; else @@ -713,6 +719,101 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/) // File is opened read-only, so "save" is always finished return S_OK; } + +//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Load (IPersistStream::Load)
+//
+// Summary: Initializes an object from the stream where it was previously saved
+//
+// Arguments: pStm
+// [in] Pointer to stream from which object should be loaded
+//
+//
+// Returns: S_OK
+// E_OUTOFMEMORY
+// E_FAIL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
+{
+
+ // These next few lines work around the "Seek pointer" bug found on Vista.
+
+ char buf[20];
+ unsigned long count;
+ HRESULT hr;
+ ULARGE_INTEGER NewPosition;
+ LARGE_INTEGER Move;
+ Move.QuadPart = 0;
+ hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
+ hr = pStm->Read (buf, 20, &count);
+
+ zlib_filefunc_def z_filefunc;
+ fill_stream_filefunc (&z_filefunc);
+ z_filefunc.opaque = (void*)pStm;
+
+ m_pStream = pStm;
+
+ try
+ {
+ if (m_pMetaInfoReader)
+ delete m_pMetaInfoReader;
+ m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
+
+ if (m_pContentReader)
+ delete m_pContentReader;
+ m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
+ }
+ catch (const std::exception&)
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax)
+//
+// Summary: Returns the size in bytes of the stream neede to save the object.
+//
+// Arguments: pcbSize
+// [out] Pointer to a 64 bit unsigned int indicating the size needed
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
+{
+ //
+ return E_NOTIMPL;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Save (IPersistStream::Save)
+//
+// Summary: Save object to specified stream
+//
+// Arguments: pStm
+// [in] Pointer to stream
+//
+// fClearDirty
+// [in] Indicates whether to clear dirty flag
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
+{
+ //
+ return E_NOTIMPL;
+}
+ //M------------------------------------------------------------------------- // // Method: COooFilter::GetCurFile (IPersistFile::GetCurFile) @@ -1142,9 +1243,19 @@ namespace /* private */ std::string ClsidEntry_Persist = CLSID_GUID_ENTRY; SubstitutePlaceholder(ClsidEntry_Persist, GUID_PLACEHOLDER, ClsidToString(PersistentGuid)); + if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist.c_str(), "", "OpenOffice.org Persistent Handler")) return E_FAIL; + // Add missing entry
+ std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
+ SubstitutePlaceholder(ClsidEntry_Persist_Entry,
+ GUID_PLACEHOLDER,
+ ClsidToString(PersistentGuid));
+
+ if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
+ + std::string ClsidEntry_Persist_Addin = CLSID_GUID_PERSIST_ADDIN_ENTRY; SubstitutePlaceholder(ClsidEntry_Persist_Addin, GUID_PLACEHOLDER, @@ -1393,3 +1504,100 @@ STDAPI DllUnregisterServer() */ return S_OK; } + +extern "C" {
+
+ // IStream callback
+ voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {
+ return opaque;
+ }
+
+ uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
+ unsigned long newsize;
+ HRESULT hr;
+
+ hr = ((IStream *)stream)->Read (buf, size, &newsize);
+ if (hr == S_OK){
+ return (unsigned long)newsize;
+ }
+ else {
+ return (uLong)0;
+ }
+ }
+
+ long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ DWORD dwOrigin;
+ Move.QuadPart = (__int64)offset;
+
+ switch (origin) {
+ case SEEK_CUR:
+ dwOrigin = STREAM_SEEK_CUR;
+ break;
+ case SEEK_END:
+ dwOrigin = STREAM_SEEK_END;
+ break;
+ case SEEK_SET:
+ dwOrigin = STREAM_SEEK_SET;
+ break;
+ default:
+ return -1;
+ }
+
+ hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
+ if (hr == S_OK){
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ ULARGE_INTEGER NewPosition;
+ Move.QuadPart = 0;
+ NewPosition.QuadPart = 0;
+
+ hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+ if (hr == S_OK){
+ return (long) NewPosition.QuadPart;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
+ return 0;
+ }
+
+ int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
+ return 0; //RJK - for now
+ }
+
+ uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
+ HRESULT hr;
+ unsigned long writecount;
+ hr = ((IStream*)stream)->Write (buf, size, &writecount);
+ if (hr == S_OK)
+ return (unsigned int)writecount;
+ else
+ return (uLong)0;
+ }
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
+ pzlib_filefunc_def->zopen_file = cb_sopen;
+ pzlib_filefunc_def->zread_file = cb_sread;
+ pzlib_filefunc_def->zwrite_file = cb_swrite;
+ pzlib_filefunc_def->ztell_file = cb_stell;
+ pzlib_filefunc_def->zseek_file = cb_sseek;
+ pzlib_filefunc_def->zclose_file = cb_sclose;
+ pzlib_filefunc_def->zerror_file = cb_serror;
+ }
+}
+ diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx index f83e8792507f..9f1566b406bd 100644 --- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx +++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx @@ -96,8 +96,7 @@ enum FilterState FilteringContent, // Filtering the content property FilteringProperty // Filtering the pseudo property }; - -class COooFilter : public IFilter, public IPersistFile +class COooFilter : public IFilter, public IPersistFile, public IPersistStream
{ public: // From IUnknown @@ -144,6 +143,18 @@ public: virtual SCODE STDMETHODCALLTYPE GetCurFile( LPWSTR * ppszFileName); + // From IPersistStream
+ virtual SCODE STDMETHODCALLTYPE Load(
+ IStream *pStm);
+
+ virtual SCODE STDMETHODCALLTYPE Save(
+ IStream *pStm,
+ BOOL fClearDirty);
+
+ virtual SCODE STDMETHODCALLTYPE GetSizeMax(
+ ULARGE_INTEGER *pcbSize);
+ + private: friend class COooFilterCF; @@ -166,6 +177,8 @@ private: ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk; ULONG m_cAttributes; // Count of attributes CFullPropSpec * m_pAttributes; // Attributes to filter + IStream * m_pStream;
+ }; //C------------------------------------------------------------------------- @@ -207,6 +220,22 @@ private: long m_lRefs; // Reference count }; +extern "C" {
+
+ voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
+ uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
+ uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
+ long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+ int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
+ int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
+
+}
+
+ + diff --git a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx index 623bc7be7772..879cf8c0115b 100644 --- a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx @@ -147,7 +147,6 @@ extern "C" HRESULT __stdcall DllCanUnloadNow() extern "C" HRESULT __stdcall DllRegisterServer() { Init(); - if (Forward_DllRegisterServer) return Forward_DllRegisterServer(); else diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx index b8af5acbde78..171bc287715f 100644 --- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx +++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx @@ -177,14 +177,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize( HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) { - try - { - m_pMetaInfo = std::auto_ptr<CMetaInfoReader>(new CMetaInfoReader(m_szFileName)); - } - catch (const std::exception&) - { - return E_FAIL; - } PROPSHEETPAGE psp; @@ -317,14 +309,17 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR //################################## void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) { - SetWindowText(GetDlgItem(hwnd,IDC_TITLE), m_pMetaInfo->getTagData( META_INFO_TITLE ).c_str() ); - SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), m_pMetaInfo->getTagData( META_INFO_AUTHOR ).c_str() ); - SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), m_pMetaInfo->getTagData( META_INFO_SUBJECT ).c_str() ); - SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), m_pMetaInfo->getTagData( META_INFO_KEYWORDS ).c_str() ); + + CMetaInfoReader metaInfo(m_szFileName); + + SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() ); + SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() ); + SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() ); + SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() ); // comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add // "\r" before "\n" to form "\r\n" in order to display return in Edit control. - std::wstring tempStr = m_pMetaInfo->getTagData( META_INFO_DESCRIPTION ).c_str(); + std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str(); std::wstring::size_type itor = tempStr.find ( L"\n" , 0 ); while (itor != std::wstring::npos) { @@ -332,6 +327,7 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) itor = tempStr.find(L"\n", itor + 2); } SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str()); + } //--------------------------------- @@ -339,7 +335,10 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) */ void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/) { - document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, m_pMetaInfo.get()); + + CMetaInfoReader metaInfo(m_szFileName); + + document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo); statistic_group_list_t sgl; doc_stat_reader->read(&sgl); @@ -350,6 +349,7 @@ void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/ GetResString(IDS_PROPERTY_VALUE)); lv_builder->build(sgl); + } diff --git a/shell/source/win32/shlxthandler/util/makefile.mk b/shell/source/win32/shlxthandler/util/makefile.mk index f5d912c4b185..c0bec9c36d3b 100644 --- a/shell/source/win32/shlxthandler/util/makefile.mk +++ b/shell/source/win32/shlxthandler/util/makefile.mk @@ -35,6 +35,7 @@ TARGET=util #LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx index 0598b4d335b7..36c19dd0c500 100644 --- a/shell/source/win32/shlxthandler/util/utilities.cxx +++ b/shell/source/win32/shlxthandler/util/utilities.cxx @@ -586,5 +586,4 @@ LCID LocaleSetToLCID( const LocaleSet_t & Locale ) return GetSystemDefaultLCID(); //System Default Locale return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT ); - } diff --git a/svx/inc/edtspell.hxx b/svx/inc/edtspell.hxx index f3d55ee87841..15e180342d85 100644 --- a/svx/inc/edtspell.hxx +++ b/svx/inc/edtspell.hxx @@ -133,6 +133,9 @@ public: void MarkWrongsInvalid(); WrongList* Clone() const; + + // #i102062# + bool operator==(const WrongList& rCompare) const; }; inline void WrongList::InsertWrong( const WrongRange& rWrong, USHORT nPos ) diff --git a/svx/inc/mscodec.hxx b/svx/inc/mscodec.hxx index 631990657470..4ee508d661dd 100644 --- a/svx/inc/mscodec.hxx +++ b/svx/inc/mscodec.hxx @@ -239,6 +239,28 @@ public: bool CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] ); + /** Encodes a block of memory. + + @see rtl_cipher_encode() + + @precond + The codec must be initialized with InitKey() before this function + can be used. The destination buffer must be able to take all + unencoded data from the source buffer (usually this means it must be + as long as or longer than the source buffer). + + @param pData + Unencrypted source data block. + @param nDatLen + Size of the passed source data block. + @param pBuffer + Destination buffer for the encrypted data. + @param nBufLen + Size of the destination buffer. + + @return + true = Encoding was successful (no error occured). + */ bool Encode( const void* pData, sal_Size nDatLen, sal_uInt8* pBuffer, sal_Size nBufLen ); @@ -283,6 +305,24 @@ public: */ bool Skip( sal_Size nDatLen ); + /** Gets salt data and salt digest. + + @precond + The codec must be initialized with InitKey() before this function + can be used. + + @param pSalt + Salt, a random number. + @param pSaltData + Salt data block generated from the salt. + @param pSaltDigest + Salt digest generated from the salt. + */ + void GetEncryptKey ( + const sal_uInt8 pSalt[16], + sal_uInt8 pSaltData[16], + sal_uInt8 pSaltDigest[16]); + private: void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] ); diff --git a/svx/inc/optgenrl.hrc b/svx/inc/optgenrl.hrc index 1972689529fc..b6f191aaea07 100644 --- a/svx/inc/optgenrl.hrc +++ b/svx/inc/optgenrl.hrc @@ -74,7 +74,7 @@ #define LINEH 12 #define FLINEH 8 #define LEFT 12 -#define MID 96 +#define MID 100 #define RIGHT 248 #define TOP 10 #define LINE(y) (14+y*15) diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index 13e835a3d378..1d78c5e6396e 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -251,8 +251,10 @@ // ResId fuer FontSubstitution #define RID_SVX_FONT_SUBSTITUTION (RID_SVX_START + 18) +// insert row&col dialog +#define DLG_INS_ROW_COL (RID_SVX_START + 156) + //InetDlg -//#define RID_SVXDLG_INTERNET (RID_SVX_START + 156) #define RID_SVXPAGE_INET_MAIL (RID_SVX_START + 155) #define RID_SVXPAGE_INET_PROXY (RID_SVX_START + 157) #define RID_SVXPAGE_INET_CACHE (RID_SVX_START + 158) diff --git a/svx/inc/svx/editobj.hxx b/svx/inc/svx/editobj.hxx index eb304425f09d..f291adefcf71 100644 --- a/svx/inc/svx/editobj.hxx +++ b/svx/inc/svx/editobj.hxx @@ -121,6 +121,9 @@ public: virtual void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ); bool operator==( const EditTextObject& rCompare ) const; + + // #i102062# + bool isWrongListEqual(const EditTextObject& rCompare) const; }; #endif // _EDITOBJ_HXX diff --git a/svx/inc/svx/fntctrl.hxx b/svx/inc/svx/fntctrl.hxx index d87d75ab3690..a0de3b2d3048 100644 --- a/svx/inc/svx/fntctrl.hxx +++ b/svx/inc/svx/fntctrl.hxx @@ -71,6 +71,7 @@ public: SvxFont& GetCJKFont(); SvxFont& GetCTLFont(); void SetColor( const Color& rColor ); + void ResetColor(); void SetBackColor( const Color& rColor ); void UseResourceText( BOOL bUse = TRUE ); void Paint( const Rectangle& ); diff --git a/svx/inc/svx/outlobj.hxx b/svx/inc/svx/outlobj.hxx index 9a8efeaaddc1..0311fa914422 100644 --- a/svx/inc/svx/outlobj.hxx +++ b/svx/inc/svx/outlobj.hxx @@ -67,6 +67,9 @@ public: bool operator==(const OutlinerParaObject& rCandidate) const; bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); } + // #i102062# + bool isWrongListEqual(const OutlinerParaObject& rCompare) const; + // outliner mode access sal_uInt16 GetOutlinerMode() const; void SetOutlinerMode(sal_uInt16 nNew); diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 3873f4026ea6..e0dcb51e9460 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -65,6 +65,9 @@ namespace drawinglayer sal_Int32 maTextRightDistance; sal_Int32 maTextLowerDistance; + // #i101556# use versioning from text attributes to detect changes + sal_uInt32 maPropertiesVersion; + // bitfield unsigned mbContour : 1; unsigned mbFitToSize : 1; @@ -111,6 +114,7 @@ namespace drawinglayer sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } sal_Int32 getTextRightDistance() const { return maTextRightDistance; } sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } + sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } // animation timing generation void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const; diff --git a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx index 7ddc9546ee78..136f43aed0aa 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx @@ -38,6 +38,8 @@ // predeclarations class SdrGrafObj; +namespace drawinglayer { namespace attribute { class SdrLineFillShadowTextAttribute; }} +class GraphicAttr; ////////////////////////////////////////////////////////////////////////////// @@ -47,6 +49,16 @@ namespace sdr { class ViewContactOfGraphic : public ViewContactOfTextObj { + private: + // helpers for constructing various primitive visualisations in various states + drawinglayer::primitive2d::Primitive2DSequence createVIP2DSForPresObj( + const basegfx::B2DHomMatrix& rObjectMatrix, + const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute, + const GraphicAttr& rLocalGrafInfo) const; + drawinglayer::primitive2d::Primitive2DSequence createVIP2DSForDraft( + const basegfx::B2DHomMatrix& rObjectMatrix, + const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const; + protected: // Create a Object-Specific ViewObjectContact, set ViewContact and // ObjectContact. Always needs to return something. @@ -63,6 +75,13 @@ namespace sdr ViewContactOfGraphic(SdrGrafObj& rGrafObj); virtual ~ViewContactOfGraphic(); + // #i102380# + void flushGraphicObjects(); + + // helpers for viusualisation state + bool visualisationUsesPresObj() const; + bool visualisationUsesDraft() const; + protected: // This method is responsible for creating the graphical visualisation data // ONLY based on model data diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index a9b3767c3c32..e4a8fa01902f 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -71,7 +71,16 @@ namespace drawinglayer attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth); attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet); attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet); - attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText); + + // #i101508# Support handing over given text-to-border distances + attribute::SdrTextAttribute* createNewSdrTextAttribute( + const SfxItemSet& rSet, + const SdrText& rText, + const sal_Int32* pLeft = 0, + const sal_Int32* pUpper = 0, + const sal_Int32* pRight = 0, + const sal_Int32* pLower = 0); + attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet); attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet); attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute( @@ -83,7 +92,15 @@ namespace drawinglayer attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill); attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet); attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet); - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(const SfxItemSet& rSet, const SdrText* pSdrText); + + // #i101508# Support handing over given text-to-border distances + attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + const SfxItemSet& rSet, + const SdrText* pSdrText, + const sal_Int32* pLeft = 0, + const sal_Int32* pUpper = 0, + const sal_Int32* pRight = 0, + const sal_Int32* pLower = 0); // helpers void calculateRelativeCornerRadius(sal_Int32 nRadius, const ::basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY); diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index 29d905c697ec..97b12b72d4a5 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -49,9 +49,9 @@ namespace drawinglayer class SdrPathPrimitive2D : public BasePrimitive2D { private: - ::basegfx::B2DHomMatrix maTransform; + basegfx::B2DHomMatrix maTransform; attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; - ::basegfx::B2DPolyPolygon maUnitPolyPolygon; + basegfx::B2DPolyPolygon maUnitPolyPolygon; protected: // local decomposition. @@ -59,14 +59,14 @@ namespace drawinglayer public: SdrPathPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon); + const basegfx::B2DPolyPolygon& rUnitPolyPolygon); // data access - const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } - const ::basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; } + const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/sdr/properties/properties.hxx b/svx/inc/svx/sdr/properties/properties.hxx index d8b374a18042..2c4512236cb7 100644 --- a/svx/inc/svx/sdr/properties/properties.hxx +++ b/svx/inc/svx/sdr/properties/properties.hxx @@ -184,6 +184,11 @@ namespace sdr // ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above. // But also from inside SdrObjects. void BroadcastItemChange(const ItemChangeBroadcaster& rChange); + + // #i101556# add versioning mechanism; used from e.g. text attribute set to + // allow detection of e.g. style sheet or single text attribute changes. The + // default implementation returns 0 (zero) + virtual sal_uInt32 getVersion() const; }; } // end of namespace properties } // end of namespace sdr diff --git a/svx/inc/svx/sdr/properties/textproperties.hxx b/svx/inc/svx/sdr/properties/textproperties.hxx index 424b76ba7610..77a19818f55a 100644 --- a/svx/inc/svx/sdr/properties/textproperties.hxx +++ b/svx/inc/svx/sdr/properties/textproperties.hxx @@ -42,6 +42,10 @@ namespace sdr { class SVX_DLLPUBLIC TextProperties : public AttributeProperties { + private: + // #i101556# versioning support + sal_uInt32 maVersion; + protected: // create a new itemset virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool); @@ -82,6 +86,9 @@ namespace sdr // Set single item at the local ItemSet. *Does not use* AllowItemChange(), // ItemChange(), PostItemChange() and ItemSetChanged() calls. void SetObjectItemNoBroadcast(const SfxPoolItem& rItem); + + // #i101556# versioning support + virtual sal_uInt32 getVersion() const; }; } // end of namespace properties } // end of namespace sdr diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 749cd61c55f4..4f00da997361 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -226,6 +226,9 @@ public: sal_Bool IsObjectTransparent() const; ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream(); + + // #i103116# FullDrag support + virtual SdrObject* getFullDragClone() const; }; #endif //_SVDOGRAF_HXX diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx index bc403b0e0e58..8654e3a79db0 100644 --- a/svx/inc/svx/svdpntv.hxx +++ b/svx/inc/svx/svdpntv.hxx @@ -320,8 +320,8 @@ public: USHORT GetHitTolerancePixel() const { return (USHORT)nHitTolPix; } // data read access on logic HitTolerance and MinMoveTolerance - const USHORT getHitTolLog() const { return nHitTolLog; } - const USHORT getMinMovLog() const { return nMinMovLog; } + USHORT getHitTolLog() const { return nHitTolLog; } + USHORT getMinMovLog() const { return nMinMovLog; } // Flag zur Visualisierung von Gruppen abfragen/testen BOOL DoVisualizeEnteredGroup() const { return bVisualizeEnteredGroup; } diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx index 233c7956f18a..e4b3b6152022 100644 --- a/svx/inc/svx/svxdlg.hxx +++ b/svx/inc/svx/svxdlg.hxx @@ -347,6 +347,13 @@ public: virtual sal_Int32 getColumns() const = 0; }; +class SvxAbstractInsRowColDlg : public VclAbstractDialog +{ +public: + virtual bool isInsertBefore() const = 0; + virtual sal_uInt16 getInsertCount() const = 0; +}; + //------------------------------------------------------------- class SVX_DLLPUBLIC SvxAbstractDialogFactory : public SfxAbstractDialogFactory @@ -543,6 +550,8 @@ public: virtual SvxAbstractSplittTableDialog* CreateSvxSplittTableDialog( Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )=0; virtual SvxAbstractNewTableDialog* CreateSvxNewTableDialog( Window* pParent ) = 0; + + virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId ) = 0; }; #endif diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 21a4bc81f94e..ef456d7b468c 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -831,7 +831,11 @@ #define SID_OFASLOTS_START ( SID_SVX_START + 425 ) //#define SID_SD_AUTOPILOT ( SID_SVX_START + 425 ) -> sfxsids.hrc #define SID_AUTOPILOT SID_SD_AUTOPILOT -// 4 defines of Writer's old wizards have been removed here + +#define SID_TABLE_INSERT_COL_DLG ( SID_SVX_START + 426 ) +#define SID_TABLE_INSERT_ROW_DLG ( SID_SVX_START + 427 ) +#define SID_TABLE_PARAM_INSERT_AFTER ( SID_SVX_START + 428 ) + #define SID_TABLEDESIGN ( SID_SVX_START + 429 ) #define SID_MN_AUTOPILOT ( SID_SVX_START + 430 ) #define SID_GENERAL_OPTIONS ( SID_SVX_START + 432 ) diff --git a/svx/inc/svx/xcolit.hxx b/svx/inc/svx/xcolit.hxx index 719ef1a48fc2..e8d041079652 100644 --- a/svx/inc/svx/xcolit.hxx +++ b/svx/inc/svx/xcolit.hxx @@ -48,7 +48,7 @@ class SVX_DLLPUBLIC XColorItem : public NameOrIndex public: TYPEINFO(); XColorItem() {} - XColorItem(USHORT nWhich, long nIndex, const Color& rTheColor); + XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor); virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); diff --git a/svx/inc/svx/xflclit.hxx b/svx/inc/svx/xflclit.hxx index 72f7728c14ab..39a382bd5e60 100644 --- a/svx/inc/svx/xflclit.hxx +++ b/svx/inc/svx/xflclit.hxx @@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XFillColorItem : public XColorItem public: TYPEINFO(); XFillColorItem() {} - XFillColorItem(long nIndex, const Color& rTheColor); + XFillColorItem(INT32 nIndex, const Color& rTheColor); XFillColorItem(const String& rName, const Color& rTheColor); XFillColorItem(SvStream& rIn); diff --git a/svx/inc/svx/xflftrit.hxx b/svx/inc/svx/xflftrit.hxx index d2c5ef8ef0b3..1e77f2a6d2e0 100644 --- a/svx/inc/svx/xflftrit.hxx +++ b/svx/inc/svx/xflftrit.hxx @@ -50,7 +50,7 @@ public: TYPEINFO(); XFillFloatTransparenceItem(); - XFillFloatTransparenceItem( long nIndex, const XGradient& rGradient, BOOL bEnable = TRUE ); + XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable = TRUE ); XFillFloatTransparenceItem(const String& rName, const XGradient& rGradient, BOOL bEnable = TRUE ); XFillFloatTransparenceItem(SfxItemPool* pPool, const XGradient& rTheGradient, BOOL bEnable = TRUE ); XFillFloatTransparenceItem(SfxItemPool* pPool ); diff --git a/svx/inc/svx/xflgrit.hxx b/svx/inc/svx/xflgrit.hxx index f463dd8f6dae..fd0a7a202c81 100644 --- a/svx/inc/svx/xflgrit.hxx +++ b/svx/inc/svx/xflgrit.hxx @@ -47,7 +47,7 @@ class SVX_DLLPUBLIC XFillGradientItem : public NameOrIndex public: TYPEINFO(); XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1) {} - XFillGradientItem(long nIndex, const XGradient& rTheGradient); + XFillGradientItem(INT32 nIndex, const XGradient& rTheGradient); XFillGradientItem(const UniString& rName, const XGradient& rTheGradient); XFillGradientItem(SfxItemPool* pPool, const XGradient& rTheGradient); XFillGradientItem(SfxItemPool* pPool ); diff --git a/svx/inc/svx/xflhtit.hxx b/svx/inc/svx/xflhtit.hxx index 30686200f298..212977c87a1f 100644 --- a/svx/inc/svx/xflhtit.hxx +++ b/svx/inc/svx/xflhtit.hxx @@ -47,7 +47,7 @@ class SVX_DLLPUBLIC XFillHatchItem : public NameOrIndex public: TYPEINFO(); XFillHatchItem() : NameOrIndex(XATTR_FILLHATCH, -1) {} - XFillHatchItem(long nIndex, const XHatch& rTheHatch); + XFillHatchItem(INT32 nIndex, const XHatch& rTheHatch); XFillHatchItem(const String& rName, const XHatch& rTheHatch); XFillHatchItem(SfxItemPool* pPool, const XHatch& rTheHatch); XFillHatchItem(SfxItemPool* pPool ); diff --git a/svx/inc/svx/xftshcit.hxx b/svx/inc/svx/xftshcit.hxx index 9668b01441dc..7f767d163278 100644 --- a/svx/inc/svx/xftshcit.hxx +++ b/svx/inc/svx/xftshcit.hxx @@ -45,7 +45,7 @@ class SVX_DLLPUBLIC XFormTextShadowColorItem : public XColorItem public: TYPEINFO(); XFormTextShadowColorItem() {} - XFormTextShadowColorItem(long nIndex, const Color& rTheColor); + XFormTextShadowColorItem(INT32 nIndex, const Color& rTheColor); XFormTextShadowColorItem(const String& rName, const Color& rTheColor); XFormTextShadowColorItem(SvStream& rIn); diff --git a/svx/inc/svx/xit.hxx b/svx/inc/svx/xit.hxx index 2eaaa1629ef2..993f16eb1f43 100644 --- a/svx/inc/svx/xit.hxx +++ b/svx/inc/svx/xit.hxx @@ -54,7 +54,7 @@ typedef BOOL (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p //------------------- class SVX_DLLPUBLIC NameOrIndex : public SfxStringItem { - long nPalIndex; + INT32 nPalIndex; protected: void Detach() { nPalIndex = -1; } @@ -62,7 +62,7 @@ protected: public: TYPEINFO(); NameOrIndex() { nPalIndex = -1; } - NameOrIndex(USHORT nWhich, long nIndex); + NameOrIndex(USHORT nWhich, INT32 nIndex); NameOrIndex(USHORT nWhich, const String& rName= String()); NameOrIndex(USHORT nWhich, SvStream& rIn); @@ -76,8 +76,8 @@ public: String GetName() const { return GetValue(); } void SetName(const String& rName) { SetValue(rName); } - long GetIndex() const { return nPalIndex; } - void SetIndex(long nIndex) { nPalIndex = nIndex; } + INT32 GetIndex() const { return nPalIndex; } + void SetIndex(INT32 nIndex) { nPalIndex = nIndex; } BOOL IsIndex() const { return (nPalIndex >= 0); } /** this static checks if the given NameOrIndex item has a unique name for its value. diff --git a/svx/inc/svx/xlnclit.hxx b/svx/inc/svx/xlnclit.hxx index 662531856689..f3622b32ce90 100644 --- a/svx/inc/svx/xlnclit.hxx +++ b/svx/inc/svx/xlnclit.hxx @@ -42,7 +42,7 @@ class SVX_DLLPUBLIC XLineColorItem : public XColorItem public: TYPEINFO(); XLineColorItem() {} - XLineColorItem(long nIndex, const Color& rTheColor); + XLineColorItem(INT32 nIndex, const Color& rTheColor); XLineColorItem(const String& rName, const Color& rTheColor); XLineColorItem(SvStream& rIn); diff --git a/svx/inc/svx/xlndsit.hxx b/svx/inc/svx/xlndsit.hxx index 355ea3f72f55..4315161b34eb 100644 --- a/svx/inc/svx/xlndsit.hxx +++ b/svx/inc/svx/xlndsit.hxx @@ -50,7 +50,7 @@ class SVX_DLLPUBLIC XLineDashItem : public NameOrIndex public: TYPEINFO(); XLineDashItem() : NameOrIndex(XATTR_LINEDASH, -1) {} - XLineDashItem(long nIndex, const XDash& rTheDash); + XLineDashItem(INT32 nIndex, const XDash& rTheDash); XLineDashItem(const String& rName, const XDash& rTheDash); XLineDashItem(SfxItemPool* pPool, const XDash& rTheDash); XLineDashItem(SfxItemPool* pPool ); diff --git a/svx/inc/svx/xlnedit.hxx b/svx/inc/svx/xlnedit.hxx index fa96776a18c4..46ef12ee2937 100644 --- a/svx/inc/svx/xlnedit.hxx +++ b/svx/inc/svx/xlnedit.hxx @@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XLineEndItem : public NameOrIndex public: TYPEINFO(); - XLineEndItem(long nIndex = -1); + XLineEndItem(INT32 nIndex = -1); XLineEndItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon); XLineEndItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon); XLineEndItem(SfxItemPool* pPool ); diff --git a/svx/inc/svx/xlnstit.hxx b/svx/inc/svx/xlnstit.hxx index 0256e078d148..1d6af8690acd 100644 --- a/svx/inc/svx/xlnstit.hxx +++ b/svx/inc/svx/xlnstit.hxx @@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XLineStartItem : public NameOrIndex public: TYPEINFO(); - XLineStartItem(long nIndex = -1); + XLineStartItem(INT32 nIndex = -1); XLineStartItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon); XLineStartItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon); XLineStartItem(SfxItemPool* pPool ); diff --git a/svx/inc/svx/xsflclit.hxx b/svx/inc/svx/xsflclit.hxx index eebe2e723620..0b065597fc8f 100644 --- a/svx/inc/svx/xsflclit.hxx +++ b/svx/inc/svx/xsflclit.hxx @@ -41,7 +41,7 @@ class XSecondaryFillColorItem : public XColorItem public: TYPEINFO(); XSecondaryFillColorItem() {} - XSecondaryFillColorItem(long nIndex, const Color& rTheColor); + XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor); XSecondaryFillColorItem(const String& rName, const Color& rTheColor); XSecondaryFillColorItem(SvStream& rIn); diff --git a/svx/inc/xmlgrhlp.hxx b/svx/inc/xmlgrhlp.hxx index f36733706ab5..f99730c0ad1c 100644 --- a/svx/inc/xmlgrhlp.hxx +++ b/svx/inc/xmlgrhlp.hxx @@ -95,7 +95,7 @@ private: SVX_DLLPRIVATE sal_Bool ImplWriteGraphic( const ::rtl::OUString& rPictureStorageName, const ::rtl::OUString& rPictureStreamName, const ::rtl::OUString& rGraphicId ); - SVX_DLLPRIVATE void ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos ); + SVX_DLLPRIVATE void ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos, rtl::OUString& rRequestedFileName ); protected: SvXMLGraphicHelper(); diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index a69aae4cf9fd..3c819229ee4c 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -14911,3 +14911,54 @@ SfxVoidItem RecheckDocument SID_RECHECK_DOCUMENT GroupId = GID_DOCUMENT; ] +//-------------------------------------------------------------------------- + +SfxVoidItem InsertColumnDialog SID_TABLE_INSERT_COL_DLG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_TABLE; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem InsertRowDialog SID_TABLE_INSERT_ROW_DLG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_TABLE; +] diff --git a/svx/source/cui/commonlingui.src b/svx/source/cui/commonlingui.src index b69d3449db4c..c229953ad3c8 100644 --- a/svx/source/cui/commonlingui.src +++ b/svx/source/cui/commonlingui.src @@ -47,7 +47,7 @@ Window RID_SVX_WND_COMMON_LINGU { HelpId=HID_SPELLDLG_SETWORD; Pos = MAP_APPFONT( 51, 9 ); - Size = MAP_APPFONT( 149, 10 ); + Size = MAP_APPFONT( 164, 10 ); Border =FALSE; TabStop = TRUE; }; @@ -62,7 +62,7 @@ Window RID_SVX_WND_COMMON_LINGU Edit ED_NEWWORD { Pos = MAP_APPFONT( 51, 24 ); - Size = MAP_APPFONT( 122, 12 ); + Size = MAP_APPFONT( 137, 12 ); Border = TRUE; }; @@ -75,21 +75,21 @@ Window RID_SVX_WND_COMMON_LINGU PushButton BTN_IGNORE { - Pos = MAP_APPFONT( 209, 6 ); + Pos = MAP_APPFONT( 224, 6 ); Size = MAP_APPFONT( 55, 14 ); Text [ en-US ] = "~Ignore" ; }; PushButton BTN_IGNOREALL { - Pos = MAP_APPFONT( 209, 22 ); + Pos = MAP_APPFONT( 224, 22 ); Size = MAP_APPFONT( 55, 14 ); Text [ en-US ] = "Always I~gnore" ; }; PushButton BTN_CHANGE { - Pos = MAP_APPFONT( 209, 40 ); + Pos = MAP_APPFONT( 224, 40 ); Size = MAP_APPFONT( 55, 14 ); Text [ en-US ] = "~Replace" ; DefButton = TRUE ; @@ -97,14 +97,14 @@ Window RID_SVX_WND_COMMON_LINGU PushButton BTN_CHANGEALL { - Pos = MAP_APPFONT( 209, 56 ); + Pos = MAP_APPFONT( 224, 56 ); Size = MAP_APPFONT( 55, 14 ); Text [ en-US ] = "Always R~eplace" ; }; PushButton BTN_OPTIONS { - Pos = MAP_APPFONT( 209, 129 ); + Pos = MAP_APPFONT( 224, 129 ); Size = MAP_APPFONT( 55, 14 ); Hide = TRUE ; Text [ en-US ] = "Options..." ; @@ -119,19 +119,19 @@ Window RID_SVX_WND_COMMON_LINGU GroupBox GB_AUDIT { Pos = MAP_APPFONT( 1, 1 ); - Size = MAP_APPFONT( 268, 148 ); + Size = MAP_APPFONT( 283, 148 ); Hide=TRUE; }; HelpButton BTN_SPL_HELP { - Pos = MAP_APPFONT( 145, 153 ); + Pos = MAP_APPFONT( 160, 153 ); Size = MAP_APPFONT( 55, 14 ); }; CancelButton BTN_SPL_CANCEL { - Pos = MAP_APPFONT ( 209 , 153 ) ; + Pos = MAP_APPFONT ( 224 , 153 ) ; Size = MAP_APPFONT ( 55 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "~Close" ; diff --git a/svx/source/cui/cuicharmap.cxx b/svx/source/cui/cuicharmap.cxx index fa962beafc3d..a66c7b3c10a8 100644 --- a/svx/source/cui/cuicharmap.cxx +++ b/svx/source/cui/cuicharmap.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cuicharmap.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -405,6 +402,11 @@ IMPL_LINK( SvxCharMapData, FontSelectHdl, ListBox *, EMPTYARG ) USHORT nPos = aFontLB.GetSelectEntryPos(), nFont = (USHORT)(ULONG)aFontLB.GetEntryData( nPos ); aFont = mpDialog->GetDevFont( nFont ); + aFont.SetWeight( WEIGHT_DONTKNOW ); + aFont.SetItalic( ITALIC_NONE ); + aFont.SetWidthType( WIDTH_DONTKNOW ); + aFont.SetPitch( PITCH_DONTKNOW ); + aFont.SetFamily( FAMILY_DONTKNOW ); // notify children using this font aShowSet.SetFont( aFont ); diff --git a/svx/source/cui/dlgfact.cxx b/svx/source/cui/dlgfact.cxx index 5fe71d5eb8af..996d0f63f9e9 100644 --- a/svx/source/cui/dlgfact.cxx +++ b/svx/source/cui/dlgfact.cxx @@ -112,6 +112,7 @@ #include "newtabledlg.hxx" #include "macroass.hxx" #include "acccfg.hxx" +#include "insrc.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::frame; @@ -2385,3 +2386,8 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateOptionsDialog( { return new VclAbstractDialog_Impl( new OfaTreeOptionsDialog( pParent, rExtensionId ) ); } + +SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId ) +{ + return new SvxInsRowColDlg( pParent, bCol, nHelpId ); +} diff --git a/svx/source/cui/dlgfact.hxx b/svx/source/cui/dlgfact.hxx index e6c1325b4b38..e52c21fc597a 100644 --- a/svx/source/cui/dlgfact.hxx +++ b/svx/source/cui/dlgfact.hxx @@ -810,6 +810,8 @@ public: virtual VclAbstractDialog* CreateOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& rApplicationContext ); + + virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId ); }; #endif diff --git a/svx/source/cui/hangulhanjadlg.src b/svx/source/cui/hangulhanjadlg.src index 91439e285f7d..920f99e03aec 100644 --- a/svx/source/cui/hangulhanjadlg.src +++ b/svx/source/cui/hangulhanjadlg.src @@ -37,7 +37,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA { HelpId = HID_DIALOG_HANGULHANJA; - Size = MAP_APPFONT( 287, 175 ); + Size = MAP_APPFONT( 302, 175 ); OutputSize = TRUE; Closeable = TRUE ; Moveable = TRUE ; @@ -47,7 +47,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA PushButton PB_FIND { - Pos = MAP_APPFONT( 192, 23 ); + Pos = MAP_APPFONT( 207, 23 ); Size = MAP_APPFONT( 30, 14 ); Text [ en-US ] = "~Find"; @@ -56,7 +56,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA Control CTL_SUGGESTIONS { Pos = MAP_APPFONT( 51, 46 ); - Size = MAP_APPFONT( 171, 30 ); + Size = MAP_APPFONT( 186, 30 ); TabStop = TRUE ; }; @@ -71,7 +71,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA RadioButton RB_SIMPLE_CONVERSION { Pos = MAP_APPFONT( 51, 81 ); - Size = MAP_APPFONT( 55, 8 ); + Size = MAP_APPFONT( 60, 8 ); Group = TRUE; @@ -80,16 +80,16 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA RadioButton RB_HANJA_HANGUL_BRACKETED { - Pos = MAP_APPFONT( 109, 81 ); - Size = MAP_APPFONT( 55, 8 ); + Pos = MAP_APPFONT( 114, 81 ); + Size = MAP_APPFONT( 60, 8 ); Text [ en-US ] = "Hanja (Han~gul)"; }; RadioButton RB_HANGUL_HANJA_BRACKETED { - Pos = MAP_APPFONT( 167, 81 ); - Size = MAP_APPFONT( 55, 8 ); + Pos = MAP_APPFONT( 177, 81 ); + Size = MAP_APPFONT( 60, 8 ); Text [ en-US ] = "Hang~ul (Hanja)"; }; @@ -97,7 +97,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA RadioButton RB_HANGUL_HANJA_ABOVE { Pos = MAP_APPFONT( 51, 95 ); - Size = MAP_APPFONT( 55, 16 ); + Size = MAP_APPFONT( 60, 16 ); // this is the _primary_ text Text [ en-US ] = "Hangu~l"; @@ -105,8 +105,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA RadioButton RB_HANGUL_HANJA_BELOW { - Pos = MAP_APPFONT( 109, 95 ); - Size = MAP_APPFONT( 55, 16 ); + Pos = MAP_APPFONT( 114, 95 ); + Size = MAP_APPFONT( 60, 16 ); // this is the _primary_ text Text [ en-US ] = "Hang~ul"; @@ -114,8 +114,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA RadioButton RB_HANJA_HANGUL_ABOVE { - Pos = MAP_APPFONT( 51, 114 ); - Size = MAP_APPFONT( 55, 16 ); + Pos = MAP_APPFONT( 56, 114 ); + Size = MAP_APPFONT( 60, 16 ); // this is the _primary_ text Text [ en-US ] = "Han~ja"; @@ -123,8 +123,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA RadioButton RB_HANJA_HANGUL_BELOW { - Pos = MAP_APPFONT( 109, 114 ); - Size = MAP_APPFONT( 55, 16 ); + Pos = MAP_APPFONT( 114, 114 ); + Size = MAP_APPFONT( 60, 16 ); // this is the _primary_ text Text [ en-US ] = "Ha~nja"; @@ -141,14 +141,14 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA CheckBox CB_HANGUL_ONLY { Pos = MAP_APPFONT( 51, 134 ); - Size = MAP_APPFONT( 55, 8 ); + Size = MAP_APPFONT( 60, 8 ); Text [ en-US ] = "Hangul ~only"; }; CheckBox CB_HANJA_ONLY { - Pos = MAP_APPFONT( 109, 134 ); + Pos = MAP_APPFONT( 114, 134 ); Size = MAP_APPFONT( 55, 8 ); Text [ en-US ] = "Hanja onl~y"; @@ -157,12 +157,12 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA // this element is only for determining where our radio button group ends (in both directions) FixedText FT_RESIZE_ANCHOR { - Pos = MAP_APPFONT( 226, 133 ); + Pos = MAP_APPFONT( 241, 133 ); }; CheckBox CB_REPLACE_BY_CHARACTER { - Pos = MAP_APPFONT( 226, 81 ); + Pos = MAP_APPFONT( 241, 81 ); Size = MAP_APPFONT( 55, 24 ); WordBreak = TRUE; diff --git a/svx/source/cui/insrc.cxx b/svx/source/cui/insrc.cxx new file mode 100644 index 000000000000..10b0a5d713a3 --- /dev/null +++ b/svx/source/cui/insrc.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: insrc.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" +#ifdef SVX_DLLIMPLEMENTATION +#undef SVX_DLLIMPLEMENTATION +#endif + +#include <svx/dialmgr.hxx> +#include <svx/svxdlg.hxx> +#include <svx/dialogs.hrc> +#include "insrc.hxx" +#include "insrc.hrc" + +bool SvxInsRowColDlg::isInsertBefore() const +{ + return !aAfterBtn.IsChecked(); +} + +sal_uInt16 SvxInsRowColDlg::getInsertCount() const +{ + return static_cast< sal_uInt16 >( aCountEdit.GetValue() ); +} + +SvxInsRowColDlg::SvxInsRowColDlg(Window* pParent, bool bCol, ULONG nHelpId ) + : ModalDialog( pParent, SVX_RES(DLG_INS_ROW_COL) ), + aCount( this, SVX_RES( FT_COUNT ) ), + aCountEdit( this, SVX_RES( ED_COUNT ) ), + aInsFL( this, SVX_RES( FL_INS ) ), + aBeforeBtn( this, SVX_RES( CB_POS_BEFORE ) ), + aAfterBtn( this, SVX_RES( CB_POS_AFTER ) ), + aPosFL( this, SVX_RES( FL_POS ) ), + aRow(SVX_RES(STR_ROW)), + aCol(SVX_RES(STR_COL)), + aOKBtn( this, SVX_RES( BT_OK ) ), + aCancelBtn( this, SVX_RES( BT_CANCEL ) ), + aHelpBtn( this, SVX_RES( BT_HELP ) ), + bColumn( bCol ) +{ + FreeResource(); + String aTmp( GetText() ); + if( bColumn ) + { + aTmp += aCol; + } + else + { + aTmp += aRow; + } + SetText( aTmp ); + SetHelpId( nHelpId ); +} + +short SvxInsRowColDlg::Execute(void) +{ + return ModalDialog::Execute(); +} + + + diff --git a/svx/source/cui/insrc.hrc b/svx/source/cui/insrc.hrc new file mode 100644 index 000000000000..e07c7cb2f1d5 --- /dev/null +++ b/svx/source/cui/insrc.hrc @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: insrc.hrc,v $ + * $Revision: 1.4 $ + * + * 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. + * + ************************************************************************/ +#define FT_COUNT 1 +#define ED_COUNT 2 +#define FL_INS 3 + +#define CB_POS_BEFORE 10 +#define CB_POS_AFTER 11 +#define FL_POS 12 + +#define STR_ROW 20 +#define STR_COL 21 + +#define BT_OK 100 +#define BT_CANCEL 101 +#define BT_HELP 102 diff --git a/svx/source/cui/insrc.hxx b/svx/source/cui/insrc.hxx new file mode 100644 index 000000000000..e187313bdd03 --- /dev/null +++ b/svx/source/cui/insrc.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: insrc.hxx,v $ + * $Revision: 1.4 $ + * + * 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 _SVX_INSRC_HXX +#define _SVX_INSRC_HXX + +#include <svx/stddlg.hxx> + +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/button.hxx> +#include <vcl/group.hxx> +#include <vcl/button.hxx> + +#include <tools/string.hxx> + +class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public ModalDialog +{ + FixedText aCount; + NumericField aCountEdit; + FixedLine aInsFL; + + RadioButton aBeforeBtn; + RadioButton aAfterBtn; + FixedLine aPosFL; + + String aRow; + String aCol; + + OKButton aOKBtn; + CancelButton aCancelBtn; + HelpButton aHelpBtn; + + bool bColumn; + +public: + SvxInsRowColDlg( Window* pParent, bool bCol, ULONG nHelpId ); + + virtual short Execute(void); + + virtual bool isInsertBefore() const; + virtual sal_uInt16 getInsertCount() const; +}; + +#endif + diff --git a/svx/source/cui/insrc.src b/svx/source/cui/insrc.src new file mode 100644 index 000000000000..6023e94604ef --- /dev/null +++ b/svx/source/cui/insrc.src @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: insrc.src,v $ + * $Revision: 1.32 $ + * + * 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. + * + ************************************************************************/ + + +#include <svx/dialogs.hrc> +#include "insrc.hrc" + +ModalDialog DLG_INS_ROW_COL +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 136 , 84 ) ; + Text [ en-US ] = "Insert" ; + Moveable = TRUE ; + OKButton BT_OK + { + Pos = MAP_APPFONT ( 80 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT ( 80 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BT_HELP + { + Pos = MAP_APPFONT ( 80 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + RadioButton CB_POS_BEFORE + { + Pos = MAP_APPFONT ( 12 , 49 ) ; + Size = MAP_APPFONT ( 56 , 10 ) ; + Text [ en-US ] = "~Before" ; + TabStop = TRUE ; + }; + RadioButton CB_POS_AFTER + { + Pos = MAP_APPFONT ( 12 , 62 ) ; + Size = MAP_APPFONT ( 56 , 10 ) ; + Text [ en-US ] = "A~fter" ; + TabStop = TRUE ; + Check = TRUE ; + }; + NumericField ED_COUNT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 44 , 14 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 99 ; + Value = 1 ; + First = 1 ; + Last = 5 ; + }; + FixedLine FL_INS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 68 , 8 ) ; + Text [ en-US ] = "Insert" ; + }; + FixedLine FL_POS + { + Pos = MAP_APPFONT ( 6 , 38 ) ; + Size = MAP_APPFONT ( 68 , 8 ) ; + Text [ en-US ] = "Position"; + }; + FixedText FT_COUNT + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "~Number" ; + Left = TRUE ; + }; + String STR_ROW + { + Text [ en-US ] = " Rows" ; + }; + String STR_COL + { + Text [ en-US ] = " Columns" ; + }; +}; diff --git a/svx/source/cui/makefile.mk b/svx/source/cui/makefile.mk index 7db32bb15f7a..7a1db4a85f19 100755 --- a/svx/source/cui/makefile.mk +++ b/svx/source/cui/makefile.mk @@ -100,7 +100,8 @@ SRC1FILES = \ textattr.src \ treeopt.src \ webconninfo.src \ - zoom.src + zoom.src \ + insrc.src SRS2NAME=cuidrawdlgs SRC2FILES = \ @@ -221,7 +222,8 @@ SLOFILES+=\ $(SLO)$/macroass.obj \ $(SLO)$/cfg.obj \ $(SLO)$/cfgutil.obj \ - $(SLO)$/optchart.obj + $(SLO)$/optchart.obj \ + $(SLO)$/insrc.obj .IF "$(GUI)"=="WNT" SLOFILES+=$(SLO)$/winpluginlib.obj diff --git a/svx/source/cui/optgdlg.cxx b/svx/source/cui/optgdlg.cxx index ca8c361fa615..ed93ab97c7d6 100644 --- a/svx/source/cui/optgdlg.cxx +++ b/svx/source/cui/optgdlg.cxx @@ -136,7 +136,6 @@ int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ ) return LEAVE_PAGE; } -# ifdef ENABLE_GTK namespace { ::rtl::OUString impl_SystemFileOpenServiceName() @@ -146,13 +145,33 @@ namespace if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) ) { + #ifdef ENABLE_GTK return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" ); + #else + return rtl::OUString(); + #endif + } + else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) + { + #ifdef ENABLE_KDE4 + return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDE4FilePicker" ); + #else + return rtl::OUString(); + #endif } else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) { + #ifdef ENABLE_KDE return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDEFilePicker" ); + #else + return rtl::OUString(); + #endif } + #if defined WNT || (defined MACOSX && defined QUARTZ) return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" ); + #else + return rtl::OUString(); + #endif } sal_Bool lcl_HasSystemFilePicker() @@ -180,8 +199,6 @@ namespace } } -#endif - // ----------------------------------------------------------------------- OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) : @@ -210,20 +227,11 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) : { FreeResource(); - //system fileopen only available in Windows and with gtk vclplug based - //picker and on MacOSX (aqua version) -#if !defined( WNT ) && !defined( ENABLE_GTK ) && !(defined(MACOSX) && defined(QUARTZ)) - aFileDlgFL.Hide(); - aFileDlgCB.Hide(); -#else -# ifdef ENABLE_GTK if (!lcl_HasSystemFilePicker()) { aFileDlgFL.Hide(); aFileDlgCB.Hide(); } -# endif -#endif #if ! defined(QUARTZ) aPrintDlgFL.Hide(); diff --git a/svx/source/cui/optpath.cxx b/svx/source/cui/optpath.cxx index b31d56493aed..eeef9ec75fea 100644 --- a/svx/source/cui/optpath.cxx +++ b/svx/source/cui/optpath.cxx @@ -41,6 +41,7 @@ #include <tools/shl.hxx> #include <vcl/msgbox.hxx> #include <sfx2/filedlghelper.hxx> +#include <sfx2/app.hxx> #include <svtools/pickerhelper.hxx> #include <svtools/aeitem.hxx> #include <svtools/svtabbx.hxx> @@ -52,6 +53,7 @@ #include <unotools/localfilehelper.hxx> #include <svtools/pathoptions.hxx> #include <svtools/moduleoptions.hxx> +#include <svtools/viewoptions.hxx> #define _SVX_OPTPATH_CXX @@ -62,6 +64,7 @@ #include <svx/dialogs.hrc> #include "helpid.hrc" #include <comphelper/processfactory.hxx> +#include <comphelper/configurationhelper.hxx> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -91,6 +94,7 @@ using namespace svx; #define POSTFIX_WRITABLE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_writable" ) ) #define POSTFIX_READONLY String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_readonly" ) ) #define VAR_ONE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "%1" ) ) +#define IODLG_CONFIGNAME String(DEFINE_CONST_UNICODE("FilePicker_Save")) // struct OptPath_Impl --------------------------------------------------- @@ -536,6 +540,26 @@ void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder ) pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(nPos)->GetUserData(); pPathImpl->eState = SFX_ITEM_SET; pPathImpl->sWritablePath = sNewPathStr; + if ( SvtPathOptions::PATH_WORK == pPathImpl->nRealId ) + { + // Remove view options entry so the new work path + // will be used for the next open dialog. + SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME ); + aDlgOpt.Delete(); + // Reset also last used dir in the sfx application instance + SfxApplication *pSfxApp = SFX_APP(); + pSfxApp->ResetLastDir(); + + // Set configuration flag to notify file picker that it's necessary + // to take over the path provided. + Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + ::comphelper::ConfigurationHelper::writeDirectKey(xFactory, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")), + ::com::sun::star::uno::makeAny(true), + ::comphelper::ConfigurationHelper::E_STANDARD); + } } } diff --git a/svx/source/cui/page.cxx b/svx/source/cui/page.cxx index deb57fbddfb1..f842af6b7559 100644 --- a/svx/source/cui/page.cxx +++ b/svx/source/cui/page.cxx @@ -596,18 +596,24 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet ) aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ), ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) ); - // Werte in die Edits eintragen - SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), eUnit ); - SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), eUnit ); - aPaperSizeBox.Clear(); + aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM); + if ( bLandscape ) + Swap( aPaperSize ); + + // Actual Paper Format + Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, TRUE ); - // Papierformate - Size aTmpSize = aPaperSize; + if ( PAPER_USER != ePaper ) + aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ); if ( bLandscape ) - Swap( aTmpSize ); - // aktuelles Format - Paper ePaper = SvxPaperInfo::GetSvxPaper( aTmpSize, (MapUnit)eUnit, TRUE ); + Swap( aPaperSize ); + + // Werte in die Edits eintragen + SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM ); + SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM ); + aPaperSizeBox.Clear(); + USHORT nActPos = LISTBOX_ENTRY_NOTFOUND; USHORT nAryId = RID_SVXSTRARY_PAPERSIZE_STD; @@ -1044,19 +1050,19 @@ IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox ) if ( ePaper != PAPER_USER ) { - Size aSize( SvxPaperInfo::GetPaperSize( ePaper ) ); + Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) ); if ( aLandscapeBtn.IsChecked() ) Swap( aSize ); - if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_TWIP ) ) + if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) ) aPaperHeightEdit.SetMin( - aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_TWIP ); - if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_TWIP ) ) + aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM ); + if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) ) aPaperWidthEdit.SetMin( - aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_TWIP ); - SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_TWIP ); - SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_TWIP ); + aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM ); + SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM ); + SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM ); // R"ander ggf. neu berechnen CalcMargin_Impl(); @@ -1145,12 +1151,12 @@ IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn ) { bLandscape = aLandscapeBtn.IsChecked(); - const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ); - const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ); + const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM ); + const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM ); // swap with and height - SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_TWIP ); - SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_TWIP ); + SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM ); + SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM ); // recalculate margins if necessary CalcMargin_Impl(); diff --git a/svx/source/cui/page.h b/svx/source/cui/page.h index 4a114b278cca..98aefdc79cc4 100644 --- a/svx/source/cui/page.h +++ b/svx/source/cui/page.h @@ -60,7 +60,7 @@ #define PAPERSIZE_MONARCH 25 #define PAPERSIZE_COM675 26 #define PAPERSIZE_COM9 27 -#define PAPERSIZE_COM10 29 +#define PAPERSIZE_COM10 28 #define PAPERSIZE_COM11 29 #define PAPERSIZE_COM12 30 #define PAPERSIZE_KAI16 31 @@ -68,7 +68,7 @@ #define PAPERSIZE_KAI32BIG 33 #define PAPERSIZE_B4_JIS 34 #define PAPERSIZE_B5_JIS 35 -#define PAPERSIZE_B6_JIS 38 +#define PAPERSIZE_B6_JIS 36 #endif diff --git a/svx/source/cui/svuidlg.src b/svx/source/cui/svuidlg.src index a00a09e919e6..cc8f2db676ae 100644 --- a/svx/source/cui/svuidlg.src +++ b/svx/source/cui/svuidlg.src @@ -156,37 +156,37 @@ ModalDialog MD_UPDATE_BASELINKS }; CancelButton 1 { - Pos = MAP_APPFONT ( 275 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 270 , 6 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Close" ; }; HelpButton 1 { - Pos = MAP_APPFONT ( 275 , 26 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 270 , 26 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; PushButton PB_UPDATE_NOW { - Pos = MAP_APPFONT ( 275 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 270 , 43 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Update" ; }; PushButton PB_OPEN_SOURCE { - Pos = MAP_APPFONT ( 275 , 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 270 , 60 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Open" ; }; PushButton PB_CHANGE_SOURCE { - Pos = MAP_APPFONT ( 275 , 77 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 270 , 77 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Modify..." ; }; PushButton PB_BREAK_LINK { - Pos = MAP_APPFONT ( 275 , 94 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 270 , 94 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Break Link" ; }; FixedText FT_FILES2 diff --git a/svx/source/cui/zoom.src b/svx/source/cui/zoom.src index dca32260ab8d..197d1e2f2959 100644 --- a/svx/source/cui/zoom.src +++ b/svx/source/cui/zoom.src @@ -37,48 +37,48 @@ ModalDialog RID_SVXDLG_ZOOM HelpId = SID_ATTR_ZOOM ; OutputSize = TRUE ; SvLook = TRUE ; - Size = MAP_APPFONT ( 218 , 112 ) ; + Size = MAP_APPFONT ( 242 , 112 ) ; Moveable = TRUE ; Text [ en-US ] = "Zoom & View Layout"; FixedLine FL_ZOOM { Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; + Size = MAP_APPFONT ( 112 , 8 ) ; Text [ en-US ] = "Zoom factor"; }; RadioButton BTN_OPTIMAL { Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 91 , 10 ) ; + Size = MAP_APPFONT ( 105 , 10 ) ; Text [ en-US ] = "~Optimal" ; }; RadioButton BTN_WHOLE_PAGE { Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 91 , 10 ) ; + Size = MAP_APPFONT ( 105 , 10 ) ; Text [ en-US ] = "~Fit width and height" ; }; RadioButton BTN_PAGE_WIDTH { Pos = MAP_APPFONT ( 12 , 40 ) ; - Size = MAP_APPFONT ( 91 , 10 ) ; + Size = MAP_APPFONT ( 105, 10 ) ; Text [ en-US ] = "Fit ~width" ; }; RadioButton BTN_100 { Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 91 , 10 ) ; + Size = MAP_APPFONT ( 105, 10 ) ; Text = "~100 %" ; }; RadioButton BTN_USER { Pos = MAP_APPFONT ( 12 , 67 ) ; - Size = MAP_APPFONT ( 59 , 10 ) ; + Size = MAP_APPFONT ( 72 , 10 ) ; Text [ en-US ] = "~Variable" ; }; MetricField ED_USER { - Pos = MAP_APPFONT ( 74 , 66 ) ; + Pos = MAP_APPFONT ( 86 , 66 ) ; Size = MAP_APPFONT ( 32 , 12 ) ; Border = TRUE ; Group = TRUE ; @@ -91,31 +91,31 @@ ModalDialog RID_SVXDLG_ZOOM }; FixedLine FL_VIEWLAYOUT { - Pos = MAP_APPFONT ( 112 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; + Pos = MAP_APPFONT ( 124 , 3 ) ; + Size = MAP_APPFONT ( 112 , 8 ) ; Text [ en-US ] = "View layout"; }; RadioButton BTN_AUTOMATIC { - Pos = MAP_APPFONT ( 118 , 14 ) ; - Size = MAP_APPFONT ( 91 , 10 ) ; + Pos = MAP_APPFONT ( 130 , 14 ) ; + Size = MAP_APPFONT ( 106 , 10 ) ; Text [ en-US ] = "~Automatic" ; }; RadioButton BTN_SINGLE { - Pos = MAP_APPFONT ( 118 , 27 ) ; - Size = MAP_APPFONT ( 91 , 10 ) ; + Pos = MAP_APPFONT ( 130, 27 ) ; + Size = MAP_APPFONT ( 106, 10 ) ; Text [ en-US ] = "~Single page" ; }; RadioButton BTN_COLUMNS { - Pos = MAP_APPFONT ( 118 , 41 ) ; - Size = MAP_APPFONT ( 64 , 10 ) ; + Pos = MAP_APPFONT ( 130, 41 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; Text [ en-US ] = "~Columns" ; }; MetricField ED_COLUMNS { - Pos = MAP_APPFONT ( 185 , 40 ) ; + Pos = MAP_APPFONT ( 209 , 40 ) ; Size = MAP_APPFONT ( 24 , 12 ) ; Border = TRUE ; Group = TRUE ; @@ -128,29 +128,29 @@ ModalDialog RID_SVXDLG_ZOOM }; CheckBox CHK_BOOK { - Pos = MAP_APPFONT ( 124 , 55 ) ; + Pos = MAP_APPFONT ( 136 , 55 ) ; Size = MAP_APPFONT ( 85 , 10 ) ; Text [ en-US ] = "~Book mode" ; }; FixedLine FL_BOTTOM { Pos = MAP_APPFONT ( 6 , 81 ) ; - Size = MAP_APPFONT ( 206 , 8 ) ; + Size = MAP_APPFONT ( 230 , 8 ) ; }; OKButton BTN_ZOOM_OK { - Pos = MAP_APPFONT ( 53 , 92 ) ; + Pos = MAP_APPFONT ( 77 , 92 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; DefButton = TRUE ; }; CancelButton BTN_ZOOM_CANCEL { - Pos = MAP_APPFONT ( 106 , 92 ) ; + Pos = MAP_APPFONT ( 130 , 92 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; }; HelpButton BTN_ZOOM_HELP { - Pos = MAP_APPFONT ( 162 , 92 ) ; + Pos = MAP_APPFONT ( 186 , 92 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; }; }; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index fb95a5bfbb15..f066cd6a4729 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -751,30 +751,9 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : } break; case mso_sptCurvedLeftArrow : - { - if ( ( seqAdjustmentValues.getLength() > 2 ) && ( seqAdjustmentValues[ 2 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) ) - { - double fValue; - seqAdjustmentValues[ 2 ].Value >>= fValue; - fValue = 21600 - fValue; - seqAdjustmentValues[ 2 ].Value <<= fValue; - } - nFlags |= DFF_CUSTOMSHAPE_FLIP_H; - } - break; + case mso_sptCurvedRightArrow : case mso_sptCurvedUpArrow : - { - if ( ( seqAdjustmentValues.getLength() > 2 ) && ( seqAdjustmentValues[ 2 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) ) - { - double fValue; - seqAdjustmentValues[ 2 ].Value >>= fValue; - fValue = 21600 - fValue; - seqAdjustmentValues[ 2 ].Value <<= fValue; - } - nFlags |= DFF_CUSTOMSHAPE_FLIP_V | DFF_CUSTOMSHAPE_EXCH; - } - break; - case mso_sptCurvedDownArrow : nFlags |= DFF_CUSTOMSHAPE_EXCH; break; + case mso_sptCurvedDownArrow : nColorData = 0x2d000000; break; case mso_sptRibbon2 : nColorData = 0x30dd0000; break; case mso_sptRibbon : nColorData = 0x30dd0000; break; diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 9cb3c414de37..0b41dda45eaa 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -54,10 +54,6 @@ static const SvxMSDffTextRect TextRect[] = { { { 0, 0 }, { 0, 0 } } }; -static const sal_Int32 BoundRect[] = -{ - 0, 0, 21600, 21600 -}; static const mso_CustomShape mso = { (SvxMSDffVertPair*)mso_sptVert, sizeof( mso_sptVert ) / sizeof( SvxMSDffVertPair ), @@ -668,10 +664,6 @@ static const SvxMSDffVertPair mso_sptCanGluePoints[] = { { 44, 6 MSO_I }, { 44, 0 }, { 0, 10800 }, { 44, 21600 }, { 88, 10800 } }; -static const sal_Int32 mso_sptCanBoundRect[] = -{ - 0, 0, 88, 21600 -}; static const SvxMSDffHandle mso_sptCanHandle[] = { { MSDFF_HANDLE_FLAGS_RANGE, @@ -1197,60 +1189,422 @@ static const mso_CustomShape msoBentUpArrow = (SvxMSDffHandle*)mso_sptBentUpArrowHandle, sizeof( mso_sptBentUpArrowHandle ) / sizeof( SvxMSDffHandle ) }; -static const SvxMSDffVertPair mso_sptCurvedArrowVert[] = // adjustment1 : y 10800 - 21600, adjustment2 : y 16424 - 21600 -{ // adjustment3 : x 0 - 21600 - { 21600, 0 }, - { 9675, 0 }, { 0, 10 MSO_I }, { 0, 9 MSO_I }, // ccp - { 0, 11 MSO_I }, - { 0, 14 MSO_I }, { 15 MSO_I, 1 MSO_I }, { 2 MSO_I, 1 MSO_I }, // ccp - { 2 MSO_I, 21600 }, { 21600, 7 MSO_I }, { 2 MSO_I, 0 MSO_I }, { 2 MSO_I, 16 MSO_I },// pppp - { 2 MSO_I, 16 MSO_I }, { 80, 8 MSO_I }, { 80, 8 MSO_I }, // ccp - { 80, 8 MSO_I }, { 21600, 5 MSO_I }, { 21600, 0 } // ccp -}; -static const sal_uInt16 mso_sptCurvedArrowSegm[] = -{ - 0x4000, 0x2001, 0x0001, 0x2001, 0x0004, 0x2002, 0x6001, 0x8000 -}; -static const SvxMSDffCalculationData mso_sptCurvedArrowCalc[] = -{ - { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0 - { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, // 1 - { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, // 2 - { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } }, // 3 - { 0xa000, { DFF_Prop_adjust2Value, 0, DFF_Prop_adjustValue } }, // 4 - { 0xa000, { 0x0404, 0, 0x0403 } }, // 5 - { 0x2001, { 0x0405, 1, 2 } }, // 6 - { 0xa000, { DFF_Prop_adjust2Value, 0, 0x0406 } }, // 7 - { 0x2001, { DFF_Prop_adjust2Value, 1, 2 } }, // 8 - { 0xa000, { 0x0408, 0, 0x0406 } }, // 9 - { 0x2001, { 0x0409, 10000, 22326 } }, // 10 - { 0x6000, { 0x0409, 0x0405, 0 } }, // 11 - { 0xa000, { DFF_Prop_adjust2Value, 0, 0x040b } }, // 12 - { 0x2001, { 0x040c, 10000, 23148 } }, // 13 - { 0x6000, { 0x040d, 0x040b, 0 } }, // 14 - { 0x2001, { DFF_Prop_adjust3Value, 10000, 25467 } }, // 15 - { 0x6000, { DFF_Prop_adjustValue, 0x0403, 0 } } // 16 -}; -static const sal_Int32 mso_sptCurvedArrowDefault[] = -{ - 3, 13000, 19400, 14400 -}; -static const SvxMSDffTextRectangles mso_sptCurvedArrowTextRect[] = // todo + +static const SvxMSDffVertPair mso_sptCurvedDownVert[] = { - { { 0, 0 }, { 21600, 21600 } } + { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 0, 21600 }, { 4 MSO_I, 0 }, + { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 4 MSO_I, 0 }, { 17 MSO_I, 24 MSO_I }, + { 15 MSO_I, 0 }, { 1 MSO_I, 21 MSO_I }, { 17 MSO_I, 24 MSO_I }, { 15 MSO_I, 21600 }, + { 15 MSO_I, 0 }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 0 }, { 13 MSO_I, 2 MSO_I }, + { 14 MSO_I, 2 MSO_I }, { 8 MSO_I, 21600 }, { 12 MSO_I, 2 MSO_I }, + { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 11 MSO_I, 2 MSO_I }, { 17 MSO_I, 24 MSO_I }, + { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 17 MSO_I, 24 MSO_I }, { 4 MSO_I, 0 } +}; +static const sal_uInt16 mso_sptCurvedDownSegm[] = +{ + 0xa508, + 0xa304, + 0x6000, + 0x8000, + 0xa604, + 0x0003, + 0xa308, + 0x6000, + 0x8000 +}; +static const SvxMSDffCalculationData mso_sptCurvedDownCalc[] = +{ + { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, + { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } }, + { 0x2001, { 0x403, 1, 2 } }, + { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } }, + { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } }, + { 0x2001, { 0x406, 1, 2 } }, + { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } }, + { 0x8000, { 21600, 0, DFF_Prop_adjust3Value } }, + { 0xa00f, { 0x409, 21600, 0x404 } }, + { 0x6000, { 0x404, 0x40a, 0 } }, + { 0x6000, { 0x40b, DFF_Prop_adjust2Value, 21600 } }, + { 0x6000, { 0x407, 0x40a, 0 } }, + { 0xa000, { 0x40c, 21600, DFF_Prop_adjustValue } }, + { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x40f, 1, 2 } }, + { 0x6002, { 0x404, 0x407, 0 } }, + { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, + { 0x2001, { 0x412, 1, 2 } }, + { 0xa000, { 0x411, 0, 0x413 } }, + { 0x0001, { 21600, 2, 1 } }, + { 0xa000, { 0x411, 0, 0x404 } }, + { 0x600f, { 0x416, 0x404, 21600 } }, + { 0x8000, { 21600, 0, 0x417 } }, + { 0x2000, { 0x408, 128, 0 } }, + { 0x2001, { 0x405, 1, 2 } }, + { 0x2000, { 0x405, 0, 128 } }, + { 0xe000, { DFF_Prop_adjustValue, 0x411, 0x40c } }, + { 0x600f, { 0x414, 0x404, 21600 } }, + { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x41e, 1, 2 } }, + { 0x0001, { 21600, 21600, 1 } }, + { 0x6001, { 0x409, 0x409, 1 } }, + { 0xa000, { 0x420, 0, 0x421 } }, + { 0x200d, { 0x422, 0, 0 } }, + { 0x2000, { 0x423, 21600, 0 } }, + { 0x8001, { 21600, 21600, 0x424 } }, + { 0x2000, { 0x425, 64, 0 } }, + { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, + { 0x600f, { 0x41f, 0x427, 21600 } }, + { 0x8000, { 21600, 0, 0x428 } }, + { 0x2000, { 0x429, 64, 0 } }, + { 0x2001, { 0x404, 1, 2 } }, + { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42b } }, + { 0x0001, { 21600, 2195, 16384 } }, + { 0x0001, { 21600, 14189, 16384 } } }; -static const mso_CustomShape msoCurvedArrow = +static const sal_Int32 mso_sptCurvedDownDefault[] = { - (SvxMSDffVertPair*)mso_sptCurvedArrowVert, sizeof( mso_sptCurvedArrowVert ) / sizeof( SvxMSDffVertPair ), - (sal_uInt16*)mso_sptCurvedArrowSegm, sizeof( mso_sptCurvedArrowSegm ) >> 1, - (SvxMSDffCalculationData*)mso_sptCurvedArrowCalc, sizeof( mso_sptCurvedArrowCalc ) / sizeof( SvxMSDffCalculationData ), - (sal_Int32*)mso_sptCurvedArrowDefault, - (SvxMSDffTextRectangles*)mso_sptCurvedArrowTextRect, sizeof( mso_sptCurvedArrowTextRect ) / sizeof( SvxMSDffTextRectangles ), + 3, 12960, 19440, 14400 +}; +static const SvxMSDffTextRectangles mso_sptCurvedDownTextRect[] = +{ + { { 43 MSO_I, 45 MSO_I }, { 44 MSO_I, 46 MSO_I } } +}; +static const SvxMSDffVertPair mso_sptCurvedDownGluePoints[] = +{ + { 17 MSO_I, 0 }, { 16 MSO_I, 21600 }, { 12 MSO_I, 2 MSO_I }, { 8 MSO_I, 21600 }, { 14 MSO_I, 2 MSO_I } +}; +static const SvxMSDffHandle mso_sptCurvedDownHandles[] = +{ + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x100, 21600, 10800, 10800, 3 + 0x26, 3 + 0x1b, 0, 10800 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL, + 0x101, 21600, 10800, 10800, 3 + 0x19, 21600, 0, 10800 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL, + 21600, 0x102, 10800, 10800, 3375, 21600, 3 + 0x2a, 21600 } +}; +static const mso_CustomShape msoCurvedDownArrow = +{ + (SvxMSDffVertPair*)mso_sptCurvedDownVert, sizeof( mso_sptCurvedDownVert ) / sizeof( SvxMSDffVertPair ), + (sal_uInt16*)mso_sptCurvedDownSegm, sizeof( mso_sptCurvedDownSegm ) >> 1, + (SvxMSDffCalculationData*)mso_sptCurvedDownCalc, sizeof( mso_sptCurvedDownCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedDownDefault, + (SvxMSDffTextRectangles*)mso_sptCurvedDownTextRect, sizeof( mso_sptCurvedDownTextRect ) / sizeof( SvxMSDffTextRectangles ), 21600, 21600, 0x80000000, 0x80000000, - NULL, 0, - NULL, 0 // handles + (SvxMSDffVertPair*)mso_sptCurvedDownGluePoints, sizeof( mso_sptCurvedDownGluePoints ) / sizeof( SvxMSDffVertPair ), + (SvxMSDffHandle*)mso_sptCurvedDownHandles, sizeof( mso_sptCurvedDownHandles ) / sizeof( SvxMSDffHandle ) +}; + +static const SvxMSDffVertPair mso_sptCurvedUpVert[] = +{ + { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 0, 0 }, { 4 MSO_I, 21 MSO_I }, + { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 12 MSO_I, 2 MSO_I }, + { 13 MSO_I, 2 MSO_I }, { 8 MSO_I, 0 }, { 11 MSO_I, 2 MSO_I }, + { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 10 MSO_I, 2 MSO_I }, { 16 MSO_I, 24 MSO_I }, + { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I }, { 14 MSO_I, 0 }, + { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I } +}; +static const sal_uInt16 mso_sptCurvedUpSegm[] = +{ + 0xa408, + 0x0003, + 0xa508, + 0x6000, + 0x8000, + 0xa604, + 0xaa00, + 0x8000 +}; +static const SvxMSDffCalculationData mso_sptCurvedUpCalc[] = +{ + { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, + { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } }, + { 0x2001, { 0x403, 1, 2 } }, + { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } }, + { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } }, + { 0x2001, { 0x406, 1, 2 } }, + { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } }, + { 0xa00f, { DFF_Prop_adjust3Value, 21600, 0x404 } }, + { 0x6000, { 0x404, 0x409, 0 } }, + { 0x6000, { 0x40a, DFF_Prop_adjust2Value, 21600 } }, + { 0x6000, { 0x407, 0x409, 0 } }, + { 0xa000, { 0x40b, 21600, DFF_Prop_adjustValue } }, + { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x40e, 1, 2 } }, + { 0x6002, { 0x404, 0x407, 0 } }, + { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, + { 0x2001, { 0x411, 1, 2 } }, + { 0xa000, { 0x410, 0, 0x412 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0000, { 0, 0, 21600 } }, + { 0xa000, { 0x410, 0, 0x404 } }, + { 0x600f, { 0x417, 0x404, 21600 } }, + { 0x2000, { 0x408, 128, 0 } }, + { 0x2001, { 0x405, 1, 2 } }, + { 0x2000, { 0x405, 0, 128 } }, + { 0xe000, { DFF_Prop_adjustValue, 0x410, 0x40b } }, + { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x41d, 1, 2 } }, + { 0x0001, { 21600, 21600, 1 } }, + { 0x6001, { DFF_Prop_adjust3Value, DFF_Prop_adjust3Value, 1 } }, + { 0xa000, { 0x41f, 0, 0x420 } }, + { 0x200d, { 0x421, 0, 0 } }, + { 0x2000, { 0x422, 21600, 0 } }, + { 0x8001, { 21600, 21600, 0x423 } }, + { 0x2000, { 0x424, 64, 0 } }, + { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, + { 0x600f, { 0x41e, 0x426, 21600 } }, + { 0x2000, { 0x427, 0, 64 } }, + { 0x2001, { 0x404, 1, 2 } }, + { 0xa000, { DFF_Prop_adjust2Value, 0, 0x429 } }, + { 0x0001, { 21600, 2195, 16384 } }, + { 0x0001, { 21600, 14189, 16384 } } +}; +static const sal_Int32 mso_sptCurvedUpDefault[] = +{ + 3, 12960, 19440, 7200 +}; +static const SvxMSDffTextRectangles mso_sptCurvedUpTextRect[] = +{ + { { 41 MSO_I, 43 MSO_I }, { 42 MSO_I, 44 MSO_I } } +}; +static const SvxMSDffVertPair mso_sptCurvedUpGluePoints[] = +{ + { 8 MSO_I, 0 }, { 11 MSO_I, 2 MSO_I }, { 15 MSO_I, 0 }, { 16 MSO_I, 21 MSO_I }, { 13 MSO_I, 2 MSO_I } +}; +static const SvxMSDffHandle mso_sptCurvedUpHandles[] = +{ + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x100, 0, 10800, 10800, 3 + 37, 3 + 27, 0, 10800 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x101, 0, 10800, 10800, 3 + 25, 3 + 20, 0, 10800 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 21600, 0x102, 10800, 10800, 3375, 21600, 0, 3 + 40 } +}; +static const mso_CustomShape msoCurvedUpArrow = +{ + (SvxMSDffVertPair*)mso_sptCurvedUpVert, sizeof( mso_sptCurvedUpVert ) / sizeof( SvxMSDffVertPair ), + (sal_uInt16*)mso_sptCurvedUpSegm, sizeof( mso_sptCurvedUpSegm ) >> 1, + (SvxMSDffCalculationData*)mso_sptCurvedUpCalc, sizeof( mso_sptCurvedUpCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedUpDefault, + (SvxMSDffTextRectangles*)mso_sptCurvedUpTextRect, sizeof( mso_sptCurvedUpTextRect ) / sizeof( SvxMSDffTextRectangles ), + 21600, 21600, + 0x80000000, 0x80000000, + (SvxMSDffVertPair*)mso_sptCurvedUpGluePoints, sizeof( mso_sptCurvedUpGluePoints ) / sizeof( SvxMSDffVertPair ), + (SvxMSDffHandle*)mso_sptCurvedUpHandles, sizeof( mso_sptCurvedUpHandles ) / sizeof( SvxMSDffHandle ) +}; + +static const SvxMSDffVertPair mso_sptCurvedRightVert[] = +{ + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 22 MSO_I, 0 }, { 0, 4 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 0, 7 MSO_I }, { 2 MSO_I, 13 MSO_I }, + { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 2 MSO_I, 11 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 22 MSO_I, 15 MSO_I }, + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 0, 4 MSO_I }, { 26 MSO_I, 17 MSO_I } +}; +static const sal_uInt16 mso_sptCurvedRightSegm[] = +{ + 0xa408, + 0x0003, + 0xa508, + 0x6000, + 0x8000, + 0xa404, + 0xaa00, + 0x8000 +}; +static const SvxMSDffCalculationData mso_sptCurvedRightCalc[] = +{ + { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, + { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } }, + { 0x2001, { 0x403, 1, 2 } }, + { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } }, + { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } }, + { 0x2001, { 0x406, 1, 2 } }, + { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } }, + { 0x8000, { 21600, 0, DFF_Prop_adjust3Value } }, + { 0xa00f, { 0x409, 21600, 0x404 } }, + { 0x6000, { 0x404, 0x40a, 0 } }, + { 0x6000, { 0x40b, DFF_Prop_adjust2Value, 21600 } }, + { 0x6000, { 0x407, 0x40a, 0 } }, + { 0xa000, { 0x40c, 21600, DFF_Prop_adjustValue } }, + { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x40f, 1, 2 } }, + { 0x6002, { 0x404, 0x407, 0 } }, + { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, + { 0x2001, { 0x412, 1, 2 } }, + { 0xa000, { 0x411, 0, 0x413 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0001, { 21600, 2, 1 } }, + { 0xa000, { 0x411, 0, 0x404 } }, + { 0x600f, { 0x418, 0x404, 21600 } }, + { 0x8000, { 21600, 0, 0x419 } }, + { 0x2000, { 0x408, 128, 0 } }, + { 0x2001, { 0x405, 1, 2 } }, + { 0x2000, { 0x405, 0, 128 } }, + { 0xe000, { DFF_Prop_adjustValue, 0x411, 0x40c } }, + { 0x600f, { 0x414, 0x404, 21600 } }, + { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x420, 1, 2 } }, + { 0x0001, { 21600, 21600, 1 } }, + { 0x6001, { 0x409, 0x409, 1 } }, + { 0xa000, { 0x422, 0, 0x423 } }, + { 0x200d, { 0x424, 0, 0 } }, + { 0x2000, { 0x425, 21600, 0 } }, + { 0x8001, { 21600, 21600, 0x426 } }, + { 0x2000, { 0x427, 64, 0 } }, + { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, + { 0x600f, { 0x421, 0x429, 21600 } }, + { 0x8000, { 21600, 0, 0x42a } }, + { 0x2000, { 0x42b, 64, 0 } }, + { 0x2001, { 0x404, 1, 2 } }, + { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42d } }, + { 0x0001, { 21600, 2195, 16384 } }, + { 0x0001, { 21600, 14189, 16384 } } +}; +static const sal_Int32 mso_sptCurvedRightDefault[] = +{ + 3, 12960, 19440, 14400 +}; +static const SvxMSDffTextRectangles mso_sptCurvedRightTextRect[] = +{ + { { 47 MSO_I, 45 MSO_I }, { 48 MSO_I, 46 MSO_I } } +}; +static const SvxMSDffVertPair mso_sptCurvedRightGluePoints[] = +{ + { 0, 17 MSO_I }, { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, { 22 MSO_I, 16 MSO_I } +}; +static const SvxMSDffHandle mso_sptCurvedRightHandles[] = +{ + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 21600, 0x100, 10800, 10800, 0, 10800, 3 + 40, 3 + 29 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 21600, 0x101, 10800, 10800, 0, 10800, 3 + 27, 3 + 21 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x102, 21600, 10800, 10800, 3 + 44, 3 + 22, 3375, 21600 } +}; +static const mso_CustomShape msoCurvedRightArrow = +{ + (SvxMSDffVertPair*)mso_sptCurvedRightVert, sizeof( mso_sptCurvedRightVert ) / sizeof( SvxMSDffVertPair ), + (sal_uInt16*)mso_sptCurvedRightSegm, sizeof( mso_sptCurvedRightSegm ) >> 1, + (SvxMSDffCalculationData*)mso_sptCurvedRightCalc, sizeof( mso_sptCurvedRightCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedRightDefault, + (SvxMSDffTextRectangles*)mso_sptCurvedRightTextRect, sizeof( mso_sptCurvedRightTextRect ) / sizeof( SvxMSDffTextRectangles ), + 21600, 21600, + 0x80000000, 0x80000000, + (SvxMSDffVertPair*)mso_sptCurvedRightGluePoints, sizeof( mso_sptCurvedRightGluePoints ) / sizeof( SvxMSDffVertPair ), + (SvxMSDffHandle*)mso_sptCurvedRightHandles, sizeof( mso_sptCurvedRightHandles ) / sizeof( SvxMSDffHandle ) +}; + +static const SvxMSDffVertPair mso_sptCurvedLeftVert[] = +{ + { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 0, 0 }, { 21 MSO_I, 4 MSO_I }, { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 2 MSO_I, 12 MSO_I }, + { 2 MSO_I, 13 MSO_I }, { 0, 8 MSO_I }, { 2 MSO_I, 11 MSO_I }, + { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 2 MSO_I, 10 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 0, 14 MSO_I }, + { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 24 MSO_I, 16 MSO_I } +}; +static const sal_uInt16 mso_sptCurvedLeftSegm[] = +{ + 0xa608, + 0x0003, + 0xa308, + 0x6000, + 0x8000, + 0xa404, + 0xaa00, + 0x8000 +}; +static const SvxMSDffCalculationData mso_sptCurvedLeftCalc[] = +{ + { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, + { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, + { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } }, + { 0x2001, { 0x403, 1, 2 } }, + { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } }, + { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } }, + { 0x2001, { 0x406, 1, 2 } }, + { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } }, + { 0xa00f, { DFF_Prop_adjust3Value, 21600, 0x404 } }, + { 0x6000, { 0x404, 0x409, 0 } }, + { 0x6000, { 0x40a, DFF_Prop_adjust2Value, 21600 } }, + { 0x6000, { 0x407, 0x409, 0 } }, + { 0xa000, { 0x40b, 21600, DFF_Prop_adjustValue } }, + { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x40e, 1, 2 } }, + { 0x6002, { 0x404, 0x407, 0 } }, + { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, + { 0x2001, { 0x411, 1, 2 } }, + { 0xa000, { 0x410, 0, 0x412 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0000, { 0, 0, 21600 } }, + { 0xa000, { 0x410, 0, 0x404 } }, + { 0x600f, { 0x417, 0x404, 21600 } }, + { 0x2000, { 0x408, 128, 0 } }, + { 0x2001, { 0x405, 1, 2 } }, + { 0x2000, { 0x405, 0, 128 } }, + { 0xe000, { DFF_Prop_adjustValue, 0x410, 0x40b } }, + { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, + { 0x2001, { 0x41d, 1, 2 } }, + { 0x0001, { 21600, 21600, 1 } }, + { 0x6001, { DFF_Prop_adjust3Value, DFF_Prop_adjust3Value, 1 } }, + { 0xa000, { 0x41f, 0, 0x420 } }, + { 0x200d, { 0x421, 0, 0 } }, + { 0x2000, { 0x422, 21600, 0 } }, + { 0x8001, { 21600, 21600, 0x423 } }, + { 0x2000, { 0x424, 64, 0 } }, + { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, + { 0x600f, { 0x41e, 0x426, 21600 } }, + { 0x2000, { 0x427, 0, 64 } }, + { 0x2001, { 0x404, 1, 2 } }, + { 0xa000, { DFF_Prop_adjust2Value, 0, 0x429 } }, + { 0x0001, { 21600, 2195, 16384 } }, + { 0x0001, { 21600, 14189, 16384 } } +}; +static const sal_Int32 mso_sptCurvedLeftDefault[] = +{ + 3, 12960, 19440, 7200 +}; +static const SvxMSDffTextRectangles mso_sptCurvedLeftTextRect[] = +{ + { { 43 MSO_I, 41 MSO_I }, { 44 MSO_I, 42 MSO_I } } }; +static const SvxMSDffVertPair mso_sptCurvedLeftGluePoints[] = +{ + { 0, 15 MSO_I }, { 2 MSO_I, 11 MSO_I }, { 0, 8 MSO_I }, { 2 MSO_I, 13 MSO_I }, { 21 MSO_I, 16 MSO_I } +}; +static const SvxMSDffHandle mso_sptCurvedLeftHandles[] = +{ + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 0, 0x100, 10800, 10800, 0, 10800, 3 + 37, 3 + 27 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 0, 0x101, 10800, 10800, 0, 10800, 3 + 25, 3 + 20 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x102, 21600, 10800, 10800, 0, 3 + 40, 3375, 21600 } +}; +static const mso_CustomShape msoCurvedLeftArrow = +{ + (SvxMSDffVertPair*)mso_sptCurvedLeftVert, sizeof( mso_sptCurvedLeftVert ) / sizeof( SvxMSDffVertPair ), + (sal_uInt16*)mso_sptCurvedLeftSegm, sizeof( mso_sptCurvedLeftSegm ) >> 1, + (SvxMSDffCalculationData*)mso_sptCurvedLeftCalc, sizeof( mso_sptCurvedLeftCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedLeftDefault, + (SvxMSDffTextRectangles*)mso_sptCurvedLeftTextRect, sizeof( mso_sptCurvedLeftTextRect ) / sizeof( SvxMSDffTextRectangles ), + 21600, 21600, + 0x80000000, 0x80000000, + (SvxMSDffVertPair*)mso_sptCurvedLeftGluePoints, sizeof( mso_sptCurvedLeftGluePoints ) / sizeof( SvxMSDffVertPair ), + (SvxMSDffHandle*)mso_sptCurvedLeftHandles, sizeof( mso_sptCurvedLeftHandles ) / sizeof( SvxMSDffHandle ) +}; + + + + static const SvxMSDffVertPair mso_sptStripedRightArrowVert[] = // adjustment1 : x 3375 - 21600 { // adjustment2 : y 0 - 10800 @@ -3046,10 +3400,6 @@ static const SvxMSDffVertPair mso_sptHeartGluePoints[] = { { 10800, 2180 }, { 3090, 10800 }, { 10800, 21600 }, { 18490, 10800 } }; -static const sal_Int32 mso_sptHeartBoundRect[] = -{ - -9, 0, 21606, 21602 -}; static const mso_CustomShape msoHeart = { (SvxMSDffVertPair*)mso_sptHeartVert, sizeof( mso_sptHeartVert ) / sizeof( SvxMSDffVertPair ), @@ -7772,10 +8122,10 @@ const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType ) case mso_sptUturnArrow : pCustomShape = &msoUturnArrow; break; case mso_sptLeftUpArrow : pCustomShape = &msoLeftUpArrow; break; case mso_sptBentUpArrow : pCustomShape = &msoBentUpArrow; break; - case mso_sptCurvedRightArrow : pCustomShape = &msoCurvedArrow; break; - case mso_sptCurvedLeftArrow : pCustomShape = &msoCurvedArrow; break; - case mso_sptCurvedUpArrow : pCustomShape = &msoCurvedArrow; break; - case mso_sptCurvedDownArrow : pCustomShape = &msoCurvedArrow; break; + case mso_sptCurvedRightArrow : pCustomShape = &msoCurvedRightArrow; break; + case mso_sptCurvedLeftArrow : pCustomShape = &msoCurvedLeftArrow; break; + case mso_sptCurvedUpArrow : pCustomShape = &msoCurvedUpArrow; break; + case mso_sptCurvedDownArrow : pCustomShape = &msoCurvedDownArrow; break; case mso_sptStripedRightArrow : pCustomShape = &msoStripedRightArrow; break; case mso_sptNotchedRightArrow : pCustomShape = &msoNotchedRightArrow; break; case mso_sptHomePlate : pCustomShape = &msoHomePlate; break; diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index beef4fe8ae48..59d0c721b560 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -173,24 +173,22 @@ void SvxRectCtl::InitRectBitmap( void ) pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) ); // set bitmap-colors - long aTempAry1[(7*sizeof(Color))/sizeof(long)]; - long aTempAry2[(7*sizeof(Color))/sizeof(long)]; - Color* pColorAry1 = (Color*)aTempAry1; - Color* pColorAry2 = (Color*)aTempAry2; - pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray - pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow - pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white - pColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray - pColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black - pColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green - pColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue - pColorAry2[0] = rStyles.GetDialogColor(); // background - pColorAry2[1] = rStyles.GetWindowColor(); - pColorAry2[2] = rStyles.GetLightColor(); - pColorAry2[3] = rStyles.GetShadowColor(); - pColorAry2[4] = rStyles.GetDarkShadowColor(); - pColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - pColorAry2[6] = rStyles.GetDialogColor(); + Color aColorAry1[7]; + Color aColorAry2[7]; + aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray + aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow + aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white + aColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray + aColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black + aColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green + aColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue + aColorAry2[0] = rStyles.GetDialogColor(); // background + aColorAry2[1] = rStyles.GetWindowColor(); + aColorAry2[2] = rStyles.GetLightColor(); + aColorAry2[3] = rStyles.GetShadowColor(); + aColorAry2[4] = rStyles.GetDarkShadowColor(); + aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); + aColorAry2[6] = rStyles.GetDialogColor(); #ifdef DBG_UTIL static BOOL bModify = FALSE; @@ -205,11 +203,11 @@ void SvxRectCtl::InitRectBitmap( void ) UINT8& rr = r; UINT8& rg = g; UINT8& rb = b; - pColorAry2[ rn ] = Color( rr, rg, rb ); + aColorAry2[ rn ] = Color( rr, rg, rb ); } #endif - pBitmap->Replace( pColorAry1, pColorAry2, 7, NULL ); + pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL ); } // ----------------------------------------------------------------------- diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 50b74e15a8f9..c0ac2da109e5 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -604,6 +604,14 @@ void SvxFontPrevWindow::SetColor(const Color &rColor) pImpl->pColor = new Color( rColor ); Invalidate(); } +// ----------------------------------------------------------------------- + +void SvxFontPrevWindow::ResetColor() +{ + delete pImpl->pColor; + pImpl->pColor = 0; + Invalidate(); +} // ----------------------------------------------------------------------- diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 8d0ec6ac4d59..918234222135 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -394,7 +394,7 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings ) aCalcStr ( THIS_SVX_RES( STR_WORDCALC ) ), \ pImpl ( NULL ), \ pSearchList ( NULL ), \ - pReplaceList ( NULL ), \ + pReplaceList ( new SearchAttrItemList ), \ pSearchItem ( NULL ), \ pSearchController ( NULL ), \ pOptionsController ( NULL ), \ diff --git a/svx/source/editeng/editobj.cxx b/svx/source/editeng/editobj.cxx index d0170e507060..fb5e921f60f0 100644 --- a/svx/source/editeng/editobj.cxx +++ b/svx/source/editeng/editobj.cxx @@ -253,6 +253,18 @@ void ContentInfo::DestroyLoadStoreTempInfos() } */ +// #i102062# +bool ContentInfo::isWrongListEqual(const ContentInfo& rCompare) const +{ + if(GetWrongList() == rCompare.GetWrongList()) + return true; + + if(!GetWrongList() || !rCompare.GetWrongList()) + return false; + + return (*GetWrongList() == *rCompare.GetWrongList()); +} + bool ContentInfo::operator==( const ContentInfo& rCompare ) const { if( (aText == rCompare.aText) && @@ -566,6 +578,12 @@ bool EditTextObject::operator==( const EditTextObject& rCompare ) const return static_cast< const BinTextObject* >( this )->operator==( static_cast< const BinTextObject& >( rCompare ) ); } +// #i102062# +bool EditTextObject::isWrongListEqual(const EditTextObject& rCompare) const +{ + return static_cast< const BinTextObject* >(this)->isWrongListEqual(static_cast< const BinTextObject& >(rCompare)); +} + // from SfxItemPoolUser void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) { @@ -599,6 +617,23 @@ void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) } } +EditEngineItemPool* getEditEngineItemPool(SfxItemPool* pPool) +{ + EditEngineItemPool* pRetval = dynamic_cast< EditEngineItemPool* >(pPool); + + while(!pRetval && pPool && pPool->GetSecondaryPool()) + { + pPool = pPool->GetSecondaryPool(); + + if(pPool) + { + pRetval = dynamic_cast< EditEngineItemPool* >(pPool); + } + } + + return pRetval; +} + BinTextObject::BinTextObject( SfxItemPool* pP ) : EditTextObject( EE_FORMAT_BIN ), SfxItemPoolUser() @@ -608,9 +643,17 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : nUserType = 0; nObjSettings = 0; pPortionInfo = 0; - if ( pP ) + + // #i101239# ensure target is a EditEngineItemPool, else + // fallback to pool ownership. This is needed to ensure that at + // pool destruction time of an alien pool, the pool is still alive. + // When registering would happen at an alien pool which just uses an + // EditEngineItemPool as some sub-pool, that pool could already + // be decoupled and deleted whcih would lead to crashes. + pPool = getEditEngineItemPool(pP); + + if ( pPool ) { - pPool = pP; bOwnerOfPool = FALSE; } else @@ -621,6 +664,7 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : if(!bOwnerOfPool && pPool) { + // it is sure now that the pool is an EditEngineItemPool pPool->AddSfxItemPoolUser(*this); } @@ -641,9 +685,12 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : nScriptType = r.nScriptType; pPortionInfo = NULL; // PortionInfo nicht kopieren bStoreUnicodeStrings = FALSE; + if ( !r.bOwnerOfPool ) { - // Dann den Pool mitverwenden + // reuse alien pool; this must be a EditEngineItemPool + // since there is no other way to construct a BinTextObject + // than it's regular constructor where that is ensured pPool = r.pPool; bOwnerOfPool = FALSE; } @@ -656,6 +703,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : if(!bOwnerOfPool && pPool) { + // it is sure now that the pool is an EditEngineItemPool pPool->AddSfxItemPoolUser(*this); } @@ -1589,6 +1637,28 @@ bool BinTextObject::operator==( const BinTextObject& rCompare ) const return true; } +// #i102062# +bool BinTextObject::isWrongListEqual(const BinTextObject& rCompare) const +{ + if(GetContents().Count() != rCompare.GetContents().Count()) + { + return false; + } + + for(USHORT a(0); a < GetContents().Count(); a++) + { + const ContentInfo& rCandA(*GetContents().GetObject(a)); + const ContentInfo& rCandB(*rCompare.GetContents().GetObject(a)); + + if(!rCandA.isWrongListEqual(rCandB)) + { + return false; + } + } + + return true; +} + #define CHARSETMARKER 0x9999 void __EXPORT BinTextObject::CreateData300( SvStream& rIStream ) diff --git a/svx/source/editeng/editobj2.hxx b/svx/source/editeng/editobj2.hxx index 51a044575dd2..2ed9c8b3e6d8 100644 --- a/svx/source/editeng/editobj2.hxx +++ b/svx/source/editeng/editobj2.hxx @@ -181,13 +181,10 @@ public: WrongList* GetWrongList() const { return pWrongs; } void SetWrongList( WrongList* p ) { pWrongs = p; } - -/* cl removed because not needed anymore since binfilter - LoadStoreTempInfos* GetLoadStoreTempInfos() const { return pTempLoadStoreInfos; } - void CreateLoadStoreTempInfos(); - void DestroyLoadStoreTempInfos(); -*/ bool operator==( const ContentInfo& rCompare ) const; + + // #i102062# + bool isWrongListEqual(const ContentInfo& rCompare) const; }; typedef ContentInfo* ContentInfoPtr; @@ -198,6 +195,7 @@ SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 ) class BinTextObject : public EditTextObject, public SfxItemPoolUser { using EditTextObject::operator==; + using EditTextObject::isWrongListEqual; private: ContentInfoList aContents; @@ -303,6 +301,9 @@ public: bool operator==( const BinTextObject& rCompare ) const; + // #i102062# + bool isWrongListEqual(const BinTextObject& rCompare) const; + // from SfxItemPoolUser virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool); }; diff --git a/svx/source/editeng/edtspell.cxx b/svx/source/editeng/edtspell.cxx index 25cf685a5df7..df6725cff00f 100644 --- a/svx/source/editeng/edtspell.cxx +++ b/svx/source/editeng/edtspell.cxx @@ -476,6 +476,31 @@ WrongList* WrongList::Clone() const return pNew; } +// #i102062# +bool WrongList::operator==(const WrongList& rCompare) const +{ + // cleck direct members + if(GetInvalidStart() != rCompare.GetInvalidStart() + || GetInvalidEnd() != rCompare.GetInvalidEnd() + || Count() != rCompare.Count()) + { + return false; + } + + for(USHORT a(0); a < Count(); a++) + { + const WrongRange& rCandA(GetObject(a)); + const WrongRange& rCandB(rCompare.GetObject(a)); + + if(rCandA.nStart != rCandB.nStart + || rCandA.nEnd != rCandB.nEnd) + { + return false; + } + } + + return true; +} #ifdef DBG_UTIL sal_Bool WrongList::DbgIsBuggy() const diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index ebd11f87c477..22ef5777f730 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -538,6 +538,19 @@ void E3dScene::operator=(const SdrObject& rObj) // #110988# ImpCleanup3DDepthMapper(); + + // #i101941# + // After a Scene as model object is cloned, the used + // ViewContactOfE3dScene is created and partially used + // to calculate Bound/SnapRects, but - since quite some + // values are buffered at the VC - not really well + // initialized. It would be possible to always watch for + // preconditions of buffered data, but this would be expensive + // and would create a lot of short living data structures. + // It is currently better to flush that data, e.g. by using + // ActionChanged at the VC which will for this class + // flush that cached data and initalize it's valid reconstruction + GetViewContact().ActionChanged(); } /************************************************************************* diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 25992ad607dd..b5cdd332362d 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -134,7 +134,8 @@ BOOL SgaObject::CreateThumb( const Graphic& rGraphic ) else aSize.Height() = (sal_Int32)( S_THUMB / fFactor ); - aThumbBmp = rGraphic.GetBitmap( &aSize ); + const GraphicConversionParameters aParameters(aSize); + aThumbBmp = rGraphic.GetBitmap(aParameters); if( !aThumbBmp.IsEmpty() ) { diff --git a/svx/source/msfilter/mscodec.cxx b/svx/source/msfilter/mscodec.cxx index 1e6c9de7112f..591bce8f4f6d 100644 --- a/svx/source/msfilter/mscodec.cxx +++ b/svx/source/msfilter/mscodec.cxx @@ -432,11 +432,12 @@ bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 n return (result); } -bool MSCodec_Std97::Encode( +bool MSCodec_Std97::Encode ( const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) { rtlCipherError result; + result = rtl_cipher_encode ( m_hCipher, pData, nDatLen, pBuffer, nBufLen); @@ -498,6 +499,38 @@ void MSCodec_Std97::GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 memcpy(pDigest, pDigestLocal, 16); } +void MSCodec_Std97::GetEncryptKey ( + const sal_uInt8 pSalt[16], + sal_uInt8 pSaltData[16], + sal_uInt8 pSaltDigest[16]) +{ + if (InitCipher(0)) + { + sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5]; + sal_uInt8 pBuffer[64]; + + rtl_cipher_encode ( + m_hCipher, pSalt, 16, pSaltData, sizeof(pBuffer)); + + (void)memcpy( pBuffer, pSalt, 16 ); + + pBuffer[16] = 0x80; + (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17); + pBuffer[56] = 0x80; + + rtl_digest_updateMD5 ( + m_hDigest, pBuffer, sizeof(pBuffer)); + rtl_digest_rawMD5 ( + m_hDigest, pDigest, sizeof(pDigest)); + + rtl_cipher_encode ( + m_hCipher, pDigest, 16, pSaltDigest, 16); + + (void)memset (pBuffer, 0, sizeof(pBuffer)); + (void)memset (pDigest, 0, sizeof(pDigest)); + } +} + // ============================================================================ } // namespace svx diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 5a8c149fa2bf..5830a737e790 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -4754,13 +4754,13 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r if ( ( nGroupRotateAngle > 4500 && nGroupRotateAngle <= 13500 ) || ( nGroupRotateAngle > 22500 && nGroupRotateAngle <= 31500 ) ) { - sal_Int32 nHalfWidth = ( aGlobalChildRect.GetWidth() + 1 ) >> 1; - sal_Int32 nHalfHeight = ( aGlobalChildRect.GetHeight() + 1 ) >> 1; - Point aTopLeft( aGlobalChildRect.Left() + nHalfWidth - nHalfHeight, - aGlobalChildRect.Top() + nHalfHeight - nHalfWidth ); - Size aNewSize( aGlobalChildRect.GetHeight(), aGlobalChildRect.GetWidth() ); + sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1; + sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1; + Point aTopLeft( aClientRect.Left() + nHalfWidth - nHalfHeight, + aClientRect.Top() + nHalfHeight - nHalfWidth ); + Size aNewSize( aClientRect.GetHeight(), aClientRect.GetWidth() ); Rectangle aNewRect( aTopLeft, aNewSize ); - aGlobalChildRect = aNewRect; + aClientRect = aNewRect; } // now importing the inner objects of the group diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index f1a89dd0bb8b..3da9e8dbecac 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -1526,7 +1526,7 @@ void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd ) if (pPara) { pPara->Invalidate(); - ImplCalcBulletText( static_cast< USHORT >(n), FALSE, FALSE ); + ImplCalcBulletText( n, FALSE, FALSE ); } } } diff --git a/svx/source/outliner/outlobj.cxx b/svx/source/outliner/outlobj.cxx index b76f3a8c366e..0e319ad1be81 100644 --- a/svx/source/outliner/outlobj.cxx +++ b/svx/source/outliner/outlobj.cxx @@ -77,6 +77,12 @@ public: && maParagraphDataVector == rCandidate.maParagraphDataVector && mbIsEditDoc == rCandidate.mbIsEditDoc); } + + // #i102062# + bool isWrongListEqual(const ImplOutlinerParaObject& rCompare) const + { + return mpEditTextObject->isWrongListEqual(*rCompare.mpEditTextObject); + } }; ////////////////////////////////////////////////////////////////////////////// @@ -147,6 +153,17 @@ bool OutlinerParaObject::operator==(const OutlinerParaObject& rCandidate) const return (*rCandidate.mpImplOutlinerParaObject == *mpImplOutlinerParaObject); } +// #i102062# +bool OutlinerParaObject::isWrongListEqual(const OutlinerParaObject& rCompare) const +{ + if(rCompare.mpImplOutlinerParaObject == mpImplOutlinerParaObject) + { + return true; + } + + return mpImplOutlinerParaObject->isWrongListEqual(*rCompare.mpImplOutlinerParaObject); +} + sal_uInt16 OutlinerParaObject::GetOutlinerMode() const { return mpImplOutlinerParaObject->mpEditTextObject->GetUserType(); diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 37215a794d06..33c958fa6268 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -37,6 +37,7 @@ #include <svx/outlobj.hxx> #include <svx/editobj.hxx> #include <svx/flditem.hxx> +#include <svx/sdr/properties/properties.hxx> ////////////////////////////////////////////////////////////////////////////// // pointer compare define @@ -69,6 +70,7 @@ namespace drawinglayer maTextUpperDistance(aTextUpperDistance), maTextRightDistance(aTextRightDistance), maTextLowerDistance(aTextLowerDistance), + maPropertiesVersion(0), mbContour(bContour), mbFitToSize(bFitToSize), mbHideContour(bHideContour), @@ -82,6 +84,11 @@ namespace drawinglayer const SfxItemSet& rSet = getSdrText().GetItemSet(); mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet); } + + // #i101556# init with version number to detect changes of single text + // attribute and/or style sheets in primitive data without having to + // copy that data locally (which would be better from principle) + maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion(); } SdrTextAttribute::~SdrTextAttribute() @@ -148,11 +155,17 @@ namespace drawinglayer bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const { return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject() + // #i102062# for primitive visualisation, the WrongList (SpellChecking) + // is important, too, so use isWrongListEqual since there is no WrongList + // comparison in the regular OutlinerParaObject compare (since it's + // not-persistent data) + && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()) && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) && getTextLeftDistance() == rCandidate.getTextLeftDistance() && getTextUpperDistance() == rCandidate.getTextUpperDistance() && getTextRightDistance() == rCandidate.getTextRightDistance() && getTextLowerDistance() == rCandidate.getTextLowerDistance() + && getPropertiesVersion() == rCandidate.getPropertiesVersion() && isContour() == rCandidate.isContour() && isFitToSize() == rCandidate.isFitToSize() && isHideContour() == rCandidate.isHideContour() diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index 851ee1f3da58..9ae265d29362 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -75,8 +75,8 @@ namespace sdr basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D()); const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D()); const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D()); - const bool bNormals(aPolyNormals3D.count()); - const bool bTexture(aPolyTexture2D.count()); + const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count());
+ const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count());
if(bNormals || bTexture) { @@ -100,12 +100,19 @@ namespace sdr { if(bNormals) { - aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(b)); + sal_uInt32 nNormalCount = aNormals3D.count(); + if( b < nNormalCount ) + aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(b)); + else if( nNormalCount > 0 ) + aCandidate3D.setNormal(b, aNormals3D.getB3DPoint(0)); } - if(bTexture) { - aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b)); + sal_uInt32 nTextureCount = aTexture2D.count(); + if( b < nTextureCount ) + aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b)); + else if( nTextureCount > 0 ) + aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(0)); } } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index aae01c5d24ff..b083a1014299 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -53,6 +53,18 @@ #include <svdglob.hxx> #include <vcl/svapp.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> +#include <drawinglayer/primitive2d/textprimitive2d.hxx> +#include <drawinglayer/primitive2d/textlayoutdevice.hxx> +#include <drawinglayer/primitive2d/maskprimitive2d.hxx> + +#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx> +#include <svx/eeitem.hxx> +#include <svx/colritem.hxx> +//#include <svx/xtable.hxx> + ////////////////////////////////////////////////////////////////////////////// namespace sdr @@ -78,6 +90,238 @@ namespace sdr { } + void ViewContactOfGraphic::flushGraphicObjects() + { + // #i102380# The graphic is swapped out. To let that have an effect ist is necessary to + // delete copies of the GraphicObject which are not swapped out and have no SwapHandler set + // (this is what happnes when the GraphicObject gets copied to a SdrGrafPrimitive2D). This + // is best achieved for the VC by clearing the local decomposition cache. It would be possible + // to also do this for the VOC cache, but that VOCs exist exactly expresss that the object + // gets visualised, so this would be wrong. + flushViewIndependentPrimitive2DSequence(); + } + + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForPresObj( + const basegfx::B2DHomMatrix& rObjectMatrix, + const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute, + const GraphicAttr& rLocalGrafInfo) const + { + drawinglayer::primitive2d::Primitive2DSequence xRetval; + GraphicObject aEmptyGraphicObject; + GraphicAttr aEmptyGraphicAttr; + + // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts + const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + rObjectMatrix, + rAttribute, + aEmptyGraphicObject, + aEmptyGraphicAttr)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); + + // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and + // without attributes + basegfx::B2DHomMatrix aSmallerMatrix; + + // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic + // into account. Since EmptyPresObj's are only used in Draw/Impress, it is + // safe to assume 100th mm as target. + Size aPrefSize(GetGrafObject().GetGrafPrefSize()); + + if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit()) + { + aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM); + } + else + { + aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM); + } + + // decompose object matrix to get single values + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); + + const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0); + const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0); + + if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) + { + // create the EmptyPresObj fallback visualisation. The fallback graphic + // is already provided in rGraphicObject in this case, use it + aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); + aSmallerMatrix.translate(fOffsetX, fOffsetY); + aSmallerMatrix.shearX(fShearX); + aSmallerMatrix.rotate(fRotate); + aSmallerMatrix.translate(aTranslate.getX(), aTranslate.getY()); + + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); + const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aSmallerMatrix, + aEmptyAttributes, + rGraphicObject, + rLocalGrafInfo)); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB); + } + + return xRetval; + } + + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForDraft( + const basegfx::B2DHomMatrix& rObjectMatrix, + const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const + { + drawinglayer::primitive2d::Primitive2DSequence xRetval; + GraphicObject aEmptyGraphicObject; + GraphicAttr aEmptyGraphicAttr; + + // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts + const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + rObjectMatrix, + rAttribute, + aEmptyGraphicObject, + aEmptyGraphicAttr)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); + + if(!rAttribute.getLine()) + { + // create a surrounding frame when no linestyle given + const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor()); + const basegfx::BColor aBColor(aColor.getBColor()); + const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); + + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + aOutline.transform(rObjectMatrix); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + aOutline, + aBColor))); + } + + // decompose object matrix to get single values + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); + + // define a distance value, used for distance from bitmap to borders and from bitmap + // to text, too (2 mm) + const double fDistance(200.0); + + // consume borders from values + aScale.setX(std::max(0.0, aScale.getX() - (2.0 * fDistance))); + aScale.setY(std::max(0.0, aScale.getY() - (2.0 * fDistance))); + aTranslate.setX(aTranslate.getX() + fDistance); + aTranslate.setY(aTranslate.getY() + fDistance); + + // draw a draft bitmap + const Bitmap aDraftBitmap(ResId(BMAP_GrafikEi, *ImpGetResMgr())); + + if(!aDraftBitmap.IsEmpty()) + { + Size aPrefSize(aDraftBitmap.GetPrefSize()); + + if(MAP_PIXEL == aDraftBitmap.GetPrefMapMode().GetMapUnit()) + { + aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aDraftBitmap.GetSizePixel(), MAP_100TH_MM); + } + else + { + aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, aDraftBitmap.GetPrefMapMode(), MAP_100TH_MM); + } + + const double fBitmapScaling(2.0); + const double fWidth(aPrefSize.getWidth() * fBitmapScaling); + const double fHeight(aPrefSize.getHeight() * fBitmapScaling); + + if(basegfx::fTools::more(fWidth, 1.0) + && basegfx::fTools::more(fHeight, 1.0) + && basegfx::fTools::lessOrEqual(fWidth, aScale.getX()) + && basegfx::fTools::lessOrEqual(fHeight, aScale.getY())) + { + basegfx::B2DHomMatrix aBitmapMatrix; + + aBitmapMatrix.scale(fWidth, fHeight); + aBitmapMatrix.shearX(fShearX); + aBitmapMatrix.rotate(fRotate); + aBitmapMatrix.translate(aTranslate.getX(), aTranslate.getY()); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::BitmapPrimitive2D( + BitmapEx(aDraftBitmap), + aBitmapMatrix))); + + // consume bitmap size in X + aScale.setX(std::max(0.0, aScale.getX() - (fWidth + fDistance))); + aTranslate.setX(aTranslate.getX() + fWidth + fDistance); + } + } + + // Build the text for the draft object + XubString aDraftText = GetGrafObject().GetFileName(); + + if(!aDraftText.Len()) + { + aDraftText = GetGrafObject().GetName(); + aDraftText.AppendAscii(" ..."); + } + + if(aDraftText.Len() && GetGrafObject().GetModel()) + { + // #i103255# Goal is to produce TextPrimitives which hold the given text as + // BlockText in the available space. It would be very tricky to do + // an own word wrap/line layout here. + // Using SdrBlockTextPrimitive2D OTOH is critical since it internally + // uses the SdrObject it references. To solve this, create a temp + // SdrObject with Attributes and Text, generate a SdrBlockTextPrimitive2D + // directly and immediately decompose it. After that, it is no longer + // needed and can be deleted. + + // create temp RectObj as TextObj and set needed attributes + SdrRectObj aRectObj(OBJ_TEXT); + aRectObj.SetModel(GetGrafObject().GetModel()); + aRectObj.NbcSetText(aDraftText); + aRectObj.SetMergedItem(SvxColorItem(Color(COL_LIGHTRED), EE_CHAR_COLOR)); + + // get SdrText and OPO + SdrText* pSdrText = aRectObj.getText(0); + OutlinerParaObject* pOPO = aRectObj.GetOutlinerParaObject(); + + if(pSdrText && pOPO) + { + // directly use the remaining space as TextRangeTransform + basegfx::B2DHomMatrix aTextRangeTransform; + + aTextRangeTransform.scale(aScale.getX(), aScale.getY()); + aTextRangeTransform.shearX(fShearX); + aTextRangeTransform.rotate(fRotate); + aTextRangeTransform.translate(aTranslate.getX(), aTranslate.getY()); + + // directly create temp SdrBlockTextPrimitive2D + drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive( + pSdrText, + *pOPO, + aTextRangeTransform, + false, + false, + false); + + // decompose immediately with neutral ViewInformation. This will + // layout the text to more simple TextPrimitives from drawinglayer + const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0); + + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( + xRetval, + aBlockTextPrimitive.get2DDecomposition(aViewInformation2D)); + } + } + + return xRetval; + } + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; @@ -86,7 +330,8 @@ namespace sdr if(pSdrText) { const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); + drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); bool bVisible(pAttribute && pAttribute->isVisible()); // create and fill GraphicAttr @@ -131,7 +376,7 @@ namespace sdr // which will use the primitive data we just create in the near future const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - ::basegfx::B2DHomMatrix aObjectMatrix; + basegfx::B2DHomMatrix aObjectMatrix; // look for mirroring const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); @@ -170,60 +415,25 @@ namespace sdr // get the current, unchenged graphic obect from SdrGrafObj const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - if(GetGrafObject().IsEmptyPresObj()) + if(visualisationUsesPresObj()) { // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one // with the content which is the placeholder graphic - GraphicObject aEmptyGraphicObject; - GraphicAttr aEmptyGraphicAttr; - drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); - - // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts - const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, *pAttribute, aEmptyGraphicObject, aEmptyGraphicAttr)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); - - // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and - // without attributes - basegfx::B2DHomMatrix aSmallerMatrix; - - // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic - // into account. Since EmptyPresObj's are only used in Draw/Impress, it is - // safe to assume 100th mm as target. - Size aPrefSize(GetGrafObject().GetGrafPrefSize()); - - if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit()) - { - aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM); - } - else - { - aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM); - } - - const double fOffsetX((aObjectRange.getWidth() - aPrefSize.getWidth()) / 2.0); - const double fOffsetY((aObjectRange.getHeight() - aPrefSize.getHeight()) / 2.0); - - if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) - { - aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); - aSmallerMatrix.translate(fOffsetX, fOffsetY); - aSmallerMatrix.shearX(fShearX); - aSmallerMatrix.rotate(fRotate); - aSmallerMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); - - const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aSmallerMatrix, - aEmptyAttributes, - rGraphicObject, - aLocalGrafInfo)); - - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB); - } + xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo); + } + else if(visualisationUsesDraft()) + { + // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism + // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious + // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent + // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster + // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages + xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute); } else { - // create primitive + // create primitive. Info: Calling the copy-constructor of GraphicObject in this + // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aObjectMatrix, *pAttribute, @@ -241,6 +451,31 @@ namespace sdr return xRetval; } + bool ViewContactOfGraphic::visualisationUsesPresObj() const + { + return GetGrafObject().IsEmptyPresObj(); + } + + bool ViewContactOfGraphic::visualisationUsesDraft() const + { + // no draft when already PresObj + if(visualisationUsesPresObj()) + return false; + + // draft when swapped out + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + static bool bAllowReplacements(true); + + if(rGraphicObject.IsSwappedOut() && bAllowReplacements) + return true; + + // draft when no graphic + if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType()) + return true; + + return false; + } + } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index dc3fbcfaaa61..0f818ff40f7a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -62,59 +62,86 @@ namespace sdr if(pSdrText) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); + drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + *pSdrText); if(pAttribute) { if(pAttribute->isVisible()) { - // prepare object transformation and unit polygon (direct model data) - ::basegfx::B2DHomMatrix aObjectMatrix; - ::basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); - const bool bIsLine( - !aUnitPolyPolygon.areControlPointsUsed() - && 1L == aUnitPolyPolygon.count() - && 2L == aUnitPolyPolygon.getB2DPolygon(0L).count()); - - if(bIsLine) - { - // special handling for single line mode (2 points) - const ::basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0L)); - const ::basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0L)); - const ::basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1L)); - const ::basegfx::B2DVector aLine(aEnd - aStart); - - // create new polygon - ::basegfx::B2DPolygon aNewPolygon; - aNewPolygon.append(::basegfx::B2DPoint(0.0, 0.0)); - aNewPolygon.append(::basegfx::B2DPoint(aLine.getLength(), 0.0)); - aUnitPolyPolygon.setB2DPolygon(0L, aNewPolygon); - - // fill objectMatrix with rotation and offset (no shear for lines, scale in polygon) - aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX())); - aObjectMatrix.translate(aStart.getX(), aStart.getY()); - } - else + basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + const sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); + + if(nPolyCount) { - // create scaled, but unsheared, unrotated and untranslated polygon - // by creating the object matrix and back-transforming the polygon - const ::basegfx::B2DRange aObjectRange(::basegfx::tools::getRange(aUnitPolyPolygon)); - const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); - - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); - - // ceate scaled unit polygon from object's absolute path - ::basegfx::B2DHomMatrix aInverse(aObjectMatrix); - aInverse.invert(); - aUnitPolyPolygon.transform(aInverse); + // prepare object transformation and unit polygon (direct model data) + basegfx::B2DHomMatrix aObjectMatrix; + const bool bIsLine( + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); + + if(bIsLine) + { + // special handling for single line mode (2 points) + const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); + const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); + const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); + const basegfx::B2DVector aLine(aEnd - aStart); + + // #i102548# create new unit polygon for line (horizontal) + basegfx::B2DPolygon aNewPolygon; + aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); + aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); + aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); + + // #i102548# fill objectMatrix with rotation and offset (no shear for lines) + aObjectMatrix.scale(aLine.getLength(), 1.0); + aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX())); + aObjectMatrix.translate(aStart.getX(), aStart.getY()); + } + else + { + // #i102548# create unscaled, unsheared, unrotated and untranslated polygon + // (unit polygon) by creating the object matrix and back-transforming the polygon + const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); + const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); + const double fWidth(aObjectRange.getWidth()); + const double fHeight(aObjectRange.getHeight()); + + aObjectMatrix.scale( + basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth, + basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + if(rGeoStat.nShearWink) + { + aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); + } + + if(rGeoStat.nDrehWink) + { + aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); + } + + aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + + // ceate unit polygon from object's absolute path + basegfx::B2DHomMatrix aInverse(aObjectMatrix); + aInverse.invert(); + aUnitPolyPolygon.transform(aInverse); + } + + // create primitive + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrPathPrimitive2D( + aObjectMatrix, + *pAttribute, + aUnitPolyPolygon)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrPathPrimitive2D(aObjectMatrix, *pAttribute, aUnitPolyPolygon)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } delete pAttribute; diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx index 394ae3141182..902e8e7d8153 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx @@ -38,6 +38,7 @@ #include <svx/svdograf.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include <svx/svdmodel.hxx> +#include <svx/svdpage.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -245,10 +246,19 @@ namespace sdr { // prepare primitive generation with evtl. loading the graphic when it's swapped out SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj(); - const bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics()); + bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics()); static bool bSuppressAsynchLoading(false); bool bSwapInDone(false); + if(bDoAsynchronGraphicLoading + && rGrafObj.IsSwappedOut() + && rGrafObj.GetPage() + && rGrafObj.GetPage()->IsMasterPage()) + { + // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation + bDoAsynchronGraphicLoading = false; + } + if(bDoAsynchronGraphicLoading && !bSuppressAsynchLoading) { bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading(); @@ -261,6 +271,23 @@ namespace sdr // get return value by calling parent drawinglayer::primitive2d::Primitive2DSequence xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); + if(xRetval.hasElements()) + { + // #i103255# suppress when graphic needs draft visualisation and output + // is for PDF export/Printer + const ViewContactOfGraphic& rVCOfGraphic = static_cast< const ViewContactOfGraphic& >(GetViewContact()); + + if(rVCOfGraphic.visualisationUsesDraft()) + { + const ObjectContact& rObjectContact = GetObjectContact(); + + if(rObjectContact.isOutputToPDFFile() || rObjectContact.isOutputToPrinter()) + { + xRetval = drawinglayer::primitive2d::Primitive2DSequence(); + } + } + } + // if swap in was forced only for printing, swap out again const bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter()); diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 87288882995e..34fddf088c98 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -291,7 +291,8 @@ namespace sdr } // add a gray outline frame, except not when printing - if(!GetObjectContact().isOutputToPrinter()) + // #i102637# add frame also when printing and page exists (handout pages) + if(!GetObjectContact().isOutputToPrinter() || pPage) { const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 0b8245b91060..277ee70f82ca 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -473,7 +473,14 @@ namespace drawinglayer return pRetval; } - attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + // #i101508# Support handing over given text-to-border distances + attribute::SdrTextAttribute* createNewSdrTextAttribute( + const SfxItemSet& rSet, + const SdrText& rText, + const sal_Int32* pLeft, + const sal_Int32* pUpper, + const sal_Int32* pRight, + const sal_Int32* pLower) { attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); @@ -519,10 +526,10 @@ namespace drawinglayer rText, aOutlinerParaObject, ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), - rTextObj.GetTextLeftDistance(), - rTextObj.GetTextUpperDistance(), - rTextObj.GetTextRightDistance(), - rTextObj.GetTextLowerDistance(), + pLeft ? *pLeft : rTextObj.GetTextLeftDistance(), + pUpper ? *pUpper : rTextObj.GetTextUpperDistance(), + pRight ? *pRight : rTextObj.GetTextRightDistance(), + pLower ? *pLower : rTextObj.GetTextLowerDistance(), ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), @@ -1031,7 +1038,14 @@ namespace drawinglayer } } - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(const SfxItemSet& rSet, const SdrText* pSdrText) + // #i101508# Support handing over given text-to-border distances + attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + const SfxItemSet& rSet, + const SdrText* pSdrText, + const sal_Int32* pLeft, + const sal_Int32* pUpper, + const sal_Int32* pRight, + const sal_Int32* pLower) { attribute::SdrFillTextAttribute* pRetval(0L); attribute::SdrFillAttribute* pFill(0L); @@ -1042,7 +1056,7 @@ namespace drawinglayer // look for text first if(pSdrText) { - pText = createNewSdrTextAttribute(rSet, *pSdrText); + pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower); } // when object has text and text is fontwork and hide contour is set for fontwork, force diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index 3445e134fd0a..b3cc32d71536 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -180,6 +180,11 @@ namespace sdr GetSdrObject().SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a)); } } + + sal_uInt32 BaseProperties::getVersion() const + { + return 0; + } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 5fb566e77dc2..f720e1b9d1b2 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -72,12 +72,14 @@ namespace sdr } TextProperties::TextProperties(SdrObject& rObj) - : AttributeProperties(rObj) + : AttributeProperties(rObj), + maVersion(0) { } TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj) - : AttributeProperties(rProps, rObj) + : AttributeProperties(rProps, rObj), + maVersion(rProps.getVersion()) { } @@ -93,10 +95,11 @@ namespace sdr void TextProperties::ItemSetChanged(const SfxItemSet& rSet) { SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); - - sal_Int32 nText = rObj.getTextCount(); + // #i101556# ItemSet has changed -> new version + maVersion++; + while( --nText >= 0 ) { SdrText* pText = rObj.getText( nText ); @@ -237,6 +240,9 @@ namespace sdr // call parent AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); + // #i101556# StyleSheet has changed -> new version + maVersion++; + if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() ) { SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner(); @@ -577,6 +583,9 @@ namespace sdr rObj.ActionChanged(); //rObj.BroadcastObjectChange(); } + + // #i101556# content of StyleSheet has changed -> new version + maVersion++; } if(SFX_HINT_DYING == nId) @@ -616,6 +625,12 @@ namespace sdr } } } + + // #i101556# Handout version information + sal_uInt32 TextProperties::getVersion() const + { + return maVersion; + } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 6845ce6bb619..341ce6dd90c0 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -793,6 +793,15 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/) // overlay objects instead. sal_Bool bUseSolidDragging(IsSolidDragging()); + // #i101648# check if dragged object is a naked SdrObject (no + // derivation of). This is e.g. used in SW Frame construction + // as placeholder. Do not use SolidDragging for naked SDrObjects, + // they cannot have a valid optical representation + if(bUseSolidDragging && OBJ_NONE == pAktCreate->GetObjIdentifier()) + { + bUseSolidDragging = false; + } + // check for objects with no fill and no line if(bUseSolidDragging) { @@ -815,13 +824,15 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/) } } - // #i68562# Force to non-solid dragging when not creating a full circle and up to step three - if(bUseSolidDragging - && pAktCreate->ISA(SdrCircObj) - && OBJ_CIRC != (SdrObjKind)(static_cast< SdrCircObj* >(pAktCreate)->GetObjIdentifier()) - && aDragStat.GetPointAnz() < 4L) + // #i101781# force to non-solid dragging when not creating a full circle + if(bUseSolidDragging) { - bUseSolidDragging = false; + SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pAktCreate); + + if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier()) + { + bUseSolidDragging = false; + } } if(bUseSolidDragging) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 263279691979..e272a51a4a7a 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1165,6 +1165,11 @@ basegfx::B2DPolyPolygon SdrObject::TakeContour() const SfxItemSet aNewSet(*GetObjectItemPool()); + // #i101980# ignore LineWidth; that's what the old implementation + // did. With linewidth, the result may be huge due to fat/thick + // line decompositions + aNewSet.Put(XLineWidthItem(0)); + // solid black lines and no fill aNewSet.Put(XLineStyleItem(XLINE_SOLID)); aNewSet.Put(XLineColorItem(String(), Color(COL_BLACK))); @@ -1392,8 +1397,15 @@ FASTBOOL SdrObject::MovCreate(SdrDragStat& rStat) rStat.TakeCreateRect(aOutRect); rStat.SetActionRect(aOutRect); aOutRect.Justify(); - SetBoundRectDirty(); - bSnapRectDirty=TRUE; + + // #i101648# for naked (non-derived) SdrObjects, do not invalidate aOutRect + // by calling SetBoundRectDirty(); aOutRect IS the geometry for such objects. + // No derivation implementation calls the parent implementation, so this will + // cause no further prolems + // + // SetBoundRectDirty(); + // bSnapRectDirty=TRUE; + return TRUE; } @@ -1401,7 +1413,11 @@ FASTBOOL SdrObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) { rStat.TakeCreateRect(aOutRect); aOutRect.Justify(); - SetRectsDirty(); + + // #i101648# see description at MovCreate + // + // SetRectsDirty(); + return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2); } @@ -2376,8 +2392,8 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas if(pRet->LineGeometryUsageIsNecessary()) { - basegfx::B2DPolyPolygon aAreaPolyPolygon; - basegfx::B2DPolyPolygon aLinePolyPolygon; + basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon; + basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon; const drawinglayer::primitive2d::Primitive2DSequence xSequence(pRet->GetViewContact().getViewIndependentPrimitive2DSequence()); if(xSequence.hasElements()) @@ -2389,36 +2405,31 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D); aExtractor.process(xSequence); - aAreaPolyPolygon = aExtractor.getExtractedLineFills(); - aLinePolyPolygon = aExtractor.getExtractedHairlines(); - } + // #i102241# check for line results + const std::vector< basegfx::B2DPolygon >& rHairlineVector = aExtractor.getExtractedHairlines(); - // Since this may in some cases lead to a count of 0 after - // the merge i moved the merge to the front. - if(aAreaPolyPolygon.count()) - { - // bezier geometry got created, even for straight edges since the given - // object is a result of DoConvertToPolyObj. For conversion to contour - // this is not really needed and can be reduced again AFAP - aAreaPolyPolygon = basegfx::tools::simplifyCurveSegments(aAreaPolyPolygon); + if(rHairlineVector.size()) + { + // for SdrObject creation, just copy all to a single Hairline-PolyPolygon + for(sal_uInt32 a(0); a < rHairlineVector.size(); a++) + { + aMergedHairlinePolyPolygon.append(rHairlineVector[a]); + } + } - // merge all to a decent result (try to use AND, but remember original) - const basegfx::B2DPolyPolygon aTemp(aAreaPolyPolygon); - aAreaPolyPolygon = basegfx::tools::solveCrossovers(aAreaPolyPolygon); - aAreaPolyPolygon = basegfx::tools::stripNeutralPolygons(aAreaPolyPolygon); - aAreaPolyPolygon = basegfx::tools::stripDispensablePolygons(aAreaPolyPolygon, false); + // #i102241# check for fill rsults + const std::vector< basegfx::B2DPolyPolygon >& rLineFillVector(aExtractor.getExtractedLineFills()); - if(!aAreaPolyPolygon.count()) + if(rLineFillVector.size()) { - // OOps, AND is empty, this means there were no overlapping parts. Use - // remembered parts as result - aAreaPolyPolygon = aTemp; + // merge to a single PolyPolygon (OR) + aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector); } } - // || aLinePolyPolygon.Count() removed; the conversion is ONLY + // || aMergedHairlinePolyPolygon.Count() removed; the conversion is ONLY // useful when new closed filled polygons are created - if(aAreaPolyPolygon.count() || (bForceLineDash && aLinePolyPolygon.count())) + if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count())) { SfxItemSet aSet(pRet->GetMergedItemSet()); XFillStyle eOldFillStyle = ((const XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue(); @@ -2426,10 +2437,10 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas SdrPathObj* aLineHairlinePart = NULL; bool bBuildGroup(false); - if(aAreaPolyPolygon.count()) + if(aMergedLineFillPolyPolygon.count()) { // create SdrObject for filled line geometry - aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aAreaPolyPolygon); + aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aMergedLineFillPolyPolygon); aLinePolygonPart->SetModel(pRet->GetModel()); // correct item properties @@ -2444,13 +2455,13 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, BOOL bForceLineDas aLinePolygonPart->SetMergedItemSet(aSet); } - if(aLinePolyPolygon.count()) + if(aMergedHairlinePolyPolygon.count()) { // create SdrObject for hairline geometry // OBJ_PATHLINE is necessary here, not OBJ_PATHFILL. This is intended // to get a non-filled object. If the poly is closed, the PathObj takes care for // the correct closed state. - aLineHairlinePart = new SdrPathObj(OBJ_PATHLINE, aLinePolyPolygon); + aLineHairlinePart = new SdrPathObj(OBJ_PATHLINE, aMergedHairlinePolyPolygon); aLineHairlinePart->SetModel(pRet->GetModel()); aSet.Put(XLineWidthItem(0L)); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index f317551079b5..3f5da01e101b 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -659,6 +659,23 @@ void SdrGrafObj::TakeObjNamePlural( XubString& rName ) const // ----------------------------------------------------------------------------- +SdrObject* SdrGrafObj::getFullDragClone() const +{ + // call parent + SdrGrafObj* pRetval = static_cast< SdrGrafObj* >(SdrRectObj::getFullDragClone()); + + // #i103116# the full drag clone leads to problems + // with linked graphics, so reset the link in this + // temporary interaction object and load graphic + if(pRetval && IsLinkedGraphic()) + { + pRetval->ForceSwapIn(); + pRetval->ReleaseGraphicLink(); + } + + return pRetval; +} + void SdrGrafObj::operator=( const SdrObject& rObj ) { SdrRectObj::operator=( rObj ); @@ -1090,6 +1107,14 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; pGraphic->SetUserData(); } + + // #i102380# + sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&GetViewContact()); + + if(pVC) + { + pVC->flushGraphicObjects(); + } } } } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 4831945dfcf3..1e9c9b57c52d 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -1749,7 +1749,10 @@ void SdrPathObj::ImpForceKind() // was called, once here below and once on a 2nd place below. // #i10659# for SdrTextObj, keep aRect up to date - aRect = ImpGetBoundRect(GetPathPoly()); + if(GetPathPoly().count()) + { + aRect = ImpGetBoundRect(GetPathPoly()); + } } // #i75974# adapt polygon state to object type. This may include a reinterpretation @@ -2382,7 +2385,10 @@ void SdrPathObj::TakeUnrotatedSnapRect(Rectangle& rRect) const void SdrPathObj::RecalcSnapRect() { - maSnapRect = ImpGetBoundRect(GetPathPoly()); + if(GetPathPoly().count()) + { + maSnapRect = ImpGetBoundRect(GetPathPoly()); + } } void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect) @@ -2472,8 +2478,11 @@ void SdrPathObj::NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum) } else { - // #i10659# for SdrTextObj, keep aRect up to date - aRect = ImpGetBoundRect(GetPathPoly()); // fuer SdrTextObj + if(GetPathPoly().count()) + { + // #i10659# for SdrTextObj, keep aRect up to date + aRect = ImpGetBoundRect(GetPathPoly()); // fuer SdrTextObj# + } } SetRectsDirty(); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 673b7432f662..76c29de8d480 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -657,7 +657,11 @@ namespace bool SdrTextObj::impCheckSpellCheckForDecomposeTextPrimitive() const { - return false; + // #i102062# asked TL who killed this feature (CWS tl56). Obviously, there + // is no more support for EE_CNTRL_NOREDLINES anymore; redlining is always + // on nowadays. Unfortunately, not false, but true should be returned then. + // Trying if this is all... + return true; } bool SdrTextObj::impDecomposeContourTextPrimitive( @@ -769,17 +773,40 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( } else { + // check if block text is used (only one of them can be true) + const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg); + const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg); + if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage()) { - rOutliner.SetMaxAutoPaperSize(aAnchorTextSize); + // #i103454# maximal paper size hor/ver needs to be limited to text + // frame size. If it's block text, still allow the 'other' direction + // to grow to get a correct real text size when using GetPaperSize(). + // When just using aAnchorTextSize as maximum, GetPaperSize() + // would just return aAnchorTextSize again: this means, the wanted + // 'measurement' of the real size of block text would not work + Size aMaxAutoPaperSize(aAnchorTextSize); + + if(bHorizontalIsBlock) + { + // allow to grow vertical for horizontal blocks + aMaxAutoPaperSize.setHeight(1000000); + } + else if(bVerticalIsBlock) + { + // allow to grow horizontal for vertical blocks + aMaxAutoPaperSize.setWidth(1000000); + } + + rOutliner.SetMaxAutoPaperSize(aMaxAutoPaperSize); } - if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg) + // set minimal paper size hor/ver if needed + if(bHorizontalIsBlock) { rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); } - - if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg) + else if(bVerticalIsBlock) { rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight)); } @@ -931,6 +958,16 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( basegfx::B2DHomMatrix aNewTransformA; basegfx::B2DHomMatrix aNewTransformB; + // #i101957# Check for vertical text. If used, aNewTransformA + // needs to translate the text initially around object width to orient + // it relative to the topper right instead of the topper left + const bool bVertical(rSdrStretchTextPrimitive.getOutlinerParaObject().IsVertical()); + + if(bVertical) + { + aNewTransformA.translate(aScale.getX(), 0.0); + } + // calculate global char stretching scale parameters. Use non-mirrored sizes // to layout without mirroring const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX()); diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index 772811f6ccec..038eb96b35e6 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -61,10 +61,19 @@ void SdrText::CheckPortionInfo( SdrOutliner& rOutliner ) { if(!mbPortionInfoChecked) { + // #i102062# no action when the Outliner is the HitTestOutliner, + // this will remove WrongList info at the OPO + if(mpModel && &rOutliner == &mpModel->GetHitTestOutliner()) + return; + // Optimierung: ggf. BigTextObject erzeugen mbPortionInfoChecked=true; if(mpOutlinerParaObject!=NULL && rOutliner.ShouldCreateBigTextObject()) - mpOutlinerParaObject= rOutliner.CreateParaObject(); + { + // #i102062# MemoryLeak closed + delete mpOutlinerParaObject; + mpOutlinerParaObject = rOutliner.CreateParaObject(); + } } } diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 9a6958b34c4d..23f3981228e1 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -554,7 +554,17 @@ Bitmap SdrExchangeView::GetMarkedObjBitmap( BOOL bNoVDevIfOneBmpMarked ) const if( !aBmp ) { const Graphic aGraphic( GetMarkedObjMetaFile( bNoVDevIfOneBmpMarked ) ); - aBmp = aGraphic.GetBitmap(); + + // #i102089# support user's settings of AA and LineSnap when the MetaFile gets + // rasterconverted to a bitmap + const SvtOptionsDrawinglayer aDrawinglayerOpt; + const GraphicConversionParameters aParameters( + Size(), + false, + aDrawinglayerOpt.IsAntiAliasing(), + aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete()); + + aBmp = aGraphic.GetBitmap(aParameters); } } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 3c6ec81cabdb..c99c2b3c2262 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -493,7 +493,7 @@ void SvxTableController::GetState( SfxItemSet& rSet ) // -------------------------------------------------------------------- -void SvxTableController::onInsert( sal_uInt16 nSId ) +void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) { ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() ); if( !pTableObj ) @@ -501,6 +501,21 @@ void SvxTableController::onInsert( sal_uInt16 nSId ) if( mxTable.is() ) try { + // + bool bInsertAfter = true; + sal_uInt16 nCount = 0; + if( pArgs ) + { + const SfxPoolItem* pItem = 0; + pArgs->GetItemState(nSId, FALSE, &pItem); + if (pItem) + { + nCount = ((const SfxInt16Item* )pItem)->GetValue(); + if(SFX_ITEM_SET == pArgs->GetItemState(SID_TABLE_PARAM_INSERT_AFTER, TRUE, &pItem)) + bInsertAfter = ((const SfxBoolItem* )pItem)->GetValue(); + } + } + CellPos aStart, aEnd; if( hasSelectedCells() ) { @@ -508,9 +523,12 @@ void SvxTableController::onInsert( sal_uInt16 nSId ) } else { - aStart.mnCol = mxTable->getColumnCount() - 1; - aStart.mnRow = mxTable->getRowCount() - 1; - aEnd = aStart; + if( bInsertAfter ) + { + aStart.mnCol = mxTable->getColumnCount() - 1; + aStart.mnRow = mxTable->getRowCount() - 1; + aEnd = aStart; + } } if( pTableObj->IsTextEditActive() ) @@ -535,8 +553,9 @@ void SvxTableController::onInsert( sal_uInt16 nSId ) } Reference< XTableColumns > xCols( mxTable->getColumns() ); - const sal_Int32 nNewColumns = aEnd.mnCol - aStart.mnCol + 1; - xCols->insertByIndex( aEnd.mnCol + 1, nNewColumns ); + const sal_Int32 nNewColumns = (nCount == 0) ? (aEnd.mnCol - aStart.mnCol + 1) : nCount; + const sal_Int32 nNewStartColumn = aEnd.mnCol + (bInsertAfter ? 1 : 0); + xCols->insertByIndex( nNewStartColumn, nNewColumns ); for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ ) { @@ -552,7 +571,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId ) if( mpModel ) mpModel->SetChanged(); - aStart.mnCol = aEnd.mnCol+1; + aStart.mnCol = nNewStartColumn; aStart.mnRow = 0; aEnd.mnCol = aStart.mnCol + nNewColumns - 1; aEnd.mnRow = mxTable->getRowCount() - 1; @@ -570,8 +589,9 @@ void SvxTableController::onInsert( sal_uInt16 nSId ) } Reference< XTableRows > xRows( mxTable->getRows() ); - const sal_Int32 nNewRows = aEnd.mnRow - aStart.mnRow + 1; - xRows->insertByIndex( aEnd.mnRow + 1, nNewRows ); + const sal_Int32 nNewRows = (nCount == 0) ? (aEnd.mnRow - aStart.mnRow + 1) : nCount; + const sal_Int32 nNewRowStart = aEnd.mnRow + (bInsertAfter ? 1 : 0); + xRows->insertByIndex( nNewRowStart, nNewRows ); for( sal_Int32 nOffset = 0; nOffset < nNewRows; nOffset++ ) { @@ -591,7 +611,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId ) mpModel->SetChanged(); aStart.mnCol = 0; - aStart.mnRow = aEnd.mnRow+1; + aStart.mnRow = nNewRowStart; aEnd.mnCol = mxTable->getColumnCount() - 1; aEnd.mnRow = aStart.mnRow + nNewRows - 1; break; @@ -759,7 +779,7 @@ void SvxTableController::Execute( SfxRequest& rReq ) { case SID_TABLE_INSERT_ROW: case SID_TABLE_INSERT_COL: - onInsert( nSId ); + onInsert( nSId, rReq.GetArgs() ); break; case SID_TABLE_DELETE_ROW: case SID_TABLE_DELETE_COL: @@ -1490,7 +1510,7 @@ bool SvxTableController::executeAction( sal_uInt16 nAction, bool bSelect, Window CellPos aNextCell( pTableObj->getNextCell( aSelectionEnd, true ) ); if( aSelectionEnd == aNextCell ) { - onInsert( SID_TABLE_INSERT_ROW ); + onInsert( SID_TABLE_INSERT_ROW, 0 ); aNextCell = pTableObj->getNextCell( aSelectionEnd, true ); } gotoCell( aNextCell, false, pWindow, nAction ); diff --git a/svx/source/table/tablecontroller.hxx b/svx/source/table/tablecontroller.hxx index 4caf7cd957a1..826b72b16908 100644 --- a/svx/source/table/tablecontroller.hxx +++ b/svx/source/table/tablecontroller.hxx @@ -43,6 +43,7 @@ class SdrObjEditView; class SdrObject; +class SfxItemSet; namespace sdr { namespace table { @@ -72,7 +73,7 @@ public: virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ); // slots - void onInsert( sal_uInt16 nSId ); + void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 ); void onDelete( sal_uInt16 nSId ); void onSelect( sal_uInt16 nSId ); void onFormatTable( SfxRequest& rReq ); diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 5c1aca5a4542..b2620452d31a 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -118,6 +118,7 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const width += maColumns[aPos.mnCol++].mnSize; nColSpan--; + nColSpan--; } } } @@ -128,6 +129,7 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const return basegfx::B2ITuple( width, height ); } + // ----------------------------------------------------------------------------- bool TableLayouter::getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rArea ) const diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index c1c58977be64..f740bf60258c 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -599,7 +599,30 @@ namespace sdr const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol); const SdrText* pSdrText = rTableObj.getText(nTextIndex); - drawinglayer::attribute::SdrFillTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(rCellItemSet, pSdrText); + drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0; + + if(pSdrText) + { + // #i101508# take cell's local text frame distances into account + const sal_Int32 nLeft(xCurrentCell->GetTextLeftDistance()); + const sal_Int32 nRight(xCurrentCell->GetTextRightDistance()); + const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance()); + const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance()); + + pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + rCellItemSet, + pSdrText, + &nLeft, + &nUpper, + &nRight, + &nLower); + } + else + { + pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + rCellItemSet, + pSdrText); + } if(pAttribute) { diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src index 180724093424..601f2594a080 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src @@ -40,7 +40,7 @@ #define FULL_WIDTH (220) #define FULL_HEIGHT (120) -#define EDITBUTTON_WIDTH (70) +#define EDITBUTTON_WIDTH (75) #define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT) #define COL_2 (COL_1+RSC_SP_FLGR_SPACE_X) diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index b5f3e5c6ec5f..098ddb6c31c0 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -104,6 +104,9 @@ using namespace ::com::sun::star::task; #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx> +// #i102251# +#include <editstat.hxx> + ////////////////////////////////////////////////////////////////////////////// namespace svx @@ -225,16 +228,27 @@ namespace svx Graphic aGraphic( rMtf ); BitmapEx aBmpEx; + // #i102089# support user's settings of AA and LineSnap when the MetaFile gets + // rasterconverted to a bitmap + const SvtOptionsDrawinglayer aDrawinglayerOpt; + const GraphicConversionParameters aParameters( + pSize ? *pSize : Size(0, 0), + true, // allow unlimited size + aDrawinglayerOpt.IsAntiAliasing(), + aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete()); + if( bTransparent ) { - Graphic aMaskGraphic( rMtf.GetMonochromeMtf( COL_BLACK ) ); - Bitmap aMaskBmp( aMaskGraphic.GetUnlimitedBitmap( pSize ) ); + Graphic aMaskGraphic(rMtf.GetMonochromeMtf(COL_BLACK)); + Bitmap aMaskBmp(aMaskGraphic.GetBitmap(aParameters)); - aMaskBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); - aBmpEx = BitmapEx( aGraphic.GetUnlimitedBitmap( pSize ), aMaskBmp ); + aMaskBmp.Convert(BMP_CONVERSION_1BIT_THRESHOLD); + aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters), aMaskBmp); } else - aBmpEx = BitmapEx( aGraphic.GetUnlimitedBitmap( pSize ) ); + { + aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters)); + } aBmpEx.SetPrefMapMode( rMtf.GetPrefMapMode() ); aBmpEx.SetPrefSize( rMtf.GetPrefSize() ); @@ -625,8 +639,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); - std::vector< SdrObject* > aShapes; + // #i102251# + const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); + sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; + rOutl.SetControlWord(nCntrl); + std::vector< SdrObject* > aShapes; bool bRet = true; // export complete page? @@ -977,6 +995,9 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); + // #i102251# + rOutl.SetControlWord(nOldCntrl); + return bRet; } diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx index 1210a3847a96..d742cf63ece8 100644 --- a/svx/source/unodraw/gluepts.cxx +++ b/svx/source/unodraw/gluepts.cxx @@ -49,19 +49,15 @@ using namespace ::cppu; const USHORT NON_USER_DEFINED_GLUE_POINTS = 4; -class SvxUnoGluePointAccess : public WeakImplHelper2< container::XIndexContainer, container::XIdentifierContainer >, - public SfxListener +class SvxUnoGluePointAccess : public WeakImplHelper2< container::XIndexContainer, container::XIdentifierContainer > { private: - SdrObject* mpObject; + SdrObjectWeakRef mpObject; public: SvxUnoGluePointAccess( SdrObject* pObject ) throw(); virtual ~SvxUnoGluePointAccess() throw(); - // SfxListener - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw (); - // XIdentifierContainer virtual sal_Int32 SAL_CALL insert( const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException); virtual void SAL_CALL removeByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); @@ -223,52 +219,16 @@ static void convert( const drawing::GluePoint2& rUnoGlue, SdrGluePoint& rSdrGlue SvxUnoGluePointAccess::SvxUnoGluePointAccess( SdrObject* pObject ) throw() : mpObject( pObject ) { - StartListening( *mpObject->GetModel() ); - } SvxUnoGluePointAccess::~SvxUnoGluePointAccess() throw() { - if( mpObject && mpObject->GetModel()) - EndListening( *mpObject->GetModel() ); -} - -void SvxUnoGluePointAccess::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw() -{ - const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); - - if( pSdrHint && mpObject) - { - if( pSdrHint->GetKind() == HINT_OBJREMOVED ) - { - if( mpObject == pSdrHint->GetObject() ) - mpObject = NULL; - } - else if( pSdrHint->GetKind() == HINT_MODELCLEARED ) - { - mpObject = NULL; - } - // #110094#-9 - //else if( pSdrHint->GetKind() == HINT_OBJLISTCLEAR ) - //{ - // SdrObjList* pObjList = mpObject ? mpObject->GetObjList() : NULL; - // while( pObjList ) - // { - // if( pSdrHint->GetObjList() == pObjList ) - // { - // mpObject = NULL; - // break; - // } - // pObjList = pObjList->GetUpList(); - // } - //} - } } // XIdentifierContainer sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - if( mpObject ) + if( mpObject.is() ) { SdrGluePointList* pList = mpObject->ForceGluePointList(); if( pList ) @@ -298,7 +258,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) thr void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - if( mpObject && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS )) + if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS )) { const USHORT nId = (USHORT)(Identifier - NON_USER_DEFINED_GLUE_POINTS) + 1; @@ -327,7 +287,7 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier ) // XIdentifierReplace void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, const uno::Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - if( mpObject && mpObject->IsNode() ) + if( mpObject.is() && mpObject->IsNode() ) { struct drawing::GluePoint2 aGluePoint; if( (Identifier < NON_USER_DEFINED_GLUE_POINTS) || !(aElement >>= aGluePoint)) @@ -361,7 +321,7 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, c // XIdentifierAccess uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - if( mpObject && mpObject->IsNode() ) + if( mpObject.is() && mpObject->IsNode() ) { struct drawing::GluePoint2 aGluePoint; @@ -401,21 +361,29 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier ) uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() throw (uno::RuntimeException) { - const SdrGluePointList* pList = mpObject->GetGluePointList(); - const USHORT nCount = pList ? pList->GetCount() : 0; + if( mpObject.is() ) + { + const SdrGluePointList* pList = mpObject->GetGluePointList(); + const USHORT nCount = pList ? pList->GetCount() : 0; - USHORT i; + USHORT i; - uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS ); - sal_Int32 *pIdentifier = aIdSequence.getArray(); + uno::Sequence< sal_Int32 > aIdSequence( nCount + NON_USER_DEFINED_GLUE_POINTS ); + sal_Int32 *pIdentifier = aIdSequence.getArray(); - for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ ) - *pIdentifier++ = (sal_Int32)i; + for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ ) + *pIdentifier++ = (sal_Int32)i; - for( i = 0; i < nCount; i++ ) - *pIdentifier++ = (sal_Int32) ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1; + for( i = 0; i < nCount; i++ ) + *pIdentifier++ = (sal_Int32) ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1; - return aIdSequence; + return aIdSequence; + } + else + { + uno::Sequence< sal_Int32 > aEmpty; + return aEmpty; + } } /* deprecated */ @@ -425,7 +393,7 @@ void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& E throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) { - if( mpObject ) + if( mpObject.is() ) { SdrGluePointList* pList = mpObject->ForceGluePointList(); if( pList ) @@ -455,7 +423,7 @@ void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& E void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) { - if( mpObject ) + if( mpObject.is() ) { SdrGluePointList* pList = mpObject->ForceGluePointList(); if( pList ) @@ -487,7 +455,7 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno: throw lang::IllegalArgumentException(); Index -= 4; - if( mpObject && Index >= 0 ) + if( mpObject.is() && Index >= 0 ) { SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() ); if( pList && Index < pList->GetCount() ) @@ -509,7 +477,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount() throw(uno::RuntimeException) { sal_Int32 nCount = 0; - if( mpObject ) + if( mpObject.is() ) { // each node has a default of 4 glue points // and any number of user defined glue points @@ -529,7 +497,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount() uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) { - if( Index >= 0 && mpObject && mpObject->IsNode() ) + if( Index >= 0 && mpObject.is() && mpObject->IsNode() ) { struct drawing::GluePoint2 aGluePoint; @@ -571,7 +539,7 @@ uno::Type SAL_CALL SvxUnoGluePointAccess::getElementType() sal_Bool SAL_CALL SvxUnoGluePointAccess::hasElements() throw( uno::RuntimeException) { - return mpObject && mpObject->IsNode(); + return mpObject.is() && mpObject->IsNode(); } /** diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index fdac6b7a9c1a..7f7aedf860e9 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -215,9 +215,14 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField( { uno::Reference< uno::XInterface > xRet; - const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") ); + const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.") ); - if( ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0 ) + // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is + // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation. + const OUString aTextFieldPrexit2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") ); + + if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) || + (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) ) { OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) ); diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 4cc56d5ca427..7ab6a44fd3fb 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -670,17 +670,16 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const ::rtl::OUString& rPictureSt // ----------------------------------------------------------------------------- -void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos ) +void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos, rtl::OUString& rRequestedFileName ) { + rtl::OUString aURLString( rURLStr ); ::rtl::OUString aPictureStorageName, aPictureStreamName; - - if( ( maURLSet.find( rURLStr ) != maURLSet.end() ) ) + if( ( maURLSet.find( aURLString ) != maURLSet.end() ) ) { URLPairVector::iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() ); - while( aIter != aEnd ) { - if( rURLStr == (*aIter).first ) + if( aURLString == (*aIter).first ) { maGrfURLs[ nInsertPos ].second = (*aIter).second; aIter = aEnd; @@ -689,7 +688,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s aIter++; } } - else if( ImplGetStreamNames( rURLStr, aPictureStorageName, aPictureStreamName ) ) + else if( ImplGetStreamNames( aURLString, aPictureStorageName, aPictureStreamName ) ) { URLPair& rURLPair = maGrfURLs[ nInsertPos ]; @@ -718,22 +717,23 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s String aStreamName( aGraphicObjectId ); Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() ); const GfxLink aGfxLink( aGraphic.GetLink() ); + String aExtension; if( aGfxLink.GetDataSize() ) { switch( aGfxLink.GetType() ) { - case( GFX_LINK_TYPE_EPS_BUFFER ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) ); break; - case( GFX_LINK_TYPE_NATIVE_GIF ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) ); break; - case( GFX_LINK_TYPE_NATIVE_JPG ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".jpg" ) ); break; - case( GFX_LINK_TYPE_NATIVE_PNG ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ); break; - case( GFX_LINK_TYPE_NATIVE_TIF ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".tif" ) ); break; - case( GFX_LINK_TYPE_NATIVE_WMF ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".wmf" ) ); break; - case( GFX_LINK_TYPE_NATIVE_MET ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".met" ) ); break; - case( GFX_LINK_TYPE_NATIVE_PCT ): aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".pct" ) ); break; + case( GFX_LINK_TYPE_EPS_BUFFER ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) ); break; + case( GFX_LINK_TYPE_NATIVE_GIF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) ); break; + case( GFX_LINK_TYPE_NATIVE_JPG ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".jpg" ) ); break; + case( GFX_LINK_TYPE_NATIVE_PNG ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ); break; + case( GFX_LINK_TYPE_NATIVE_TIF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".tif" ) ); break; + case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".wmf" ) ); break; + case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".met" ) ); break; + case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".pct" ) ); break; default: - aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) ); + aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) ); break; } } @@ -742,30 +742,52 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s if( aGrfObject.GetType() == GRAPHIC_BITMAP ) { if( aGrfObject.IsAnimated() ) - aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) ); + aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) ); else - aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ); + aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ); } else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE ) { // SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() ); if ( ImplCheckForEPS( rMtf ) ) - aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) ); + aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) ); else - aStreamName += String( RTL_CONSTASCII_USTRINGPARAM( ".svm" ) ); + aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".svm" ) ); } } + rtl::OUString aURLEntry; + const String sPictures( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) ); + + if ( rRequestedFileName.getLength() ) + { + aURLEntry = sPictures; + aURLEntry += rRequestedFileName; + aURLEntry += aExtension; + + URLPairVector::iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() ); + while( aIter != aEnd ) + { + if( aURLEntry == (*aIter).second ) + break; + aIter++; + } + if ( aIter == aEnd ) + aStreamName = rRequestedFileName; + } + + aStreamName += aExtension; + if( mbDirect && aStreamName.Len() ) ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId ); - rURLPair.second = String( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) ); + rURLPair.second = sPictures; rURLPair.second += aStreamName; } } - maURLSet.insert( rURLStr ); + maURLSet.insert( aURLString ); } } @@ -820,14 +842,45 @@ void SvXMLGraphicHelper::Destroy( SvXMLGraphicHelper* pSvXMLGraphicHelper ) // ----------------------------------------------------------------------------- // XGraphicObjectResolver -::rtl::OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const ::rtl::OUString& aURL ) +::rtl::OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const ::rtl::OUString& rURL ) throw(uno::RuntimeException) { ::osl::MutexGuard aGuard( maMutex ); const sal_Int32 nIndex = maGrfURLs.size(); + rtl::OUString aURL( rURL ); + rtl::OUString aUserData; + rtl::OUString aRequestedFileName; + + sal_Int32 nUser = rURL.indexOf( '?', 0 ); + if ( nUser >= 0 ) + { + aURL = rtl::OUString( rURL.copy( 0, nUser ) ); + nUser++; + aUserData = rURL.copy( nUser, rURL.getLength() - nUser ); + } + if ( aUserData.getLength() ) + { + sal_Int32 nIndex2 = 0; + do + { + rtl::OUString aToken = aUserData.getToken( 0, ';', nIndex2 ); + sal_Int32 n = aToken.indexOf( '=' ); + if ( ( n > 0 ) && ( ( n + 1 ) < aToken.getLength() ) ) + { + rtl::OUString aParam( aToken.copy( 0, n ) ); + rtl::OUString aValue( aToken.copy( n + 1, aToken.getLength() - ( n + 1 ) ) ); + + const rtl::OUString sRequestedName( RTL_CONSTASCII_USTRINGPARAM("requestedName") ); + if ( aParam.match( sRequestedName ) ) + aRequestedFileName = aValue; + } + } + while ( nIndex2 >= 0 ); + } + maGrfURLs.push_back( ::std::make_pair( aURL, ::rtl::OUString() ) ); - ImplInsertGraphicURL( aURL, nIndex ); + ImplInsertGraphicURL( aURL, nIndex, aRequestedFileName ); return maGrfURLs[ nIndex ].second; } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 21dd7fcb1acd..6fae754662ee 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -66,6 +66,8 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/vector/b2dvector.hxx> +#include <stdio.h> + using namespace ::rtl; using namespace ::com::sun::star; @@ -108,7 +110,7 @@ long ScaleMetricValue( long nVal, long nMul, long nDiv ) /************************************************************************* |* -|* NameOrIndex::NameOrIndex(USHORT nWhich, long nIndex) +|* NameOrIndex::NameOrIndex(USHORT nWhich, INT32 nIndex) |* |* Beschreibung |* Ersterstellung 14.11.94 @@ -116,7 +118,7 @@ long ScaleMetricValue( long nVal, long nMul, long nDiv ) |* *************************************************************************/ -NameOrIndex::NameOrIndex(USHORT _nWhich, long nIndex) : +NameOrIndex::NameOrIndex(USHORT _nWhich, INT32 nIndex) : SfxStringItem(_nWhich, aNameOrIndexEmptyString), nPalIndex(nIndex) { @@ -134,7 +136,7 @@ NameOrIndex::NameOrIndex(USHORT _nWhich, long nIndex) : NameOrIndex::NameOrIndex(USHORT _nWhich, const XubString& rName) : SfxStringItem(_nWhich, rName), - nPalIndex((long)-1) + nPalIndex(-1) { } @@ -230,7 +232,7 @@ SfxPoolItem* NameOrIndex::Create(SvStream& rIn, USHORT /*nVer*/) const SvStream& NameOrIndex::Store( SvStream& rOut, USHORT nItemVersion ) const { SfxStringItem::Store( rOut, nItemVersion ); - rOut << (INT32)nPalIndex; + rOut << nPalIndex; return rOut; } @@ -369,11 +371,11 @@ TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex); /************************************************************************* |* -|* XColorItem::XColorItem(USHORT nWhich, long nIndex, const Color& rTheColor) +|* XColorItem::XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor) |* \************************************************************************/ -XColorItem::XColorItem(USHORT _nWhich, long nIndex, const Color& rTheColor) : +XColorItem::XColorItem(USHORT _nWhich, INT32 nIndex, const Color& rTheColor) : NameOrIndex(_nWhich, nIndex), aColor(rTheColor) { @@ -884,7 +886,7 @@ TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex); /************************************************************************* |* -|* XLineDashItem::XLineDashItem(long nIndex, const XDash& rTheDash) +|* XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash) |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -892,7 +894,7 @@ TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex); |* *************************************************************************/ -XLineDashItem::XLineDashItem(long nIndex, const XDash& rTheDash) : +XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash) : NameOrIndex(XATTR_LINEDASH, nIndex), aDash(rTheDash) { @@ -1501,7 +1503,7 @@ TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem); /************************************************************************* |* -|* XLineColorItem::XLineColorItem(long nIndex, const Color& rTheColor) +|* XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor) |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -1509,7 +1511,7 @@ TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem); |* *************************************************************************/ -XLineColorItem::XLineColorItem(long nIndex, const Color& rTheColor) : +XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor) : XColorItem(XATTR_LINECOLOR, nIndex, rTheColor) { } @@ -1720,7 +1722,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex); /************************************************************************* |* -|* XLineStartItem::XLineStartItem(long nIndex) +|* XLineStartItem::XLineStartItem(INT32 nIndex) |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -1728,7 +1730,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex); |* *************************************************************************/ -XLineStartItem::XLineStartItem(long nIndex) +XLineStartItem::XLineStartItem(INT32 nIndex) : NameOrIndex(XATTR_LINESTART, nIndex) { } @@ -2192,7 +2194,7 @@ TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex); /************************************************************************* |* -|* XLineEndItem::XLineEndItem(long nIndex) +|* XLineEndItem::XLineEndItem(INT32 nIndex) |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -2200,7 +2202,7 @@ TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex); |* *************************************************************************/ -XLineEndItem::XLineEndItem(long nIndex) +XLineEndItem::XLineEndItem(INT32 nIndex) : NameOrIndex(XATTR_LINEEND, nIndex) { } @@ -2664,7 +2666,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem); /************************************************************************* |* -|* XLineStartWidthItem::XLineStartWidthItem(long nWidth) +|* XLineStartWidthItem::XLineStartWidthItem(INT32 nWidth) |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -3249,7 +3251,7 @@ TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem); /************************************************************************* |* -|* XFillColorItem::XFillColorItem(long nIndex, const Color& rTheColor) +|* XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor) |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -3257,7 +3259,7 @@ TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem); |* *************************************************************************/ -XFillColorItem::XFillColorItem(long nIndex, const Color& rTheColor) : +XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor) : XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor) { } @@ -3372,7 +3374,7 @@ sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE // ----------------------------- TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem); -XSecondaryFillColorItem::XSecondaryFillColorItem(long nIndex, const Color& rTheColor) : +XSecondaryFillColorItem::XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor) : XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor) { } @@ -3510,7 +3512,7 @@ TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex); /************************************************************************* |* -|* XFillGradientItem::XFillGradientItem(long nIndex, +|* XFillGradientItem::XFillGradientItem(INT32 nIndex, |* const XGradient& rTheGradient) |* |* Beschreibung @@ -3519,7 +3521,7 @@ TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex); |* *************************************************************************/ -XFillGradientItem::XFillGradientItem(long nIndex, +XFillGradientItem::XFillGradientItem(INT32 nIndex, const XGradient& rTheGradient) : NameOrIndex(XATTR_FILLGRADIENT, nIndex), aGradient(rTheGradient) @@ -4042,7 +4044,7 @@ XFillFloatTransparenceItem::XFillFloatTransparenceItem() : //------------------------------------------------------------------------ -XFillFloatTransparenceItem::XFillFloatTransparenceItem( long nIndex, const XGradient& rGradient, BOOL bEnable ) : +XFillFloatTransparenceItem::XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable ) : XFillGradientItem ( nIndex, rGradient ), bEnabled ( bEnable ) { @@ -4246,7 +4248,7 @@ TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex); /************************************************************************* |* -|* XFillHatchItem::XFillHatchItem(long nIndex, +|* XFillHatchItem::XFillHatchItem(INT32 nIndex, |* const XHatch& rTheHatch) |* |* Beschreibung @@ -4255,7 +4257,7 @@ TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex); |* *************************************************************************/ -XFillHatchItem::XFillHatchItem(long nIndex, +XFillHatchItem::XFillHatchItem(INT32 nIndex, const XHatch& rTheHatch) : NameOrIndex(XATTR_FILLHATCH, nIndex), aHatch(rTheHatch) @@ -5258,7 +5260,7 @@ TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem); |* *************************************************************************/ -XFormTextShadowColorItem::XFormTextShadowColorItem(long nIndex, +XFormTextShadowColorItem::XFormTextShadowColorItem(INT32 nIndex, const Color& rTheColor) : XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor) { diff --git a/svx/util/makefile.pmk b/svx/util/makefile.pmk index 27f185e936bd..b2aae3329111 100644 --- a/svx/util/makefile.pmk +++ b/svx/util/makefile.pmk @@ -36,4 +36,12 @@ CDEFS += -DSVX_DLLIMPLEMENTATION CFLAGS+=-DENABLE_GTK .ENDIF +.IF "$(ENABLE_KDE)" != "" +CFLAGS+=-DENABLE_KDE +.ENDIF + +.IF "$(ENABLE_KDE4)" != "" +CFLAGS+=-DENABLE_KDE4 +.ENDIF + VISIBILITY_HIDDEN=TRUE diff --git a/sysui/util/checksize.pl b/sysui/util/checksize.pl index ea0def46d5b5..808442d91a18 100644 --- a/sysui/util/checksize.pl +++ b/sysui/util/checksize.pl @@ -82,8 +82,8 @@ sub check #04.02.2005 13:40 my $path = shift; my $file = shift; print "$path$file\n" if ((-e "$path$file") && $is_debug); - # don't check dpc,flag,rpmflag, [obj for UNX] files, or etc subdirectory - return if ( ($file =~ /.+\.(dpc|\w*?flag)/) || ($file =~ /.+\.obj/ && $ENV{GUI} eq 'UNX') || ($path =~ /.+etc/) || ($path =~ /.+logs/) ); + # don't check dpc,flag,rpmflag,sdf [obj for UNX] files, or etc subdirectory + return if ( ($file =~ /.+\.(dpc|\w*?flag)/) || ($file =~ /.+\.obj/ && $ENV{GUI} eq 'UNX') || ($path =~ /.+etc/) || ($path =~ /.+logs/) || ($path =~ /.+sdf/) ); if ( -z "$path$file" ) { print "Error: $path$file 0 Bytes!\n"; $err++; diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 30a4d0f48c94..62de20f87a74 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -63,6 +63,7 @@ #include "com/sun/star/task/XInteractionHandler.hpp" #include "com/sun/star/task/XInteractionHandler2.hpp" #include "com/sun/star/task/DocumentPasswordRequest.hpp" +#include "com/sun/star/task/DocumentMSPasswordRequest.hpp" #include "com/sun/star/task/ErrorCodeIOException.hpp" #include "com/sun/star/task/ErrorCodeRequest.hpp" #include "com/sun/star/task/MasterPasswordRequest.hpp" @@ -1132,6 +1133,15 @@ bool UUIInteractionHelper::handleDialogRequests( return true; } + star::task::DocumentMSPasswordRequest aDocumentMSPasswordRequest; + if (aAnyRequest >>= aDocumentMSPasswordRequest) + { + handleMSPasswordRequest(aDocumentMSPasswordRequest.Mode, + rRequest->getContinuations(), + aDocumentMSPasswordRequest.Name); + return true; + } + star::task::PasswordRequest aPasswordRequest; if (aAnyRequest >>= aPasswordRequest) { @@ -1839,6 +1849,48 @@ UUIInteractionHelper::executePasswordDialog( } void +UUIInteractionHelper::executeMSPasswordDialog( + LoginErrorInfo & rInfo, + star::task::PasswordRequestMode nMode, + ::rtl::OUString aDocName) + SAL_THROW((star::uno::RuntimeException)) +{ + try + { + vos::OGuard aGuard(Application::GetSolarMutex()); + + std::auto_ptr< ResMgr > + xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); + if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE ) + { + std::auto_ptr< PasswordCreateDialog > + xDialog(new PasswordCreateDialog( + getParentProperty(), xManager.get(), true)); + + rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : + ERRCODE_BUTTON_CANCEL); + rInfo.SetPassword( xDialog->GetPassword() ); + } + else + { + std::auto_ptr< PasswordDialog > + xDialog(new PasswordDialog( + getParentProperty(), nMode, xManager.get(), aDocName )); + + rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : + ERRCODE_BUTTON_CANCEL); + rInfo.SetPassword( xDialog->GetPassword() ); + } + } + catch (std::bad_alloc const &) + { + throw star::uno::RuntimeException( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")), + star::uno::Reference< star::uno::XInterface>()); + } +} + +void UUIInteractionHelper::executeCookieDialog(CntHTTPCookieRequest & rRequest) SAL_THROW((star::uno::RuntimeException)) { @@ -2558,6 +2610,47 @@ UUIInteractionHelper::handlePasswordRequest( } void +UUIInteractionHelper::handleMSPasswordRequest( + star::task::PasswordRequestMode nMode, + star::uno::Sequence< star::uno::Reference< + star::task::XInteractionContinuation > > const & + rContinuations, + ::rtl::OUString aDocumentName ) + SAL_THROW((star::uno::RuntimeException)) +{ + star::uno::Reference< star::task::XInteractionRetry > xRetry; + star::uno::Reference< star::task::XInteractionAbort > xAbort; + star::uno::Reference< star::task::XInteractionPassword > + xPassword; + getContinuations( + rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + LoginErrorInfo aInfo; + + executeMSPasswordDialog(aInfo, nMode, aDocumentName); + + switch (aInfo.GetResult()) + { + case ERRCODE_BUTTON_OK: + if (xPassword.is()) + { + xPassword->setPassword(aInfo.GetPassword()); + xPassword->select(); + } + break; + + case ERRCODE_BUTTON_RETRY: + if (xRetry.is()) + xRetry->select(); + break; + + default: + if (xAbort.is()) + xAbort->select(); + break; + } +} + +void UUIInteractionHelper::handleCookiesRequest( star::ucb::HandleCookiesRequest const & rRequest, star::uno::Sequence< star::uno::Reference< diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index 8b53b071a629..4053f919bf7b 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -201,6 +201,12 @@ private: ::rtl::OUString aDocumentName) SAL_THROW((com::sun::star::uno::RuntimeException)); + void + executeMSPasswordDialog(LoginErrorInfo & rInfo, + com::sun::star::task::PasswordRequestMode nMode, + ::rtl::OUString aDocumentName) + SAL_THROW((com::sun::star::uno::RuntimeException)); + void executeCookieDialog(CntHTTPCookieRequest & rRequest) SAL_THROW((com::sun::star::uno::RuntimeException)); @@ -280,6 +286,16 @@ private: ::rtl::OUString aDocumentName = ::rtl::OUString()) SAL_THROW((com::sun::star::uno::RuntimeException)); + void + handleMSPasswordRequest( + com::sun::star::task::PasswordRequestMode nMode, + com::sun::star::uno::Sequence< + com::sun::star::uno::Reference< + com::sun::star::task::XInteractionContinuation > > const & + rContinuations, + ::rtl::OUString aDocumentName = ::rtl::OUString()) + SAL_THROW((com::sun::star::uno::RuntimeException)); + void handleCookiesRequest( com::sun::star::ucb::HandleCookiesRequest const & rRequest, diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx index a57255cddefe..636cd4510ecc 100644 --- a/uui/source/passcrtdlg.cxx +++ b/uui/source/passcrtdlg.cxx @@ -69,19 +69,19 @@ IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG ) // ----------------------------------------------------------------------- -PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr ) +PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode) :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) ) ,aFTPasswordCrt ( this, ResId( FT_PASSWORD_CRT, *pResMgr ) ) ,aEDPasswordCrt ( this, ResId( ED_PASSWORD_CRT, *pResMgr ) ) ,aFTPasswordRepeat ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr ) ) ,aEDPasswordRepeat ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr ) ) - ,aFTWarning ( this, ResId( FT_PASSWORD_WARNING, *pResMgr ) ) + ,aFTWarning ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr ) ) ,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) ) ,aOKBtn ( this, ResId( BTN_PASSCRT_OK, *pResMgr ) ) ,aCancelBtn ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr ) ) ,aHelpBtn ( this, ResId( BTN_PASSCRT_HELP, *pResMgr ) ) ,pResourceMgr ( pResMgr ) - ,nMinLen(5) + ,nMinLen( bMSCryptoMode ? 1 : 5 ) { FreeResource(); @@ -90,6 +90,12 @@ PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr ) aOKBtn.Enable( sal_False ); + if ( bMSCryptoMode ) + { + aEDPasswordCrt.SetMaxTextLen( 15 ); + aEDPasswordRepeat.SetMaxTextLen( 15 ); + } + long nLabelWidth = aFTWarning.GetSizePixel().Width(); long nLabelHeight = aFTWarning.GetSizePixel().Height(); long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() ); diff --git a/uui/source/passcrtdlg.hrc b/uui/source/passcrtdlg.hrc index 4c10fa92fddd..54a09494e2ab 100644 --- a/uui/source/passcrtdlg.hrc +++ b/uui/source/passcrtdlg.hrc @@ -28,19 +28,20 @@ * ************************************************************************/ -#ifndef UUI_PASSCRTDLG_HRC
-#define UUI_PASSCRTDLG_HRC
+#ifndef UUI_PASSCRTDLG_HRC +#define UUI_PASSCRTDLG_HRC -// local identifiers
-#define BTN_PASSCRT_CANCEL 1
-#define ED_PASSWORD_CRT 2
-#define FT_PASSWORD_REPEAT 3
-#define FT_PASSWORD_WARNING 4
-#define ED_PASSWORD_REPEAT 5
-#define FL_FIXED_LINE_1 6
-#define BTN_PASSCRT_OK 7
-#define BTN_PASSCRT_HELP 8
-#define FT_PASSWORD_CRT 9
+// local identifiers +#define BTN_PASSCRT_CANCEL 1 +#define ED_PASSWORD_CRT 2 +#define FT_PASSWORD_REPEAT 3 +#define FT_PASSWORD_WARNING 4 +#define ED_PASSWORD_REPEAT 5 +#define FL_FIXED_LINE_1 6 +#define BTN_PASSCRT_OK 7 +#define BTN_PASSCRT_HELP 8 +#define FT_PASSWORD_CRT 9 +#define FT_MSPASSWORD_WARNING 10 -#endif // UUI_PASSCRTDLG_HRC
+#endif // UUI_PASSCRTDLG_HRC diff --git a/uui/source/passcrtdlg.hxx b/uui/source/passcrtdlg.hxx index 0fefc10d09ba..b4f0f61644d6 100644 --- a/uui/source/passcrtdlg.hxx +++ b/uui/source/passcrtdlg.hxx @@ -58,7 +58,7 @@ class PasswordCreateDialog : public ModalDialog DECL_LINK( EditHdl_Impl, Edit * ); public: - PasswordCreateDialog( Window* pParent, ResMgr * pResMgr ); + PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false ); String GetPassword() const { return aEDPasswordCrt.GetText(); } }; diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src index cdfc9d380079..13f1ea688620 100644 --- a/uui/source/passcrtdlg.src +++ b/uui/source/passcrtdlg.src @@ -34,7 +34,7 @@ #include <ids.hrc> #endif #ifndef UUI_PASSCRTDLG_HRC -#include "passcrtdlg.hrc"
+#include "passcrtdlg.hrc" #endif ModalDialog DLG_UUI_PASSWORD_CRT @@ -44,61 +44,68 @@ ModalDialog DLG_UUI_PASSWORD_CRT Moveable = TRUE ; OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT( 145, 129 );
+ Size = MAP_APPFONT( 145, 129 ); FixedText FT_PASSWORD_CRT { - Pos = MAP_APPFONT( 3, 4 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Enter password";
+ Pos = MAP_APPFONT( 3, 4 ); + Size = MAP_APPFONT( 139, 9 ); + Text [ en-US ] = "Enter password"; }; Edit ED_PASSWORD_CRT { Border = TRUE ; - Pos = MAP_APPFONT( 3, 17 );
+ Pos = MAP_APPFONT( 3, 17 ); Size = MAP_APPFONT( 139, 13 ); PassWord = TRUE ; }; Edit ED_PASSWORD_REPEAT { Border = TRUE ; - Pos = MAP_APPFONT( 3, 47 );
+ Pos = MAP_APPFONT( 3, 47 ); Size = MAP_APPFONT( 139, 13 ); PassWord = TRUE ; }; OKButton BTN_PASSCRT_OK { - Pos = MAP_APPFONT( 27, 110 );
+ Pos = MAP_APPFONT( 27, 110 ); Size = MAP_APPFONT( 37, 15 ); DefButton = TRUE ; }; CancelButton BTN_PASSCRT_CANCEL { - Pos = MAP_APPFONT( 66, 110 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 66, 110 ); + Size = MAP_APPFONT( 37, 15 ); }; HelpButton BTN_PASSCRT_HELP { - Pos = MAP_APPFONT( 105, 110 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 105, 110 ); + Size = MAP_APPFONT( 37, 15 ); }; - FixedText FT_PASSWORD_REPEAT
- {
- Pos = MAP_APPFONT( 3, 34 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Reenter password";
- };
- FixedText FT_PASSWORD_WARNING
- {
- Pos = MAP_APPFONT( 4, 64 );
- Size = MAP_APPFONT( 137, 40 );
- Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
- WordBreak = TRUE;
- };
- FixedLine FL_FIXED_LINE_1
- {
- Pos = MAP_APPFONT( 0, 104 );
- Size = MAP_APPFONT( 145, 6 );
+ FixedText FT_PASSWORD_REPEAT + { + Pos = MAP_APPFONT( 3, 34 ); + Size = MAP_APPFONT( 139, 9 ); + Text [ en-US ] = "Reenter password"; + }; + FixedText FT_PASSWORD_WARNING + { + Pos = MAP_APPFONT( 4, 64 ); + Size = MAP_APPFONT( 137, 40 ); + Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long."; + WordBreak = TRUE; + }; + FixedText FT_MSPASSWORD_WARNING + { + Pos = MAP_APPFONT( 4, 64 ); + Size = MAP_APPFONT( 137, 40 ); + Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long."; + WordBreak = TRUE; + }; + FixedLine FL_FIXED_LINE_1 + { + Pos = MAP_APPFONT( 0, 104 ); + Size = MAP_APPFONT( 145, 6 ); }; - Text [ en-US ] = "Enter Password";
+ Text [ en-US ] = "Enter Password"; }; diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx index 2267452d93e7..ebecb4d19bb5 100644 --- a/xmloff/inc/SchXMLImport.hxx +++ b/xmloff/inc/SchXMLImport.hxx @@ -102,6 +102,7 @@ enum SchXMLAxisElemTokenMap enum SchXMLChartAttrMap { + XML_TOK_CHART_HREF, XML_TOK_CHART_CLASS, XML_TOK_CHART_WIDTH, XML_TOK_CHART_HEIGHT, diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index c228ed26eb41..e0bd8868f181 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -1991,4 +1991,11 @@ XML_CONSTASCII_ACTION( sXML_readonly, "readonly" ); XML_CONSTASCII_ACTION( sXML_page_continuation, "page-continuation" ); +XML_CONSTASCII_ACTION( sXML_contains, "contains" ); +XML_CONSTASCII_ACTION( sXML_does_not_contain, "does-not-contain" ); +XML_CONSTASCII_ACTION( sXML_begins_with, "begins-with" ); +XML_CONSTASCII_ACTION( sXML_does_not_begin_with, "does-not-begin-with" ); +XML_CONSTASCII_ACTION( sXML_ends_with, "ends-with" ); +XML_CONSTASCII_ACTION( sXML_does_not_end_with, "does-not-end-with" ); + #endif diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx index b886e499d329..2082ce59de03 100644 --- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx +++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx @@ -233,13 +233,6 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc ); - // if no data provider exists by, now the model (as XChild) is asked for its - // parent which creates the data provider that is finally set at the chart - // document - static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > - GetDataProvider( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > & xChartDoc ); - ::com::sun::star::awt::Size getPageSize( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const; diff --git a/xmloff/inc/xmloff/SchXMLImportHelper.hxx b/xmloff/inc/xmloff/SchXMLImportHelper.hxx index 0b8df9580e9e..d62368739c8a 100644 --- a/xmloff/inc/xmloff/SchXMLImportHelper.hxx +++ b/xmloff/inc/xmloff/SchXMLImportHelper.hxx @@ -143,13 +143,6 @@ public: sal_Int32 GetLengthOfSeries(); void ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoints = -1 ); - // if no data provider exists by, now the model (as XChild) is asked for its - // parent which creates the data provider that is finally set at the chart - // document - static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > - GetDataProvider( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > & xChartDoc ); - /** @param bPushLastChartType If </FALSE>, in case a new chart type has to be added (because it does not exist yet), it is appended at the end of the chart-type container. When </TRUE>, a new chart type diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 38ac954e6314..988614298fbb 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3081,6 +3081,13 @@ namespace xmloff { namespace token { XML_MATHWEIGHT, XML_MATHCOLOR, + XML_CONTAINS, + XML_DOES_NOT_CONTAIN, + XML_BEGINS_WITH, + XML_DOES_NOT_BEGIN_WITH, + XML_ENDS_WITH, + XML_DOES_NOT_END_WITH, + XML_TOKEN_END }; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 02c822afed7d..d103876b9350 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -228,6 +228,57 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen } } +uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex ) +{ + const sal_Unicode aSpace( ' ' ); + + // count number of entries + ::std::vector< sal_Int32 > aVec; + sal_Int32 nLastPos = 0; + sal_Int32 nPos = 0; + while( nPos != -1 ) + { + nPos = rStr.indexOf( aSpace, nLastPos ); + if( nPos > nLastPos ) + { + aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() ); + } + if( nPos != -1 ) + nLastPos = nPos + 1; + } + // last entry + if( nLastPos != 0 && + rStr.getLength() > nLastPos ) + { + aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() ); + } + + const sal_Int32 nVecSize = aVec.size(); + uno::Sequence< sal_Int32 > aSeq( nVecSize ); + + if(!bAddOneToEachOldIndex) + { + sal_Int32* pSeqArr = aSeq.getArray(); + for( nPos = 0; nPos < nVecSize; ++nPos ) + { + pSeqArr[ nPos ] = aVec[ nPos ]; + } + } + else if( bAddOneToEachOldIndex ) + { + aSeq.realloc( nVecSize+1 ); + aSeq[0]=0; + + sal_Int32* pSeqArr = aSeq.getArray(); + for( nPos = 0; nPos < nVecSize; ++nPos ) + { + pSeqArr[ nPos+1 ] = aVec[ nPos ]+1; + } + } + + return aSeq; +} + } // anonymous namespace static __FAR_DATA SvXMLEnumMapEntry aXMLLegendAlignmentMap[] = @@ -249,7 +300,8 @@ SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName ) : SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ), mrImportHelper( rImpHelper ), - mbHasOwnTable( sal_True ), + m_bHasRangeAtPlotArea( false ), + m_bHasTableElement( false ), mbAllRangeAddressesAvailable( sal_True ), mbColHasLabels( sal_False ), mbRowHasLabels( sal_False ), @@ -283,6 +335,10 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut switch( rAttrTokenMap.Get( nPrefix, aLocalName )) { + case XML_TOK_CHART_HREF: + m_aXLinkHRefAttributeToIndicateDataProvider = aValue; + break; + case XML_TOK_CHART_CLASS: { rtl::OUString sClassName; @@ -606,14 +662,21 @@ bool lcl_SpecialHandlingForDonutChartNeeded( } // anonymous namespace -void SchXMLChartContext::ChangeDiagramAccordingToTemplate( - const uno::Reference< chart2::XChartDocument >& xNewDoc ) + +void lcl_ApplyDataFromRectangularRangeToDiagram( + const uno::Reference< chart2::XChartDocument >& xNewDoc + , const rtl::OUString& rRectangularRange + , ::com::sun::star::chart::ChartDataRowSource eDataRowSource + , bool bRowHasLabels, bool bColHasLabels + , bool bSwitchOnLabelsAndCategoriesForOwnData + , const rtl::OUString& sColTrans + , const rtl::OUString& sRowTrans ) { if( !xNewDoc.is() ) return; uno::Reference< chart2::XDiagram > xNewDia( xNewDoc->getFirstDiagram()); - uno::Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( xNewDoc ) ); + uno::Reference< chart2::data::XDataProvider > xDataProvider( xNewDoc->getDataProvider() ); if( !xNewDia.is() || !xDataProvider.is() ) return; @@ -622,11 +685,11 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate( return; sal_Bool bFirstCellAsLabel = - (meDataRowSource==chart::ChartDataRowSource_COLUMNS)? mbRowHasLabels : mbColHasLabels; + (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bRowHasLabels : bColHasLabels; sal_Bool bHasCateories = - (meDataRowSource==chart::ChartDataRowSource_COLUMNS)? mbColHasLabels : mbRowHasLabels; + (eDataRowSource==chart::ChartDataRowSource_COLUMNS)? bColHasLabels : bRowHasLabels; - if( mbHasOwnTable ) + if( bSwitchOnLabelsAndCategoriesForOwnData ) { bFirstCellAsLabel = true; bHasCateories = true; @@ -635,25 +698,25 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate( uno::Sequence< beans::PropertyValue > aArgs( 3 ); aArgs[0] = beans::PropertyValue( ::rtl::OUString::createFromAscii("CellRangeRepresentation"), - -1, uno::makeAny( msChartAddress ), + -1, uno::makeAny( rRectangularRange ), beans::PropertyState_DIRECT_VALUE ); aArgs[1] = beans::PropertyValue( ::rtl::OUString::createFromAscii("DataRowSource"), - -1, uno::makeAny( meDataRowSource ), + -1, uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE ); aArgs[2] = beans::PropertyValue( ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1, uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE ); - if( msColTrans.getLength() || msRowTrans.getLength() ) + if( sColTrans.getLength() || sRowTrans.getLength() ) { aArgs.realloc( aArgs.getLength() + 1 ); aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue( ::rtl::OUString::createFromAscii("SequenceMapping"), - -1, uno::makeAny( msColTrans.getLength() - ? GetNumberSequenceFromString( msColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) - : GetNumberSequenceFromString( msRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ), + -1, uno::makeAny( sColTrans.getLength() + ? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) + : lcl_getNumberSequenceFromString( sRowTrans, bHasCateories && !xNewDoc->hasInternalDataProvider() ) ), beans::PropertyState_DIRECT_VALUE ); } @@ -766,21 +829,36 @@ void SchXMLChartContext::EndElement() if(!xNewDoc.is()) return; - // if we already have an internal data provider, we know that we cannot have - // external data here. If we can have external data but know that we have - // internal data due to missing ranges, we must create an internal data - // provider + bool bHasOwnData = false; + if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) //data comes from the chart itself + bHasOwnData = true; + else if( m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( ".." ) ) //data comes from the parent application + bHasOwnData = false; + else if( m_aXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself if data are available + bHasOwnData = m_bHasTableElement; + else + bHasOwnData = !m_bHasRangeAtPlotArea; + if( xNewDoc->hasInternalDataProvider()) - mbHasOwnTable = true; - else if( mbHasOwnTable ) + { + if( !m_bHasTableElement && !m_aXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) + { + //#i103147# ODF, workaround broken files with a missing table:cell-range-address at the plot-area + bool bSwitchSuccessful = SchXMLTools::switchBackToDataProviderFromParent( xNewDoc, maLSequencesPerIndex ); + bHasOwnData = !bSwitchSuccessful; + } + else + bHasOwnData = true;//e.g. in case of copy->paste from calc to impress + } + else if( bHasOwnData ) { xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ ); } - if( mbHasOwnTable ) + if( bHasOwnData ) msChartAddress = ::rtl::OUString::createFromAscii("all"); - bool bPostProcessTable = false; - if( !mbHasOwnTable && mbAllRangeAddressesAvailable ) + bool bSwitchRangesFromOuterToInternalIfNecessary = false; + if( !bHasOwnData && mbAllRangeAddressesAvailable ) { // special handling for stock chart (merge series together) if( mbIsStockChart ) @@ -788,24 +866,28 @@ void SchXMLChartContext::EndElement() } else if( msChartAddress.getLength() ) { - // in this case there are range addresses that are simply wrong. + //own data or only rectangular range available + bool bOlderThan2_3 = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY )); - bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && mbHasOwnTable && (meDataRowSource==chart::ChartDataRowSource_ROWS)); + bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && bHasOwnData && (meDataRowSource==chart::ChartDataRowSource_ROWS)); // in this case there are range addresses that are simply wrong. + if( mbAllRangeAddressesAvailable && !bSpecialHandlingForDonutChart && !mbIsStockChart && !bOldFileWithOwnDataFromRows ) { - // note: mbRowHasLabels means the first row contains labels, that - // means we have "column-descriptions", (analogously mbColHasLabels - // means we have "row-descriptions") - SchXMLTableHelper::applyTable( maTable, xNewDoc ); - bPostProcessTable = true; + //bHasOwnData is true in this case! + //e.g. for normal files with own data or also in case of copy paste scenario (e.g. calc to impress) + if( xNewDoc->hasInternalDataProvider() ) + SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc ); + bSwitchRangesFromOuterToInternalIfNecessary = true; } else { + //apply data from rectangular range + // apply data read from the table sub-element to the chart // if the data provider supports the XChartDataArray interface like // the internal data provider - uno::Reference< chart::XChartDataArray > xChartData( mrImportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY ); + uno::Reference< chart::XChartDataArray > xChartData( xNewDoc->getDataProvider(), uno::UNO_QUERY ); if( xChartData.is()) SchXMLTableHelper::applyTableSimple( maTable, xChartData ); @@ -815,29 +897,32 @@ void SchXMLChartContext::EndElement() { if( bOlderThan2_3 && xDiaProp.is() )//for older charts the hidden cells were removed by calc on the fly xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IncludeHiddenCells")),uno::makeAny(false)); - ChangeDiagramAccordingToTemplate( xNewDoc ); + + // note: mbRowHasLabels means the first row contains labels, that means we have "column-descriptions", + // (analogously mbColHasLabels means we have "row-descriptions") + lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans ); } catch( uno::Exception & ) { //try to fallback to internal data - DBG_ERROR( "Exception during import SchXMLChartContext::ChangeDiagramAccordingToTemplate try to fallback to internal data" ); - if(!mbHasOwnTable) + DBG_ERROR( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" ); + if(!bHasOwnData) { - mbHasOwnTable = true; + bHasOwnData = true; msChartAddress = ::rtl::OUString::createFromAscii("all"); if( !xNewDoc->hasInternalDataProvider() ) { xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ ); - xChartData = uno::Reference< chart::XChartDataArray >( mrImportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY ); + xChartData = uno::Reference< chart::XChartDataArray >( xNewDoc->getDataProvider(), uno::UNO_QUERY ); if( xChartData.is()) SchXMLTableHelper::applyTableSimple( maTable, xChartData ); try { - ChangeDiagramAccordingToTemplate( xNewDoc ); + lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans ); } catch( uno::Exception & ) { - DBG_ERROR( "Exception during import SchXMLChartContext::ChangeDiagramAccordingToTemplate fallback to internal data failed also" ); + DBG_ERROR( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" ); } } } @@ -893,16 +978,23 @@ void SchXMLChartContext::EndElement() SchXMLSeries2Context::setStylesToStatisticsObjects( maSeriesDefaultsAndStyles , pStylesCtxt, pStyle, sCurrStyleName ); } + } + //#i98319# call switchRangesFromOuterToInternalIfNecessary before the data point styles are applied, otherwise in copy->paste scenario the data point styles do get lost + if( bSwitchRangesFromOuterToInternalIfNecessary ) + { + if( xNewDoc->hasInternalDataProvider() ) + SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource ); + } + + if( pStylesCtxt ) + { // ... then iterate over data-point attributes, so the latter are not overwritten SchXMLSeries2Context::setStylesToDataPoints( maSeriesDefaultsAndStyles , pStylesCtxt, pStyle, sCurrStyleName, mrImportHelper, GetImport(), mbIsStockChart, bSpecialHandlingForDonutChart, bSwitchOffLinesForScatter ); } } - if( bPostProcessTable ) - SchXMLTableHelper::postProcessTable( maTable, maLSequencesPerIndex, xNewDoc, meDataRowSource ); - if( xProp.is()) xProp->setPropertyValue( rtl::OUString::createFromAscii( "RefreshAddInAllowed" ) , uno::makeAny( sal_True) ); } @@ -1003,8 +1095,9 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( { case XML_TOK_CHART_PLOT_AREA: pContext = new SchXMLPlotAreaContext( mrImportHelper, GetImport(), rLocalName, + m_aXLinkHRefAttributeToIndicateDataProvider, maSeriesAddresses, msCategoriesAddress, - msChartAddress, mbHasOwnTable, mbAllRangeAddressesAvailable, + msChartAddress, m_bHasRangeAtPlotArea, mbAllRangeAddressesAvailable, mbColHasLabels, mbRowHasLabels, meDataRowSource, maSeriesDefaultsAndStyles, @@ -1046,6 +1139,7 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( { SchXMLTableContext * pTableContext = new SchXMLTableContext( mrImportHelper, GetImport(), rLocalName, maTable ); + m_bHasTableElement = true; // #i85913# take into account column- and row- mapping for // charts with own data only for those which were not copied // from a place where they got data from the container. Note, @@ -1060,12 +1154,12 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( if( msColTrans.getLength() > 0 ) { OSL_ASSERT( msRowTrans.getLength() == 0 ); - pTableContext->setColumnPermutation( GetNumberSequenceFromString( msColTrans, true )); + pTableContext->setColumnPermutation( lcl_getNumberSequenceFromString( msColTrans, true )); msColTrans = OUString(); } else if( msRowTrans.getLength() > 0 ) { - pTableContext->setRowPermutation( GetNumberSequenceFromString( msRowTrans, true )); + pTableContext->setRowPermutation( lcl_getNumberSequenceFromString( msRowTrans, true )); msRowTrans = OUString(); } } @@ -1143,57 +1237,6 @@ void SchXMLChartContext::InitChart( } } -uno::Sequence< sal_Int32 > SchXMLChartContext::GetNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex ) -{ - const sal_Unicode aSpace( ' ' ); - - // count number of entries - ::std::vector< sal_Int32 > aVec; - sal_Int32 nLastPos = 0; - sal_Int32 nPos = 0; - while( nPos != -1 ) - { - nPos = rStr.indexOf( aSpace, nLastPos ); - if( nPos > nLastPos ) - { - aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() ); - } - if( nPos != -1 ) - nLastPos = nPos + 1; - } - // last entry - if( nLastPos != 0 && - rStr.getLength() > nLastPos ) - { - aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() ); - } - - const sal_Int32 nVecSize = aVec.size(); - uno::Sequence< sal_Int32 > aSeq( nVecSize ); - - if(!bAddOneToEachOldIndex) - { - sal_Int32* pSeqArr = aSeq.getArray(); - for( nPos = 0; nPos < nVecSize; ++nPos ) - { - pSeqArr[ nPos ] = aVec[ nPos ]; - } - } - else if( bAddOneToEachOldIndex ) - { - aSeq.realloc( nVecSize+1 ); - aSeq[0]=0; - - sal_Int32* pSeqArr = aSeq.getArray(); - for( nPos = 0; nPos < nVecSize; ++nPos ) - { - pSeqArr[ nPos+1 ] = aVec[ nPos ]+1; - } - } - - return aSeq; -} - // ---------------------------------------- SchXMLTitleContext::SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx index 5bc20b3e862b..c02f623ebe10 100644 --- a/xmloff/source/chart/SchXMLChartContext.hxx +++ b/xmloff/source/chart/SchXMLChartContext.hxx @@ -114,7 +114,9 @@ private: ::rtl::OUString maMainTitle, maSubTitle; com::sun::star::awt::Point maMainTitlePos, maSubTitlePos, maLegendPos; - sal_Bool mbHasOwnTable; + ::rtl::OUString m_aXLinkHRefAttributeToIndicateDataProvider; + bool m_bHasRangeAtPlotArea; + bool m_bHasTableElement; sal_Bool mbAllRangeAddressesAvailable; sal_Bool mbColHasLabels; sal_Bool mbRowHasLabels; @@ -147,9 +149,6 @@ private: const ::rtl::OUString & rChartTypeServiceName, sal_Bool bSetSwitchData); - void ChangeDiagramAccordingToTemplate( - const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xNewDoc ); - ::com::sun::star::uno::Sequence< sal_Int32 > GetNumberSequenceFromString( const ::rtl::OUString& rStr, bool bAddOneToEachOldIndex ); void MergeSeriesForStockChart(); }; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 8f6c0bbf12e9..3290cb31db96 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -353,8 +353,10 @@ bool lcl_isSeriesAttachedToFirstAxis( OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const Reference< chart2::XChartDocument > & xDoc ) { OUString aResult = rRange; + if( !xDoc.is() ) + return aResult; Reference< chart2::data::XRangeXMLConversion > xConversion( - SchXMLExportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY ); + xDoc->getDataProvider(), uno::UNO_QUERY ); if( xConversion.is()) aResult = xConversion->convertRangeToXML( rRange ); return aResult; @@ -1114,6 +1116,16 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha if( bExportContent ) { + //export data provider in xlink:href attribute + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 ) + { + OUString aDataProviderURL( RTL_CONSTASCII_USTRINGPARAM( ".." ) ); + if( xNewDoc->hasInternalDataProvider() ) + aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ); + mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aDataProviderURL ); + } + OUString sChartType( xDiagram->getDiagramType() ); // attributes @@ -3521,7 +3533,7 @@ void SchXMLExport::_ExportContent() // check if we have own data. If so we must not export the complete // range string, as this is our only indicator for having own or // external data. @todo: fix this in the file format! - Reference< lang::XServiceInfo > xDPServiceInfo( maExportHelper.GetDataProvider( xNewDoc ), uno::UNO_QUERY ); + Reference< lang::XServiceInfo > xDPServiceInfo( xNewDoc->getDataProvider(), uno::UNO_QUERY ); if( ! (xDPServiceInfo.is() && xDPServiceInfo->getImplementationName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.comp.chart.InternalDataProvider" )))) @@ -3581,45 +3593,12 @@ void SchXMLExport::SetProgress( sal_Int32 nPercentage ) mxStatusIndicator->setValue( nPercentage ); } -// static -Reference< chart2::data::XDataProvider > SchXMLExportHelper::GetDataProvider( - const Reference< chart2::XChartDocument > & xDoc ) -{ - Reference< chart2::data::XDataProvider > xResult; - if( xDoc.is()) - { - xResult.set( xDoc->getDataProvider()); - // allowed to attach a new data provider in export? -// if( ! xResult.is()) -// { -// Reference< container::XChild > xChild( xDoc, uno::UNO_QUERY ); -// if( xChild.is()) -// { -// Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY ); -// if( xFact.is()) -// { -// xResult.set( -// xFact->createInstance( OUString::createFromAscii("com.sun.star.chart2.data.DataProvider")), -// uno::UNO_QUERY ); -// if( xResult.is()) -// { -// Reference< chart2::data::XDataReceiver > xReceiver( xDoc, uno::UNO_QUERY ); -// if( xReceiver.is()) -// xReceiver->attachDataProvider( xResult ); -// } -// } -// } -// } - } - return xResult; -} - void SchXMLExportHelper::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc ) { if( xChartDoc.is()) try { - Reference< chart2::data::XDataProvider > xDataProvider( GetDataProvider( xChartDoc )); + Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() ); OSL_ENSURE( xDataProvider.is(), "No DataProvider" ); if( xDataProvider.is()) { diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index ca79b12a3e2d..831c15fb624e 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -346,6 +346,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetChartAttrTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aChartAttrTokenMap[] = { + { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CHART_HREF }, { XML_NAMESPACE_CHART, XML_CLASS, XML_TOK_CHART_CLASS }, { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_CHART_WIDTH }, { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CHART_HEIGHT }, @@ -614,38 +615,6 @@ void SchXMLImportHelper::ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoin } } -// static -Reference< chart2::data::XDataProvider > SchXMLImportHelper::GetDataProvider( - const Reference< chart2::XChartDocument > & xDoc ) -{ - Reference< chart2::data::XDataProvider > xResult; - if( xDoc.is()) - { - try - { - xResult.set( xDoc->getDataProvider()); -// if( ! xResult.is()) -// { -// Reference< container::XChild > xChild( xDoc, uno::UNO_QUERY_THROW ); -// Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY ); -// if( xFact.is()) -// { -// Reference< chart2::data::XDataReceiver > xReceiver( xDoc, uno::UNO_QUERY_THROW ); -// xResult.set( -// xFact->createInstance( OUString::createFromAscii("com.sun.star.chart2.data.DataProvider")), -// uno::UNO_QUERY_THROW ); -// xReceiver->attachDataProvider( xResult ); -// } -// } - } - catch( const uno::Exception & ) - { - // didn't get a data provider from the container - } - } - return xResult; -} - //static void SchXMLImportHelper::DeleteDataSeries( const Reference< chart2::XDataSeries > & xSeries, @@ -796,6 +765,8 @@ SchXMLImport::SchXMLImport( sal_uInt16 nImportFlags ) : SvXMLImport( xServiceFactory, nImportFlags ) { + GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + mbIsGraphicLoadOnDemandSupported = false; } @@ -807,6 +778,8 @@ SchXMLImport::SchXMLImport( sal_Bool /*bLoadDoc*/, sal_Bool bShowProgress ) : SvXMLImport( xServiceFactory, xModel, rGrfContainer ) { + GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + // get status indicator (if requested) if( bShowProgress ) { diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 46254192571a..8bb4712b4159 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -108,8 +108,10 @@ struct lcl_AxisHasCategories : public ::std::unary_function< SchXMLAxis, bool > OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc ) { OUString aResult = rRange; + if(!xDoc.is()) + return aResult; uno::Reference< chart2::data::XRangeXMLConversion > xConversion( - SchXMLImportHelper::GetDataProvider( xDoc ), uno::UNO_QUERY ); + xDoc->getDataProvider(), uno::UNO_QUERY ); if( xConversion.is()) aResult = xConversion->convertRangeFromXML( rRange ); return aResult; @@ -177,10 +179,11 @@ SchXML3DSceneAttributesHelper::~SchXML3DSceneAttributesHelper() SchXMLPlotAreaContext::SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName, + const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider, uno::Sequence< chart::ChartSeriesAddress >& rSeriesAddresses, ::rtl::OUString& rCategoriesAddress, ::rtl::OUString& rChartAddress, - sal_Bool & rHasOwnTable, + bool& rbHasRangeAtPlotArea, sal_Bool & rAllRangeAddressesAvailable, sal_Bool & rColHasLabels, sal_Bool & rRowHasLabels, @@ -203,8 +206,9 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( mbHasPosition(false), mbPercentStacked(false), m_bAxisPositionAttributeImported(false), + m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider), mrChartAddress( rChartAddress ), - mrHasOwnTable( rHasOwnTable ), + m_rbHasRangeAtPlotArea( rbHasRangeAtPlotArea ), mrColHasLabels( rColHasLabels ), mrRowHasLabels( rRowHasLabels ), mrDataRowSource( rDataRowSource ), @@ -213,6 +217,8 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( mbGlobalChartTypeUsedBySeries( false ), maChartSize( rChartSize ) { + m_rbHasRangeAtPlotArea = false; + // get Diagram uno::Reference< chart::XChartDocument > xDoc( rImpHelper.GetChartDocument(), uno::UNO_QUERY ); if( xDoc.is()) @@ -338,7 +344,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri case XML_TOK_PA_CHART_ADDRESS: mrChartAddress = lcl_ConvertRange( aValue, xNewDoc ); // indicator for getting data from the outside - mrHasOwnTable = sal_False; + m_rbHasRangeAtPlotArea = true; break; case XML_TOK_PA_DS_HAS_LABELS: { @@ -514,7 +520,17 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri } // - if( mrHasOwnTable && mxNewDoc.is()) + bool bCreateInternalDataProvider = false; + if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAscii( "." ) ) //data comes from the chart itself + bCreateInternalDataProvider = true; + else if( m_rXLinkHRefAttributeToIndicateDataProvider.equalsAscii( ".." ) ) //data comes from the parent application + bCreateInternalDataProvider = false; + else if( m_rXLinkHRefAttributeToIndicateDataProvider.getLength() ) //not supported so far to get the data by sibling objects -> fall back to chart itself + bCreateInternalDataProvider = true; + else if( !m_rbHasRangeAtPlotArea ) + bCreateInternalDataProvider = true; + + if( bCreateInternalDataProvider && mxNewDoc.is() ) { // we have no complete range => we have own data, so switch the data // provider to internal. Clone is not necessary, as we don't have any @@ -625,7 +641,7 @@ void SchXMLPlotAreaContext::EndElement() if( mrCategoriesAddress.getLength() && mxNewDoc.is()) { uno::Reference< chart2::data::XDataProvider > xDataProvider( - mrImportHelper.GetDataProvider( mxNewDoc )); + mxNewDoc->getDataProvider() ); // @todo: correct coordinate system index sal_Int32 nDimension( 0 ); ::std::vector< SchXMLAxis >::const_iterator aIt( diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx index 403a87192c54..ed01ad2fa8da 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -74,11 +74,12 @@ class SchXMLPlotAreaContext : public SvXMLImportContext public: SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName, + const rtl::OUString& rXLinkHRefAttributeToIndicateDataProvider, ::com::sun::star::uno::Sequence< ::com::sun::star::chart::ChartSeriesAddress >& rSeriesAddresses, ::rtl::OUString& rCategoriesAddress, ::rtl::OUString& rChartAddress, - sal_Bool & rHasOwnTable, + bool& bHasRangeAtPlotArea, sal_Bool & rAllRangeAddressesAvailable, sal_Bool & rColHasLabels, sal_Bool & rRowHasLabels, @@ -119,8 +120,9 @@ private: bool mbPercentStacked; bool m_bAxisPositionAttributeImported; ::rtl::OUString msAutoStyleName; + const ::rtl::OUString& m_rXLinkHRefAttributeToIndicateDataProvider; ::rtl::OUString& mrChartAddress; - sal_Bool & mrHasOwnTable; + bool& m_rbHasRangeAtPlotArea; sal_Bool & mrColHasLabels; sal_Bool & mrRowHasLabels; ::com::sun::star::chart::ChartDataRowSource & mrDataRowSource; diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index ca325fe3bafe..4633a149e4df 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -341,7 +341,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib Reference< chart2::data::XRangeXMLConversion > xRangeConversion; if( mxNewDoc.is()) - xRangeConversion.set( mrImportHelper.GetDataProvider( mxNewDoc ), uno::UNO_QUERY ); + xRangeConversion.set( mxNewDoc->getDataProvider(), uno::UNO_QUERY ); for( sal_Int16 i = 0; i < nAttrCount; i++ ) { @@ -409,7 +409,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib if( m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && ! bHasRange ) m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable = sal_False; - Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( mxNewDoc )); + Reference< chart2::data::XDataProvider > xDataProvider( mxNewDoc->getDataProvider() ); if( xDataProvider.is()) { bool bIsCandleStick = maGlobalChartTypeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.CandleStickChartType")); @@ -665,7 +665,10 @@ void SchXMLSeries2Context::EndElement() } } - Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( mxNewDoc )); + Reference< chart2::data::XDataProvider > xDataProvider; + if ( mxNewDoc.is() ) { + xDataProvider = mxNewDoc->getDataProvider(); + } for( std::vector< DomainInfo >::reverse_iterator aIt( aDomainInfos.rbegin() ); aIt!= aDomainInfos.rend(); ++aIt ) { DomainInfo aDomainInfo( *aIt ); diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 046da76497d7..4eb17d289d73 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -343,37 +343,6 @@ void lcl_fillRangeMapping( } } -void lcl_copyProperties( - const Reference< beans::XPropertySet > & xSource, - const Reference< beans::XPropertySet > & xDestination ) -{ - if( ! (xSource.is() && xDestination.is())) - return; - - try - { - Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW ); - Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW ); - Sequence< beans::Property > aProperties( xSrcInfo->getProperties()); - const sal_Int32 nLength = aProperties.getLength(); - for( sal_Int32 i = 0; i < nLength; ++i ) - { - OUString aName( aProperties[i].Name); - if( xDestInfo->hasPropertyByName( aName )) - { - beans::Property aProp( xDestInfo->getPropertyByName( aName )); - if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 ) - xDestination->setPropertyValue( - aName, xSource->getPropertyValue( aName )); - } - } - } - catch( const uno::Exception & ) - { - OSL_ENSURE( false, "Copying property sets failed!" ); - } -} - Reference< chart2::data::XDataSequence > lcl_reassignDataSequence( const Reference< chart2::data::XDataSequence > & xSequence, @@ -1016,7 +985,7 @@ void SchXMLTableHelper::applyTableSimple( // ---------------------------------------- -void SchXMLTableHelper::applyTable( +void SchXMLTableHelper::applyTableToInternalDataProvider( const SchXMLTable& rTable, uno::Reference< chart2::XChartDocument > xChartDoc ) { @@ -1031,19 +1000,12 @@ void SchXMLTableHelper::applyTable( // prerequisite for this method: all objects (data series, domains, etc.) // need their own range string. - // If the range-strings are valid (starting with "local-table") they should - // be interpreted like given, otherwise (when the ranges refer to Calc- or - // Writer-ranges, but the container is not available like when pasting a - // chart from Calc to Impress) the range is ignored, and every object gets - // one table column in the order of appearance, which is: 1. categories, - // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values) - // apply all data read in the table to the chart data-array of the internal // data provider lcl_applyXMLTableToInternalDataprovider( rTable, xDataArray ); } -void SchXMLTableHelper::postProcessTable( +void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex, uno::Reference< chart2::XChartDocument > xChartDoc, @@ -1051,6 +1013,14 @@ void SchXMLTableHelper::postProcessTable( { if( ! (xChartDoc.is() && xChartDoc->hasInternalDataProvider())) return; + + // If the range-strings are valid (starting with "local-table") they should + // be interpreted like given, otherwise (when the ranges refer to Calc- or + // Writer-ranges, but the container is not available like when pasting a + // chart from Calc to Impress) the range is ignored, and every object gets + // one table column in the order of appearance, which is: 1. categories, + // 2. data series: 2.a) domains, 2.b) values (main-role, usually y-values) + Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider()); // create a mapping from original ranges to new ranges @@ -1079,7 +1049,7 @@ void SchXMLTableHelper::postProcessTable( lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange )); if( xNewSeq != xSeq ) { - lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), + SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY )); aLSeqIt->second->setValues( xNewSeq ); } @@ -1099,7 +1069,7 @@ void SchXMLTableHelper::postProcessTable( Reference< chart2::data::XDataSequence > xNewSequence( xDataProv->createDataSequenceByRangeRepresentation( OUString(RTL_CONSTASCII_USTRINGPARAM("categories")))); - lcl_copyProperties( + SchXMLTools::copyProperties( xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY )); aLSeqIt->second->setValues( xNewSequence ); bCategoriesApplied = true; @@ -1110,7 +1080,7 @@ void SchXMLTableHelper::postProcessTable( OUString aRep( OUString::valueOf( aLSeqIt->first.first )); Reference< chart2::data::XDataSequence > xNewSequence( xDataProv->createDataSequenceByRangeRepresentation( aRep )); - lcl_copyProperties( + SchXMLTools::copyProperties( xOldSequenceProp, Reference< beans::XPropertySet >( xNewSequence, uno::UNO_QUERY )); aLSeqIt->second->setValues( xNewSequence ); } @@ -1131,7 +1101,7 @@ void SchXMLTableHelper::postProcessTable( lcl_reassignDataSequence( xSeq, xDataProv, aRangeMap, aRange )); if( xNewSeq != xSeq ) { - lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), + SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY )); aLSeqIt->second->setLabel( xNewSeq ); } @@ -1143,7 +1113,7 @@ void SchXMLTableHelper::postProcessTable( Reference< chart2::data::XDataSequence > xNewSeq( xDataProv->createDataSequenceByRangeRepresentation( aRep )); - lcl_copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), + SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), Reference< beans::XPropertySet >( xNewSeq, uno::UNO_QUERY )); aLSeqIt->second->setLabel( xNewSeq ); } diff --git a/xmloff/source/chart/SchXMLTableContext.hxx b/xmloff/source/chart/SchXMLTableContext.hxx index 8a9ea5c369a0..7cff3e7ecff7 100644 --- a/xmloff/source/chart/SchXMLTableContext.hxx +++ b/xmloff/source/chart/SchXMLTableContext.hxx @@ -108,14 +108,14 @@ public: table, the addresses of series, the addresses of labels, the cell-range-address for the categories */ - static void applyTable( const SchXMLTable& rTable, + static void applyTableToInternalDataProvider( const SchXMLTable& rTable, com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc ); - /** Second part of applyTable that has to be called after the data series + /** Second part of applyTableToInternalDataProvider that has to be called after the data series got their styles set. This function reorders local data to fit the correct data structure. */ - static void postProcessTable( const SchXMLTable& rTable, + static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex, com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc, ::com::sun::star::chart::ChartDataRowSource eDataRowSource ); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 627d88f58a2e..57ba65868140 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -54,8 +54,10 @@ #include <xmloff/xmlexp.hxx> #include "xmlnmspe.hxx" +#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -123,6 +125,24 @@ sal_Int32 lcl_getBuildIDFromGenerator( const ::rtl::OUString& rGenerator ) return nBuildId; } +Reference< chart2::data::XDataSequence > lcl_createNewSequenceFromCachedXMLRange( const Reference< chart2::data::XDataSequence >& xSeq, const Reference< chart2::data::XDataProvider >& xDataProvider ) +{ + Reference< chart2::data::XDataSequence > xRet; + OUString aRange; + Reference< chart2::data::XRangeXMLConversion > xRangeConversion( xDataProvider, uno::UNO_QUERY ); + if( xRangeConversion.is() ) + { + if( xSeq.is() && SchXMLTools::getXMLRangePropertyFromDataSequence( xSeq, aRange, /* bClearProp = */ true ) ) + { + xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( + xRangeConversion->convertRangeFromXML( aRange )) ); + SchXMLTools::copyProperties( Reference< beans::XPropertySet >( xSeq, uno::UNO_QUERY ), + Reference< beans::XPropertySet >( xRet, uno::UNO_QUERY )); + } + } + return xRet; +} + } // anonymous namespace // ---------------------------------------- @@ -591,6 +611,68 @@ bool getXMLRangePropertyFromDataSequence( return bResult; } +void copyProperties( + const Reference< beans::XPropertySet > & xSource, + const Reference< beans::XPropertySet > & xDestination ) +{ + if( ! (xSource.is() && xDestination.is()) ) + return; + + try + { + Reference< beans::XPropertySetInfo > xSrcInfo( xSource->getPropertySetInfo(), uno::UNO_QUERY_THROW ); + Reference< beans::XPropertySetInfo > xDestInfo( xDestination->getPropertySetInfo(), uno::UNO_QUERY_THROW ); + Sequence< beans::Property > aProperties( xSrcInfo->getProperties()); + const sal_Int32 nLength = aProperties.getLength(); + for( sal_Int32 i = 0; i < nLength; ++i ) + { + OUString aName( aProperties[i].Name); + if( xDestInfo->hasPropertyByName( aName )) + { + beans::Property aProp( xDestInfo->getPropertyByName( aName )); + if( (aProp.Attributes & beans::PropertyAttribute::READONLY) == 0 ) + xDestination->setPropertyValue( + aName, xSource->getPropertyValue( aName )); + } + } + } + catch( const uno::Exception & ) + { + OSL_ENSURE( false, "Copying property sets failed!" ); + } +} + +bool switchBackToDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex ) +{ + //return whether the switch is successful + if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() ) + return false; + Reference< chart2::data::XDataProvider > xDataProviderFromParent( SchXMLTools::getDataProviderFromParent( xChartDoc ) ); + if( !xDataProviderFromParent.is() ) + return false; + uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY ); + if( !xDataReceiver.is() ) + return false; + + xDataReceiver->attachDataProvider( xDataProviderFromParent ); + + for( tSchXMLLSequencesPerIndex::const_iterator aLSeqIt( rLSequencesPerIndex.begin() ); + aLSeqIt != rLSequencesPerIndex.end(); ++aLSeqIt ) + { + Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( aLSeqIt->second ); + if( !xLabeledSeq.is() ) + continue; + Reference< chart2::data::XDataSequence > xNewSeq; + xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getValues(), xDataProviderFromParent ); + if( xNewSeq.is() ) + xLabeledSeq->setValues( xNewSeq ); + xNewSeq = lcl_createNewSequenceFromCachedXMLRange( xLabeledSeq->getLabel(), xDataProviderFromParent ); + if( xNewSeq.is() ) + xLabeledSeq->setLabel( xNewSeq ); + } + return true; +} + bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel ) { bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel ); @@ -649,4 +731,27 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame: return bResult; } +Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc ) +{ + Reference< chart2::data::XDataProvider > xRet; + uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY ); + if( xChild.is() ) + { + Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY ); + if( xFact.is() ) + { + const OUString aDataProviderServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider")); + const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames()); + const OUString * pBegin = aServiceNames.getConstArray(); + const OUString * pEnd = pBegin + aServiceNames.getLength(); + if( ::std::find( pBegin, pEnd, aDataProviderServiceName ) != pEnd ) + { + xRet = Reference< chart2::data::XDataProvider >( + xFact->createInstance( aDataProviderServiceName ), uno::UNO_QUERY ); + } + } + } + return xRet; +} + } // namespace SchXMLTools diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index 21a286783aad..916fffc382aa 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -127,6 +127,16 @@ namespace SchXMLTools ::com::sun::star::chart2::data::XDataSequence > & xDataSequence, ::rtl::OUString & rOutXMLRange, bool bClearProp = false ); + + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > getDataProviderFromParent( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc ); + + bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument >& xChartDoc + , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex ); + + void copyProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination ); } #endif // SCH_XML_TOOLS_HXX_ diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index ab54dd054401..a9e5b2abc517 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3082,6 +3082,13 @@ namespace xmloff { namespace token { TOKEN( "mathweight", XML_MATHWEIGHT ), TOKEN( "mathcolor", XML_MATHCOLOR ), + TOKEN( "contains", XML_CONTAINS ), + TOKEN( "does-not-contain", XML_DOES_NOT_CONTAIN ), + TOKEN( "begins-with", XML_BEGINS_WITH ), + TOKEN( "does-not-begin-with", XML_DOES_NOT_BEGIN_WITH ), + TOKEN( "ends-with", XML_ENDS_WITH ), + TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index a7bb8bd7fcec..b2e81d333fba 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -49,6 +49,7 @@ #endif #include "sdpropls.hxx" #include <tools/debug.hxx> +#include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/xmluconv.hxx> @@ -1166,8 +1167,30 @@ void XMLShapeExport::ImpExportGraphicObjectShape( OUString aStreamURL; OUString aStr; + xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL; xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL; - aStr = mrExport.AddEmbeddedGraphicObject( sImageURL ); + + OUString aResolveURL( sImageURL ); + const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") ); + + // sj: trying to preserve the filename + if ( aStreamURL.match( sPackageURL, 0 ) ) + { + rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); + sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1; + if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) ) + sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex ); + nLastIndex = sRequestedName.lastIndexOf( '.' ); + if ( nLastIndex >= 0 ) + sRequestedName = sRequestedName.copy( 0, nLastIndex ); + if ( sRequestedName.getLength() ) + { + aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName="))); + aResolveURL = aResolveURL.concat( sRequestedName ); + } + } + + aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL ); mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr ); if( aStr.getLength() ) diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx index d38bb3761868..e2e804eefb43 100644 --- a/xmloff/source/draw/shapeexport4.cxx +++ b/xmloff/source/draw/shapeexport4.cxx @@ -1130,21 +1130,21 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape { mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sTemplate ); - const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; - - while( pEntry->msApiName ) try + for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; pEntry->msApiName; pEntry++ ) { - sal_Bool bBool = sal_False; - const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); + try + { + sal_Bool bBool = sal_False; + const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); - xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool; - if( bBool ) - mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE ); - pEntry++; - } - catch( uno::Exception& ) - { - DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!"); + xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool; + if( bBool ) + mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE ); + } + catch( uno::Exception& ) + { + DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!"); + } } } } diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 27ca5c4beafe..65aad96bad86 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -3584,16 +3584,17 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc } const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; - int i = 0; - while( pEntry->msApiName && (i < 6) ) try - { - const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); - xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i++] ) ); - pEntry++; - } - catch( Exception& ) + for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ ) { - DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!"); + try + { + const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); + xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) ); + } + catch( Exception& ) + { + DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!"); + } } } |