author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-12-23 10:01:58 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-12-23 10:01:58 +0100 |
commit | 48de44881b95b2ce90759e0485d3a96fe1c1f4db (patch) | |
tree | 9616f3de0aa7b09e04de84f07534ccc05ef412de | |
parent | eb77ace518782bcbc0ac29c03b58ca3811e25cf8 (diff) | |
parent | 794c821e4d48c34aa376cdc7b6ab2cb029d9574d (diff) |
diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst index 6651d9d74f8f..2348b606dcab 100644 --- a/avmedia/prj/build.lst +++ b/avmedia/prj/build.lst @@ -1,4 +1,4 @@ -av avmedia : l10n tools sfx2 NULL +av avmedia : l10n tools sfx2 LIBXSLT:libxslt NULL av avmedia usr1 - all av_mkout NULL av avmedia\prj get - all av_prj NULL av avmedia\inc get - all av_inv NULL diff --git a/basic/inc/modsizeexceeded.hxx b/basic/inc/basic/modsizeexceeded.hxx index e2d716259f09..e2d716259f09 100644 --- a/basic/inc/modsizeexceeded.hxx +++ b/basic/inc/basic/modsizeexceeded.hxx diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx index 0bc764e863fe..d6ee1d3eab0e 100644 --- a/basic/inc/basic/sbmod.hxx +++ b/basic/inc/basic/sbmod.hxx @@ -46,6 +46,7 @@ class SbProcedureProperty; class SbIfaceMapperMethod; class SbClassModuleObject; +class ModuleInitDependencyMap; struct ClassModuleRunInitItem; struct SbClassData; class SbModuleImpl; @@ -62,6 +63,8 @@ class SbModule : public SbxObject SbModuleImpl* mpSbModuleImpl; // Impl data std::vector< String > mModuleVariableNames; + void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic ); + protected: com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper; ::rtl::OUString aOUSource; @@ -74,7 +77,7 @@ protected: SbxObjectRef pDocObject; // an impl object ( used by Document Modules ) bool bIsProxyModule; - static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem ); + static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem ); void StartDefinitions(); SbMethod* GetMethod( const String&, SbxDataType ); SbProperty* GetProperty( const String&, SbxDataType ); @@ -84,6 +87,7 @@ protected: USHORT Run( SbMethod* ); void RunInit(); void ClearPrivateVars(); + void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic ); void GlobalRunInit( BOOL bBasicStart ); // for all modules void GlobalRunDeInit( void ); const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT& ) const; @@ -94,6 +98,7 @@ protected: virtual BOOL LoadCompleted(); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); + void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint ); virtual ~SbModule(); public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2); diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx index 9ff46d1931f3..49fefb79309e 100644 --- a/basic/inc/basic/sbobjmod.hxx +++ b/basic/inc/basic/sbobjmod.hxx @@ -52,10 +52,18 @@ class SbObjModule : public SbModule { SbObjModule( const SbObjModule& ); SbObjModule(); + +protected: + virtual ~SbObjModule(); + public: TYPEINFO(); SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible ); virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); + + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + using SbxValue::GetObject; SbxVariable* GetObject(); void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ; @@ -81,7 +89,7 @@ public: SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); virtual ~SbUserFormModule(); virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); - void ResetApiObj(); + void ResetApiObj( bool bTriggerTerminateEvent = true ); void Unload(); void Load(); void triggerMethod( const String& ); @@ -93,6 +101,11 @@ public: void triggerLayoutEvent(); void triggerResizeEvent(); + bool getInitState( void ) + { return mbInit; } + void setInitState( bool bInit ) + { mbInit = bInit; } + class SbUserFormModuleInstance* CreateInstance(); }; diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx index 7d189c363364..db67836890e9 100644 --- a/basic/inc/basic/sbstar.hxx +++ b/basic/inc/basic/sbstar.hxx @@ -38,6 +38,7 @@ #include <basic/sbdef.hxx> #include <basic/sberrors.hxx> #include <com/sun/star/script/ModuleInfo.hpp> +#include <com/sun/star/frame/XModel.hpp> class SbModule; // completed module class SbiInstance; // runtime instance @@ -77,6 +78,8 @@ class StarBASIC : public SbxObject SbxObjectRef pVBAGlobals; SbxObject* getVBAGlobals( ); + void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic ); + protected: BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); private: @@ -206,6 +209,9 @@ public: bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); void QuitAndExitApplication(); BOOL IsQuitApplication() { return bQuit; }; + + static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModelFromBasic( SbxObject* pBasic ); }; #ifndef __SB_SBSTARBASICREF_HXX diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx index 89322be776f9..b85b3552c79e 100644 --- a/basic/inc/basic/sbxdef.hxx +++ b/basic/inc/basic/sbxdef.hxx @@ -106,6 +106,7 @@ enum SbxDataType { }; const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; +const UINT32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000; const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible #endif @@ -317,6 +318,8 @@ enum SbxError { // Ergebnis einer Rechenoperation/Konversion #define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call) #define SBX_NO_MODIFY 0x8000 // SetModified is suppressed #define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN +#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one + // is used for objects, the other for variables only // Broadcaster-IDs: #define SBX_HINT_DYING SFX_HINT_DYING diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx index 0cddcbdf8d17..1ba1b5d1edfa 100644 --- a/basic/inc/basic/sbxvar.hxx +++ b/basic/inc/basic/sbxvar.hxx @@ -439,6 +439,7 @@ SV_DECL_REF(SbxInfo) class SfxBroadcaster; class SbxVariableImpl; +class StarBASIC; class SbxVariable : public SbxValue { @@ -499,7 +500,9 @@ public: const String& GetDeclareClassName( void ); void SetDeclareClassName( const String& ); - void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener ); + void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener, + StarBASIC* pParentBasic ); + void ClearComListener( void ); static USHORT MakeHashCode( const String& rName ); }; diff --git a/basic/inc/svtmsg.hrc b/basic/inc/basic/svtmsg.hrc index ff215d3fc9cb..ff215d3fc9cb 100644 --- a/basic/inc/svtmsg.hrc +++ b/basic/inc/basic/svtmsg.hrc diff --git a/basic/inc/testtool.hrc b/basic/inc/basic/testtool.hrc index 075b462944c9..075b462944c9 100644 --- a/basic/inc/testtool.hrc +++ b/basic/inc/basic/testtool.hrc diff --git a/basic/inc/ttmsg.hrc b/basic/inc/basic/ttmsg.hrc index 26f250bc6a6a..26f250bc6a6a 100644 --- a/basic/inc/ttmsg.hrc +++ b/basic/inc/basic/ttmsg.hrc diff --git a/basic/prj/build.lst b/basic/prj/build.lst index c00a3d8412d3..8eab007313ec 100755..100644 --- a/basic/prj/build.lst +++ b/basic/prj/build.lst @@ -1,4 +1,4 @@ -sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper NULL +sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper LIBXSLT:libxslt NULL sb basic usr1 - all sb_mkout NULL sb basic\inc nmake - all sb_inc NULL sb basic\source\app nmake - all sb_app sb_class sb_inc NULL diff --git a/basic/prj/d.lst b/basic/prj/d.lst index d8d0fce41994..41d1a59550f0 100644 --- a/basic/prj/d.lst +++ b/basic/prj/d.lst @@ -20,41 +20,10 @@ mkdir: %COMMON_DEST%\res%_EXT% ..\%__SRC%\lib\libsample.a %_DEST%\lib%_EXT%\libsample.a mkdir: %_DEST%\inc%_EXT%\basic -..\inc\testtool.hrc %_DEST%\inc%_EXT%\basic\testtool.hrc -..\inc\ttmsg.hrc %_DEST%\inc%_EXT%\basic\ttmsg.hrc -..\inc\basic\ttglobal.hrc %_DEST%\inc%_EXT%\basic\ttglobal.hrc -..\inc\svtmsg.hrc %_DEST%\inc%_EXT%\basic\svtmsg.hrc +..\inc\basic\*.hxx %_DEST%\inc%_EXT%\basic\*.hxx +..\inc\basic\*.hrc %_DEST%\inc%_EXT%\basic\*.hrc +..\inc\basic\*.h %_DEST%\inc%_EXT%\basic\*.h -..\inc\basic\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx -..\inc\basic\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx -..\inc\basic\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx -..\inc\basic\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx -..\inc\basic\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx -..\inc\basic\sbstar.hxx %_DEST%\inc%_EXT%\basic\sbstar.hxx -..\inc\basic\sbuno.hxx %_DEST%\inc%_EXT%\basic\sbuno.hxx -..\inc\basic\basmgr.hxx %_DEST%\inc%_EXT%\basic\basmgr.hxx -..\inc\basic\sberrors.hxx %_DEST%\inc%_EXT%\basic\sberrors.hxx -..\inc\basic\basrdll.hxx %_DEST%\inc%_EXT%\basic\basrdll.hxx -..\inc\basic\sbstdobj.hxx %_DEST%\inc%_EXT%\basic\sbstdobj.hxx -..\inc\basic\process.hxx %_DEST%\inc%_EXT%\basic\process.hxx -..\inc\basic\mybasic.hxx %_DEST%\inc%_EXT%\basic\mybasic.hxx -..\inc\basic\testtool.hxx %_DEST%\inc%_EXT%\basic\testtool.hxx -..\inc\basic\basicrt.hxx %_DEST%\inc%_EXT%\basic\basicrt.hxx -..\inc\basic\dispdefs.hxx %_DEST%\inc%_EXT%\basic\dispdefs.hxx -..\inc\basic\ttstrhlp.hxx %_DEST%\inc%_EXT%\basic\ttstrhlp.hxx - -..\inc\basic\sbx.hxx %_DEST%\inc%_EXT%\basic\sbx.hxx -..\inc\basic\sbxcore.hxx %_DEST%\inc%_EXT%\basic\sbxcore.hxx -..\inc\basic\sbxdef.hxx %_DEST%\inc%_EXT%\basic\sbxdef.hxx -..\inc\basic\sbxform.hxx %_DEST%\inc%_EXT%\basic\sbxform.hxx -..\inc\basic\sbxmeth.hxx %_DEST%\inc%_EXT%\basic\sbxmeth.hxx -..\inc\basic\sbxobj.hxx %_DEST%\inc%_EXT%\basic\sbxobj.hxx -..\inc\basic\sbxprop.hxx %_DEST%\inc%_EXT%\basic\sbxprop.hxx -..\inc\basic\sbxvar.hxx %_DEST%\inc%_EXT%\basic\sbxvar.hxx -..\inc\basic\sbxbase.hxx %_DEST%\inc%_EXT%\basic\sbxbase.hxx -..\inc\basic\sbxfac.hxx %_DEST%\inc%_EXT%\basic\sbxfac.hxx -..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx - -..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx ..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx ..\%__SRC%\misc\sb.component %_DEST%\xml%_EXT%\sb.component + diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src index 89686ebfc0ee..748256bb5564 100644 --- a/basic/source/app/svtmsg.src +++ b/basic/source/app/svtmsg.src @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "svtmsg.hrc" +#include "basic/svtmsg.hrc" // Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten diff --git a/basic/source/app/testtool.src b/basic/source/app/testtool.src index 245cff6c7917..090cb735c139 100644 --- a/basic/source/app/testtool.src +++ b/basic/source/app/testtool.src @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "testtool.hrc" +#include "basic/testtool.hrc" /////////////////////////////// diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src index 63a6643f3cf1..076ee83fd879 100644 --- a/basic/source/app/ttmsg.src +++ b/basic/source/app/ttmsg.src @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "ttmsg.hrc" +#include "basic/ttmsg.hrc" // Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index f6a16ffa80c0..a5a1d4c8ca12 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -139,9 +139,17 @@ namespace basic impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ); /** creates a new BasicManager instance for the given model + + @param _out_rpBasicManager + reference to the pointer variable that will hold the new + BasicManager. + + @param _rxDocumentModel + the model whose BasicManager will be created. Must not be <NULL/>. */ - BasicManagerPointer - impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel ); + void impl_createManagerForModel( + BasicManagerPointer& _out_rpBasicManager, + const Reference< XModel >& _rxDocumentModel ); /** creates the application-wide BasicManager */ @@ -244,9 +252,17 @@ namespace basic { ::osl::MutexGuard aGuard( m_aMutex ); + /* #163556# (DR) - This function may be called recursively while + constructing the Basic manager and loading the Basic storage. By + passing the map entry received from impl_getLocationForModel() to + the function impl_createManagerForModel(), the new Basic manager + will be put immediately into the map of existing Basic managers, + thus a recursive call of this function will find and return it + without creating another instance. + */ BasicManagerPointer& pBasicManager = impl_getLocationForModel( _rxDocumentModel ); if ( pBasicManager == NULL ) - pBasicManager = impl_createManagerForModel( _rxDocumentModel ); + impl_createManagerForModel( pBasicManager, _rxDocumentModel ); return pBasicManager; } @@ -408,21 +424,21 @@ namespace basic } //-------------------------------------------------------------------- - BasicManagerPointer ImplRepository::impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel ) + void ImplRepository::impl_createManagerForModel( BasicManagerPointer& _out_rpBasicManager, const Reference< XModel >& _rxDocumentModel ) { StarBASIC* pAppBasic = impl_getDefaultAppBasicLibrary(); - BasicManager* pBasicManager( NULL ); + _out_rpBasicManager = 0; Reference< XStorage > xStorage; if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) ) // the document is not able to provide the storage it is based on. - return pBasicManager; + return; Reference< XPersistentLibraryContainer > xBasicLibs; Reference< XPersistentLibraryContainer > xDialogLibs; if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) ) // the document does not have BasicLibraries and DialogLibraries - return pBasicManager; + return; if ( xStorage.is() ) { @@ -433,24 +449,24 @@ namespace basic // Storage and BaseURL are only needed by binary documents! SotStorageRef xDummyStor = new SotStorage( ::rtl::OUString() ); - pBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */, + _out_rpBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */, pAppBasic, &aAppBasicDir, TRUE ); - if ( pBasicManager->HasErrors() ) + if ( _out_rpBasicManager->HasErrors() ) { // handle errors - BasicError* pErr = pBasicManager->GetFirstError(); + BasicError* pErr = _out_rpBasicManager->GetFirstError(); while ( pErr ) { // show message to user if ( ERRCODE_BUTTON_CANCEL == ErrorHandler::HandleError( pErr->GetErrorId() ) ) { // user wants to break loading of BASIC-manager - BasicManagerCleaner::deleteBasicManager( pBasicManager ); + BasicManagerCleaner::deleteBasicManager( _out_rpBasicManager ); xStorage.clear(); break; } - pErr = pBasicManager->GetNextError(); + pErr = _out_rpBasicManager->GetNextError(); } } } @@ -461,14 +477,14 @@ namespace basic // create new BASIC-manager StarBASIC* pBasic = new StarBASIC( pAppBasic ); pBasic->SetFlag( SBX_EXTSEARCH ); - pBasicManager = new BasicManager( pBasic, NULL, TRUE ); + _out_rpBasicManager = new BasicManager( pBasic, NULL, TRUE ); } // knit the containers with the BasicManager LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< OldBasicPassword* >( xBasicLibs.get() ) ); OSL_ENSURE( aInfo.mpOldBasicPassword, "ImplRepository::impl_createManagerForModel: wrong BasicLibraries implementation!" ); - pBasicManager->SetLibraryContainerInfo( aInfo ); - //pBasicCont->setBasicManager( pBasicManager ); + _out_rpBasicManager->SetLibraryContainerInfo( aInfo ); + //pBasicCont->setBasicManager( _out_rpBasicManager ); // that's not needed anymore today. The containers will retrieve their associated // BasicManager from the BasicManagerRepository, when needed. @@ -476,13 +492,13 @@ namespace basic impl_initDocLibraryContainers_nothrow( xBasicLibs, xDialogLibs ); // damit auch Dialoge etc. 'qualifiziert' angesprochen werden k"onnen - pBasicManager->GetLib(0)->SetParent( pAppBasic ); + _out_rpBasicManager->GetLib(0)->SetParent( pAppBasic ); // global properties in the document's Basic - pBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) ); + _out_rpBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) ); // notify - impl_notifyCreationListeners( _rxDocumentModel, *pBasicManager ); + impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager ); // register as listener for this model being disposed/closed Reference< XComponent > xDocumentComponent( _rxDocumentModel, UNO_QUERY ); @@ -490,9 +506,7 @@ namespace basic startComponentListening( xDocumentComponent ); // register as listener for the BasicManager being destroyed - StartListening( *pBasicManager ); - - return pBasicManager; + StartListening( *_out_rpBasicManager ); } //-------------------------------------------------------------------- diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 78682a633fe3..6c77259ccc7d 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -88,54 +88,6 @@ using namespace ::cppu; using namespace ::osl; - -Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic ) -{ - OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); - if ( !pBasic ) - return NULL; - - // look for the ThisComponent variable, first in the parent (which - // might be the document's Basic), then in the parent's parent (which might be - // the application Basic) - const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ); - SbxVariable* pThisComponent = NULL; - - SbxObject* pLookup = pBasic->GetParent(); - while ( pLookup && !pThisComponent ) - { - pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT ); - pLookup = pLookup->GetParent(); - } - if ( !pThisComponent ) - { - OSL_TRACE("Failed to get ThisComponent"); - // the application Basic, at the latest, should have this variable - return NULL; - } - - Any aThisComponent( sbxToUnoValue( pThisComponent ) ); - Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY ); - if ( !xModel.is() ) - { - // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller. - Reference< frame::XController > xController( aThisComponent, UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - - if ( !xModel.is() ) - return NULL; - -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Have model ThisComponent points to url %s", - ::rtl::OUStringToOString( xModel->getURL(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); -#endif - - return xModel; -} - void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel ) { OSL_TRACE("SFURL_firing_impl() processing script url %s", @@ -569,7 +521,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) bool bDocDialog = false; StarBASIC* pFoundBasic = NULL; OSL_TRACE("About to try get a hold of ThisComponent"); - Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ; + Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ; aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); // If we found the dialog then it belongs to the Search basic if ( !pFoundBasic ) diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 056c2ea38c4c..30e01892fab9 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -71,6 +71,7 @@ TYPEINIT1(StarBASIC,SbxObject) #define RTLNAME "@SBRTL" // i#i68894# +using namespace ::com::sun::star; using com::sun::star::uno::Reference; using com::sun::star::uno::Any; using com::sun::star::uno::UNO_QUERY; @@ -346,7 +347,18 @@ SbxObject* SbFormFactory::CreateObject( const String& rClassName ) { if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) ) { - pFormModule->Load(); + bool bInitState = pFormModule->getInitState(); + if( bInitState ) + { + // Not the first instantiate, reset + bool bTriggerTerminateEvent = false; + pFormModule->ResetApiObj( bTriggerTerminateEvent ); + pFormModule->setInitState( false ); + } + else + { + pFormModule->Load(); + } return pFormModule->CreateInstance(); } } @@ -564,7 +576,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) if( pObj != NULL ) { String aObjClass = pObj->GetClassName(); - (void)aObjClass; SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase); if( pClassModuleObj != NULL ) @@ -611,93 +622,7 @@ SbClassModuleObject::~SbClassModuleObject() void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ) { - bool bDone = false; - - const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); - if( pHint ) - { - SbxVariable* pVar = pHint->GetVar(); - SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar ); - if( pProcProperty ) - { - bDone = true; - - if( pHint->GetId() == SBX_HINT_DATAWANTED ) - { - String aProcName; - aProcName.AppendAscii( "Property Get " ); - aProcName += pProcProperty->GetName(); - - SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD ); - if( pMeth ) - { - SbxValues aVals; - aVals.eType = SbxVARIANT; - - SbxArray* pArg = pVar->GetParameters(); - USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0; - if( nVarParCount > 1 ) - { - SbxArrayRef xMethParameters = new SbxArray; - xMethParameters->Put( pMeth, 0 ); // Method as parameter 0 - for( USHORT i = 1 ; i < nVarParCount ; ++i ) - { - SbxVariable* pPar = pArg->Get( i ); - xMethParameters->Put( pPar, i ); - } - - pMeth->SetParameters( xMethParameters ); - pMeth->Get( aVals ); - pMeth->SetParameters( NULL ); - } - else - { - pMeth->Get( aVals ); - } - - pVar->Put( aVals ); - } - } - else if( pHint->GetId() == SBX_HINT_DATACHANGED ) - { - SbxVariable* pMeth = NULL; - - bool bSet = pProcProperty->isSet(); - if( bSet ) - { - pProcProperty->setSet( false ); - - String aProcName; - aProcName.AppendAscii( "Property Set " ); - aProcName += pProcProperty->GetName(); - pMeth = Find( aProcName, SbxCLASS_METHOD ); - } - if( !pMeth ) // Let - { - String aProcName; - aProcName.AppendAscii( "Property Let " ); - aProcName += pProcProperty->GetName(); - pMeth = Find( aProcName, SbxCLASS_METHOD ); - } - - if( pMeth ) - { - // Setup parameters - SbxArrayRef xArray = new SbxArray; - xArray->Put( pMeth, 0 ); // Method as parameter 0 - xArray->Put( pVar, 1 ); - pMeth->SetParameters( xArray ); - - SbxValues aVals; - pMeth->Get( aVals ); - pMeth->SetParameters( NULL ); - } - } - } - } - - if( !bDone ) - SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + handleProcedureProperties( rBC, rHint ); } SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t ) @@ -809,6 +734,9 @@ SbModule* SbClassFactory::FindClass( const String& rClassName ) return pMod; } +typedef std::vector< StarBASIC* > DocBasicVector; +static DocBasicVector GaDocBasics; + StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic ) { @@ -822,8 +750,6 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) { pSBFAC = new SbiFactory; AddFactory( pSBFAC ); - pUNOFAC = new SbUnoFactory; - AddFactory( pUNOFAC ); pTYPEFAC = new SbTypeFactory; AddFactory( pTYPEFAC ); pCLASSFAC = new SbClassFactory; @@ -832,12 +758,17 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) AddFactory( pOLEFAC ); pFORMFAC = new SbFormFactory; AddFactory( pFORMFAC ); + pUNOFAC = new SbUnoFactory; + AddFactory( pUNOFAC ); } pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this ); // Search via StarBasic is always global SetFlag( SBX_GBLSEARCH ); pVBAGlobals = NULL; bQuit = FALSE; + + if( bDocBasic ) + GaDocBasics.push_back( this ); } // #51727 Override SetModified so that the modified state @@ -877,6 +808,29 @@ StarBASIC::~StarBASIC() } #endif } + else if( bDocBasic ) + { + SbxError eOld = SbxBase::GetError(); + + DocBasicVector::iterator it; + for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it ) + { + if( *it == this ) + { + GaDocBasics.erase( it ); + break; + } + } + for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it ) + { + StarBASIC* pBasic = *it; + pBasic->implClearDependingVarsOnDelete( this ); + } + + SbxBase::ResetError(); + if( eOld != SbxERR_OK ) + SbxBase::SetError( eOld ); + } // #100326 Set Parent NULL in registered listeners if( xUnoListeners.Is() ) @@ -889,6 +843,9 @@ StarBASIC::~StarBASIC() } xUnoListeners = NULL; } + + clearUnoMethodsForBasic( this ); + disposeComVariablesForBasic( this ); } // Override new() operator, so that everyone can create a new instance @@ -907,6 +864,27 @@ void StarBASIC::operator delete( void* p ) ::operator delete( p ); } +void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic ) +{ + if( this != pDeletedBasic ) + { + for( USHORT i = 0; i < pModules->Count(); i++ ) + { + SbModule* p = (SbModule*)pModules->Get( i ); + p->ClearVarsDependingOnDeletedBasic( pDeletedBasic ); + } + } + + for( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) + { + SbxVariable* pVar = pObjs->Get( nObj ); + StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar); + if( pBasic && pBasic != pDeletedBasic ) + pBasic->implClearDependingVarsOnDelete( pDeletedBasic ); + } +} + + /************************************************************************** * * Creation/Managment of modules @@ -1036,15 +1014,15 @@ struct ClassModuleRunInitItem {} }; -typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem, - ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap; +// Derive from has_map type instead of typedef +// to allow forward declaration in sbmod.hxx +class ModuleInitDependencyMap : public + std::hash_map< ::rtl::OUString, ClassModuleRunInitItem, + ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > +{}; -static ModuleInitDependencyMap* GpMIDMap = NULL; - -void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) +void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem ) { - ModuleInitDependencyMap& rMIDMap = *GpMIDMap; - rItem.m_bProcessing = true; //bool bAnyDependencies = true; @@ -1059,8 +1037,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) String& rStr = *it; // Is required type a class module? - ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr ); - if( itFind != rMIDMap.end() ) + ModuleInitDependencyMap::iterator itFind = rMap.find( rStr ); + if( itFind != rMap.end() ) { ClassModuleRunInitItem& rParentItem = itFind->second; if( rParentItem.m_bProcessing ) @@ -1071,7 +1049,7 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) } if( !rParentItem.m_bRunInitDone ) - implProcessModuleRunInit( rParentItem ); + implProcessModuleRunInit( rMap, rParentItem ); } } } @@ -1085,6 +1063,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) // Run Init-Code of all modules (including inserted libraries) void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) { + ::vos::OGuard guard( Application::GetSolarMutex() ); + // Init own modules for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) { @@ -1099,7 +1079,6 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) // Consider required types to init in right order. Class modules // that are required by other modules have to be initialized first. ModuleInitDependencyMap aMIDMap; - GpMIDMap = &aMIDMap; for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); @@ -1112,9 +1091,8 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it ) { ClassModuleRunInitItem& rItem = it->second; - SbModule::implProcessModuleRunInit( rItem ); + SbModule::implProcessModuleRunInit( aMIDMap, rItem ); } - GpMIDMap = NULL; // Call RunInit on standard modules for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) @@ -1143,7 +1121,7 @@ void StarBASIC::DeInitAllModules( void ) for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); - if( pModule->pImage ) + if( pModule->pImage && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) ) pModule->pImage->bInit = false; } @@ -1849,6 +1827,54 @@ bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::u return bRes; } +Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic ) +{ + OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); + if ( !pBasic ) + return NULL; + + // look for the ThisComponent variable, first in the parent (which + // might be the document's Basic), then in the parent's parent (which might be + // the application Basic) + const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ); + SbxVariable* pThisComponent = NULL; + + SbxObject* pLookup = pBasic->GetParent(); + while ( pLookup && !pThisComponent ) + { + pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT ); + pLookup = pLookup->GetParent(); + } + if ( !pThisComponent ) + { + OSL_TRACE("Failed to get ThisComponent"); + // the application Basic, at the latest, should have this variable + return NULL; + } + + Any aThisComponentAny( sbxToUnoValue( pThisComponent ) ); + Reference< frame::XModel > xModel( aThisComponentAny, UNO_QUERY ); + if ( !xModel.is() ) + { + // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller. + Reference< frame::XController > xController( aThisComponentAny, UNO_QUERY ); + if ( xController.is() ) + xModel = xController->getModel(); + } + + if ( !xModel.is() ) + return NULL; + +#if OSL_DEBUG_LEVEL > 0 + OSL_TRACE("Have model ThisComponent points to url %s", + ::rtl::OUStringToOString( xModel->getURL(), + RTL_TEXTENCODING_ASCII_US ).pData->buffer ); +#endif + + return xModel; +} + + //======================================================================== // #118116 Implementation Collection object diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 79f55faf37b6..e176eb9e3654 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -36,15 +36,18 @@ #include <svl/hint.hxx> #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/extract.hxx> +#include <cppuhelper/interfacecontainer.hxx> #include <comphelper/processfactory.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> #include <com/sun/star/script/ArrayWrapper.hpp> +#include <com/sun/star/script/NativeObjectWrapper.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/DeploymentException.hpp> @@ -61,6 +64,7 @@ #include <com/sun/star/script/XInvocationAdapterFactory.hpp> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> +#include <com/sun/star/script/XDirectInvocation.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/reflection/XIdlArray.hpp> @@ -512,6 +516,44 @@ static void implHandleAnyException( const Any& _rCaughtException ) } } + +// NativeObjectWrapper handling +struct ObjectItem +{ + SbxObjectRef m_xNativeObj; + + ObjectItem( void ) + {} + ObjectItem( SbxObject* pNativeObj ) + : m_xNativeObj( pNativeObj ) + {} +}; +static std::vector< ObjectItem > GaNativeObjectWrapperVector; + +void clearNativeObjectWrapperVector( void ) +{ + GaNativeObjectWrapperVector.clear(); +} + +sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) +{ + sal_uInt32 nIndex = GaNativeObjectWrapperVector.size(); + GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) ); + return nIndex; +} + +SbxObject* lcl_getNativeObject( sal_uInt32 nIndex ) +{ + SbxObjectRef xRetObj; + if( nIndex < GaNativeObjectWrapperVector.size() ) + { + ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ]; + xRetObj = rItem.m_xNativeObj; + } + return xRetObj; +} + + // Von Uno nach Sbx wandeln SbxDataType unoToSbxType( TypeClass eType ) { @@ -698,6 +740,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) if( eTypeClass == TypeClass_STRUCT ) { ArrayWrapper aWrap; + NativeObjectWrapper aNativeObjectWrapper; if ( (aValue >>= aWrap) ) { SbxDimArray* pArray = NULL; @@ -717,6 +760,18 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) pVar->PutEmpty(); break; } + else if ( (aValue >>= aNativeObjectWrapper) ) + { + sal_uInt32 nIndex = 0; + if( (aNativeObjectWrapper.ObjectId >>= nIndex) ) + { + SbxObject* pObj = lcl_getNativeObject( nIndex ); + pVar->PutObject( pObj ); + } + else + pVar->PutEmpty(); + break; + } else { SbiInstance* pInst = pINST; @@ -1093,6 +1148,20 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType = if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) ) return aRetAny; } + if( !xObj->ISA(SbUnoObject) ) + { + // Create NativeObjectWrapper to identify object in case of callbacks + SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject()); + if( pObj != NULL ) + { + NativeObjectWrapper aNativeObjectWrapper; + sal_uInt32 nIndex = lcl_registerNativeObjectWrapper( pObj ); + aNativeObjectWrapper.ObjectId <<= nIndex; + Any aRetAny; + aRetAny <<= aNativeObjectWrapper; + return aRetAny; + } + } } } @@ -2223,26 +2292,36 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, } else if( bInvocation && mxInvocation.is() ) { - Sequence< INT16 > OutParamIndex; - Sequence< Any > OutParam; - Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam ); + Reference< XDirectInvocation > xDirectInvoke; + if ( pMeth->needsDirectInvocation() ) + xDirectInvoke.set( mxInvocation, UNO_QUERY ); - // Wert von Uno nach Sbx uebernehmen - unoToSbxValue( pVar, aRetAny ); - - const INT16* pIndices = OutParamIndex.getConstArray(); - UINT32 nLen = OutParamIndex.getLength(); - if( nLen ) + Any aRetAny; + if ( xDirectInvoke.is() ) + aRetAny = xDirectInvoke->directInvoke( pMeth->GetName(), args ); + else { - const Any* pNewValues = OutParam.getConstArray(); - for( UINT32 j = 0 ; j < nLen ; j++ ) + Sequence< INT16 > OutParamIndex; + Sequence< Any > OutParam; + aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam ); + + const INT16* pIndices = OutParamIndex.getConstArray(); + UINT32 nLen = OutParamIndex.getLength(); + if( nLen ) { - INT16 iTarget = pIndices[ j ]; - if( iTarget >= (INT16)nParamCount ) - break; - unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] ); + const Any* pNewValues = OutParam.getConstArray(); + for( UINT32 j = 0 ; j < nLen ; j++ ) + { + INT16 iTarget = pIndices[ j ]; + if( iTarget >= (INT16)nParamCount ) + break; + unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] ); + } } } + + // Wert von Uno nach Sbx uebernehmen + unoToSbxValue( pVar, aRetAny ); } // #55460, Parameter hier weghauen, da das in unoToSbxValue() @@ -2271,7 +2350,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny ); SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) : SbxObject( aName_ ) , bNeedIntrospection( TRUE ) - , bIgnoreNativeCOMObjectMembers( FALSE ) + , bNativeCOMObject( FALSE ) { static Reference< XIntrospection > xIntrospection; @@ -2322,7 +2401,7 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) // hiding of equally named COM symbols, e.g. XInvocation::getValue Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY ); if( xAutomationObject.is() ) - bIgnoreNativeCOMObjectMembers = TRUE; + bNativeCOMObject = TRUE; } maTmpUnoObj = aUnoObj_; @@ -2446,6 +2525,47 @@ void SbUnoObject::doIntrospection( void ) // #67781 Start einer Liste aller SbUnoMethod-Instanzen static SbUnoMethod* pFirst = NULL; +void clearUnoMethodsForBasic( StarBASIC* pBasic ) +{ + SbUnoMethod* pMeth = pFirst; + while( pMeth ) + { + SbxObject* pObject = dynamic_cast< SbxObject* >( pMeth->GetParent() ); + if ( pObject ) + { + StarBASIC* pModBasic = dynamic_cast< StarBASIC* >( pObject->GetParent() ); + if ( pModBasic == pBasic ) + { + // for now the solution is to remove the method from the list and to clear it, + // but in case the element should be correctly transfered to another StarBASIC, + // we should either set module parent to NULL without clearing it, or even + // set the new StarBASIC as the parent of the module + // pObject->SetParent( NULL ); + + if( pMeth == pFirst ) + pFirst = pMeth->pNext; + else if( pMeth->pPrev ) + pMeth->pPrev->pNext = pMeth->pNext; + if( pMeth->pNext ) + pMeth->pNext->pPrev = pMeth->pPrev; + + pMeth->pPrev = NULL; + pMeth->pNext = NULL; + + pMeth->SbxValue::Clear(); + pObject->SbxValue::Clear(); + + // start from the beginning after object clearing, the cycle will end since the method is removed each time + pMeth = pFirst; + } + else + pMeth = pMeth->pNext; + } + else + pMeth = pMeth->pNext; + } +} + void clearUnoMethods( void ) { SbUnoMethod* pMeth = pFirst; @@ -2462,10 +2582,12 @@ SbUnoMethod::SbUnoMethod const String& aName_, SbxDataType eSbxType, Reference< XIdlMethod > xUnoMethod_, - bool bInvocation + bool bInvocation, + bool bDirect ) : SbxMethod( aName_, eSbxType ) , mbInvocation( bInvocation ) + , mbDirectInvocation( bDirect ) { m_xUnoMethod = xUnoMethod_; pParamInfoSeq = NULL; @@ -2566,7 +2688,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t ) if( !pRes ) { ::rtl::OUString aUName( rName ); - if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers ) + if( mxUnoAccess.is() && !bNativeCOMObject ) { if( mxExactName.is() ) { @@ -2667,6 +2789,17 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t ) QuickInsert( (SbxVariable*)xMethRef ); pRes = xMethRef; } + else + { + Reference< XDirectInvocation > xDirectInvoke( mxInvocation, UNO_QUERY ); + if ( xDirectInvoke.is() && xDirectInvoke->hasMember( aUName ) ) + { + SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod, true, true ); + QuickInsert( (SbxVariable*)xMethRef ); + pRes = xMethRef; + } + + } } catch( RuntimeException& e ) { @@ -2726,11 +2859,11 @@ void SbUnoObject::implCreateAll( void ) // Instrospection besorgen Reference< XIntrospectionAccess > xAccess = mxUnoAccess; - if( !xAccess.is() || bIgnoreNativeCOMObjectMembers ) + if( !xAccess.is() || bNativeCOMObject ) { if( mxInvocation.is() ) xAccess = mxInvocation->getIntrospection(); - else if( bIgnoreNativeCOMObjectMembers ) + else if( bNativeCOMObject ) return; } if( !xAccess.is() ) @@ -4170,14 +4303,26 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) //========================================================================== -typedef WeakImplHelper1< XInvocation > ModuleInvocationProxyHelper; +namespace { +class OMutexBasis +{ +protected: + // this mutex is necessary for OInterfaceContainerHelper + ::osl::Mutex m_aMutex; +}; +} // namespace + +typedef WeakImplHelper2< XInvocation, XComponent > ModuleInvocationProxyHelper; -class ModuleInvocationProxy : public ModuleInvocationProxyHelper +class ModuleInvocationProxy : public OMutexBasis, + public ModuleInvocationProxyHelper { ::rtl::OUString m_aPrefix; SbxObjectRef m_xScopeObj; bool m_bProxyIsClassModuleObject; + ::cppu::OInterfaceContainerHelper m_aListeners; + public: ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ); ~ModuleInvocationProxy() @@ -4197,11 +4342,17 @@ public: Sequence< sal_Int16 >& rOutParamIndex, Sequence< Any >& rOutParam ) throw( CannotConvertException, InvocationTargetException ); + + // XComponent + virtual void SAL_CALL dispose() throw(RuntimeException); + virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); }; ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ) : m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) ) , m_xScopeObj( xScopeObj ) + , m_aListeners( m_aMutex ) { m_bProxyIsClassModuleObject = xScopeObj.Is() ? xScopeObj->ISA(SbClassModuleObject) : false; } @@ -4298,13 +4449,27 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, vos::OGuard guard( Application::GetSolarMutex() ); Any aRet; - if( !m_xScopeObj.Is() ) + SbxObjectRef xScopeObj = m_xScopeObj; + if( !xScopeObj.Is() ) return aRet; ::rtl::OUString aFunctionName = m_aPrefix; aFunctionName += rFunction; - SbxVariable* p = m_xScopeObj->Find( aFunctionName, SbxCLASS_METHOD ); + sal_Bool bSetRescheduleBack = sal_False; + sal_Bool bOldReschedule = sal_True; + SbiInstance* pInst = pINST; + if( pInst && pInst->IsCompatibility() ) + { + bOldReschedule = pInst->IsReschedule(); + if ( bOldReschedule ) + { + pInst->EnableReschedule( sal_False ); + bSetRescheduleBack = sal_True; + } + } + + SbxVariable* p = xScopeObj->Find( aFunctionName, SbxCLASS_METHOD ); SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL; if( pMeth == NULL ) { @@ -4336,11 +4501,38 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, aRet = sbxToUnoValue( xValue ); pMeth->SetParameters( NULL ); + if( bSetRescheduleBack ) + pInst->EnableReschedule( bOldReschedule ); + // TODO: OutParameter? return aRet; } +void SAL_CALL ModuleInvocationProxy::dispose() + throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + EventObject aEvent( (XComponent*)this ); + m_aListeners.disposeAndClear( aEvent ); + + m_xScopeObj = NULL; +} + +void SAL_CALL ModuleInvocationProxy::addEventListener( const Reference< XEventListener >& xListener ) + throw (RuntimeException) +{ + m_aListeners.addInterface( xListener ); +} + +void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEventListener >& xListener ) + throw (RuntimeException) +{ + m_aListeners.removeInterface( xListener ); +} + + Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType, const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ) { @@ -4370,6 +4562,97 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: return xRet; } +typedef std::vector< WeakReference< XComponent > > ComponentRefVector; + +struct StarBasicDisposeItem +{ + StarBASIC* m_pBasic; + SbxArrayRef m_pRegisteredVariables; + ComponentRefVector m_vComImplementsObjects; + + StarBasicDisposeItem( StarBASIC* pBasic ) + : m_pBasic( pBasic ) + { + m_pRegisteredVariables = new SbxArray(); + } +}; + +typedef std::vector< StarBasicDisposeItem* > DisposeItemVector; + +static DisposeItemVector GaDisposeItemVector; + +DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic ) +{ + DisposeItemVector::iterator it; + for( it = GaDisposeItemVector.begin() ; it != GaDisposeItemVector.end() ; ++it ) + { + StarBasicDisposeItem* pItem = *it; + if( pItem->m_pBasic == pBasic ) + return it; + } + return GaDisposeItemVector.end(); +} + +StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic ) +{ + DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic ); + StarBasicDisposeItem* pItem = (it != GaDisposeItemVector.end()) ? *it : NULL; + if( pItem == NULL ) + { + pItem = new StarBasicDisposeItem( pBasic ); + GaDisposeItemVector.push_back( pItem ); + } + return pItem; +} + +void registerComponentToBeDisposedForBasic + ( Reference< XComponent > xComponent, StarBASIC* pBasic ) +{ + StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic ); + pItem->m_vComImplementsObjects.push_back( xComponent ); +} + +void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic ) +{ + StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic ); + SbxArray* pArray = pItem->m_pRegisteredVariables; + pArray->Put( pVar, pArray->Count() ); +} + +void disposeComVariablesForBasic( StarBASIC* pBasic ) +{ + DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic ); + if( it != GaDisposeItemVector.end() ) + { + StarBasicDisposeItem* pItem = *it; + + SbxArray* pArray = pItem->m_pRegisteredVariables; + USHORT nCount = pArray->Count(); + for( USHORT i = 0 ; i < nCount ; ++i ) + { + SbxVariable* pVar = pArray->Get( i ); + pVar->ClearComListener(); + } + + ComponentRefVector& rv = pItem->m_vComImplementsObjects; + ComponentRefVector::iterator itCRV; + for( itCRV = rv.begin() ; itCRV != rv.end() ; ++itCRV ) + { + try + { + Reference< XComponent > xComponent( (*itCRV).get(), UNO_QUERY_THROW ); + xComponent->dispose(); + } + catch( Exception& ) + {} + } + + delete pItem; + GaDisposeItemVector.erase( it ); + } +} + + // Handle module implements mechanism for OLE types bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ) { @@ -4423,6 +4706,23 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP if( bSuccess ) { + Reference< XComponent > xComponent( xProxy, UNO_QUERY ); + if( xComponent.is() ) + { + StarBASIC* pParentBasic = NULL; + SbxObject* pCurObject = this; + do + { + SbxObject* pObjParent = pCurObject->GetParent(); + pParentBasic = PTR_CAST( StarBASIC, pObjParent ); + pCurObject = pObjParent; + } + while( pParentBasic == NULL && pCurObject != NULL ); + + OSL_ASSERT( pParentBasic != NULL ); + registerComponentToBeDisposedForBasic( xComponent, pParentBasic ); + } + o_rRetAny <<= xRet; break; } @@ -4432,3 +4732,30 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP return bSuccess; } + +// Due to an incorrect behavior IE returns an object instead of a string +// in some scenarios. Calling toString at the object may correct this. +// Helper function used in sbxvalue.cxx +bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ) +{ + bool bSuccess = false; + + SbUnoObject* pUnoObj = NULL; + if( pObj != NULL && (pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj)) != NULL ) + { + // Only for native COM objects + if( pUnoObj->isNativeCOMObject() ) + { + SbxVariableRef pMeth = pObj->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "toString" ) ), SbxCLASS_METHOD ); + if ( pMeth.Is() ) + { + SbxValues aRes; + pMeth->Get( aRes ); + pVal->Put( aRes ); + bSuccess = true; + } + } + } + return bSuccess; +} + diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index e70f38bbeaed..0f807db7cf8f 100644..100755 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -496,33 +496,26 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ ) return 0L; } -#if 0 -bool UnlockControllerHack( StarBASIC* pBasic ) +bool VBAUnlockControllers( StarBASIC* pBasic ) { bool bRes = false; if ( pBasic && pBasic->IsDocBasic() ) { - uno::Any aUnoVar; - ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) ); - SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) ); - if ( pGlobs ) - aUnoVar = pGlobs->getUnoAny(); - uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY); - if ( xModel.is() ) + SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) ); + if ( pGlobs ) try { - try - { + uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW ); + if ( xModel->hasControllersLocked() ) xModel->unlockControllers(); - bRes = true; - } - catch( uno::Exception& ) - { - } + bRes = true; + } + catch( uno::Exception& ) + { } } return bRes; } -#endif + ///////////////////////////////////////////////////////////////////////////// // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen @@ -1176,6 +1169,8 @@ USHORT SbModule::Run( SbMethod* pMeth ) // beim Programm-Ende freigeben, damit nichts gehalten wird. ClearUnoObjectsInRTL_Impl( xBasic ); + clearNativeObjectWrapperVector(); + DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0"); delete pINST, pINST = NULL, bDelInst = FALSE; @@ -1184,6 +1179,14 @@ USHORT SbModule::Run( SbMethod* pMeth ) SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth ); GlobalRunDeInit(); + + // VBA always ensures screenupdating is enabled after completing + if ( mbVBACompat ) + VBAUnlockControllers( PTR_CAST( StarBASIC, GetParent() ) ); + +#ifdef DBG_TRACE_BASIC + dbg_DeInitTrace(); +#endif } } else @@ -1195,12 +1198,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); } - // VBA always ensure screenupdating is enabled after completing StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); -#if 0 - if ( pBasic && pBasic->IsDocBasic() && !pINST ) - UnlockControllerHack( pBasic ); -#endif if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, @@ -1332,6 +1330,61 @@ void SbModule::ClearPrivateVars() } } +void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic ) +{ + if( pVar->SbxValue::GetType() != SbxOBJECT || pVar->ISA( SbProcedureProperty ) ) + return; + + SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject()); + if( pObj != NULL ) + { + SbxObject* p = pObj; + + SbModule* pMod = PTR_CAST( SbModule, p ); + if( pMod != NULL ) + pMod->ClearVarsDependingOnDeletedBasic( pDeletedBasic ); + + while( (p = p->GetParent()) != NULL ) + { + StarBASIC* pBasic = PTR_CAST( StarBASIC, p ); + if( pBasic != NULL && pBasic == pDeletedBasic ) + { + pVar->SbxValue::Clear(); + break; + } + } + } +} + +void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic ) +{ + (void)pDeletedBasic; + + for( USHORT i = 0 ; i < pProps->Count() ; i++ ) + { + SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) ); + if( p ) + { + if( p->GetType() & SbxARRAY ) + { + SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject()); + if( pArray ) + { + for( USHORT j = 0 ; j < pArray->Count() ; j++ ) + { + SbxVariable* pVar = PTR_CAST(SbxVariable,pArray->Get( j )); + implClearIfVarDependsOnDeletedBasic( pVar, pDeletedBasic ); + } + } + } + else + { + implClearIfVarDependsOnDeletedBasic( p, pDeletedBasic ); + } + } + } +} + // Zunaechst in dieses Modul, um 358-faehig zu bleiben // (Branch in sb.cxx vermeiden) void StarBASIC::ClearAllModuleVars( void ) @@ -1341,7 +1394,7 @@ void StarBASIC::ClearAllModuleVars( void ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); // Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde - if( pModule->pImage && pModule->pImage->bInit ) + if( pModule->pImage && pModule->pImage->bInit && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) ) pModule->ClearPrivateVars(); } @@ -1739,6 +1792,98 @@ BOOL SbModule::LoadCompleted() return TRUE; } +void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + bool bDone = false; + + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar ); + if( pProcProperty ) + { + bDone = true; + + if( pHint->GetId() == SBX_HINT_DATAWANTED ) + { + String aProcName; + aProcName.AppendAscii( "Property Get " ); + aProcName += pProcProperty->GetName(); + + SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD ); + if( pMeth ) + { + SbxValues aVals; + aVals.eType = SbxVARIANT; + + SbxArray* pArg = pVar->GetParameters(); + USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0; + if( nVarParCount > 1 ) + { + SbxArrayRef xMethParameters = new SbxArray; + xMethParameters->Put( pMeth, 0 ); // Method as parameter 0 + for( USHORT i = 1 ; i < nVarParCount ; ++i ) + { + SbxVariable* pPar = pArg->Get( i ); + xMethParameters->Put( pPar, i ); + } + + pMeth->SetParameters( xMethParameters ); + pMeth->Get( aVals ); + pMeth->SetParameters( NULL ); + } + else + { + pMeth->Get( aVals ); + } + + pVar->Put( aVals ); + } + } + else if( pHint->GetId() == SBX_HINT_DATACHANGED ) + { + SbxVariable* pMeth = NULL; + + bool bSet = pProcProperty->isSet(); + if( bSet ) + { + pProcProperty->setSet( false ); + + String aProcName; + aProcName.AppendAscii( "Property Set " ); + aProcName += pProcProperty->GetName(); + pMeth = Find( aProcName, SbxCLASS_METHOD ); + } + if( !pMeth ) // Let + { + String aProcName; + aProcName.AppendAscii( "Property Let " ); + aProcName += pProcProperty->GetName(); + pMeth = Find( aProcName, SbxCLASS_METHOD ); + } + + if( pMeth ) + { + // Setup parameters + SbxArrayRef xArray = new SbxArray; + xArray->Put( pMeth, 0 ); // Method as parameter 0 + xArray->Put( pVar, 1 ); + pMeth->SetParameters( xArray ); + + SbxValues aVals; + pMeth->Get( aVals ); + pMeth->SetParameters( NULL ); + } + } + } + } + + if( !bDone ) + SbModule::Notify( rBC, rHint ); +} + + ///////////////////////////////////////////////////////////////////////// // Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen) SbJScriptModule::SbJScriptModule( const String& rName ) @@ -1969,6 +2114,11 @@ SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::Mod else if ( mInfo.ModuleObject.is() ) SetUnoObject( uno::makeAny( mInfo.ModuleObject ) ); } + +SbObjModule::~SbObjModule() +{ +} + void SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException ) { @@ -2005,6 +2155,13 @@ SbObjModule::Find( const XubString& rName, SbxClassType t ) return pVar; } +void SbObjModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + SbModule::handleProcedureProperties( rBC, rHint ); +} + + typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE; class FormObjEventListenerImpl : public FormObjEventListener_BASE @@ -2192,9 +2349,9 @@ SbUserFormModule::~SbUserFormModule() { } -void SbUserFormModule::ResetApiObj() +void SbUserFormModule::ResetApiObj( bool bTriggerTerminateEvent ) { - if ( m_xDialog.is() ) // probably someone close the dialog window + if ( bTriggerTerminateEvent && m_xDialog.is() ) // probably someone close the dialog window { triggerTerminateEvent(); } @@ -2379,11 +2536,12 @@ void SbUserFormModule::Unload() } //liuchen +void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic ); + void SbUserFormModule::InitObject() { try { - String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE ); if ( m_xModel.is() && pGlobs ) @@ -2410,6 +2568,25 @@ void SbUserFormModule::InitObject() aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() ); pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) ); uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW ); + + // the dialog must be disposed at the end! + if( xComponent.is() ) + { + StarBASIC* pParentBasic = NULL; + SbxObject* pCurObject = this; + do + { + SbxObject* pObjParent = pCurObject->GetParent(); + pParentBasic = PTR_CAST( StarBASIC, pObjParent ); + pCurObject = pObjParent; + } + while( pParentBasic == NULL && pCurObject != NULL ); + + OSL_ASSERT( pParentBasic != NULL ); + registerComponentToBeDisposedForBasic( xComponent, pParentBasic ); + } + + // remove old listener if it exists if ( m_DialogListener.get() ) m_DialogListener->removeListener(); diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 59d77e3f3757..4d188ec1ca8a 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -375,6 +375,9 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) if( pDef->IsWithEvents() ) nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG; + if( bCompatible && pDef->IsNew() ) + nOpnd2 |= SBX_TYPE_DIM_AS_NEW_FLAG; + short nFixedStringLength = pDef->GetFixedStringLength(); if( nFixedStringLength >= 0 ) nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (UINT32(nFixedStringLength) << 17)); // len = all bits above 0x10000 diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 7a4ea5965558..69f9ea553529 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -578,10 +578,20 @@ SbiExprNode* SbiExpression::Unary() { case MINUS: eTok = NEG; - case NOT: pParser->Next(); pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); break; + case NOT: + if( pParser->IsVBASupportOn() ) + { + pNd = Operand(); + } + else + { + pParser->Next(); + pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); + } + break; case PLUS: pParser->Next(); pNd = Unary(); @@ -725,9 +735,26 @@ SbiExprNode* SbiExpression::Comp() return pNd; } +SbiExprNode* SbiExpression::VBA_Not() +{ + SbiExprNode* pNd = NULL; + + SbiToken eTok = pParser->Peek(); + if( eTok == NOT ) + { + pParser->Next(); + pNd = new SbiExprNode( pParser, VBA_Not(), eTok, NULL ); + } + else + { + pNd = Comp(); + } + return pNd; +} + SbiExprNode* SbiExpression::Like() { - SbiExprNode* pNd = Comp(); + SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp(); if( m_eMode != EXPRMODE_EMPTY_PAREN ) { short nCount = 0; diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx index 5b7e5c70591d..c8fe782487e3 100755 --- a/basic/source/comp/sbcomp.cxx +++ b/basic/source/comp/sbcomp.cxx @@ -32,6 +32,7 @@ #include "sbcomp.hxx" #include "image.hxx" #include "sbtrace.hxx" +#include <basic/sbobjmod.hxx> //========================================================================== @@ -42,11 +43,145 @@ #include <hash_map> -// Trace Settings -static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt"; -static const bool GbIncludePCodes = false; -static const int GnIndentPerCallLevel = 4; -static const int GnIndentForPCode = 2; +// Trace ini file (set NULL to ignore) +static char GpTraceIniFile[] = "d:\\zBasic.Asm\\BasicTrace.ini"; +//static char* GpTraceIniFile = NULL; + + +// Trace Settings, used if no ini file / not found in ini file +static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt"; +static char* GpTraceFileName = GpTraceFileNameDefault; + +// GbTraceOn: +// true = tracing is active, false = tracing is disabled, default = true +// Set to false initially if you want to activate tracing on demand with +// TraceCommand( "TraceOn" ), see below +static bool GbTraceOn = true; + +// GbIncludePCodes: +// true = PCodes are written to trace, default = false, correspondents +// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below +static bool GbIncludePCodes = false; + +static int GnIndentPerCallLevel = 4; +static int GnIndentForPCode = 2; + +/* + With trace enabled the runtime function TraceCommand + can be used to influence the trace functionality + from within the running Basic macro. + + Format: TraceCommand( command as String [, param as Variant] ) + + Supported commands (command is NOT case sensitive): + TraceCommand "TraceOn" sets GbTraceOn = true + TraceCommand "TraceOff" sets GbTraceOn = false + + TraceCommand "PCodeOn" sets GbIncludePCodes = true + TraceCommand "PCodeOff" sets GbIncludePCodes = false + + TraceCommand "Print", aVal writes aVal into the trace file as + long as it can be converted to string +*/ + +static void lcl_skipWhites( char*& rpc ) +{ + while( *rpc == ' ' || *rpc == '\t' ) + ++rpc; +} + +inline void lcl_findNextLine( char*& rpc, char* pe ) +{ + // Find line end + while( rpc < pe && *rpc != 13 && *rpc != 10 ) + ++rpc; + + // Read all + while( rpc < pe && (*rpc == 13 || *rpc == 10) ) + ++rpc; +} + +inline bool lcl_isAlpha( char c ) +{ + bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + return bRet; +} + +static void lcl_ReadIniFile( const char* pIniFileName ) +{ + const int BUF_SIZE = 1000; + static sal_Char TraceFileNameBuffer[BUF_SIZE]; + sal_Char Buffer[BUF_SIZE]; + sal_Char VarNameBuffer[BUF_SIZE]; + sal_Char ValBuffer[BUF_SIZE]; + + FILE* pFile = fopen( pIniFileName ,"rb" ); + if( pFile == NULL ) + return; + + size_t nRead = fread( Buffer, 1, BUF_SIZE, pFile ); + + // Scan + char* pc = Buffer; + char* pe = Buffer + nRead; + while( pc < pe ) + { + lcl_skipWhites( pc ); if( pc == pe ) break; + + // Read variable + char* pVarStart = pc; + while( pc < pe && lcl_isAlpha( *pc ) ) + ++pc; + int nVarLen = pc - pVarStart; + if( nVarLen == 0 ) + { + lcl_findNextLine( pc, pe ); + continue; + } + strncpy( VarNameBuffer, pVarStart, nVarLen ); + VarNameBuffer[nVarLen] = '\0'; + + // Check = + lcl_skipWhites( pc ); if( pc == pe ) break; + if( *pc != '=' ) + continue; + ++pc; + lcl_skipWhites( pc ); if( pc == pe ) break; + + // Read value + char* pValStart = pc; + while( pc < pe && *pc != 13 && *pc != 10 ) + ++pc; + int nValLen = pc - pValStart; + if( nValLen == 0 ) + { + lcl_findNextLine( pc, pe ); + continue; + } + strncpy( ValBuffer, pValStart, nValLen ); + ValBuffer[nValLen] = '\0'; + + // Match variables + if( strcmp( VarNameBuffer, "GpTraceFileName") == 0 ) + { + strcpy( TraceFileNameBuffer, ValBuffer ); + GpTraceFileName = TraceFileNameBuffer; + } + else + if( strcmp( VarNameBuffer, "GbTraceOn") == 0 ) + GbTraceOn = (strcmp( ValBuffer, "true" ) == 0); + else + if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 ) + GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0); + else + if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 ) + GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 ); + else + if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 ) + GnIndentForPCode = strtol( ValBuffer, NULL, 10 ); + } + fclose( pFile ); +} struct TraceTextData { @@ -122,7 +257,7 @@ static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr ) return aORetStr; } -String dumpMethodParameters( SbMethod* pMethod ) +String lcl_dumpMethodParameters( SbMethod* pMethod ) { String aStr; if( pMethod == NULL ) @@ -149,9 +284,10 @@ String dumpMethodParameters( SbMethod* pMethod ) aStr += pParam->aName; } aStr += '='; - if( pVar->GetType() & SbxARRAY ) + SbxDataType eType = pVar->GetType(); + if( eType & SbxARRAY ) aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); - else + else if( eType != SbxOBJECT ) aStr += pVar->GetString(); if ( nParam < ( pParams->Count() - 1 ) ) aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); @@ -166,16 +302,36 @@ String dumpMethodParameters( SbMethod* pMethod ) return aStr; } + // Public functions + +static bool GbSavTraceOn = false; void dbg_InitTrace( void ) { + if( GpTraceIniFile != NULL ) + lcl_ReadIniFile( GpTraceIniFile ); + FILE* pFile = fopen( GpTraceFileName, "w" ); if( pFile != NULL ) fclose( pFile ); + GbSavTraceOn = GbTraceOn; + if( !GbTraceOn ) + lcl_lineOut( GpTraceFileName, "### Program started with trace off ###" ); +} + +void dbg_DeInitTrace( void ) +{ + GbTraceOn = GbSavTraceOn; } +static INT32 GnLastCallLvl = 0; + void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ) { + if( !GbTraceOn ) + return; + GnLastCallLvl = nCallLvl; + SbModule* pTraceMod = pModule; if( pTraceMod->ISA(SbClassModuleObject) ) { @@ -206,14 +362,11 @@ void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ) { const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr(); char Buffer[200]; - sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr ); + sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", (int)nPC, pModuleNameStr ); lcl_lineOut( GpTraceFileName, Buffer ); return; } - //nCallLvl--; - //if( nCallLvl < 0 ) - // nCallLvl = 0; int nIndent = nCallLvl * GnIndentPerCallLevel; const TraceTextData& rTraceTextData = itInner->second; @@ -234,6 +387,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, { static const char* pSeparator = "' ================================================================================"; + if( !GbTraceOn ) + return; + GnLastCallLvl = nCallLvl; + SbModule* pTraceMod = pModule; SbClassModuleObject* pClassModuleObj = NULL; if( pTraceMod->ISA(SbClassModuleObject) ) @@ -281,7 +438,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, aStr.AppendAscii( "]" ); } if( !bLeave ) - aStr += dumpMethodParameters( pMethod ); + aStr += lcl_dumpMethodParameters( pMethod ); lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) ); if( !bLeave ) @@ -293,6 +450,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl ) { + if( !GbTraceOn ) + return; + GnLastCallLvl = nCallLvl; + rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US ); char Buffer[200]; @@ -329,6 +490,63 @@ void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, (*pInnerMap)[nPC] = aData; } +void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + String aCommand = rPar.Get(1)->GetString(); + + if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) ) + GbTraceOn = true; + else + if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) ) + GbTraceOn = false; + else + if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) ) + GbIncludePCodes = true; + else + if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) ) + GbIncludePCodes = false; + else + if( aCommand.EqualsIgnoreCaseAscii( "Print" ) ) + { + if ( rPar.Count() < 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + SbxError eOld = SbxBase::GetError(); + if( eOld != SbxERR_OK ) + SbxBase::ResetError(); + + String aValStr = rPar.Get(2)->GetString(); + SbxError eErr = SbxBase::GetError(); + if( eErr != SbxERR_OK ) + { + aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) ); + SbxBase::ResetError(); + } + + char Buffer[500]; + const char* pValStr = OUStringToOString( rtl::OUString( aValStr ), RTL_TEXTENCODING_ASCII_US ).getStr(); + + sprintf( Buffer, "### TRACE_PRINT: %s ###", pValStr ); + int nIndent = GnLastCallLvl * GnIndentPerCallLevel; + lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) ); + + if( eOld != SbxERR_OK ) + SbxBase::SetError( eOld ); + } +} + #endif @@ -431,7 +649,8 @@ BOOL SbModule::Compile() BOOL bRet = IsCompiled(); if( bRet ) { - pBasic->ClearAllModuleVars(); + if( !this->ISA(SbObjModule) ) + pBasic->ClearAllModuleVars(); RemoveVars(); // remove 'this' Modules variables // clear all method statics for( USHORT i = 0; i < pMethods->Count(); i++ ) diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index dd68f20893f5..26c6af53cc56 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -224,6 +224,30 @@ BOOL SbiScanner::NextSym() for ( ; (BasicSimpleCharClass::isAlphaNumeric( *pLine, bCompatible ) || ( *pLine == '_' ) ); pLine++ ) nCol++; aSym = aLine.copy( n, nCol - n ); + + // Special handling for "go to" + if( bCompatible && *pLine && aSym.EqualsIgnoreCaseAscii( "go" ) ) + { + const sal_Unicode* pTestLine = pLine; + short nTestCol = nCol; + while( *pTestLine && (( *pTestLine == ' ' ) || ( *pTestLine == '\t' )) ) + { + pTestLine++; + nTestCol++; + } + + if( *pTestLine && *(pTestLine + 1) ) + { + String aTestSym = aLine.copy( nTestCol, 2 ); + if( aTestSym.EqualsIgnoreCaseAscii( "to" ) ) + { + aSym = String::CreateFromAscii( "goto" ); + pLine = pTestLine + 2; + nCol = nTestCol + 2; + } + } + } + // Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt // (sonst falsche Zeilenfortsetzung) if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' ) diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index d6b3dbb878fc..9df91a5748b9 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -206,9 +206,10 @@ void SbiSymPool::Add( SbiSymDef* pDef ) SbiSymDef* SbiSymPool::Find( const String& rName ) const { - for( USHORT i = 0; i < aData.Count(); i++ ) + USHORT nCount = aData.Count(); + for( USHORT i = 0; i < nCount; i++ ) { - SbiSymDef* p = aData.GetObject( i ); + SbiSymDef* p = aData.GetObject( nCount - i - 1 ); if( ( !p->nProcId || ( p->nProcId == nProcId ) ) && ( p->aName.EqualsIgnoreCaseAscii( rName ) ) ) return p; diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 851d0d6f1fe5..3795321f0578 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -188,6 +188,7 @@ protected: SbiExprNode* AddSub(); SbiExprNode* Cat(); SbiExprNode* Like(); + SbiExprNode* VBA_Not(); SbiExprNode* Comp(); SbiExprNode* Boolean(); public: diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index 6ca69209a752..356e07c9e55c 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -276,6 +276,8 @@ struct RefSaveItem class SbiRuntime { + friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); + typedef void( SbiRuntime::*pStep0 )(); typedef void( SbiRuntime::*pStep1 )( UINT32 nOp1 ); typedef void( SbiRuntime::*pStep2 )( UINT32 nOp1, UINT32 nOp2 ); @@ -434,7 +436,7 @@ class SbiRuntime void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32); void StepFIND_CM( UINT32, UINT32 ); void StepFIND_STATIC( UINT32, UINT32 ); - void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 ); + void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 ); public: void SetVBAEnabled( bool bEnabled ); USHORT GetImageFlag( USHORT n ) const; diff --git a/basic/source/inc/sbtrace.hxx b/basic/source/inc/sbtrace.hxx index e8a482c2f6e9..50e344fb63d2 100755 --- a/basic/source/inc/sbtrace.hxx +++ b/basic/source/inc/sbtrace.hxx @@ -28,15 +28,17 @@ #ifndef _SBTRACE_HXX #define _SBTRACE_HXX -// #define DBG_TRACE_BASIC +//#define DBG_TRACE_BASIC #ifdef DBG_TRACE_BASIC void dbg_InitTrace( void ); +void dbg_DeInitTrace( void ); void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ); void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false ); void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl ); void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, const String& aTraceStr_STMNT, const String& aTraceStr_PCode ); +void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); #endif #endif diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 78afa9783ca8..051ceedfbc78 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -52,7 +52,7 @@ class SbUnoObject: public SbxObject ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation; BOOL bNeedIntrospection; - BOOL bIgnoreNativeCOMObjectMembers; + BOOL bNativeCOMObject; ::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection! // Hilfs-Methode zum Anlegen der dbg_-Properties @@ -84,17 +84,22 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > getInvocation( void ) { return mxInvocation; } void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); + + bool isNativeCOMObject( void ) + { return bNativeCOMObject; } }; SV_DECL_IMPL_REF(SbUnoObject); // #67781 Rueckgabewerte der Uno-Methoden loeschen void clearUnoMethods( void ); +void clearUnoMethodsForBasic( StarBASIC* pBasic ); class SbUnoMethod : public SbxMethod { friend class SbUnoObject; friend void clearUnoMethods( void ); + friend void clearUnoMethodsForBasic( StarBASIC* pBasic ); ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod; ::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq; @@ -103,13 +108,15 @@ class SbUnoMethod : public SbxMethod SbUnoMethod* pPrev; SbUnoMethod* pNext; - bool mbInvocation; // Method is based on invocation + bool mbInvocation; // Method is based on invocation + bool mbDirectInvocation; // Method should be used with XDirectInvocation interface public: TYPEINFO(); SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_, - bool bInvocation ); + bool bInvocation, + bool bDirect = false ); virtual ~SbUnoMethod(); virtual SbxInfo* GetInfo(); @@ -117,6 +124,8 @@ public: bool isInvocationBased( void ) { return mbInvocation; } + bool needsDirectInvocation( void ) + { return mbDirectInvocation; } }; @@ -293,6 +302,9 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void disposeComVariablesForBasic( StarBASIC* pBasic ); +void clearNativeObjectWrapperVector( void ); + //======================================================================== // #118116 Collection object diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx index 091fbc24cdbe..d788a73da0fc 100644 --- a/basic/source/inc/scriptcont.hxx +++ b/basic/source/inc/scriptcont.hxx @@ -43,6 +43,7 @@ namespace basic class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword { ::rtl::OUString maScriptLanguage; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxCodeNameAccess; // Methods to distinguish between deffirent library types virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ); diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx new file mode 100644 index 000000000000..ba3def41838f --- /dev/null +++ b/basic/source/runtime/comenumwrapper.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_basic.hxx" +#include "comenumwrapper.hxx" + +using namespace ::com::sun::star; + +::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements() + throw ( uno::RuntimeException ) +{ + sal_Bool bResult = sal_False; + + try + { + if ( m_xInvocation.is() ) + { + sal_Int32 nLength = 0; + bResult = + ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength ) + && nLength > m_nCurInd ); + } + } + catch( uno::Exception& ) + {} + + return bResult; +} + +uno::Any SAL_CALL ComEnumerationWrapper::nextElement() + throw ( container::NoSuchElementException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + try + { + if ( m_xInvocation.is() ) + { + uno::Sequence< sal_Int16 > aNamedParamIndex; + uno::Sequence< uno::Any > aNamedParam; + uno::Sequence< uno::Any > aArgs( 1 ); + + aArgs[0] <<= m_nCurInd++; + + return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ), + aArgs, + aNamedParamIndex, + aNamedParam ); + } + } + catch( uno::Exception& ) + {} + + throw container::NoSuchElementException(); +} + + diff --git a/basic/source/runtime/comenumwrapper.hxx b/basic/source/runtime/comenumwrapper.hxx new file mode 100644 index 000000000000..b2464d686f67 --- /dev/null +++ b/basic/source/runtime/comenumwrapper.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _COMENUMWRAPPER_HXX +#define _COMENUMWRAPPER_HXX + +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/script/XInvocation.hpp> + +#include <cppuhelper/implbase1.hxx> + +class ComEnumerationWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration > +{ + ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > m_xInvocation; + sal_Int32 m_nCurInd; + +public: + ComEnumerationWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation >& xInvocation ) + : m_xInvocation( xInvocation ) + , m_nCurInd( 0 ) + { + } + + // container::XEnumeration + virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +#endif // _COMENUMWRAPPER_HXX + diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk index f2ed11196b28..8ca052aaae1a 100644 --- a/basic/source/runtime/makefile.mk +++ b/basic/source/runtime/makefile.mk @@ -41,6 +41,7 @@ ENABLE_EXCEPTIONS = TRUE SLOFILES= \ $(SLO)$/basrdll.obj \ + $(SLO)$/comenumwrapper.obj \ $(SLO)$/inputbox.obj \ $(SLO)$/runtime.obj \ $(SLO)$/step0.obj \ diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 2a536eae65be..6b955fed3d8a 100644..100755 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -112,6 +112,126 @@ static Reference< XCalendar > getLocaleCalendar( void ) return xCalendar; } +RTLFUNC(CallByName) +{ + (void)pBasic; + (void)bWrite; + + const INT16 vbGet = 2; + const INT16 vbLet = 4; + const INT16 vbMethod = 1; + const INT16 vbSet = 8; + + // At least 3 parameter needed plus function itself -> 4 + USHORT nParCount = rPar.Count(); + if ( nParCount < 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // 1. parameter is object + SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject(); + SbxObject* pObj = NULL; + if( pObjVar ) + pObj = PTR_CAST(SbxObject,pObjVar); + if( !pObj && pObjVar && pObjVar->ISA(SbxVariable) ) + { + SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); + } + if( !pObj ) + { + StarBASIC::Error( SbERR_BAD_PARAMETER ); + return; + } + + // 2. parameter is ProcedureName + String aNameStr = rPar.Get(2)->GetString(); + + // 3. parameter is CallType + INT16 nCallType = rPar.Get(3)->GetInteger(); + + //SbxObject* pFindObj = NULL; + SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_DONTCARE ); + if( pFindVar == NULL ) + { + StarBASIC::Error( SbERR_PROC_UNDEFINED ); + return; + } + + switch( nCallType ) + { + case vbGet: + { + SbxValues aVals; + aVals.eType = SbxVARIANT; + pFindVar->Get( aVals ); + + SbxVariableRef refVar = rPar.Get(0); + refVar->Put( aVals ); + } + break; + case vbLet: + case vbSet: + { + if ( nParCount != 5 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + SbxVariableRef pValVar = rPar.Get(4); + if( nCallType == vbLet ) + { + SbxValues aVals; + aVals.eType = SbxVARIANT; + pValVar->Get( aVals ); + pFindVar->Put( aVals ); + } + else + { + SbxVariableRef rFindVar = pFindVar; + SbiInstance* pInst = pINST; + SbiRuntime* pRT = pInst ? pInst->pRun : NULL; + if( pRT != NULL ) + pRT->StepSET_Impl( pValVar, rFindVar, false ); + } + } + break; + case vbMethod: + { + SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar); + if( pMeth == NULL ) + { + StarBASIC::Error( SbERR_PROC_UNDEFINED ); + return; + } + + // Setup parameters + SbxArrayRef xArray; + USHORT nMethParamCount = nParCount - 4; + if( nMethParamCount > 0 ) + { + xArray = new SbxArray; + for( USHORT i = 0 ; i < nMethParamCount ; i++ ) + { + SbxVariable* pPar = rPar.Get( i + 4 ); + xArray->Put( pPar, i + 1 ); + } + } + + // Call method + SbxVariableRef refVar = rPar.Get(0); + if( xArray.Is() ) + pMeth->SetParameters( xArray ); + pMeth->Call( refVar ); + pMeth->SetParameters( NULL ); + } + break; + default: + StarBASIC::Error( SbERR_PROC_UNDEFINED ); + } +} RTLFUNC(CBool) // JSM { @@ -527,6 +647,7 @@ RTLFUNC(DoEvents) //aTimer.Start(); //while ( aTimer.IsActive() ) // Application::Reschedule(); + Application::Reschedule( true ); } RTLFUNC(GetGUIVersion) @@ -1513,6 +1634,12 @@ RTLFUNC(GetDefaultContext) RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite ); } +#ifdef DBG_TRACE_BASIC +RTLFUNC(TraceCommand) +{ + RTL_Impl_TraceCommand( pBasic, rPar, bWrite ); +} +#endif RTLFUNC(Join) { diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx index 5437654f69a0..ba7af48c8472 100644 --- a/basic/source/runtime/rtlproto.hxx +++ b/basic/source/runtime/rtlproto.hxx @@ -26,6 +26,7 @@ ************************************************************************/ #include <basic/sbstar.hxx> +#include "sbtrace.hxx" #define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) #define RTLNAME( name ) &SbRtl_##name @@ -271,6 +272,7 @@ extern RTLFUNC(AboutStarBasic); extern RTLFUNC(LoadPicture); extern RTLFUNC(SavePicture); +extern RTLFUNC(CallByName); extern RTLFUNC(CBool); // JSM extern RTLFUNC(CByte); // JSM extern RTLFUNC(CCur); // JSM @@ -345,5 +347,9 @@ extern RTLFUNC(CDec); extern RTLFUNC(Partition); // Fong +#ifdef DBG_TRACE_BASIC +extern RTLFUNC(TraceCommand); +#endif + extern double Now_Impl(); extern void Wait_Impl( bool bDurationBased, SbxArray& rPar ); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 1bb6fb82e113..62aa639e4c7e 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -45,6 +45,7 @@ #include "sbunoobj.hxx" #include "errobject.hxx" #include "sbtrace.hxx" +#include "comenumwrapper.hxx" using namespace ::com::sun::star; @@ -890,11 +891,12 @@ void SbiRuntime::Error( SbError _errCode, const String& _details ) { if ( _errCode ) { - OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" ); + // Not correct for class module usage, remove for now + //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!" ); + //OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" ); } else { @@ -1176,6 +1178,23 @@ void SbiRuntime::PushForEach() p->xEnumeration = xEnumerationAccess->createEnumeration(); p->eForType = FOR_EACH_XENUMERATION; } + else if ( isVBAEnabled() && pUnoObj->isNativeCOMObject() ) + { + uno::Reference< script::XInvocation > xInvocation; + if ( ( aAny >>= xInvocation ) && xInvocation.is() ) + { + try + { + p->xEnumeration = new ComEnumerationWrapper( xInvocation ); + p->eForType = FOR_EACH_XENUMERATION; + } + catch( uno::Exception& ) + {} + } + + if ( !p->xEnumeration.is() ) + bError_ = true; + } else { bError_ = true; diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index 4455901bfeba..39f92afdea4a 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -94,6 +94,10 @@ static Methods aMethods[] = { { "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 }, { "RGB-Value", SbxLONG, 0,NULL,0 }, +{ "CallByName", SbxVARIANT, 3 | _FUNCTION, RTLNAME(CallByName),0 }, + { "Object", SbxOBJECT, 0,NULL,0 }, + { "ProcedureName",SbxSTRING, 0,NULL,0 }, + { "CallType", SbxINTEGER, 0,NULL,0 }, { "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool),0 }, { "expression", SbxVARIANT, 0,NULL,0 }, { "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 }, @@ -531,6 +535,10 @@ static Methods aMethods[] = { { "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 }, { "String", SbxSTRING, 0,NULL,0 }, { "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE),0 }, +#ifdef DBG_TRACE_BASIC +{ "TraceCommand", SbxNULL, 1 | _FUNCTION, RTLNAME(TraceCommand),0 }, + { "Command", SbxSTRING, 0,NULL,0 }, +#endif { "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim),0 }, { "String", SbxSTRING, 0,NULL,0 }, { "True", SbxBOOL, _CPROP, RTLNAME(True),0 }, diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 2acf59ca6b71..c686b0ed80ed 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -47,6 +47,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ); #include <algorithm> +#include <hash_map> SbxVariable* getDefaultProp( SbxVariable* pRef ); @@ -418,9 +419,53 @@ void SbiRuntime::StepPUT() } +// VBA Dim As New behavior handling, save init object information +struct DimAsNewRecoverItem +{ + String m_aObjClass; + String m_aObjName; + SbxObject* m_pObjParent; + SbModule* m_pClassModule; + + DimAsNewRecoverItem( void ) + : m_pObjParent( NULL ) + , m_pClassModule( NULL ) + {} + + DimAsNewRecoverItem( const String& rObjClass, const String& rObjName, + SbxObject* pObjParent, SbModule* pClassModule ) + : m_aObjClass( rObjClass ) + , m_aObjName( rObjName ) + , m_pObjParent( pObjParent ) + , m_pClassModule( pClassModule ) + {} + +}; + + +struct SbxVariablePtrHash +{ + size_t operator()( SbxVariable* pVar ) const + { return (size_t)pVar; } +}; + +typedef std::hash_map< SbxVariable*, DimAsNewRecoverItem, SbxVariablePtrHash > DimAsNewRecoverHash; + +static DimAsNewRecoverHash GaDimAsNewRecoverHash; + +void removeDimAsNewRecoverItem( SbxVariable* pVar ) +{ + DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar ); + if( it != GaDimAsNewRecoverHash.end() ) + GaDimAsNewRecoverHash.erase( it ); +} + + // Speichern Objektvariable // Nicht-Objekt-Variable fuehren zu Fehlern +static const char pCollectionStr[] = "Collection"; + void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp ) { // #67733 Typen mit Array-Flag sind auch ok @@ -523,6 +568,12 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b } } + // Handle Dim As New + BOOL bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW ); + SbxBaseRef xPrevVarObj; + if( bDimAsNew ) + xPrevVarObj = refVar->GetObject(); + // Handle withevents BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); if ( bWithEvents ) @@ -541,7 +592,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj ); refVal->SetDeclareClassName( aDeclareClassName ); - refVal->SetComListener( xComListener ); // Hold reference + refVal->SetComListener( xComListener, &rBasic ); // Hold reference } *refVar = *refVal; @@ -551,6 +602,68 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b *refVar = *refVal; } + if ( bDimAsNew ) + { + if( !refVar->ISA(SbxObject) ) + { + SbxBase* pValObjBase = refVal->GetObject(); + if( pValObjBase == NULL ) + { + if( xPrevVarObj.Is() ) + { + // Object is overwritten with NULL, instantiate init object + DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar ); + if( it != GaDimAsNewRecoverHash.end() ) + { + const DimAsNewRecoverItem& rItem = it->second; + if( rItem.m_pClassModule != NULL ) + { + SbClassModuleObject* pNewObj = new SbClassModuleObject( rItem.m_pClassModule ); + pNewObj->SetName( rItem.m_aObjName ); + pNewObj->SetParent( rItem.m_pObjParent ); + refVar->PutObject( pNewObj ); + } + else if( rItem.m_aObjClass.EqualsIgnoreCaseAscii( pCollectionStr ) ) + { + BasicCollection* pNewCollection = new BasicCollection( String( RTL_CONSTASCII_USTRINGPARAM(pCollectionStr) ) ); + pNewCollection->SetName( rItem.m_aObjName ); + pNewCollection->SetParent( rItem.m_pObjParent ); + refVar->PutObject( pNewCollection ); + } + } + } + } + else + { + // Does old value exist? + bool bFirstInit = !xPrevVarObj.Is(); + if( bFirstInit ) + { + // Store information to instantiate object later + SbxObject* pValObj = PTR_CAST(SbxObject,pValObjBase); + if( pValObj != NULL ) + { + String aObjClass = pValObj->GetClassName(); + + SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase); + if( pClassModuleObj != NULL ) + { + SbModule* pClassModule = pClassModuleObj->getClassModule(); + GaDimAsNewRecoverHash[refVar] = + DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule ); + } + else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) ) + { + GaDimAsNewRecoverHash[refVar] = + DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL ); + } + } + } + } + } + } + + // lhs is a property who's value is currently (Empty e.g. no broadcast yet) // in this case if there is a default prop involved the value of the // default property may infact be void so the type will also be SbxEMPTY diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 587b0ae7a590..64a9d86ab940 100755 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -143,15 +143,19 @@ SbxVariable* SbiRuntime::FindElement else pElem = getVBAConstant( aName ); } - // #72382 VORSICHT! Liefert jetzt wegen unbekannten - // Modulen IMMER ein Ergebnis! - SbUnoClass* pUnoClass = findUnoClass( aName ); - if( pUnoClass ) + + if( !pElem ) { - pElem = new SbxVariable( t ); - SbxValues aRes( SbxOBJECT ); - aRes.pObj = pUnoClass; - pElem->SbxVariable::Put( aRes ); + // #72382 VORSICHT! Liefert jetzt wegen unbekannten + // Modulen IMMER ein Ergebnis! + SbUnoClass* pUnoClass = findUnoClass( aName ); + if( pUnoClass ) + { + pElem = new SbxVariable( t ); + SbxValues aRes( SbxOBJECT ); + aRes.pObj = pUnoClass; + pElem->SbxVariable::Put( aRes ); + } } // #62939 Wenn eine Uno-Klasse gefunden wurde, muss @@ -407,6 +411,34 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 ) } } } + else if( bVBAEnabled && p->GetType() == SbxOBJECT && (!p->ISA(SbxMethod) || !p->IsBroadcaster()) ) + { + // Check for default method with named parameters + SbxBaseRef pObj = (SbxBase*)p->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj; + Any aAny = pUnoObj->getUnoAny(); + + if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) + { + Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue(); + Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY ); + + rtl::OUString sDefaultMethod; + if ( xDfltMethod.is() ) + sDefaultMethod = xDfltMethod->getDefaultMethodName(); + if ( sDefaultMethod.getLength() ) + { + SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD ); + if( meth != NULL ) + pInfo = meth->GetInfo(); + if( pInfo ) + bError_ = false; + } + } + } + } if( bError_ ) Error( SbERR_NO_NAMED_ARGS ); } @@ -489,7 +521,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) pPar->Put( NULL, 0 ); } // Index-Access bei UnoObjekten beruecksichtigen - else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) ) + else if( pElem->GetType() == SbxOBJECT && (!pElem->ISA(SbxMethod) || !pElem->IsBroadcaster()) ) { pPar = pElem->GetParameters(); if ( pPar ) @@ -589,6 +621,12 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) pCol->CollItem( pPar ); } } + else if( bVBAEnabled ) // !pObj + { + SbxArray* pParam = pElem->GetParameters(); + if( pParam != NULL ) + Error( SbERR_NO_OBJECT ); + } } } @@ -1085,12 +1123,24 @@ void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 ) PushVar( pNew ); } -void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 ) +void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 ) { - USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000 - String aStr; - aStr.Fill( nCount, 0 ); - pStrVar->PutString( aStr ); + bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); + if( bWithEvents ) + pVar->SetFlag( SBX_WITH_EVENTS ); + + bool bDimAsNew = ((nOp2 & SBX_TYPE_DIM_AS_NEW_FLAG) != 0); + if( bDimAsNew ) + pVar->SetFlag( SBX_DIM_AS_NEW ); + + bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0); + if( bFixedString ) + { + USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000 + String aStr; + aStr.Fill( nCount, 0 ); + pVar->PutString( aStr ); + } } // Einrichten einer lokalen Variablen (+StringID+Typ) @@ -1105,12 +1155,7 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 ) SbxDataType t = (SbxDataType)(nOp2 & 0xffff); SbxVariable* p = new SbxVariable( t ); p->SetName( aName ); - bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); - if( bWithEvents ) - p->SetFlag( SBX_WITH_EVENTS ); - bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0); - if( bFixedString ) - implCreateFixedString( p, nOp2 ); + implHandleSbxFlags( p, t, nOp2 ); refLocals->Put( p, refLocals->Count() ); } } @@ -1137,12 +1182,7 @@ void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassMo // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden' pProp->SetFlag( SBX_NO_MODIFY); - bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); - if( bWithEvents ) - pProp->SetFlag( SBX_WITH_EVENTS ); - bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0); - if( bFixedString ) - implCreateFixedString( p, nOp2 ); + implHandleSbxFlags( pProp, t, nOp2 ); } } diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index b2b67fe3774f..6628973b29e8 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -112,6 +112,9 @@ SbxObject::~SbxObject() CheckParentsOnDelete( this, pProps ); CheckParentsOnDelete( this, pMethods ); CheckParentsOnDelete( this, pObjs ); + + // avoid handling in ~SbxVariable as SBX_DIM_AS_NEW == SBX_GBLSEARCH + ResetFlag( SBX_DIM_AS_NEW ); } SbxDataType SbxObject::GetType() const diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 4ea4836b701b..a5e80e8921c6 100644..100755 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -436,6 +436,8 @@ SbxValue* SbxValue::TheRealValue() const } // #55226 Zusaetzliche Info transportieren +bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx + SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const { SbxValue* p = (SbxValue*) this; @@ -461,8 +463,12 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const ((SbxValue*) pObj)->aData.eType == SbxOBJECT && ((SbxValue*) pObj)->aData.pObj == pObj ) { - SetError( SbxERR_BAD_PROP_VALUE ); - p = NULL; + bool bSuccess = handleToStringForCOMObjects( pObj, p ); + if( !bSuccess ) + { + SetError( SbxERR_BAD_PROP_VALUE ); + p = NULL; + } } else if( pDflt ) p = pDflt; diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 58e3c1ae92c2..12a6d29672a9 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -59,13 +59,17 @@ class SbxVariableImpl friend class SbxVariable; String m_aDeclareClassName; Reference< XInterface > m_xComListener; + StarBASIC* m_pComListenerParentBasic; SbxVariableImpl( void ) + : m_pComListenerParentBasic( NULL ) {} SbxVariableImpl( const SbxVariableImpl& r ) : m_aDeclareClassName( r.m_aDeclareClassName ) , m_xComListener( r.m_xComListener ) - {} + , m_pComListenerParentBasic( r.m_pComListenerParentBasic ) + { + } }; @@ -84,12 +88,18 @@ SbxVariable::SbxVariable() : SbxValue() #endif } +void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic ); + SbxVariable::SbxVariable( const SbxVariable& r ) : SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo ) { mpSbxVariableImpl = NULL; if( r.mpSbxVariableImpl != NULL ) + { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); + if( mpSbxVariableImpl->m_xComListener.is() ) + registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); + } pCst = NULL; if( r.CanRead() ) { @@ -126,6 +136,8 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p ) #endif } +void removeDimAsNewRecoverItem( SbxVariable* pVar ); + SbxVariable::~SbxVariable() { #ifdef DBG_UTIL @@ -136,6 +148,8 @@ SbxVariable::~SbxVariable() maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 ); GetSbxData_Impl()->aVars.Remove( this ); #endif + if( IsSet( SBX_DIM_AS_NEW )) + removeDimAsNewRecoverItem( this ); delete mpSbxVariableImpl; delete pCst; } @@ -315,7 +329,11 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r ) SbxValue::operator=( r ); delete mpSbxVariableImpl; if( r.mpSbxVariableImpl != NULL ) + { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); + if( mpSbxVariableImpl->m_xComListener.is() ) + registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); + } else mpSbxVariableImpl = NULL; return *this; @@ -396,10 +414,19 @@ void SbxVariable::SetDeclareClassName( const String& rDeclareClassName ) pImpl->m_aDeclareClassName = rDeclareClassName; } -void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener ) +void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener, + StarBASIC* pParentBasic ) { SbxVariableImpl* pImpl = getImpl(); pImpl->m_xComListener = xComListener; + pImpl->m_pComListenerParentBasic = pParentBasic; + registerComListenerVariableForBasic( this, pParentBasic ); +} + +void SbxVariable::ClearComListener( void ) +{ + SbxVariableImpl* pImpl = getImpl(); + pImpl->m_xComListener.clear(); } diff --git a/basic/source/uno/modsizeexceeded.cxx b/basic/source/uno/modsizeexceeded.cxx index 408b0f3f8dd4..3efc7f2d230b 100644 --- a/basic/source/uno/modsizeexceeded.cxx +++ b/basic/source/uno/modsizeexceeded.cxx @@ -27,9 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_basic.hxx" -#include "modsizeexceeded.hxx" +#include "basic/modsizeexceeded.hxx" -#include <framework/interaction.hxx> +#include <comphelper/interaction.hxx> #include <com/sun/star/script/ModuleSizeExceededRequest.hpp> using namespace com::sun::star; @@ -44,8 +44,8 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& m_aRequest <<= aReq; - m_xAbort.set( uno::Reference< task::XInteractionAbort >(new framework::ContinuationAbort), uno::UNO_QUERY ); - m_xApprove.set( uno::Reference< task::XInteractionApprove >(new framework::ContinuationApprove ), uno::UNO_QUERY ); + m_xAbort.set( uno::Reference< task::XInteractionAbort >(new comphelper::OInteractionAbort), uno::UNO_QUERY ); + m_xApprove.set( uno::Reference< task::XInteractionApprove >(new comphelper::OInteractionApprove ), uno::UNO_QUERY ); m_lContinuations.realloc( 2 ); m_lContinuations[0] = m_xApprove; m_lContinuations[1] = m_xAbort; @@ -54,15 +54,15 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& sal_Bool ModuleSizeExceeded::isAbort() const { - framework::ContinuationAbort* pBase = static_cast< framework::ContinuationAbort* >( m_xAbort.get() ); - return pBase->isSelected(); + comphelper::OInteractionAbort* pBase = static_cast< comphelper::OInteractionAbort* >( m_xAbort.get() ); + return pBase->wasSelected(); } sal_Bool ModuleSizeExceeded::isApprove() const { - framework::ContinuationApprove* pBase = static_cast< framework::ContinuationApprove* >( m_xApprove.get() ); - return pBase->isSelected(); + comphelper::OInteractionApprove* pBase = static_cast< comphelper::OInteractionApprove* >( m_xApprove.get() ); + return pBase->wasSelected(); } diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index c31aed1f8ef7..f44846972710 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -2815,19 +2815,37 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException) { - BasicManager* pBasMgr = getBasicManager(); - if( pBasMgr ) + /* The member variable mbVBACompat must be set first, the following call + to getBasicManager() may call getVBACompatibilityMode() which returns + this value. */ + mbVBACompat = _vbacompatmodeon; + if( BasicManager* pBasMgr = getBasicManager() ) { // get the standard library - String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - if ( pBasMgr->GetName().Len() ) - aLibName = pBasMgr->GetName(); + String aLibName = pBasMgr->GetName(); + if ( aLibName.Len() == 0 ) + aLibName = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); - if( pBasic ) + if( StarBASIC* pBasic = pBasMgr->GetLib( aLibName ) ) pBasic->SetVBAEnabled( _vbacompatmodeon ); + + /* If in VBA compatibility mode, force creation of the VBA Globals + object. Each application will create an instance of its own + implementation and store it in its Basic manager. Implementations + will do all necessary additional initialization, such as + registering the global "This***Doc" UNO constant, starting the + document events processor etc. + */ + if( mbVBACompat ) try + { + Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref + Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) + { + } } - mbVBACompat = _vbacompatmodeon; } // Methods XServiceInfo diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index f7091d1c1a0b..d99f98589b31 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -62,7 +62,7 @@ #include <basic/basmgr.hxx> #include <basic/sbmod.hxx> #include <basic/basicmanagerrepository.hxx> -#include "modsizeexceeded.hxx" +#include "basic/modsizeexceeded.hxx" #include <xmlscript/xmlmod_imexp.hxx> #include <cppuhelper/factory.hxx> #include <com/sun/star/util/VetoException.hpp> @@ -80,10 +80,9 @@ using namespace com::sun::star::script; using namespace com::sun::star::xml::sax; using namespace com::sun::star; using namespace cppu; -using namespace rtl; using namespace osl; -using com::sun::star::uno::Reference; +using ::rtl::OUString; //============================================================================ // Implementation class SfxScriptLibraryContainer @@ -311,24 +310,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement // aMod.aName ignored if( aMod.aModuleType.getLength() > 0 ) { - if( !getVBACompatibilityMode() ) + /* If in VBA compatibility mode, force creation of the VBA Globals + object. Each application will create an instance of its own + implementation and store it in its Basic manager. Implementations + will do all necessary additional initialization, such as + registering the global "This***Doc" UNO constant, starting the + document events processor etc. + */ + if( getVBACompatibilityMode() ) try + { + Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref + Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) { - setVBACompatibilityMode( sal_True ); - - Any aGlobs; - Sequence< Any > aArgs(1); - Reference<frame::XModel > xModel( mxOwnerDocument ); - aArgs[ 0 ] <<= xModel; - - BasicManager* pBasicMgr = getBasicManager(); - if( pBasicMgr ) - { - aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); - pBasicMgr->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); - } - pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False ); - if( pBasicMgr ) - pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] ); } script::ModuleInfo aModInfo; @@ -353,25 +349,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement RTL_CONSTASCII_STRINGPARAM("document") )) { aModInfo.ModuleType = ModuleType::DOCUMENT; - Reference<frame::XModel > xModel( mxOwnerDocument ); - Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY); - Reference< container::XNameAccess > xVBACodeNameAccess; - if( xSF.is() ) + + // #163691# use the same codename access instance for all document modules + if( !mxCodeNameAccess.is() ) try { - try - { - xVBACodeNameAccess.set( xSF->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "ooo.vba.VBAObjectModuleObjectProvider"))), - UNO_QUERY ); - } - catch(uno::Exception&) {} + Reference<frame::XModel > xModel( mxOwnerDocument ); + Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY_THROW ); + mxCodeNameAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider" ) ) ), UNO_QUERY ); } - if( xVBACodeNameAccess.is() ) + catch( Exception& ) {} + + if( mxCodeNameAccess.is() ) { try { - aModInfo.ModuleObject.set( xVBACodeNameAccess->getByName( aElementName), uno::UNO_QUERY ); + aModInfo.ModuleObject.set( mxCodeNameAccess->getByName( aElementName), uno::UNO_QUERY ); } catch(uno::Exception&) { diff --git a/configmgr/prj/build.lst b/configmgr/prj/build.lst index bbd0d7f34a9a..6043290f0914 100644 --- a/configmgr/prj/build.lst +++ b/configmgr/prj/build.lst @@ -1,4 +1,4 @@ -cg configmgr : BOOST:boost comphelper cppu cppuhelper offuh sal salhelper stlport xmlreader NULL +cg configmgr : BOOST:boost LIBXSLT:libxslt comphelper cppu cppuhelper offuh sal salhelper stlport xmlreader NULL cg configmgr\inc nmake - all cg_inc NULL cg configmgr\source nmake - all cg_source cg_inc NULL cg configmgr\qa\unoapi nmake - all cg_qa_unoapi NULL diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx index fa283cb5cf04..04ec8dc153df 100644 --- a/connectivity/inc/connectivity/sqlnode.hxx +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -231,6 +231,7 @@ namespace connectivity character_string_type, other_like_predicate_part_2, between_predicate_part_2, + cast_spec, rule_count, // letzter_wert UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID) }; diff --git a/connectivity/prj/build.lst b/connectivity/prj/build.lst index 0b15c06acf15..6d70bc71c97c 100644 --- a/connectivity/prj/build.lst +++ b/connectivity/prj/build.lst @@ -1,4 +1,4 @@ -cn connectivity : shell l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss NULL +cn connectivity : shell l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss LIBXSLT:libxslt NULL cn connectivity usr1 - all cn_mkout NULL cn connectivity\inc nmake - all cn_inc NULL cn connectivity\com\sun\star\sdbcx\comp\hsqldb nmake - all cn_jhsqldbdb cn_hsqldb cn_inc NULL diff --git a/connectivity/prj/d.lst b/connectivity/prj/d.lst index 01d82ba9177e..22bffa638254 100644 --- a/connectivity/prj/d.lst +++ b/connectivity/prj/d.lst @@ -2,6 +2,7 @@ ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib +..\%__SRC%\lib\*.jnilib %_DEST%\lib%_EXT%\*.jnilib ..\%__SRC%\slb\connectivity*.* %_DEST%\lib%_EXT%\connectivity*.* ..\%__SRC%\lib\idbt* %_DEST%\lib%_EXT%\idbt* ..\source\cpool\*.xml %_DEST%\xml%_EXT%\*.xml diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk index 5be6fa08cd7b..d0e22fde8970 100644 --- a/connectivity/source/drivers/hsqldb/makefile.mk +++ b/connectivity/source/drivers/hsqldb/makefile.mk @@ -103,6 +103,7 @@ SHL1STDLIBS=\ SHL1DEPN= +SHL1CREATEJNILIB=TRUE SHL1IMPLIB= i$(HSQLDB_TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index b8bcd5334787..8f2b3d69812a 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1425,7 +1425,8 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: { OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" }, { OSQLParseNode::character_string_type, "character_string_type" }, { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" }, - { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" } + { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" }, + { OSQLParseNode::cast_spec, "cast_spec" } }; size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] ); OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" ); @@ -2511,6 +2512,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode rString.append(m_aNodeValue); rString.appendAscii("#"); break; + case SQL_NODE_INTNUM: case SQL_NODE_APPROXNUM: { @@ -2523,6 +2525,12 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode rString.append(aTmp); } break; + case SQL_NODE_PUNCTUATION: + if ( getParent() && SQL_ISRULE(getParent(),cast_spec) && m_aNodeValue.toChar() == '(' ) // no spaces in front of '(' + { + rString.append(m_aNodeValue); + break; + } // fall through default: if (rString.getLength() && m_aNodeValue.toChar() != '.' && m_aNodeValue.toChar() != ':' ) diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index 0fedcd4c2d49..146579cab8bc 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -1,4 +1,4 @@ -dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg offuh NULL +dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg offuh filter LIBXSLT:libxslt NULL dt desktop usr1 - all dt_mkout NULL dt desktop\inc nmake - all dt_inc NULL dt desktop\prj get - all dt_prj NULL @@ -42,3 +42,6 @@ dt desktop\source\registration\com\sun\star\servicetag\resources get - a dt desktop\source\registration\com\sun\star\servicetag nmake - all sn_svctag NULL dt desktop\source\registration\com\sun\star\registration nmake - all sn_regjob sn_svctag NULL dt desktop\qa\deployment_misc nmake - all sn_qa_deployment_misc dt_dp_misc dt_inc NULL +dt desktop\test\deployment\active nmake - all dt_test_deployment_active NULL +dt desktop\test\deployment\boxt nmake - all dt_test_deployment_boxt NULL +dt desktop\test\deployment\passive nmake - all dt_test_deployment_passive NULL diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 5f52b042edf3..dcde55654a30 100755 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -106,7 +106,7 @@ #define RID_DLG_UPDATE_LINE 8 #define RID_DLG_UPDATE_HELP 9 #define RID_DLG_UPDATE_OK 10 -#define RID_DLG_UPDATE_CANCEL 11 +#define RID_DLG_UPDATE_CLOSE 11 #define RID_DLG_UPDATE_NORMALALERT 12 #define RID_DLG_UPDATE_HIGHCONTRASTALERT 13 #define RID_DLG_UPDATE_ERROR 14 @@ -127,6 +127,11 @@ #define RID_DLG_UPDATE_RELEASENOTES_LINK 29 #define RID_DLG_UPDATE_NOUPDATE 30 #define RID_DLG_UPDATE_VERSION 31 +#define RID_DLG_UPDATE_IGNORE 32 +#define RID_DLG_UPDATE_ENABLE 33 +#define RID_DLG_UPDATE_IGNORE_ALL 34 +#define RID_DLG_UPDATE_IGNORED_UPDATE 35 + #define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20) @@ -163,6 +168,7 @@ #define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95) #define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96) #define RID_STR_ERROR_MISSING_LICENSE (RID_DEPLOYMENT_GUI_START+97) +#define RID_STR_SHOW_LICENSE_CMD (RID_DEPLOYMENT_GUI_START+98) #define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100) @@ -172,6 +178,7 @@ #define RID_WARNINGBOX_REMOVE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+104) #define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105) #define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106) +#define RID_DLG_SHOW_LICENSE (RID_DEPLOYMENT_GUI_START+107) #define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index 665dbe5934d7..c9fd19c25592 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -119,6 +119,11 @@ String RID_STR_ERROR_MISSING_LICENSE Text [ en-US ] = "This extension is disabled because you haven't accepted the license yet.\n"; }; +String RID_STR_SHOW_LICENSE_CMD +{ + Text [ en-US ] = "Show license"; +}; + // Dialog layout // --------------------------------------------------- // row 1 | multi line edit @@ -293,6 +298,35 @@ ModalDialog RID_DLG_LICENSE }; +ModalDialog RID_DLG_SHOW_LICENSE +{ + Text [ en-US ] = "Extension Software License Agreement"; + Size = MAP_APPFONT( 300, 200 ); + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + Closeable = TRUE; + Sizeable = TRUE; + + MultiLineEdit ML_LICENSE + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 300 - 10, 200 - 15 - RSC_CD_PUSHBUTTON_HEIGHT ); + Border = TRUE; + VScroll = TRUE; + ReadOnly = TRUE; + }; + + OKButton RID_EM_BTN_CLOSE + { + TabStop = TRUE; + DefButton = TRUE; + Text [ en-US ] = "Close"; + Pos = MAP_APPFONT( (300-RSC_CD_PUSHBUTTON_WIDTH)/2, 200 - 5 - RSC_CD_PUSHBUTTON_HEIGHT ); + Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; +}; + WarningBox RID_WARNINGBOX_INSTALL_EXTENSION { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 44d1e30f74b6..8fd0f4c754d0 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -39,8 +39,10 @@ #include "dp_gui_theextmgr.hxx" #include "dp_gui_extensioncmdqueue.hxx" #include "dp_misc.h" +#include "dp_ucb.h" #include "dp_update.hxx" #include "dp_identifier.hxx" +#include "dp_descriptioninfoset.hxx" #include "vcl/ctrl.hxx" #include "vcl/menu.hxx" @@ -118,7 +120,8 @@ enum MENU_COMMAND CMD_REMOVE = 1, CMD_ENABLE, CMD_DISABLE, - CMD_UPDATE + CMD_UPDATE, + CMD_SHOW_LICENSE }; class ExtBoxWithBtns_Impl : public ExtensionBox_Impl @@ -224,13 +227,10 @@ const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const // ----------------------------------------------------------------------- void ExtBoxWithBtns_Impl::RecalcAll() { - ExtensionBox_Impl::RecalcAll(); - const sal_Int32 nActive = getSelIndex(); if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { - SetButtonPos( GetEntryRect( nActive ) ); SetButtonStatus( GetEntryData( nActive) ); } else @@ -239,6 +239,11 @@ void ExtBoxWithBtns_Impl::RecalcAll() m_pEnableBtn->Hide(); m_pRemoveBtn->Hide(); } + + ExtensionBox_Impl::RecalcAll(); + + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + SetButtonPos( GetEntryRect( nActive ) ); } @@ -363,28 +368,29 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) // ----------------------------------------------------------------------- MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) - { - if ( ! GetEntryData( nPos )->m_bLocked ) - { - PopupMenu aPopup; - - aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + if ( nPos >= (long) getItemCount() ) + return CMD_NONE; - if ( GetEntryData( nPos )->m_bUser ) - { - 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 ) ); - } + PopupMenu aPopup; - aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - return (MENU_COMMAND) aPopup.Execute( this, rPos ); + if ( ! GetEntryData( nPos )->m_bLocked ) + { + if ( GetEntryData( nPos )->m_bUser ) + { + 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, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); } - return CMD_NONE; + + if ( GetEntryData( nPos )->m_sLicenseText.Len() ) + aPopup.InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) ); + + return (MENU_COMMAND) aPopup.Execute( this, rPos ); } //------------------------------------------------------------------------------ @@ -409,6 +415,12 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) break; case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage ); break; + case CMD_SHOW_LICENSE: + { + ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage ); + aLicenseDlg.Execute(); + break; + } } } else if ( rMEvt.IsLeft() ) @@ -1742,6 +1754,42 @@ void UpdateRequiredDialog::disableAllEntries() m_aCloseBtn.SetText( m_sCloseText ); } +//------------------------------------------------------------------------------ +// ShowLicenseDialog +//------------------------------------------------------------------------------ +ShowLicenseDialog::ShowLicenseDialog( Window * pParent, + const uno::Reference< deployment::XPackage > &xPackage ) : + ModalDialog( pParent, DialogHelper::getResId( RID_DLG_SHOW_LICENSE ) ), + m_aLicenseText( this, DialogHelper::getResId( ML_LICENSE ) ), + m_aCloseBtn( this, DialogHelper::getResId( RID_EM_BTN_CLOSE ) ) +{ + FreeResource(); + + OUString aText = xPackage->getLicenseText(); + m_aLicenseText.SetText( aText ); +} + +//------------------------------------------------------------------------------ +ShowLicenseDialog::~ShowLicenseDialog() +{} + +//------------------------------------------------------------------------------ +void ShowLicenseDialog::Resize() +{ + Size aTotalSize( GetOutputSizePixel() ); + Size aTextSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_TOP - 2*RSC_SP_DLG_INNERBORDER_BOTTOM + - m_aCloseBtn.GetSizePixel().Height() ); + + m_aLicenseText.SetPosSizePixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ), + aTextSize ); + + Point aBtnPos( (aTotalSize.Width() - m_aCloseBtn.GetSizePixel().Width())/2, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM + - m_aCloseBtn.GetSizePixel().Height() ); + m_aCloseBtn.SetPosPixel( aBtnPos ); +} + //================================================================================= // UpdateRequiredDialogService //================================================================================= diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index f0a85cce98c0..755c3aadcbdf 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -35,6 +35,7 @@ #include "svtools/fixedhyper.hxx" #include "svtools/prgsbar.hxx" +#include "svtools/svmedit.hxx" #include "osl/conditn.hxx" #include "osl/mutex.hxx" @@ -246,6 +247,20 @@ public: }; //============================================================================== +class ShowLicenseDialog : public ModalDialog +{ + MultiLineEdit m_aLicenseText; + OKButton m_aCloseBtn; + +public: + ShowLicenseDialog( Window * pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + virtual ~ShowLicenseDialog(); + + virtual void Resize(); +}; + +//============================================================================== class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog > { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 5f9de3965199..54495de410dc 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -76,6 +76,7 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_sTitle = xPackage->getDisplayName(); m_sVersion = xPackage->getVersion(); m_sDescription = xPackage->getDescription(); + m_sLicenseText = xPackage->getLicenseText(); beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); m_sPublisher = aInfo.First; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 762f50296690..cbf9e27a8da1 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -81,6 +81,7 @@ struct Entry_Impl String m_sPublisher; String m_sPublisherURL; String m_sErrorText; + String m_sLicenseText; Image m_aIcon; Image m_aIconHC; svt::FixedHyperlink *m_pPublisher; diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index 76eb8af31e8e..1112de0b34e8 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -28,6 +28,7 @@ #define INCLUDED_DP_GUI_UPDATEDATA_HXX #include "sal/config.h" +#include "tools/solar.h" #include "rtl/ustring.hxx" #include "com/sun/star/uno/Reference.hxx" @@ -80,6 +81,10 @@ struct UpdateData //are to be ignored. ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aUpdateSource; + + // ID to find this entry in the update listbox + USHORT m_nID; + bool m_bIgnored; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index b27cd8da81fe..44f335dd509d 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -50,7 +50,9 @@ #include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/container/XNameContainer.hpp" #include "com/sun/star/deployment/DeploymentException.hpp" #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" @@ -62,6 +64,7 @@ #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/lang/IllegalArgumentException.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/system/XSystemShellExecute.hpp" #include "com/sun/star/task/XAbortChannel.hpp" @@ -76,6 +79,7 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/URL.hpp" +#include "com/sun/star/util/XChangesBatch.hpp" #include "com/sun/star/util/XURLTransformer.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/XNode.hpp" @@ -129,16 +133,23 @@ namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } -namespace css = ::com::sun::star; - +using namespace ::com::sun::star; using dp_gui::UpdateDialog; namespace { static sal_Unicode const LF = 0x000A; static sal_Unicode const CR = 0x000D; +static const USHORT CMD_ENABLE_UPDATE = 1; +static const USHORT CMD_IGNORE_UPDATE = 2; +static const USHORT CMD_IGNORE_ALL_UPDATES = 3; + +#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) + +#define IGNORED_UPDATES OUSTR("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates") +#define PROPERTY_VERSION OUSTR("Version") -enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, GENERAL_ERROR, SPECIFIC_ERROR }; +enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, SPECIFIC_ERROR }; rtl::OUString confineToParagraph(rtl::OUString const & text) { // Confine arbitrary text to a single paragraph in a dp_gui::AutoScrollEdit. @@ -151,86 +162,64 @@ rtl::OUString confineToParagraph(rtl::OUString const & text) { struct UpdateDialog::DisabledUpdate { rtl::OUString name; - css::uno::Sequence< rtl::OUString > unsatisfiedDependencies; + uno::Sequence< rtl::OUString > unsatisfiedDependencies; // We also want to show release notes and publisher for disabled updates ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo; + USHORT m_nID; }; struct UpdateDialog::SpecificError { rtl::OUString name; rtl::OUString message; + USHORT m_nID; }; -union UpdateDialog::IndexUnion{ - std::vector< dp_gui::UpdateData >::size_type enabledUpdate; - std::vector< UpdateDialog::DisabledUpdate >::size_type disabledUpdate; - std::vector< rtl::OUString >::size_type generalError; - std::vector< UpdateDialog::SpecificError >::size_type specificError; -}; - -struct UpdateDialog::Index { - static std::auto_ptr< UpdateDialog::Index const > newEnabledUpdate( - std::vector< dp_gui::UpdateData >::size_type n); - - static std::auto_ptr< UpdateDialog::Index const > newDisabledUpdate( - std::vector< UpdateDialog::DisabledUpdate >::size_type n); +//------------------------------------------------------------------------------ +struct UpdateDialog::IgnoredUpdate { + rtl::OUString sExtensionID; + rtl::OUString sVersion; + bool bRemoved; - static std::auto_ptr< UpdateDialog::Index const > newGeneralError( - std::vector< rtl::OUString >::size_type n); - - static std::auto_ptr< UpdateDialog::Index const > newSpecificError( - std::vector< UpdateDialog::SpecificError >::size_type n); - - Kind kind; - IndexUnion index; - -private: - explicit Index(Kind theKind); + IgnoredUpdate( const rtl::OUString &rExtensionID, const rtl::OUString &rVersion ); }; -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newEnabledUpdate( - std::vector< dp_gui::UpdateData >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(ENABLED_UPDATE); - p->index.enabledUpdate = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} - -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newDisabledUpdate( - std::vector< UpdateDialog::DisabledUpdate >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(DISABLED_UPDATE); - p->index.disabledUpdate = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} +//------------------------------------------------------------------------------ +UpdateDialog::IgnoredUpdate::IgnoredUpdate( const rtl::OUString &rExtensionID, const rtl::OUString &rVersion ): + sExtensionID( rExtensionID ), + sVersion( rVersion ), + bRemoved( false ) +{} -std::auto_ptr< UpdateDialog::Index const > UpdateDialog::Index::newGeneralError( - std::vector< rtl::OUString >::size_type n) +//------------------------------------------------------------------------------ +struct UpdateDialog::Index { - UpdateDialog::Index * p = new UpdateDialog::Index(GENERAL_ERROR); - p->index.generalError = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} + Kind m_eKind; + bool m_bIgnored; + USHORT m_nID; + USHORT m_nIndex; + rtl::OUString m_aName; -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newSpecificError( - std::vector< UpdateDialog::SpecificError >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(SPECIFIC_ERROR); - p->index.specificError = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} + Index( Kind theKind, USHORT nID, USHORT nIndex, const rtl::OUString &rName ); +}; -UpdateDialog::Index::Index(Kind theKind): kind(theKind) {} +//------------------------------------------------------------------------------ +UpdateDialog::Index::Index( Kind theKind, USHORT nID, USHORT nIndex, const rtl::OUString &rName ): + m_eKind( theKind ), + m_bIgnored( false ), + m_nID( nID ), + m_nIndex( nIndex ), + m_aName( rName ) +{} +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ class UpdateDialog::Thread: public dp_gui::Thread { public: Thread( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< css::uno::Reference< css::deployment::XPackage > > & vExtensionList); + const std::vector< uno::Reference< deployment::XPackage > > & vExtensionList); void stop(); @@ -240,16 +229,16 @@ private: struct Entry { explicit Entry( - css::uno::Reference< css::deployment::XPackage > const & thePackage, + uno::Reference< deployment::XPackage > const & thePackage, rtl::OUString const & theVersion); - css::uno::Reference< css::deployment::XPackage > package; + uno::Reference< deployment::XPackage > package; rtl::OUString version; //Indicates that the extension provides its own update URLs. //If this is true, then we must not use the default update //URL to find the update information. bool bProvidesOwnUpdate; - css::uno::Reference< css::xml::dom::XNode > info; + uno::Reference< xml::dom::XNode > info; UpdateDialog::DisabledUpdate disableUpdate; dp_gui::UpdateData updateData; }; @@ -261,20 +250,20 @@ private: virtual void execute(); #if 0 - void handleGeneralError(css::uno::Any const & exception) const; + void handleGeneralError(uno::Any const & exception) const; #endif void handleSpecificError( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Any const & exception) const; + uno::Reference< deployment::XPackage > const & package, + uno::Any const & exception) const; - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > + uno::Sequence< uno::Reference< xml::dom::XElement > > getUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Sequence< rtl::OUString > const & urls, + uno::Reference< deployment::XPackage > const & package, + uno::Sequence< rtl::OUString > const & urls, rtl::OUString const & identifier) const; void getOwnUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, + uno::Reference< deployment::XPackage > const & package, Map * map); ::rtl::OUString getUpdateDisplayString( @@ -286,40 +275,40 @@ private: dp_gui::UpdateData & out_data) const; bool update( - UpdateDialog::DisabledUpdate const & du, - dp_gui::UpdateData const & data) const; + UpdateDialog::DisabledUpdate & du, + dp_gui::UpdateData & data) const; - css::uno::Reference< css::uno::XComponentContext > m_context; + uno::Reference< uno::XComponentContext > m_context; UpdateDialog & m_dialog; - std::vector< css::uno::Reference< css::deployment::XPackage > > m_vExtensionList; - css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation; - css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHdl; + std::vector< uno::Reference< deployment::XPackage > > m_vExtensionList; + uno::Reference< deployment::XUpdateInformationProvider > m_updateInformation; + uno::Reference< task::XInteractionHandler > m_xInteractionHdl; // guarded by Application::GetSolarMutex(): - css::uno::Reference< css::task::XAbortChannel > m_abort; + uno::Reference< task::XAbortChannel > m_abort; bool m_stop; }; UpdateDialog::Thread::Thread( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< css::uno::Reference< css::deployment::XPackage > > &vExtensionList): + const std::vector< uno::Reference< deployment::XPackage > > &vExtensionList): m_context(context), m_dialog(dialog), m_vExtensionList(vExtensionList), m_updateInformation( - css::deployment::UpdateInformationProvider::create(context)), + deployment::UpdateInformationProvider::create(context)), m_stop(false) { if( m_context.is() ) { - css::uno::Reference< css::lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); + uno::Reference< lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); if( xServiceManager.is() ) { - m_xInteractionHdl = css::uno::Reference< css::task::XInteractionHandler > ( + m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( xServiceManager->createInstanceWithContext( OUSTR( "com.sun.star.task.InteractionHandler" ), m_context), - css::uno::UNO_QUERY ); + uno::UNO_QUERY ); if ( m_xInteractionHdl.is() ) m_updateInformation->setInteractionHandler( m_xInteractionHdl ); } @@ -327,7 +316,7 @@ UpdateDialog::Thread::Thread( } void UpdateDialog::Thread::stop() { - css::uno::Reference< css::task::XAbortChannel > abort; + uno::Reference< task::XAbortChannel > abort; { vos::OGuard g(Application::GetSolarMutex()); abort = m_abort; @@ -340,7 +329,7 @@ void UpdateDialog::Thread::stop() { } UpdateDialog::Thread::Entry::Entry( - css::uno::Reference< css::deployment::XPackage > const & thePackage, + uno::Reference< deployment::XPackage > const & thePackage, rtl::OUString const & theVersion): package(thePackage), @@ -353,7 +342,7 @@ UpdateDialog::Thread::Entry::Entry( UpdateDialog::Thread::~Thread() { if ( m_xInteractionHdl.is() ) - m_updateInformation->setInteractionHandler( css::uno::Reference< css::task::XInteractionHandler > () ); + m_updateInformation->setInteractionHandler( uno::Reference< task::XInteractionHandler > () ); } void UpdateDialog::Thread::execute() @@ -364,16 +353,16 @@ void UpdateDialog::Thread::execute() return; } } - css::uno::Reference<css::deployment::XExtensionManager> extMgr = - css::deployment::ExtensionManager::get(m_context); + uno::Reference<deployment::XExtensionManager> extMgr = + deployment::ExtensionManager::get(m_context); - std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, css::uno::Any > > errors; + std::vector<std::pair<uno::Reference<deployment::XPackage>, uno::Any > > errors; dp_misc::UpdateInfoMap updateInfoMap = dp_misc::getOnlineUpdateInfos( m_context, extMgr, m_updateInformation, &m_vExtensionList, errors); - typedef std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, - css::uno::Any> >::const_iterator ITERROR; + typedef std::vector<std::pair<uno::Reference<deployment::XPackage>, + uno::Any> >::const_iterator ITERROR; for (ITERROR ite = errors.begin(); ite != errors.end(); ite ++) handleSpecificError(ite->first, ite->second); @@ -392,12 +381,12 @@ void UpdateDialog::Thread::execute() rtl::OUString sVersionUser; rtl::OUString sVersionShared; rtl::OUString sVersionBundled; - css::uno::Sequence< css::uno::Reference< css::deployment::XPackage> > extensions; + uno::Sequence< uno::Reference< deployment::XPackage> > extensions; try { extensions = extMgr->getExtensionsWithSameIdentifier( dp_misc::getIdentifier(info.extension), info.extension->getName(), - css::uno::Reference<css::ucb::XCommandEnvironment>()); - } catch (css::lang::IllegalArgumentException& ) { + uno::Reference<ucb::XCommandEnvironment>()); + } catch (lang::IllegalArgumentException& ) { OSL_ASSERT(0); } OSL_ASSERT(extensions.getLength() == 3); @@ -415,7 +404,7 @@ void UpdateDialog::Thread::execute() dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension( bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion); - css::uno::Reference<css::deployment::XPackage> updateSource; + uno::Reference<deployment::XPackage> updateSource; if (sourceUser != dp_misc::UPDATE_SOURCE_NONE) { if (sourceUser == dp_misc::UPDATE_SOURCE_SHARED) @@ -452,11 +441,11 @@ void UpdateDialog::Thread::execute() } } #if 0 -void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) +void UpdateDialog::Thread::handleGeneralError(uno::Any const & exception) const { rtl::OUString message; - css::uno::Exception e; + uno::Exception e; if (exception >>= e) { message = e.Message; } @@ -468,13 +457,13 @@ void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) #endif //Parameter package can be null void UpdateDialog::Thread::handleSpecificError( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Any const & exception) const + uno::Reference< deployment::XPackage > const & package, + uno::Any const & exception) const { UpdateDialog::SpecificError data; if (package.is()) data.name = package->getDisplayName(); - css::uno::Exception e; + uno::Exception e; if (exception >>= e) { data.message = e.Message; } @@ -516,7 +505,7 @@ void UpdateDialog::Thread::handleSpecificError( /** out_data will only be filled if all dependencies are ok. */ void UpdateDialog::Thread::prepareUpdateData( - css::uno::Reference< css::xml::dom::XNode > const & updateInfo, + uno::Reference< xml::dom::XNode > const & updateInfo, UpdateDialog::DisabledUpdate & out_du, dp_gui::UpdateData & out_data) const { @@ -524,7 +513,7 @@ void UpdateDialog::Thread::prepareUpdateData( return; dp_misc::DescriptionInfoset infoset(m_context, updateInfo); OSL_ASSERT(infoset.getVersion().getLength() != 0); - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > ds( + uno::Sequence< uno::Reference< xml::dom::XElement > > ds( dp_misc::Dependencies::check(infoset)); out_du.aUpdateInfo = updateInfo; @@ -547,8 +536,8 @@ void UpdateDialog::Thread::prepareUpdateData( } bool UpdateDialog::Thread::update( - UpdateDialog::DisabledUpdate const & du, - dp_gui::UpdateData const & data) const + UpdateDialog::DisabledUpdate & du, + dp_gui::UpdateData & data) const { bool ret = false; if (du.unsatisfiedDependencies.getLength() == 0) @@ -570,9 +559,9 @@ bool UpdateDialog::Thread::update( // UpdateDialog ---------------------------------------------------------- UpdateDialog::UpdateDialog( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, Window * parent, - const std::vector<css::uno::Reference< css::deployment::XPackage > > &vExtensionList, + const std::vector<uno::Reference< deployment::XPackage > > &vExtensionList, std::vector< dp_gui::UpdateData > * updateData): ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)), m_context(context), @@ -592,7 +581,7 @@ UpdateDialog::UpdateDialog( m_line(this, DpGuiResId(RID_DLG_UPDATE_LINE)), m_help(this, DpGuiResId(RID_DLG_UPDATE_HELP)), m_ok(this, DpGuiResId(RID_DLG_UPDATE_OK)), - m_cancel(this, DpGuiResId(RID_DLG_UPDATE_CANCEL)), + m_close(this, DpGuiResId(RID_DLG_UPDATE_CLOSE)), m_error(String(DpGuiResId(RID_DLG_UPDATE_ERROR))), m_none(String(DpGuiResId(RID_DLG_UPDATE_NONE))), m_noInstallable(String(DpGuiResId(RID_DLG_UPDATE_NOINSTALLABLE))), @@ -604,71 +593,84 @@ UpdateDialog::UpdateDialog( m_noDependencyCurVer(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY_CUR_VER))), m_browserbased(String(DpGuiResId(RID_DLG_UPDATE_BROWSERBASED))), m_version(String(DpGuiResId(RID_DLG_UPDATE_VERSION))), + m_ignoredUpdate(String(DpGuiResId(RID_DLG_UPDATE_IGNORED_UPDATE))), m_updateData(*updateData), m_thread( new UpdateDialog::Thread( context, *this, vExtensionList)), m_nFirstLineDelta(0), - m_nOneLineMissing(0) + m_nOneLineMissing(0), + m_nLastID(1), + m_bModified( false ) // TODO: check! // , // m_extensionManagerDialog(extensionManagerDialog) { OSL_ASSERT(updateData != NULL); - m_xExtensionManager = css::deployment::ExtensionManager::get( context ); + m_xExtensionManager = deployment::ExtensionManager::get( context ); - css::uno::Reference< css::awt::XToolkit > toolkit; + uno::Reference< awt::XToolkit > toolkit; try { - toolkit = css::uno::Reference< css::awt::XToolkit >( - (css::uno::Reference< css::lang::XMultiComponentFactory >( + toolkit = uno::Reference< awt::XToolkit >( + (uno::Reference< lang::XMultiComponentFactory >( m_context->getServiceManager(), - css::uno::UNO_QUERY_THROW)-> + uno::UNO_QUERY_THROW)-> createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")), m_context)), - css::uno::UNO_QUERY_THROW); - } catch (css::uno::RuntimeException &) { + uno::UNO_QUERY_THROW); + } catch (uno::RuntimeException &) { throw; - } catch (css::uno::Exception & e) { - throw css::uno::RuntimeException(e.Message, e.Context); + } catch (uno::Exception & e) { + throw uno::RuntimeException(e.Message, e.Context); } Control c(this, DpGuiResId(RID_DLG_UPDATE_THROBBER)); Point pos(c.GetPosPixel()); Size size(c.GetSizePixel()); try { - m_throbber = css::uno::Reference< css::awt::XThrobber >( + m_throbber = uno::Reference< awt::XThrobber >( toolkit->createWindow( - css::awt::WindowDescriptor( - css::awt::WindowClass_SIMPLE, + awt::WindowDescriptor( + awt::WindowClass_SIMPLE, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber")), GetComponentInterface(), 0, - css::awt::Rectangle( + awt::Rectangle( pos.X(), pos.Y(), size.Width(), size.Height()), - css::awt::WindowAttribute::SHOW)), - css::uno::UNO_QUERY_THROW); - } catch (css::lang::IllegalArgumentException & e) { - throw css::uno::RuntimeException(e.Message, e.Context); + awt::WindowAttribute::SHOW)), + uno::UNO_QUERY_THROW); + } catch (lang::IllegalArgumentException & e) { + throw uno::RuntimeException(e.Message, e.Context); } m_updates.SetSelectHdl(LINK(this, UpdateDialog, selectionHandler)); m_all.SetToggleHdl(LINK(this, UpdateDialog, allHandler)); m_ok.SetClickHdl(LINK(this, UpdateDialog, okHandler)); - m_cancel.SetClickHdl(LINK(this, UpdateDialog, cancelHandler)); + m_close.SetClickHdl(LINK(this, UpdateDialog, closeHandler)); if ( ! dp_misc::office_is_running()) m_help.Disable(); FreeResource(); initDescription(); + getIgnoredUpdates(); } -UpdateDialog::~UpdateDialog() { - for (USHORT i = 0; i < m_updates.getItemCount(); ++i) { - delete static_cast< UpdateDialog::Index const * >( - m_updates.GetEntryData(i)); +//------------------------------------------------------------------------------ +UpdateDialog::~UpdateDialog() +{ + storeIgnoredUpdates(); + + for ( std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); i != m_ListboxEntries.end(); ++i ) + { + delete (*i); + } + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + delete (*i); } } +//------------------------------------------------------------------------------ BOOL UpdateDialog::Close() { m_thread->stop(); return ModalDialog::Close(); @@ -680,29 +682,45 @@ short UpdateDialog::Execute() { return ModalDialog::Execute(); } -UpdateDialog::CheckListBox::CheckListBox( - UpdateDialog & dialog, ResId const & resource, - Image const & normalStaticImage, Image const & highContrastStaticImage): - SvxCheckListBox( - &dialog, resource, normalStaticImage, highContrastStaticImage), +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +UpdateDialog::CheckListBox::CheckListBox( UpdateDialog & dialog, ResId const & resource, + Image const & normalStaticImage, + Image const & highContrastStaticImage ): + SvxCheckListBox( &dialog, resource, normalStaticImage, highContrastStaticImage ), + m_ignoreUpdate( String( DpGuiResId( RID_DLG_UPDATE_IGNORE ) ) ), + m_ignoreAllUpdates( String( DpGuiResId( RID_DLG_UPDATE_IGNORE_ALL ) ) ), + m_enableUpdate( String( DpGuiResId( RID_DLG_UPDATE_ENABLE ) ) ), m_dialog(dialog) {} +//------------------------------------------------------------------------------ UpdateDialog::CheckListBox::~CheckListBox() {} +//------------------------------------------------------------------------------ USHORT UpdateDialog::CheckListBox::getItemCount() const { ULONG i = GetEntryCount(); OSL_ASSERT(i <= std::numeric_limits< USHORT >::max()); return sal::static_int_cast< USHORT >(i); } -void UpdateDialog::CheckListBox::MouseButtonDown(MouseEvent const & event) { +//------------------------------------------------------------------------------ +void UpdateDialog::CheckListBox::MouseButtonDown( MouseEvent const & event ) +{ // When clicking on a selected entry in an SvxCheckListBox, the entry's // checkbox is toggled on mouse button down: - SvxCheckListBox::MouseButtonDown(event); + SvxCheckListBox::MouseButtonDown( event ); + + if ( event.IsRight() ) + { + handlePopupMenu( event.GetPosPixel() ); + } + m_dialog.enableOk(); } +//------------------------------------------------------------------------------ void UpdateDialog::CheckListBox::MouseButtonUp(MouseEvent const & event) { // When clicking on an entry's checkbox in an SvxCheckListBox, the entry's // checkbox is toggled on mouse button up: @@ -715,25 +733,82 @@ void UpdateDialog::CheckListBox::KeyInput(KeyEvent const & event) { m_dialog.enableOk(); } -void UpdateDialog::insertItem( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, SvLBoxButtonKind kind) +//------------------------------------------------------------------------------ +void UpdateDialog::CheckListBox::handlePopupMenu( const Point &rPos ) { - m_updates.InsertEntry( - name, position, - const_cast< void * >(static_cast< void const * >(index.release())), - kind); - //TODO #i72487#: UpdateDialog::Index potentially leaks as the exception - // behavior of SvxCheckListBox::InsertEntry is unspecified + SvListEntry *pData = GetEntry( rPos ); + + if ( pData ) + { + USHORT nEntryPos = GetSelectEntryPos(); + UpdateDialog::Index * p = static_cast< UpdateDialog::Index * >( GetEntryData( nEntryPos ) ); + + if ( ( p->m_eKind == ENABLED_UPDATE ) || ( p->m_eKind == DISABLED_UPDATE ) ) + { + PopupMenu aPopup; + + if ( p->m_bIgnored ) + aPopup.InsertItem( CMD_ENABLE_UPDATE, m_enableUpdate ); + else + { + aPopup.InsertItem( CMD_IGNORE_UPDATE, m_ignoreUpdate ); + aPopup.InsertItem( CMD_IGNORE_ALL_UPDATES, m_ignoreAllUpdates ); + } + + USHORT aCmd = aPopup.Execute( this, rPos ); + if ( ( aCmd == CMD_IGNORE_UPDATE ) || ( aCmd == CMD_IGNORE_ALL_UPDATES ) ) + { + p->m_bIgnored = true; + if ( p->m_eKind == ENABLED_UPDATE ) + { + RemoveEntry( nEntryPos ); + m_dialog.addAdditional( p, SvLBoxButtonKind_disabledCheckbox ); + } + if ( aCmd == CMD_IGNORE_UPDATE ) + m_dialog.setIgnoredUpdate( p, true, false ); + else + m_dialog.setIgnoredUpdate( p, true, true ); + // TODO: reselect entry to display new description! + } + else if ( aCmd == CMD_ENABLE_UPDATE ) + { + p->m_bIgnored = false; + if ( p->m_eKind == ENABLED_UPDATE ) + { + RemoveEntry( nEntryPos ); + m_dialog.insertItem( p, SvLBoxButtonKind_enabledCheckbox ); + } + m_dialog.setIgnoredUpdate( p, false, false ); + } + } + } } -void UpdateDialog::addAdditional( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, SvLBoxButtonKind kind) +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +USHORT UpdateDialog::insertItem( UpdateDialog::Index *pEntry, SvLBoxButtonKind kind ) +{ + m_updates.InsertEntry( pEntry->m_aName, LISTBOX_APPEND, static_cast< void * >( pEntry ), kind ); + + for ( USHORT i = m_updates.getItemCount(); i != 0 ; ) + { + i -= 1; + UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData( i ) ); + if ( p == pEntry ) + return i; + } + OSL_ASSERT(0); + return 0; +} + +//------------------------------------------------------------------------------ +void UpdateDialog::addAdditional( UpdateDialog::Index * index, SvLBoxButtonKind kind ) { m_all.Enable(); - if (m_all.IsChecked()) { - insertItem(name, position, index, kind); + if (m_all.IsChecked()) + { + insertItem( index, kind ); m_update.Enable(); m_updates.Enable(); m_description.Enable(); @@ -741,71 +816,81 @@ void UpdateDialog::addAdditional( } } -void UpdateDialog::addEnabledUpdate( - rtl::OUString const & name, dp_gui::UpdateData const & data) +//------------------------------------------------------------------------------ +void UpdateDialog::addEnabledUpdate( rtl::OUString const & name, + dp_gui::UpdateData & data ) { - std::vector< dp_gui::UpdateData >::size_type n = m_enabledUpdates.size(); - m_enabledUpdates.push_back(data); - insertItem( - name, sal::static_int_cast< USHORT >(n), - UpdateDialog::Index::newEnabledUpdate(n), - SvLBoxButtonKind_enabledCheckbox); - // position overflow is rather harmless - m_updates.CheckEntryPos(sal::static_int_cast< USHORT >(n)); - //TODO #i72487#: fragile computation; insertItem should instead return - // pos + USHORT nIndex = sal::static_int_cast< USHORT >( m_enabledUpdates.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( ENABLED_UPDATE, m_nLastID, nIndex, name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_enabledUpdates.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + if ( ! isIgnoredUpdate( pEntry ) ) + { + USHORT nPos = insertItem( pEntry, SvLBoxButtonKind_enabledCheckbox ); + m_updates.CheckEntryPos( nPos ); + } + else + addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox ); + m_update.Enable(); m_updates.Enable(); m_description.Enable(); m_descriptions.Enable(); } -void UpdateDialog::addDisabledUpdate(UpdateDialog::DisabledUpdate const & data) +//------------------------------------------------------------------------------ +void UpdateDialog::addDisabledUpdate( UpdateDialog::DisabledUpdate & data ) { - std::vector< UpdateDialog::DisabledUpdate >::size_type n = - m_disabledUpdates.size(); - m_disabledUpdates.push_back(data); - addAdditional( - data.name, sal::static_int_cast< USHORT >(m_enabledUpdates.size() + n), - UpdateDialog::Index::newDisabledUpdate(n), - SvLBoxButtonKind_disabledCheckbox); - // position overflow is rather harmless -} -#if 0 -void UpdateDialog::addGeneralError(rtl::OUString const & message) { - std::vector< rtl::OUString >::size_type n = m_generalErrors.size(); - m_generalErrors.push_back(message); - addAdditional( - m_error, - sal::static_int_cast< USHORT >( - m_enabledUpdates.size() + m_disabledUpdates.size() + n), - UpdateDialog::Index::newGeneralError(n), SvLBoxButtonKind_staticImage); - // position overflow is rather harmless + USHORT nIndex = sal::static_int_cast< USHORT >( m_disabledUpdates.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, m_nLastID, nIndex, data.name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_disabledUpdates.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + isIgnoredUpdate( pEntry ); + addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox ); } -#endif -void UpdateDialog::addSpecificError(UpdateDialog::SpecificError const & data) { - std::vector< UpdateDialog::SpecificError >::size_type n = - m_specificErrors.size(); - m_specificErrors.push_back(data); - addAdditional( - data.name, LISTBOX_APPEND, UpdateDialog::Index::newSpecificError(n), - SvLBoxButtonKind_staticImage); + +//------------------------------------------------------------------------------ +void UpdateDialog::addSpecificError( UpdateDialog::SpecificError & data ) +{ + USHORT nIndex = sal::static_int_cast< USHORT >( m_specificErrors.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, m_nLastID, nIndex, data.name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_specificErrors.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + addAdditional( pEntry, SvLBoxButtonKind_staticImage); } void UpdateDialog::checkingDone() { m_checking.Hide(); m_throbber->stop(); - css::uno::Reference< css::awt::XWindow >( - m_throbber, css::uno::UNO_QUERY_THROW)->setVisible(false); + uno::Reference< awt::XWindow >( + m_throbber, uno::UNO_QUERY_THROW)->setVisible(false); if (m_updates.getItemCount() == 0) { clearDescription(); m_description.Enable(); m_descriptions.Enable(); - showDescription( - ( m_disabledUpdates.empty() && m_generalErrors.empty() && m_specificErrors.empty() ) - ? m_none : m_noInstallable, false ); + + if ( m_disabledUpdates.empty() && m_specificErrors.empty() && m_ignoredUpdates.empty() ) + showDescription( m_none, false ); + else + showDescription( m_noInstallable, false ); } + enableOk(); } @@ -817,7 +902,7 @@ void UpdateDialog::enableOk() { // ********************************************************************************* void UpdateDialog::createNotifyJob( bool bPrepareOnly, - css::uno::Sequence< css::uno::Sequence< rtl::OUString > > &rItemList ) + uno::Sequence< uno::Sequence< rtl::OUString > > &rItemList ) { if ( !dp_misc::office_is_running() ) return; @@ -825,51 +910,51 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, // notify update check job try { - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xConfigProvider( xFactory->createInstance( OUSTR( "com.sun.star.configuration.ConfigurationProvider" )), - css::uno::UNO_QUERY_THROW); + uno::UNO_QUERY_THROW); - css::beans::PropertyValue aProperty; + beans::PropertyValue aProperty; aProperty.Name = OUSTR( "nodepath" ); - aProperty.Value = css::uno::makeAny( OUSTR("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); + aProperty.Value = uno::makeAny( OUSTR("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); - css::uno::Sequence< css::uno::Any > aArgumentList( 1 ); - aArgumentList[0] = css::uno::makeAny( aProperty ); + uno::Sequence< uno::Any > aArgumentList( 1 ); + aArgumentList[0] = uno::makeAny( aProperty ); - css::uno::Reference< css::container::XNameAccess > xNameAccess( + uno::Reference< container::XNameAccess > xNameAccess( xConfigProvider->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ), - css::uno::UNO_QUERY_THROW ); + uno::UNO_QUERY_THROW ); - css::util::URL aURL; + util::URL aURL; xNameAccess->getByName(OUSTR("URL")) >>= aURL.Complete; - css::uno::Reference < css::util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), - css::uno::UNO_QUERY_THROW ); + uno::Reference < util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), + uno::UNO_QUERY_THROW ); xTransformer->parseStrict(aURL); - css::uno::Reference < css::frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), - css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), - css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); + uno::Reference < frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); if( xDispatch.is() ) { - css::uno::Sequence< css::beans::PropertyValue > aPropList(2); + uno::Sequence< beans::PropertyValue > aPropList(2); aProperty.Name = OUSTR( "updateList" ); - aProperty.Value = css::uno::makeAny( rItemList ); + aProperty.Value = uno::makeAny( rItemList ); aPropList[0] = aProperty; aProperty.Name = OUSTR( "prepareOnly" ); - aProperty.Value = css::uno::makeAny( bPrepareOnly ); + aProperty.Value = uno::makeAny( bPrepareOnly ); aPropList[1] = aProperty; xDispatch->dispatch(aURL, aPropList ); } } - catch( const css::uno::Exception& e ) + catch( const uno::Exception& e ) { dp_misc::TRACE( OUSTR("Caught exception: ") + e.Message + OUSTR("\n thread terminated.\n\n")); @@ -882,26 +967,26 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) if ( !dp_misc::office_is_running() ) return; - css::uno::Sequence< css::uno::Sequence< rtl::OUString > > aItemList; + uno::Sequence< uno::Sequence< rtl::OUString > > aItemList; sal_Int32 nCount = 0; if ( ! bRecheckOnly ) { for ( sal_Int16 i = 0; i < m_updates.getItemCount(); ++i ) { - css::uno::Sequence< rtl::OUString > aItem(2); + uno::Sequence< rtl::OUString > aItem(2); UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >(m_updates.GetEntryData(i)); - if ( p->kind == ENABLED_UPDATE ) + if ( p->m_eKind == ENABLED_UPDATE ) { - dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->index.enabledUpdate ]; + dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->m_nIndex ]; aItem[0] = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); dp_misc::DescriptionInfoset aInfoset( m_context, aUpdData.aUpdateInfo ); aItem[1] = aInfoset.getVersion(); } - else if ( p->kind == DISABLED_UPDATE ) + else if ( p->m_eKind == DISABLED_UPDATE ) continue; else continue; @@ -911,6 +996,8 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) nCount += 1; } } + + storeIgnoredUpdates(); createNotifyJob( bPrepareOnly, aItemList ); } @@ -984,17 +1071,17 @@ void UpdateDialog::clearDescription() m_descriptions.SetPosSizePixel( m_aFirstLinePos, m_aFirstLineSize ); } -bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > const & aUpdateInfo) +bool UpdateDialog::showDescription(uno::Reference< xml::dom::XNode > const & aUpdateInfo) { dp_misc::DescriptionInfoset infoset(m_context, aUpdateInfo); return showDescription(infoset.getLocalizedPublisherNameAndURL(), infoset.getLocalizedReleaseNotesURL()); } -bool UpdateDialog::showDescription(css::uno::Reference< css::deployment::XPackage > const & aExtension) +bool UpdateDialog::showDescription(uno::Reference< deployment::XPackage > const & aExtension) { OSL_ASSERT(aExtension.is()); - css::beans::StringPair pubInfo = aExtension->getPublisherInfo(); + beans::StringPair pubInfo = aExtension->getPublisherInfo(); return showDescription(std::make_pair(pubInfo.First, pubInfo.Second), OUSTR("")); } @@ -1057,7 +1144,7 @@ bool UpdateDialog::showDescription( const String& rDescription, bool bWithPublis return true; } -bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const +bool UpdateDialog::isReadOnly( const uno::Reference< deployment::XPackage > &xPackage ) const { if ( m_xExtensionManager.is() && xPackage.is() ) { @@ -1067,6 +1154,162 @@ bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPack return true; } +//------------------------------------------------------------------------------ +void UpdateDialog::getIgnoredUpdates() +{ + uno::Reference< lang::XMultiServiceFactory > xConfig( m_context->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.configuration.ConfigurationProvider"), m_context ), uno::UNO_QUERY_THROW); + beans::NamedValue aValue( OUSTR("nodepath"), uno::Any( IGNORED_UPDATES ) ); + uno::Sequence< uno::Any > args(1); + args[0] <<= aValue; + + uno::Reference< container::XNameAccess > xNameAccess( xConfig->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), args), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames(); + + for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) + { + ::rtl::OUString aIdentifier = aElementNames[i]; + ::rtl::OUString aVersion; + + uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); + aPropValue >>= aVersion; + IgnoredUpdate *pData = new IgnoredUpdate( aIdentifier, aVersion ); + m_ignoredUpdates.push_back( pData ); + } +} + +//------------------------------------------------------------------------------ +void UpdateDialog::storeIgnoredUpdates() +{ + if ( m_bModified && ( m_ignoredUpdates.size() != 0 ) ) + { + uno::Reference< lang::XMultiServiceFactory > xConfig( m_context->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.configuration.ConfigurationProvider"), m_context ), uno::UNO_QUERY_THROW ); + beans::NamedValue aValue( OUSTR("nodepath"), uno::Any( IGNORED_UPDATES ) ); + uno::Sequence< uno::Any > args(1); + args[0] <<= aValue; + + uno::Reference< container::XNameContainer > xNameContainer( xConfig->createInstanceWithArguments( + OUSTR("com.sun.star.configuration.ConfigurationUpdateAccess"), args ), uno::UNO_QUERY_THROW ); + + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( xNameContainer->hasByName( (*i)->sExtensionID ) ) + { + if ( (*i)->bRemoved ) + xNameContainer->removeByName( (*i)->sExtensionID ); + else + uno::Reference< beans::XPropertySet >( xNameContainer->getByName( (*i)->sExtensionID ), uno::UNO_QUERY_THROW )->setPropertyValue( PROPERTY_VERSION, uno::Any( (*i)->sVersion ) ); + } + else if ( ! (*i)->bRemoved ) + { + uno::Reference< beans::XPropertySet > elem( uno::Reference< lang::XSingleServiceFactory >( xNameContainer, uno::UNO_QUERY_THROW )->createInstance(), uno::UNO_QUERY_THROW ); + elem->setPropertyValue( PROPERTY_VERSION, uno::Any( (*i)->sVersion ) ); + xNameContainer->insertByName( (*i)->sExtensionID, uno::Any( elem ) ); + } + } + + uno::Reference< util::XChangesBatch > xChangesBatch( xNameContainer, uno::UNO_QUERY ); + if ( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) + xChangesBatch->commitChanges(); + } + + m_bModified = false; +} + +//------------------------------------------------------------------------------ +bool UpdateDialog::isIgnoredUpdate( UpdateDialog::Index * index ) +{ + bool bIsIgnored = false; + + if ( m_ignoredUpdates.size() != 0 ) + { + rtl::OUString aExtensionID; + rtl::OUString aVersion; + + if ( index->m_eKind == ENABLED_UPDATE ) + { + dp_gui::UpdateData aUpdData = m_enabledUpdates[ index->m_nIndex ]; + aExtensionID = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); + aVersion = aUpdData.updateVersion; + } + else if ( index->m_eKind == DISABLED_UPDATE ) + { + DisabledUpdate &rData = m_disabledUpdates[ index->m_nIndex ]; + dp_misc::DescriptionInfoset aInfoset( m_context, rData.aUpdateInfo ); + ::boost::optional< ::rtl::OUString > aID( aInfoset.getIdentifier() ); + if ( aID ) + aExtensionID = *aID; + aVersion = aInfoset.getVersion(); + } + + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( (*i)->sExtensionID == aExtensionID ) + { + if ( ( (*i)->sVersion.getLength() == 0 ) || ( (*i)->sVersion == aVersion ) ) + { + bIsIgnored = true; + index->m_bIgnored = true; + } + else // when we find another update of an ignored version, we will remove the old one to keep the ignored list small + (*i)->bRemoved = true; + break; + } + } + } + + return bIsIgnored; +} + +//------------------------------------------------------------------------------ +void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ) +{ + rtl::OUString aExtensionID; + rtl::OUString aVersion; + + m_bModified = true; + + if ( pIndex->m_eKind == ENABLED_UPDATE ) + { + dp_gui::UpdateData aUpdData = m_enabledUpdates[ pIndex->m_nIndex ]; + aExtensionID = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); + if ( !bIgnoreAll ) + aVersion = aUpdData.updateVersion; + } + else if ( pIndex->m_eKind == DISABLED_UPDATE ) + { + DisabledUpdate &rData = m_disabledUpdates[ pIndex->m_nIndex ]; + dp_misc::DescriptionInfoset aInfoset( m_context, rData.aUpdateInfo ); + ::boost::optional< ::rtl::OUString > aID( aInfoset.getIdentifier() ); + if ( aID ) + aExtensionID = *aID; + if ( !bIgnoreAll ) + aVersion = aInfoset.getVersion(); + } + + if ( aExtensionID.getLength() ) + { + bool bFound = false; + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( (*i)->sExtensionID == aExtensionID ) + { + (*i)->sVersion = aVersion; + (*i)->bRemoved = !bIgnore; + bFound = true; + break; + } + } + if ( bIgnore && !bFound ) + { + IgnoredUpdate *pData = new IgnoredUpdate( aExtensionID, aVersion ); + m_ignoredUpdates.push_back( pData ); + } + } +} + +//------------------------------------------------------------------------------ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) { rtl::OUStringBuffer b; @@ -1075,38 +1318,32 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) m_updates.GetEntryData(m_updates.GetSelectEntryPos())); clearDescription(); - if (p != NULL) + if ( p != NULL ) { - //When the index is greater or equal than the amount of enabled updates then the "Show all" - //button is probably checked. Then we show first all enabled and then the disabled - //updates. - USHORT pos = m_updates.GetSelectEntryPos(); - const std::vector< dp_gui::UpdateData >::size_type sizeEnabled = - m_enabledUpdates.size(); - const std::vector< UpdateDialog::DisabledUpdate >::size_type sizeDisabled = - m_disabledUpdates.size(); - if (pos < sizeEnabled) - { - if (m_enabledUpdates[pos].aUpdateSource.is()) - bInserted = showDescription(m_enabledUpdates[pos].aUpdateSource); - else - bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo); - } - else if (pos >= sizeEnabled - && pos < (sizeEnabled + sizeDisabled)) - bInserted = showDescription(m_disabledUpdates[pos - sizeEnabled].aUpdateInfo); + USHORT pos = p->m_nIndex; - switch (p->kind) + switch (p->m_eKind) { case ENABLED_UPDATE: { - b.append(m_noDescription); + if ( m_enabledUpdates[ pos ].aUpdateSource.is() ) + bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateSource ); + else + bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateInfo ); + + if ( p->m_bIgnored ) + b.append( m_ignoredUpdate ); + break; } case DISABLED_UPDATE: { - UpdateDialog::DisabledUpdate & data = m_disabledUpdates[ - p->index.disabledUpdate]; + bInserted = showDescription( m_disabledUpdates[pos].aUpdateInfo ); + + if ( p->m_bIgnored ) + b.append( m_ignoredUpdate ); + + UpdateDialog::DisabledUpdate & data = m_disabledUpdates[ pos ]; if (data.unsatisfiedDependencies.getLength() != 0) { // create error string for version mismatch @@ -1139,23 +1376,12 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) } break; } - case GENERAL_ERROR: - { - rtl::OUString & msg = m_generalErrors[p->index.generalError]; - b.append(m_failure); - b.append(LF); - b.append(msg.getLength() == 0 ? m_unknownError : msg); - break; - } case SPECIFIC_ERROR: { - UpdateDialog::SpecificError & data = m_specificErrors[ - p->index.specificError]; + UpdateDialog::SpecificError & data = m_specificErrors[ pos ]; b.append(m_failure); b.append(LF); - b.append( - data.message.getLength() == 0 - ? m_unknownError : data.message); + b.append( data.message.getLength() == 0 ? m_unknownError : data.message ); break; } default: @@ -1164,56 +1390,37 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) } } + if ( b.getLength() == 0 ) + b.append( m_noDescription ); + showDescription( b.makeStringAndClear(), bInserted ); return 0; } -IMPL_LINK(UpdateDialog, allHandler, void *, EMPTYARG) { - if (m_all.IsChecked()) { +IMPL_LINK(UpdateDialog, allHandler, void *, EMPTYARG) +{ + if (m_all.IsChecked()) + { m_update.Enable(); m_updates.Enable(); m_description.Enable(); m_descriptions.Enable(); - std::vector< UpdateDialog::DisabledUpdate >::size_type n1 = 0; - for (std::vector< UpdateDialog::DisabledUpdate >::iterator i( - m_disabledUpdates.begin()); - i != m_disabledUpdates.end(); ++i) - { - insertItem( - i->name, LISTBOX_APPEND, - UpdateDialog::Index::newDisabledUpdate(n1++), - SvLBoxButtonKind_disabledCheckbox); - } - std::vector< rtl::OUString >::size_type n2 = 0; - for (std::vector< rtl::OUString >::iterator i(m_generalErrors.begin()); - i != m_generalErrors.end(); ++i) + + for (std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); + i != m_ListboxEntries.end(); ++i ) { - insertItem( - m_error, LISTBOX_APPEND, - UpdateDialog::Index::newGeneralError(n2++), - SvLBoxButtonKind_staticImage); + if ( (*i)->m_bIgnored || ( (*i)->m_eKind != ENABLED_UPDATE ) ) + insertItem( (*i), SvLBoxButtonKind_disabledCheckbox ); } - std::vector< UpdateDialog::SpecificError >::size_type n3 = 0; - for (std::vector< UpdateDialog::SpecificError >::iterator i( - m_specificErrors.begin()); - i != m_specificErrors.end(); ++i) + } + else + { + for ( USHORT i = 0; i < m_updates.getItemCount(); ) { - insertItem( - i->name, LISTBOX_APPEND, - UpdateDialog::Index::newSpecificError(n3++), - SvLBoxButtonKind_staticImage); - } - } else { - for (USHORT i = 0; i < m_updates.getItemCount();) { - UpdateDialog::Index const * p = - static_cast< UpdateDialog::Index const * >( - m_updates.GetEntryData(i)); - if (p->kind != ENABLED_UPDATE) { + UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i) ); + if ( p->m_bIgnored || ( p->m_eKind != ENABLED_UPDATE ) ) + { m_updates.RemoveEntry(i); - //TODO #i72487#: UpdateDialog::Index potentially leaks as - // SvxCheckListBox::RemoveEntry's exception behavior is - // unspecified - delete p; } else { ++i; } @@ -1260,8 +1467,8 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i)); - if (p->kind == ENABLED_UPDATE && m_updates.IsChecked(i)) { - m_updateData.push_back(m_enabledUpdates[p->index.enabledUpdate]); + if (p->m_eKind == ENABLED_UPDATE && m_updates.IsChecked(i)) { + m_updateData.push_back( m_enabledUpdates[ p->m_nIndex ] ); } } @@ -1269,7 +1476,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) return 0; } -IMPL_LINK(UpdateDialog, cancelHandler, void *, EMPTYARG) { +IMPL_LINK(UpdateDialog, closeHandler, void *, EMPTYARG) { m_thread->stop(); EndDialog(RET_CANCEL); return 0; @@ -1285,15 +1492,15 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) try { - css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( + uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_context->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), - m_context), css::uno::UNO_QUERY_THROW); - //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException + m_context), uno::UNO_QUERY_THROW); + //throws lang::IllegalArgumentException, system::SystemShellExecuteException xSystemShellExecute->execute( - sURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS); + sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); } - catch (css::uno::Exception& ) + catch (uno::Exception& ) { } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 32c317cb8735..54e645f195d8 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -112,8 +112,7 @@ private: struct DisabledUpdate; struct SpecificError; - union IndexUnion; - friend union IndexUnion; + struct IgnoredUpdate; struct Index; friend struct Index; class Thread; @@ -135,40 +134,36 @@ private: void operator =(UpdateDialog::CheckListBox &); // not defined virtual void MouseButtonDown(MouseEvent const & event); - virtual void MouseButtonUp(MouseEvent const & event); - virtual void KeyInput(KeyEvent const & event); + void handlePopupMenu( const Point &rPos ); + + rtl::OUString m_ignoreUpdate; + rtl::OUString m_ignoreAllUpdates; + rtl::OUString m_enableUpdate; UpdateDialog & m_dialog; }; friend class CheckListBox; - void insertItem( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, - SvLBoxButtonKind kind); - - void addAdditional( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, - SvLBoxButtonKind kind); + USHORT insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); + void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); + bool isIgnoredUpdate( UpdateDialog::Index *pIndex ); + void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ); - void addEnabledUpdate( - rtl::OUString const & name, dp_gui::UpdateData const & data); - - void addDisabledUpdate(UpdateDialog::DisabledUpdate const & data); -#if 0 - void addGeneralError(rtl::OUString const & message); -#endif - void addSpecificError(UpdateDialog::SpecificError const & data); + void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data ); + void addDisabledUpdate( UpdateDialog::DisabledUpdate & data ); + void addSpecificError( UpdateDialog::SpecificError & data ); void checkingDone(); void enableOk(); + void getIgnoredUpdates(); + void storeIgnoredUpdates(); + void initDescription(); void clearDescription(); bool showDescription(::com::sun::star::uno::Reference< @@ -183,7 +178,7 @@ private: DECL_LINK(selectionHandler, void *); DECL_LINK(allHandler, void *); DECL_LINK(okHandler, void *); - DECL_LINK(cancelHandler, void *); + DECL_LINK(closeHandler, void *); DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *); com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > @@ -202,7 +197,7 @@ private: FixedLine m_line; HelpButton m_help; PushButton m_ok; - CancelButton m_cancel; + PushButton m_close; rtl::OUString m_error; rtl::OUString m_none; rtl::OUString m_noInstallable; @@ -214,18 +209,22 @@ private: rtl::OUString m_noDependencyCurVer; rtl::OUString m_browserbased; rtl::OUString m_version; + rtl::OUString m_ignoredUpdate; std::vector< dp_gui::UpdateData > m_enabledUpdates; std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates; - std::vector< rtl::OUString > m_generalErrors; std::vector< UpdateDialog::SpecificError > m_specificErrors; + std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates; + std::vector< Index* > m_ListboxEntries; std::vector< dp_gui::UpdateData > & m_updateData; rtl::Reference< UpdateDialog::Thread > m_thread; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; - Point m_aFirstLinePos; - Size m_aFirstLineSize; - long m_nFirstLineDelta; - long m_nOneLineMissing; + Point m_aFirstLinePos; + Size m_aFirstLineSize; + long m_nFirstLineDelta; + long m_nOneLineMissing; + USHORT m_nLastID; + bool m_bModified; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src index 20b7d30988fd..4da431733e31 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.src +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src @@ -199,7 +199,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "~Install"; DefButton = TRUE; }; - CancelButton RID_DLG_UPDATE_CANCEL { + PushButton RID_DLG_UPDATE_CLOSE { Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH, (RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT + @@ -208,6 +208,7 @@ ModalDialog RID_DLG_UPDATE { RSC_SP_CTRL_DESC_Y + LOCAL_LIST_HEIGHT2 + RSC_SP_FLGR_SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_Y)); Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT); + Text[en-US] = "Close"; }; Image RID_DLG_UPDATE_NORMALALERT { @@ -227,7 +228,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "No new updates are available."; }; String RID_DLG_UPDATE_NOINSTALLABLE { - Text[en-US] = "No installable updates are available. To see all updates, mark the check box 'Show all updates'."; + Text[en-US] = "No installable updates are available. To see ignored or disabled updates, mark the check box 'Show all updates'."; }; String RID_DLG_UPDATE_FAILURE { Text[en-US] = "An error occurred:"; @@ -236,7 +237,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "Unknown error."; }; String RID_DLG_UPDATE_NODESCRIPTION { - Text[en-US] = "No descriptions available for this extension."; + Text[en-US] = "No more details are available for this update."; }; String RID_DLG_UPDATE_NOINSTALL { Text[en-US] = "The extension cannot be updated because:"; @@ -250,10 +251,21 @@ ModalDialog RID_DLG_UPDATE { String RID_DLG_UPDATE_BROWSERBASED { Text[en-US] = "browser based update"; }; - String RID_DLG_UPDATE_VERSION { Text[en-US] = "Version"; }; + String RID_DLG_UPDATE_IGNORE { + Text[en-US] = "Ignore this Update"; + }; + String RID_DLG_UPDATE_IGNORE_ALL { + Text[en-US] = "Ignore all Updates"; + }; + String RID_DLG_UPDATE_ENABLE { + Text[en-US] = "Enable Updates"; + }; + String RID_DLG_UPDATE_IGNORED_UPDATE { + Text[en-US] = "This update will be ignored.\n"; + }; }; WarningBox RID_WARNINGBOX_UPDATE_SHARED_EXTENSION diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src index 0d341122af16..ae810d2c7851 100644..100755 --- a/desktop/source/deployment/misc/dp_misc.src +++ b/desktop/source/deployment/misc/dp_misc.src @@ -32,7 +32,7 @@ String RID_DEPLYOMENT_DEPENDENCIES_UNKNOWN { }; String RID_DEPLYOMENT_DEPENDENCIES_MIN { - Text[en-US] = "Extensions requires at least OpenOffice.org %VERSION"; + Text[en-US] = "Extension requires at least OpenOffice.org %VERSION"; }; String RID_DEPLYOMENT_DEPENDENCIES_MAX { diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index e0844c227669..d1511952a92a 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -65,6 +65,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; using ::rtl::OUString; +namespace css = com::sun::star; namespace dp_registry { namespace backend { @@ -121,14 +122,15 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend BackendImpl * getMyBackend() const; const OUString m_loader; - ComponentBackendDb::Data m_registeredComponentsDb; enum reg { REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED, REG_MAYBE_REGISTERED } m_registered; - Reference<loader::XImplementationLoader> getComponentInfo( - t_stringlist * pImplNames, t_stringpairvec * pSingletons, + void getComponentInfo( + ComponentBackendDb::Data * data, + std::vector< css::uno::Reference< css::uno::XInterface > > * + factories, Reference<XComponentContext> const & xContext ); virtual void SAL_CALL disposing(); @@ -161,6 +163,30 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend }; friend class ComponentPackageImpl; + class ComponentsPackageImpl : public ::dp_registry::backend::Package + { + BackendImpl * getMyBackend() const; + + // Package + virtual beans::Optional< beans::Ambiguous<sal_Bool> > isRegistered_( + ::osl::ResettableMutexGuard & guard, + ::rtl::Reference<AbortChannel> const & abortChannel, + Reference<XCommandEnvironment> const & xCmdEnv ); + virtual void processPackage_( + ::osl::ResettableMutexGuard & guard, + bool registerPackage, + bool startup, + ::rtl::Reference<AbortChannel> const & abortChannel, + Reference<XCommandEnvironment> const & xCmdEnv ); + public: + ComponentsPackageImpl( + ::rtl::Reference<PackageRegistryBackend> const & myBackend, + OUString const & url, OUString const & name, + Reference<deployment::XPackageTypeInfo> const & xPackageType, + bool bRemoved, OUString const & identifier); + }; + friend class ComponentsPackageImpl; + class TypelibraryPackageImpl : public ::dp_registry::backend::Package { BackendImpl * getMyBackend() const; @@ -194,8 +220,20 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend t_stringlist m_jar_typelibs; t_stringlist m_rdb_typelibs; - t_stringlist & getTypelibs( bool jar ) { - return jar ? m_jar_typelibs : m_rdb_typelibs; + t_stringlist m_components; + + enum RcItem { RCITEM_JAR_TYPELIB, RCITEM_RDB_TYPELIB, RCITEM_COMPONENTS }; + + t_stringlist & getRcItemList( RcItem kind ) { + switch (kind) + { + case RCITEM_JAR_TYPELIB: + return m_jar_typelibs; + case RCITEM_RDB_TYPELIB: + return m_rdb_typelibs; + default: // case RCITEM_COMPONENTS + return m_components; + } } bool m_unorc_inited; @@ -217,6 +255,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend const Reference<deployment::XPackageTypeInfo> m_xDynComponentTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xJavaComponentTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xPythonComponentTypeInfo; + const Reference<deployment::XPackageTypeInfo> m_xComponentsTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xRDBTypelibTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xJavaTypelibTypeInfo; Sequence< Reference<deployment::XPackageTypeInfo> > m_typeInfos; @@ -254,13 +293,31 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString const & id, Reference<XInterface> const & xObject ); void releaseObject( OUString const & id ); - bool addToUnoRc( bool jarFile, OUString const & url, + bool addToUnoRc( RcItem kind, OUString const & url, Reference<XCommandEnvironment> const & xCmdEnv ); - bool removeFromUnoRc( bool jarFile, OUString const & url, + bool removeFromUnoRc( RcItem kind, OUString const & url, Reference<XCommandEnvironment> const & xCmdEnv ); - bool hasInUnoRc( bool jarFile, OUString const & url ); + bool hasInUnoRc( RcItem kind, OUString const & url ); + + css::uno::Reference< css::registry::XRegistryKey > openRegistryKey( + css::uno::Reference< css::registry::XRegistryKey > const & base, + rtl::OUString const & path); + void extractComponentData( + css::uno::Reference< css::uno::XComponentContext > const & context, + css::uno::Reference< css::registry::XRegistryKey > const & registry, + ComponentBackendDb::Data * data, + std::vector< css::uno::Reference< css::uno::XInterface > > * factories, + css::uno::Reference< css::loader::XImplementationLoader > const * + componentLoader, + rtl::OUString const * componentUrl); + void componentLiveInsertion( + ComponentBackendDb::Data const & data, + std::vector< css::uno::Reference< css::uno::XInterface > > const & + factories); + + void componentLiveRemoval(ComponentBackendDb::Data const & data); public: BackendImpl( Sequence<Any> const & args, @@ -291,13 +348,7 @@ BackendImpl::ComponentPackageImpl::ComponentPackageImpl( xPackageType, bRemoved, identifier), m_loader( loader ), m_registered( REG_UNINIT ) -{ - if (bRemoved) - { - m_registeredComponentsDb = getMyBackend()->readDataFromDb(url); - } -} - +{} const Reference<registry::XSimpleRegistry> BackendImpl::ComponentPackageImpl::getRDB() const @@ -538,6 +589,13 @@ BackendImpl::BackendImpl( RID_STR_PYTHON_COMPONENT), RID_IMG_COMPONENT, RID_IMG_COMPONENT_HC ) ), + m_xComponentsTypeInfo( new Package::TypeInfo( + OUSTR("application/" + "vnd.sun.star.uno-components"), + OUSTR("*.components"), + getResourceString(RID_STR_COMPONENTS), + RID_IMG_COMPONENT, + RID_IMG_COMPONENT_HC ) ), m_xRDBTypelibTypeInfo( new Package::TypeInfo( OUSTR("application/" "vnd.sun.star.uno-typelibrary;" @@ -553,13 +611,14 @@ BackendImpl::BackendImpl( getResourceString(RID_STR_JAVA_TYPELIB), RID_IMG_JAVA_TYPELIB, RID_IMG_JAVA_TYPELIB_HC ) ), - m_typeInfos( 5 ) + m_typeInfos( 6 ) { m_typeInfos[ 0 ] = m_xDynComponentTypeInfo; m_typeInfos[ 1 ] = m_xJavaComponentTypeInfo; m_typeInfos[ 2 ] = m_xPythonComponentTypeInfo; - m_typeInfos[ 3 ] = m_xRDBTypelibTypeInfo; - m_typeInfos[ 4 ] = m_xJavaTypelibTypeInfo; + m_typeInfos[ 3 ] = m_xComponentsTypeInfo; + m_typeInfos[ 4 ] = m_xRDBTypelibTypeInfo; + m_typeInfos[ 5 ] = m_xJavaTypelibTypeInfo; const Reference<XCommandEnvironment> xCmdEnv; @@ -724,6 +783,17 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( } } else if (subType.EqualsIgnoreCaseAscii( + "vnd.sun.star.uno-components")) + { + INetContentTypeParameter const * param = params.find( + ByteString("platform") ); + if (param == 0 || platform_fits( param->m_sValue )) { + return new BackendImpl::ComponentsPackageImpl( + this, url, name, m_xComponentsTypeInfo, bRemoved, + identifier); + } + } + else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.uno-typelibrary")) { INetContentTypeParameter const * param = params.find( @@ -816,11 +886,50 @@ void BackendImpl::unorc_verify_init( while (index >= 0); } if (readLine( &line, OUSTR("UNO_SERVICES="), ucb_content, - RTL_TEXTENCODING_UTF8 )) { - sal_Int32 start = sizeof ("UNO_SERVICES=?$ORIGIN/") - 1; - sal_Int32 sep = line.indexOf( ' ', start ); - OSL_ASSERT( sep > 0 ); - m_commonRDB_RO = line.copy( start, sep - start ); + RTL_TEXTENCODING_UTF8 )) + { + // The UNO_SERVICES line always has the BNF form + // "UNO_SERVICES=" + // ("?$ORIGIN/" <common-rdb>)? -- first + // "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}"? -- second + // ("?" ("BUNDLED_EXTENSIONS" | -- third + // "UNO_SHARED_PACKAGES_CACHE" | "UNO_USER_PACKAGES_CACHE") + // ...)* + // so can unambiguously be split into its thre parts: + int state = 1; + for (sal_Int32 i = RTL_CONSTASCII_LENGTH("UNO_SERVICES="); + i >= 0;) + { + rtl::OUString token(line.getToken(0, ' ', i)); + if (token.getLength() != 0) + { + if (state == 1 && + token.matchAsciiL( + RTL_CONSTASCII_STRINGPARAM("?$ORIGIN/"))) + { + m_commonRDB_RO = token.copy( + RTL_CONSTASCII_LENGTH("?$ORIGIN/")); + state = 2; + } + else if (state <= 2 && + token.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( + "${$ORIGIN/${_OS}_${_ARCH}rc:" + "UNO_SERVICES}"))) + { + state = 3; + } + else + { + if (token[0] == '?') + { + token = token.copy(1); + } + m_components.push_back(token); + state = 3; + } + } + } } // native rc: @@ -896,16 +1005,27 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) OUString sCommonRDB(m_commonRDB.getLength() > 0 ? m_commonRDB : m_commonRDB_RO); OUString sNativeRDB(m_nativeRDB.getLength() > 0 ? m_nativeRDB : m_nativeRDB_RO); - if (sCommonRDB.getLength() > 0 || sNativeRDB.getLength() > 0) + if (sCommonRDB.getLength() > 0 || sNativeRDB.getLength() > 0 || + !m_components.empty()) { - buf.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") ); - buf.append( ::rtl::OUStringToOString( - sCommonRDB, RTL_TEXTENCODING_ASCII_US ) ); + buf.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=") ); + bool space = false; + if (sCommonRDB.getLength() > 0) + { + buf.append( RTL_CONSTASCII_STRINGPARAM("?$ORIGIN/") ); + buf.append( ::rtl::OUStringToOString( + sCommonRDB, RTL_TEXTENCODING_ASCII_US ) ); + space = true; + } if (sNativeRDB.getLength() > 0) { + if (space) + { + buf.append(' '); + } buf.append( RTL_CONSTASCII_STRINGPARAM( - " ${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}") ); - buf.append(LF); + "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}") ); + space = true; // write native rc: ::rtl::OStringBuffer buf2; @@ -927,6 +1047,18 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) xCmdEnv ); ucb_content.writeStream( xData, true /* replace existing */ ); } + for (t_stringlist::iterator i(m_components.begin()); + i != m_components.end(); ++i) + { + if (space) + { + buf.append(' '); + } + buf.append('?'); + buf.append(rtl::OUStringToOString(*i, RTL_TEXTENCODING_UTF8)); + space = true; + } + buf.append(LF); } // write unorc: @@ -943,13 +1075,13 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) } //______________________________________________________________________________ -bool BackendImpl::addToUnoRc( bool jarFile, OUString const & url_, +bool BackendImpl::addToUnoRc( RcItem kind, OUString const & url_, Reference<XCommandEnvironment> const & xCmdEnv ) { const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); unorc_verify_init( xCmdEnv ); - t_stringlist & rSet = getTypelibs(jarFile); + t_stringlist & rSet = getRcItemList(kind); if (::std::find( rSet.begin(), rSet.end(), rcterm ) == rSet.end()) { rSet.push_front( rcterm ); // prepend to list, thus overriding // write immediately: @@ -963,13 +1095,13 @@ bool BackendImpl::addToUnoRc( bool jarFile, OUString const & url_, //______________________________________________________________________________ bool BackendImpl::removeFromUnoRc( - bool jarFile, OUString const & url_, + RcItem kind, OUString const & url_, Reference<XCommandEnvironment> const & xCmdEnv ) { const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); unorc_verify_init( xCmdEnv ); - getTypelibs(jarFile).remove( rcterm ); + getRcItemList(kind).remove( rcterm ); // write immediately: m_unorc_modified = true; unorc_flush( xCmdEnv ); @@ -978,22 +1110,215 @@ bool BackendImpl::removeFromUnoRc( //______________________________________________________________________________ bool BackendImpl::hasInUnoRc( - bool jarFile, OUString const & url_ ) + RcItem kind, OUString const & url_ ) { const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); - t_stringlist const & rSet = getTypelibs(jarFile); + t_stringlist const & rSet = getRcItemList(kind); return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end(); } +css::uno::Reference< css::registry::XRegistryKey > BackendImpl::openRegistryKey( + css::uno::Reference< css::registry::XRegistryKey > const & base, + rtl::OUString const & path) +{ + OSL_ASSERT(base.is()); + css::uno::Reference< css::registry::XRegistryKey > key(base->openKey(path)); + if (!key.is()) { + throw css::deployment::DeploymentException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("missing registry entry ")) + + path + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" under ")) + + base->getKeyName()), + static_cast< OWeakObject * >(this), Any()); + } + return key; +} + +void BackendImpl::extractComponentData( + css::uno::Reference< css::uno::XComponentContext > const & context, + css::uno::Reference< css::registry::XRegistryKey > const & registry, + ComponentBackendDb::Data * data, + std::vector< css::uno::Reference< css::uno::XInterface > > * factories, + css::uno::Reference< css::loader::XImplementationLoader > const * + componentLoader, + rtl::OUString const * componentUrl) +{ + OSL_ASSERT(context.is() && registry.is() && data != 0 && factories != 0); + rtl::OUString registryName(registry->getKeyName()); + sal_Int32 prefix = registryName.getLength(); + if (!registryName.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM("/"))) { + prefix += RTL_CONSTASCII_LENGTH("/"); + } + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + keys(registry->openKeys()); + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( + context->getServiceManager(), css::uno::UNO_QUERY_THROW); + for (sal_Int32 i = 0; i < keys.getLength(); ++i) { + rtl::OUString name(keys[i]->getKeyName().copy(prefix)); + data->implementationNames.push_back(name); + css::uno::Reference< css::registry::XRegistryKey > singletons( + keys[i]->openKey( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNO/SINGLETONS")))); + if (singletons.is()) { + sal_Int32 prefix2 = keys[i]->getKeyName().getLength() + + RTL_CONSTASCII_LENGTH("/UNO/SINGLETONS/"); + css::uno::Sequence< + css::uno::Reference< css::registry::XRegistryKey > > + singletonKeys(singletons->openKeys()); + for (sal_Int32 j = 0; j < singletonKeys.getLength(); ++j) { + data->singletons.push_back( + std::pair< rtl::OUString, rtl::OUString >( + singletonKeys[j]->getKeyName().copy(prefix2), name)); + } + } + css::uno::Reference< css::loader::XImplementationLoader > loader; + if (componentLoader == 0) { + rtl::OUString activator( + openRegistryKey( + keys[i], + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("UNO/ACTIVATOR")))-> + getAsciiValue()); + loader.set( + smgr->createInstanceWithContext(activator, context), + css::uno::UNO_QUERY); + if (!loader.is()) { + throw css::deployment::DeploymentException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "cannot instantiate loader ")) + + activator), + static_cast< OWeakObject * >(this), Any()); + } + } else { + OSL_ASSERT(componentLoader->is()); + loader = *componentLoader; + } + factories->push_back( + loader->activate( + name, rtl::OUString(), + (componentUrl == 0 + ? (openRegistryKey( + keys[i], + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("UNO/LOCATION")))-> + getAsciiValue()) + : *componentUrl), + keys[i])); + } +} + +void BackendImpl::componentLiveInsertion( + ComponentBackendDb::Data const & data, + std::vector< css::uno::Reference< css::uno::XInterface > > const & + factories) +{ + css::uno::Reference< css::container::XSet > set( + getComponentContext()->getServiceManager(), css::uno::UNO_QUERY_THROW); + std::vector< css::uno::Reference< css::uno::XInterface > >::const_iterator + factory(factories.begin()); + for (t_stringlist::const_iterator i(data.implementationNames.begin()); + i != data.implementationNames.end(); ++i) + { + try { + set->insert(css::uno::Any(*factory++)); + } catch (container::ElementExistException &) { + OSL_TRACE( + "implementation %s already registered", + rtl::OUStringToOString(*i, RTL_TEXTENCODING_UTF8).getStr()); + } + } + if (!data.singletons.empty()) { + css::uno::Reference< css::container::XNameContainer > + rootContext( + getComponentContext()->getValueByName( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_root"))), + css::uno::UNO_QUERY); + if (rootContext.is()) { + for (t_stringpairvec::const_iterator i(data.singletons.begin()); + i != data.singletons.end(); ++i) + { + rtl::OUString name( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/")) + + i->first); + try { + rootContext->removeByName( + name + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/arguments"))); + } catch (container::NoSuchElementException &) {} + try { + rootContext->insertByName( + (name + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/service"))), + css::uno::Any(i->second)); + } catch (container::ElementExistException &) { + rootContext->replaceByName( + (name + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/service"))), + css::uno::Any(i->second)); + } + try { + rootContext->insertByName(name, css::uno::Any()); + } catch (container::ElementExistException &) { + OSL_TRACE( + "singleton %s already registered", + rtl::OUStringToOString( + i->first, RTL_TEXTENCODING_UTF8).getStr()); + rootContext->replaceByName(name, css::uno::Any()); + } + } + } + } +} + +void BackendImpl::componentLiveRemoval(ComponentBackendDb::Data const & data) { + css::uno::Reference< css::container::XSet > set( + getComponentContext()->getServiceManager(), css::uno::UNO_QUERY_THROW); + for (t_stringlist::const_iterator i(data.implementationNames.begin()); + i != data.implementationNames.end(); ++i) + { + try { + set->remove(css::uno::Any(*i)); + } catch (css::container::NoSuchElementException &) { + // ignore if factory has not been live deployed + } + } + if (!data.singletons.empty()) { + css::uno::Reference< css::container::XNameContainer > rootContext( + getComponentContext()->getValueByName( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_root"))), + css::uno::UNO_QUERY); + if (rootContext.is()) { + for (t_stringpairvec::const_iterator i(data.singletons.begin()); + i != data.singletons.end(); ++i) + { + rtl::OUString name( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/")) + + i->first); + try { + rootContext->removeByName( + name + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/arguments"))); + rootContext->removeByName( + name + + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/service"))); + rootContext->removeByName(name); + } catch (container::NoSuchElementException &) {} + } + } + } +} + //______________________________________________________________________________ void BackendImpl::releaseObject( OUString const & id ) { const ::osl::MutexGuard guard( getMutex() ); - if ( m_backendObjects.erase( id ) != 1 ) - { - OSL_ASSERT( false ); - } + m_backendObjects.erase( id ); } //______________________________________________________________________________ @@ -1076,62 +1401,38 @@ Reference<XComponentContext> raise_uno_process( } //------------------------------------------------------------------------------ -Reference<loader::XImplementationLoader> -BackendImpl::ComponentPackageImpl::getComponentInfo( - t_stringlist * pImplNames, t_stringpairvec * pSingletons, +void BackendImpl::ComponentPackageImpl::getComponentInfo( + ComponentBackendDb::Data * data, + std::vector< css::uno::Reference< css::uno::XInterface > > * factories, Reference<XComponentContext> const & xContext ) { const Reference<loader::XImplementationLoader> xLoader( xContext->getServiceManager()->createInstanceWithContext( m_loader, xContext ), UNO_QUERY ); if (! xLoader.is()) - return Reference<loader::XImplementationLoader>(); + { + throw css::deployment::DeploymentException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("cannot instantiate loader ")) + + m_loader), + static_cast< OWeakObject * >(this), Any()); + } // HACK: highly dependent on stoc/source/servicemanager // and stoc/source/implreg implementation which rely on the same // services.rdb format! - + // .../UNO/LOCATION and .../UNO/ACTIVATOR appear not to be written by + // writeRegistryInfo, however, but are knwon, fixed values here, so + // can be passed into extractComponentData + rtl::OUString url(getURL()); const Reference<registry::XSimpleRegistry> xMemReg( xContext->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.registry.SimpleRegistry"), xContext ), UNO_QUERY_THROW ); xMemReg->open( OUString() /* in mem */, false, true ); - xLoader->writeRegistryInfo( xMemReg->getRootKey(), OUString(), getURL() ); - - const Sequence< Reference<registry::XRegistryKey> > keys( - xMemReg->getRootKey()->openKeys() ); - for ( sal_Int32 pos = keys.getLength(); pos--; ) - { - Reference<registry::XRegistryKey> const & xImplKey = keys[ pos ]; - const OUString implName( - xImplKey->getKeyName().copy( 1 /*leading slash*/ ) ); - - // check for singletons: - const Reference<registry::XRegistryKey> xSingletonKey( - xImplKey->openKey( OUSTR("UNO/SINGLETONS") ) ); - if (xSingletonKey.is() && xSingletonKey->isValid()) - { - const Sequence< Reference<registry::XRegistryKey> > singletonKeys( - xSingletonKey->openKeys() ); - for ( sal_Int32 i = singletonKeys.getLength(); i--; ) - { - Reference<registry::XRegistryKey> const & xSingleton = - singletonKeys[ i ]; - pSingletons->push_back( - ::std::pair<OUString, OUString>( - xSingleton->getKeyName().copy( - implName.getLength() + - sizeof ("//UNO/SINGLETONS/") - 1 ), - xSingleton->getStringValue() ) ); - } - } - else - { - pImplNames->push_back( implName ); - } - } - - return xLoader; + xLoader->writeRegistryInfo( xMemReg->getRootKey(), OUString(), url ); + getMyBackend()->extractComponentData( + xContext, xMemReg->getRootKey(), data, factories, &xLoader, &url); } // Package @@ -1222,223 +1523,74 @@ void BackendImpl::ComponentPackageImpl::processPackage_( Reference<XCommandEnvironment> const & xCmdEnv ) { BackendImpl * that = getMyBackend(); - - - const bool java = m_loader.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.Java2") ); - const OUString url( getURL() ); - bool isJavaTypelib; - if (m_bRemoved) - isJavaTypelib = m_registeredComponentsDb.javaTypeLibrary; - else - isJavaTypelib = java && - !jarManifestHeaderPresent( url, OUSTR("UNO-Type-Path"), xCmdEnv ); - - ComponentBackendDb::Data data; - data.javaTypeLibrary = isJavaTypelib; - if (doRegisterPackage) - { - Reference <uno::XComponentContext> context(that->getComponentContext()); - if (! startup) - { - context.set( - that->getObject( url ), UNO_QUERY ); - - if (! context.is()) { + rtl::OUString url(getURL()); + if (doRegisterPackage) { + ComponentBackendDb::Data data; + css::uno::Reference< css::uno::XComponentContext > context; + if (startup) { + context = that->getComponentContext(); + } else { + context.set(that->getObject(url), css::uno::UNO_QUERY); + if (!context.is()) { context.set( - that->insertObject( url, raise_uno_process( - that->getComponentContext(), - abortChannel ) ), - UNO_QUERY_THROW ); + that->insertObject( + url, + raise_uno_process( + that->getComponentContext(), abortChannel)), + css::uno::UNO_QUERY_THROW); } } - - const Reference<registry::XSimpleRegistry> xServicesRDB( getRDB() ); - const Reference<registry::XImplementationRegistration> xImplReg( + css::uno::Reference< css::registry::XImplementationRegistration>( context->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.registry.ImplementationRegistration"), - context ), UNO_QUERY_THROW ); - - xImplReg->registerImplementation( m_loader, url, xServicesRDB ); - //only write to unorc if registration was successful. - //It may fail if there is no suitable java. - if (isJavaTypelib) + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.ImplementationRegistration")), + context), + css::uno::UNO_QUERY_THROW)->registerImplementation( + m_loader, url, getRDB()); + // Only write to unorc after successful registration; it may fail if + // there is no suitable java + if (m_loader.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.Java2")) && + !jarManifestHeaderPresent(url, OUSTR("UNO-Type-Path"), xCmdEnv)) { - that->addToUnoRc( java, url, xCmdEnv ); + that->addToUnoRc(RCITEM_JAR_TYPELIB, url, xCmdEnv); data.javaTypeLibrary = true; } - - t_stringlist implNames; - t_stringpairvec singletons; - const Reference<loader::XImplementationLoader> xLoader( - getComponentInfo( &implNames, &singletons, context ) ); - data.implementationNames = implNames; - data.singletons = singletons; - - if (!startup) - { - // factories live insertion: - const Reference<container::XSet> xSet( - that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); - for ( t_stringlist::const_iterator iPos( implNames.begin() ); - iPos != implNames.end(); ++iPos ) - { - checkAborted( abortChannel ); - OUString const & implName = *iPos; - // activate factory: - const Reference<XInterface> xFactory( - xLoader->activate( - implName, OUString(), url, - xServicesRDB->getRootKey()->openKey( - OUSTR("/IMPLEMENTATIONS/") + implName ) ) ); - try { - xSet->insert( Any(xFactory) ); - } // ignore if factory has already been inserted: - catch (container::ElementExistException &) { - OSL_ENSURE( 0, "### factory already registered?" ); - } - } - - if (! singletons.empty()) - { - // singletons live insertion: - const Reference<container::XNameContainer> xRootContext( - that->getComponentContext()->getValueByName( - OUSTR("_root") ), UNO_QUERY ); - if (xRootContext.is()) - { - for ( t_stringpairvec::const_iterator iPos( - singletons.begin() ); - iPos != singletons.end(); ++iPos ) - { - ::std::pair<OUString, OUString> const & sp = *iPos; - const OUString name( OUSTR("/singletons/") + sp.first ); - // assure no arguments: - try { - xRootContext->removeByName( name + OUSTR("/arguments")); - } catch (container::NoSuchElementException &) {} - // used service: - try { - xRootContext->insertByName( - name + OUSTR("/service"), Any(sp.second) ); - } catch (container::ElementExistException &) { - xRootContext->replaceByName( - name + OUSTR("/service"), Any(sp.second) ); - } - // singleton entry: - try { - xRootContext->insertByName( name, Any() ); - } catch (container::ElementExistException & exc) { - (void) exc; // avoid warnings - OSL_ENSURE( - 0, OUStringToOString( - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - xRootContext->replaceByName( name, Any() ); - } - } - } - } + std::vector< css::uno::Reference< css::uno::XInterface > > factories; + getComponentInfo(&data, &factories, context); + if (!startup) { + that->componentLiveInsertion(data, factories); } - m_registered = REG_REGISTERED; - getMyBackend()->addDataToDb(url, data); - } - else // revokePackage() - { - // set to VOID during revocation process: + that->addDataToDb(url, data); + } else { // revoke m_registered = REG_VOID; - - //get the remote context. If it does not exist then use the local one - Reference<XComponentContext> xContext( - that->getObject( url ), UNO_QUERY ); - bool bRemoteContext = false; - if (!xContext.is()) - xContext = that->getComponentContext(); - else - bRemoteContext = true; - - t_stringlist implNames; - t_stringpairvec singletons; - if (m_bRemoved) - { - implNames = m_registeredComponentsDb.implementationNames; - singletons = m_registeredComponentsDb.singletons; + ComponentBackendDb::Data data(that->readDataFromDb(url)); + css::uno::Reference< css::uno::XComponentContext > context( + that->getObject(url), css::uno::UNO_QUERY); + bool remoteContext = context.is(); + if (!remoteContext) { + context = that->getComponentContext(); } - else - { - getComponentInfo( &implNames, &singletons, xContext ); + if (!startup) { + that->componentLiveRemoval(data); } - - if (!startup) - { - // factories live removal: - const Reference<container::XSet> xSet( - that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); - for ( t_stringlist::const_iterator iPos( implNames.begin() ); - iPos != implNames.end(); ++iPos ) - { - OUString const & implName = *iPos; - try { - xSet->remove( Any(implName) ); - } // ignore if factory has not been live deployed: - catch (container::NoSuchElementException &) { - } - } - - if (! singletons.empty()) - { - // singletons live removal: - const Reference<container::XNameContainer> xRootContext( - that->getComponentContext()->getValueByName( - OUSTR("_root") ), UNO_QUERY ); - if (xRootContext.is()) - { - for ( t_stringpairvec::const_iterator iPos( - singletons.begin() ); - iPos != singletons.end(); ++iPos ) - { - ::std::pair<OUString, OUString> const & sp = *iPos; - const OUString name( OUSTR("/singletons/") + sp.first ); - // arguments: - try { - xRootContext->removeByName( name + OUSTR("/arguments")); - } - catch (container::NoSuchElementException &) {} - // used service: - try { - xRootContext->removeByName( name + OUSTR("/service") ); - } - catch (container::NoSuchElementException &) {} - // singleton entry: - try { - xRootContext->removeByName( name ); - } - catch (container::NoSuchElementException & exc) { - (void) exc; // avoid warnings - OSL_ENSURE( - 0, OUStringToOString( - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - } - } + css::uno::Reference< css::registry::XImplementationRegistration >( + context->getServiceManager()->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.ImplementationRegistration")), + context), + css::uno::UNO_QUERY_THROW)->revokeImplementation(url, getRDB()); + if (data.javaTypeLibrary) { + that->removeFromUnoRc(RCITEM_JAR_TYPELIB, url, xCmdEnv); + } + if (remoteContext) { + that->releaseObject(url); } - - const Reference<registry::XSimpleRegistry> xServicesRDB( getRDB() ); - const Reference<registry::XImplementationRegistration> xImplReg( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.registry.ImplementationRegistration"), - xContext ), UNO_QUERY_THROW ); - xImplReg->revokeImplementation( url, xServicesRDB ); - - if (isJavaTypelib) - that->removeFromUnoRc( java, url, xCmdEnv ); - - if (bRemoteContext) - that->releaseObject( url ); - m_registered = REG_NOT_REGISTERED; - getMyBackend()->deleteDataFromDb(url); + that->deleteDataFromDb(url); } } @@ -1480,7 +1632,8 @@ BackendImpl::TypelibraryPackageImpl::isRegistered_( return beans::Optional< beans::Ambiguous<sal_Bool> >( true /* IsPresent */, beans::Ambiguous<sal_Bool>( - that->hasInUnoRc( m_jarFile, getURL() ), + that->hasInUnoRc( + m_jarFile ? RCITEM_JAR_TYPELIB : RCITEM_RDB_TYPELIB, getURL() ), false /* IsAmbiguous */ ) ); } @@ -1546,11 +1699,13 @@ void BackendImpl::TypelibraryPackageImpl::processPackage_( } } - that->addToUnoRc( m_jarFile, url, xCmdEnv ); + that->addToUnoRc( m_jarFile ? RCITEM_JAR_TYPELIB : RCITEM_RDB_TYPELIB, + url, xCmdEnv ); } else // revokePackage() { - that->removeFromUnoRc( m_jarFile, url, xCmdEnv ); + that->removeFromUnoRc( + m_jarFile ? RCITEM_JAR_TYPELIB : RCITEM_RDB_TYPELIB, url, xCmdEnv ); // revoking types at runtime, possible, sensible? if (!m_xTDprov.is()) @@ -1570,6 +1725,97 @@ void BackendImpl::TypelibraryPackageImpl::processPackage_( } } +BackendImpl * BackendImpl::ComponentsPackageImpl::getMyBackend() const +{ + BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); + if (NULL == pBackend) + { + //Throws a DisposedException + check(); + //We should never get here... + throw RuntimeException( + OUSTR("Failed to get the BackendImpl"), + static_cast<OWeakObject*>(const_cast<ComponentsPackageImpl *>(this))); + } + return pBackend; +} + +beans::Optional< beans::Ambiguous<sal_Bool> > +BackendImpl::ComponentsPackageImpl::isRegistered_( + ::osl::ResettableMutexGuard &, + ::rtl::Reference<AbortChannel> const &, + Reference<XCommandEnvironment> const & ) +{ + return beans::Optional< beans::Ambiguous<sal_Bool> >( + true, + beans::Ambiguous<sal_Bool>( + getMyBackend()->hasInUnoRc(RCITEM_COMPONENTS, getURL()), false)); +} + +void BackendImpl::ComponentsPackageImpl::processPackage_( + ::osl::ResettableMutexGuard &, + bool doRegisterPackage, + bool startup, + ::rtl::Reference<AbortChannel> const & abortChannel, + Reference<XCommandEnvironment> const & xCmdEnv ) +{ + BackendImpl * that = getMyBackend(); + rtl::OUString url(getURL()); + if (doRegisterPackage) { + ComponentBackendDb::Data data; + data.javaTypeLibrary = false; + std::vector< css::uno::Reference< css::uno::XInterface > > factories; + css::uno::Reference< css::uno::XComponentContext > context( + that->getObject(url), css::uno::UNO_QUERY); + if (!context.is()) { + context.set( + that->insertObject( + url, + raise_uno_process( + that->getComponentContext(), abortChannel)), + css::uno::UNO_QUERY_THROW); + } + css::uno::Reference< css::registry::XSimpleRegistry > registry( + css::uno::Reference< css::lang::XMultiComponentFactory >( + that->getComponentContext()->getServiceManager(), + css::uno::UNO_SET_THROW)->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry")), + that->getComponentContext()), + css::uno::UNO_QUERY_THROW); + registry->open(expandUnoRcUrl(url), true, false); + getMyBackend()->extractComponentData( + context, + that->openRegistryKey( + registry->getRootKey(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IMPLEMENTATIONS"))), + &data, &factories, 0, 0); + registry->close(); + if (!startup) { + that->componentLiveInsertion(data, factories); + } + that->addDataToDb(url, data); + that->addToUnoRc(RCITEM_COMPONENTS, url, xCmdEnv); + } else { // revoke + that->removeFromUnoRc(RCITEM_COMPONENTS, url, xCmdEnv); + if (!startup) { + that->componentLiveRemoval(that->readDataFromDb(url)); + } + that->releaseObject(url); + that->deleteDataFromDb(url); + } +} + +BackendImpl::ComponentsPackageImpl::ComponentsPackageImpl( + ::rtl::Reference<PackageRegistryBackend> const & myBackend, + OUString const & url, OUString const & name, + Reference<deployment::XPackageTypeInfo> const & xPackageType, + bool bRemoved, OUString const & identifier) + : Package( myBackend, url, name, name /* display-name */, + xPackageType, bRemoved, identifier) +{} + } // anon namespace namespace sdecl = comphelper::service_decl; diff --git a/desktop/source/deployment/registry/component/dp_component.hrc b/desktop/source/deployment/registry/component/dp_component.hrc index 53085a48d185..4a8c4184a994 100644 --- a/desktop/source/deployment/registry/component/dp_component.hrc +++ b/desktop/source/deployment/registry/component/dp_component.hrc @@ -33,6 +33,7 @@ #define RID_STR_DYN_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+10) #define RID_STR_JAVA_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+11) #define RID_STR_PYTHON_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+12) +#define RID_STR_COMPONENTS (RID_DEPLOYMENT_COMPONENT_START+13) #define RID_STR_RDB_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+20) #define RID_STR_JAVA_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+21) diff --git a/desktop/source/deployment/registry/component/dp_component.src b/desktop/source/deployment/registry/component/dp_component.src index 36f2a1cc4a5c..9e9ab1a82bbf 100644 --- a/desktop/source/deployment/registry/component/dp_component.src +++ b/desktop/source/deployment/registry/component/dp_component.src @@ -42,6 +42,11 @@ String RID_STR_PYTHON_COMPONENT Text [ en-US ] = "UNO Python Component"; }; +String RID_STR_COMPONENTS +{ + Text [ en-US ] = "UNO Components"; +}; + String RID_STR_RDB_TYPELIB { Text [ en-US ] = "UNO RDB Type Library"; diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index d781ba9e40ef..fa53d4e78a15 100644..100755 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -520,6 +520,15 @@ OUString Package::getDescription() throw ( } //______________________________________________________________________________ +OUString Package::getLicenseText() throw ( + deployment::ExtensionRemovedException,RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + return OUString(); +} + +//______________________________________________________________________________ Sequence<OUString> Package::getUpdateInformationURLs() throw ( deployment::ExtensionRemovedException, RuntimeException) { diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 5a5efe825cfb..53a7ba1c316d 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -450,7 +450,7 @@ void BackendImpl::implProcessHelp aJarFile, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.zip://" ); aDestBasePath += aEncodedJarFilePath; aDestBasePath += rtl::OUString::createFromAscii( "/" ); diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 3d3bf7cf912c..20fc2a8dc7e1 100644..100755 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -237,6 +237,9 @@ public: virtual ::rtl::OUString SAL_CALL getDescription() throw (css::deployment::ExtensionRemovedException, css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLicenseText() + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getUpdateInformationURLs() throw (css::deployment::ExtensionRemovedException, @@ -294,7 +297,7 @@ protected: ::rtl::OUString m_context; // currently only for library containers: - enum context { + enum { CONTEXT_UNKNOWN, CONTEXT_USER, CONTEXT_SHARED,CONTEXT_BUNDLED, CONTEXT_TMP, CONTEXT_DOCUMENT diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 7f262d66684b..262bbef420f2 100755 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -190,6 +190,9 @@ class BackendImpl : public ImplBaseT virtual OUString SAL_CALL getDescription() throw (deployment::ExtensionRemovedException, RuntimeException); + virtual OUString SAL_CALL getLicenseText() + throw (deployment::ExtensionRemovedException, RuntimeException); + virtual void SAL_CALL exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, @@ -1003,6 +1006,31 @@ OUString BackendImpl::PackageImpl::getDescription() } //______________________________________________________________________________ +OUString BackendImpl::PackageImpl::getLicenseText() + throw (deployment::ExtensionRemovedException, RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + + OUString sLicense; + DescriptionInfoset aInfo = getDescriptionInfoset(); + + ::boost::optional< SimpleLicenseAttributes > aSimplLicAttr = aInfo.getSimpleLicenseAttributes(); + if ( aSimplLicAttr ) + { + OUString aLicenseURL = aInfo.getLocalizedLicenseURL(); + + if ( aLicenseURL.getLength() ) + { + OUString aFullURL = m_url_expanded + OUSTR("/") + aLicenseURL; + sLicense = getTextFromURL( Reference< ucb::XCommandEnvironment >(), aFullURL); + } + } + + return sLicense; +} + +//______________________________________________________________________________ void BackendImpl::PackageImpl::exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, Reference<ucb::XCommandEnvironment> const & xCmdEnv ) diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 8a4ee1b45fbc..f3195701fc7c 100644..100755 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -88,6 +88,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString const & identifier); // XPackage virtual OUString SAL_CALL getDescription() throw (RuntimeException); + virtual OUString SAL_CALL getLicenseText() throw (RuntimeException); }; friend class PackageImpl; @@ -133,6 +134,12 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) } //______________________________________________________________________________ +OUString BackendImpl::PackageImpl::getLicenseText() throw (RuntimeException) +{ + return Package::getDescription(); +} + +//______________________________________________________________________________ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference<BackendImpl> const & myBackend, OUString const & url, OUString const & libType, bool bRemoved, diff --git a/desktop/test/deployment/active/Addons.xcu b/desktop/test/deployment/active/Addons.xcu new file mode 100644 index 000000000000..cc75f2ab8f64 --- /dev/null +++ b/desktop/test/deployment/active/Addons.xcu @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="Addons"> + <node o:name="AddonUI"> + <node o:name="OfficeMenuBar"> + <node o:name="org.openoffice.test.desktop.deployment.active" + o:op="replace"> + <prop o:name="Title" xml:lang="en-US"> + <value>active</value> + </prop> + <node o:name="Submenu"> + <node o:name="1" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.active_native:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>native</value> + </prop> + </node> + <node o:name="2" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.active_java:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>java</value> + </prop> + </node> + <node o:name="3" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.active_python:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>python</value> + </prop> + </node> + </node> + </node> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/active/Dispatch.java b/desktop/test/deployment/active/Dispatch.java new file mode 100644 index 000000000000..25443f96e092 --- /dev/null +++ b/desktop/test/deployment/active/Dispatch.java @@ -0,0 +1,101 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.awt.MessageBoxButtons; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XStatusListener; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch +{ + public Dispatch(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return false; //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public void dispatch(URL URL, PropertyValue[] Arguments) { + try { + XMultiComponentFactory smgr = UnoRuntime.queryInterface( + XMultiComponentFactory.class, context.getServiceManager()); + XMessageBox box = UnoRuntime.queryInterface( + XMessageBoxFactory.class, + smgr.createInstanceWithContext( + "com.sun.star.awt.Toolkit", context)). + createMessageBox( + UnoRuntime.queryInterface( + XWindowPeer.class, + (UnoRuntime.queryInterface( + XDesktop.class, + smgr.createInstanceWithContext( + "com.sun.star.frame.Desktop", context)). + getCurrentFrame().getComponentWindow())), + new Rectangle(), "infobox", MessageBoxButtons.BUTTONS_OK, + "active", "java"); + box.execute(); + UnoRuntime.queryInterface(XComponent.class, box).dispose(); + } catch (com.sun.star.uno.RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException( + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.active_java_singleton"; + + static final String[] serviceNames = new String[0]; +} diff --git a/desktop/test/deployment/active/MANIFEST.MF b/desktop/test/deployment/active/MANIFEST.MF new file mode 100644 index 000000000000..63480874dd55 --- /dev/null +++ b/desktop/test/deployment/active/MANIFEST.MF @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.active_java.Services +UNO-Type-Path: diff --git a/desktop/test/deployment/active/ProtocolHandler.xcu b/desktop/test/deployment/active/ProtocolHandler.xcu new file mode 100644 index 000000000000..017bdea72bea --- /dev/null +++ b/desktop/test/deployment/active/ProtocolHandler.xcu @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="ProtocolHandler"> + <node o:name="HandlerSet"> + <node o:name="com.sun.star.test.deployment.active_native" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.active_native:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.active_java" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.active_java:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.active_python" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.active_python:*</value> + </prop> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/active/Provider.java b/desktop/test/deployment/active/Provider.java new file mode 100644 index 000000000000..df31979f4b9d --- /dev/null +++ b/desktop/test/deployment/active/Provider.java @@ -0,0 +1,81 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Provider extends WeakBase + implements XServiceInfo, XDispatchProvider +{ + public Provider(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return ServiceName.equals(getSupportedServiceNames()[0]); //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public XDispatch queryDispatch( + URL URL, String TargetFrameName, int SearchFlags) + { + return UnoRuntime.queryInterface( + XDispatch.class, + context.getValueByName( + "/singletons/" + + "com.sun.star.test.deployment.active_java_singleton")); + } + + public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { + XDispatch[] s = new XDispatch[Requests.length]; + for (int i = 0; i < s.length; ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; + } + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.active_java"; + + static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.active_java" }; +} diff --git a/desktop/test/deployment/active/Services.java b/desktop/test/deployment/active/Services.java new file mode 100644 index 000000000000..4ea19f4b7a71 --- /dev/null +++ b/desktop/test/deployment/active/Services.java @@ -0,0 +1,72 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.registry.InvalidRegistryException; +import com.sun.star.registry.XRegistryKey; + +public final class Services { + private Services() {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + if (implementation.equals(Dispatch.implementationName)) { + return Factory.createComponentFactory( + Dispatch.class, Dispatch.implementationName, + Dispatch.serviceNames); + } else if (implementation.equals(Provider.implementationName)) { + return Factory.createComponentFactory( + Provider.class, Provider.implementationName, + Provider.serviceNames); + } else { + return null; + } + } + + public static boolean __writeRegistryServiceInfo(XRegistryKey key) { + if (!(Factory.writeRegistryServiceInfo( + Dispatch.implementationName, Dispatch.serviceNames, key) && + Factory.writeRegistryServiceInfo( + Provider.implementationName, Provider.serviceNames, key))) + { + return false; + } + try { + key. + createKey( + "/" + Dispatch.implementationName + + "/UNO/SINGLETONS/" + + "com.sun.star.test.deployment.active_java_singleton"). + setStringValue(Dispatch.implementationName); + } catch (InvalidRegistryException e) { + return false; + } + return true; + } +} diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx new file mode 100644 index 000000000000..a34d8de88a61 --- /dev/null +++ b/desktop/test/deployment/active/active_native.cxx @@ -0,0 +1,320 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_desktop.hxx" +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/awt/MessageBoxButtons.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/XMessageBox.hpp" +#include "com/sun/star/awt/XMessageBoxFactory.hpp" +#include "com/sun/star/awt/XWindowPeer.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/frame/DispatchDescriptor.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatch.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/frame/XStatusListener.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/util/URL.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/diagnose.h" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +namespace { + +namespace css = com::sun::star; + +class Provider: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatchProvider >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Provider(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + +private: + Provider( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Provider() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Provider::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.active_native")); +} + +css::uno::Sequence< rtl::OUString > Provider::static_getSupportedServiceNames() +{ + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.test.deployment.active_native")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +css::uno::Reference< css::frame::XDispatch > Provider::queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::frame::XDispatch > dispatch; + if (!(context_->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.test.deployment." + "active_native_singleton"))) >>= + dispatch) || + !dispatch.is()) + { + throw css::uno::DeploymentException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "component context fails to supply singleton" + " com.sun.star.test.deployment.active_native_singleton of" + " type com.sun.star.frame.XDispatch")), + context_); + } + return dispatch; +} + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Provider::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s( + Requests.getLength()); + for (sal_Int32 i = 0; i < s.getLength(); ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; +} + +class Dispatch: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatch >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Dispatch(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames() + { return css::uno::Sequence< rtl::OUString >(); } + +private: + Dispatch( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Dispatch() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &) + throw (css::uno::RuntimeException) + { return false; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Dispatch::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.active_native_singleton")); +} + +void Dispatch::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( + context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( + css::uno::Reference< css::awt::XMessageBoxFactory >( + smgr->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.awt.Toolkit")), context_), + css::uno::UNO_QUERY_THROW)->createMessageBox( + css::uno::Reference< css::awt::XWindowPeer >( + css::uno::Reference< css::frame::XFrame >( + css::uno::Reference< css::frame::XDesktop >( + smgr->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop")), + context_), + css::uno::UNO_QUERY_THROW)->getCurrentFrame(), + css::uno::UNO_SET_THROW)->getComponentWindow(), + css::uno::UNO_QUERY_THROW), + css::awt::Rectangle(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("infobox")), + css::awt::MessageBoxButtons::BUTTONS_OK, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("active")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("native"))), + css::uno::UNO_SET_THROW); + box->execute(); + css::uno::Reference< css::lang::XComponent >( + box, css::uno::UNO_QUERY_THROW)->dispose(); +} + +static cppu::ImplementationEntry const services[] = { + { &Provider::static_create, &Provider::static_getImplementationName, + &Provider::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { &Dispatch::static_create, &Dispatch::static_getImplementationName, + &Dispatch::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +extern "C" sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey) +{ + if (!component_writeInfoHelper(pServiceManager, pRegistryKey, services)) { + return false; + } + try { + css::uno::Reference< css::registry::XRegistryKey >( + (css::uno::Reference< css::registry::XRegistryKey >( + static_cast< css::registry::XRegistryKey * >(pRegistryKey))-> + createKey( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + + Dispatch::static_getImplementationName() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/UNO/SINGLETONS/com.sun.star.test.deployment." + "active_native_singleton")))), + css::uno::UNO_SET_THROW)-> + setStringValue(Dispatch::static_getImplementationName()); + } catch (css::uno::Exception & e) { + (void) e; + OSL_TRACE( + "active_native component_writeInfo exception: %s", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + return false; + } + return true; +} diff --git a/desktop/test/deployment/active/active_python.py b/desktop/test/deployment/active/active_python.py new file mode 100644 index 000000000000..8ba0947b6bf8 --- /dev/null +++ b/desktop/test/deployment/active/active_python.py @@ -0,0 +1,120 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo +from com.sun.star.registry import InvalidRegistryException + +class Provider(unohelper.Base, XServiceInfo, XDispatchProvider): + implementationName = "com.sun.star.comp.test.deployment.active_python" + + serviceNames = ("com.sun.star.test.deployment.active_python",) + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self.context.getValueByName( \ + "/singletons/com.sun.star.test.deployment.active_python_singleton") + + def queryDispatches(self, Requests): + tuple( \ + self.queryDispatch(i.FeatureURL, i.FrameName, i.SearchFlags) \ + for i in Requests) + +class Dispatch(unohelper.Base, XServiceInfo, XDispatch): + implementationName = \ + "com.sun.star.comp.test.deployment.active_python_singleton" + + serviceNames = () + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def dispatch(self, URL, Arguments): + smgr = self.context.getServiceManager() + box = smgr.createInstanceWithContext( \ + "com.sun.star.awt.Toolkit", self.context).createMessageBox( \ + smgr.createInstanceWithContext( \ + "com.sun.star.frame.Desktop", self.context). \ + getCurrentFrame().getComponentWindow(), \ + Rectangle(), "infobox", BUTTONS_OK, "active", "python") + box.execute(); + box.dispose(); + + def addStatusListener(self, Control, URL): + pass + + def removeStatusListener(self, Control, URL): + pass + +def getComponentFactory(implementationName, smgr, regKey): + if implementationName == Provider.implementationName: + return unohelper.createSingleServiceFactory( \ + Provider, Provider.implementationName, Provider.serviceNames) + elif implementationName == Dispatch.implementationName: + return unohelper.createSingleServiceFactory( \ + Dispatch, Dispatch.implementationName, Dispatch.serviceNames) + else: + return None + +def writeRegistryInfo(smgr, regKey): + try: + for i in (Provider, Dispatch): + key = regKey.createKey("/" + i.implementationName + "/UNO") + for j in i.serviceNames: + key.createKey("/SERVICES/" + j); + regKey.createKey( \ + "/" + Dispatch.implementationName + "/UNO/SINGLETONS/" \ + "com.sun.star.test.deployment.active_python_singleton"). \ + setStringValue(Dispatch.implementationName) + except InvalidRegistryException: + return False + return True diff --git a/desktop/test/deployment/active/description.xml b/desktop/test/deployment/active/description.xml new file mode 100644 index 000000000000..fd7049e0cc3d --- /dev/null +++ b/desktop/test/deployment/active/description.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<d:description xmlns:d="http://openoffice.org/extensions/description/2006"> + <d:identifier + value="org.openoffice/framework/desktop/test/deployment/active"/> + <d:version value="1"/> + <d:dependencies> + <d:OpenOffice.org-minimal-version d:name="OpenOffice.org 3.4" value="3.4"/> + </d:dependencies> +</d:description> diff --git a/desktop/test/deployment/active/makefile.mk b/desktop/test/deployment/active/makefile.mk new file mode 100644 index 000000000000..5511a39c8baf --- /dev/null +++ b/desktop/test/deployment/active/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = ../../.. +PRJNAME = desktop +TARGET = test_deployment_active + +ENABLE_EXCEPTIONS = TRUE + +PACKAGE = com/sun/star/comp/test/deployment/active_java +JAVAFILES = Dispatch.java Provider.java Services.java +JARFILES = juh.jar ridl.jar unoil.jar + +.INCLUDE: settings.mk + +DLLPRE = + +SLOFILES = $(SHL1OBJS) + +SHL1TARGET = active_native.uno +SHL1OBJS = $(SLO)/active_native.obj +SHL1RPATH = OXT +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/reg-component.map +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk + +ALLTAR : $(MISC)/active.oxt + +$(MISC)/active.oxt : manifest.xml description.xml Addons.xcu \ + ProtocolHandler.xcu $(SHL1TARGETN) $(MISC)/$(TARGET)/active_java.jar \ + active_python.py + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/active.oxt-zip + $(MKDIR) $(MISC)/$(TARGET)/active.oxt-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/active.oxt-zip/META-INF + $(SED) -e 's|@PATH@|$(SHL1TARGETN:f)|g' \ + -e 's|@PLATFORM@|$(RTL_OS:l)_$(RTL_ARCH:l)|g' < manifest.xml \ + > $(MISC)/$(TARGET)/active.oxt-zip/META-INF/manifest.xml + $(COPY) description.xml Addons.xcu ProtocolHandler.xcu $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/active_java.jar active_python.py \ + $(MISC)/$(TARGET)/active.oxt-zip/ + cd $(MISC)/$(TARGET)/active.oxt-zip && zip ../../active.oxt \ + META-INF/manifest.xml description.xml Addons.xcu ProtocolHandler.xcu \ + $(SHL1TARGETN:f) active_java.jar active_python.py + +$(MISC)/$(TARGET)/active_java.jar : MANIFEST.MF $(JAVATARGET) + $(MKDIRHIER) $(@:d) + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/active_java.jar-zip + $(MKDIR) $(MISC)/$(TARGET)/active_java.jar-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/active_java.jar-zip/META-INF \ + $(MISC)/$(TARGET)/active_java.jar-zip/$(PACKAGE) + $(COPY) MANIFEST.MF $(MISC)/$(TARGET)/active_java.jar-zip/META-INF/ + $(COPY) $(foreach,i,$(JAVAFILES:b) $(CLASSDIR)/$(PACKAGE)/$i.class) \ + $(MISC)/$(TARGET)/active_java.jar-zip/$(PACKAGE)/ + cd $(MISC)/$(TARGET)/active_java.jar-zip && zip ../active_java.jar \ + META-INF/MANIFEST.MF $(foreach,i,$(JAVAFILES:b) $(PACKAGE)/$i.class) diff --git a/desktop/test/deployment/active/manifest.xml b/desktop/test/deployment/active/manifest.xml new file mode 100644 index 000000000000..4f076696663b --- /dev/null +++ b/desktop/test/deployment/active/manifest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<m:manifest xmlns:m="http://openoffice.org/2001/manifest"> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="Addons.xcu"/> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="ProtocolHandler.xcu"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=native;platform=@PLATFORM@" + m:full-path="@PATH@"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=Java" + m:full-path="active_java.jar"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=Python" + m:full-path="active_python.py"/> +</m:manifest> diff --git a/desktop/test/deployment/boxt/boxt.cxx b/desktop/test/deployment/boxt/boxt.cxx index dc82c0c004d6..245617a2ad12 100644 --- a/desktop/test/deployment/boxt/boxt.cxx +++ b/desktop/test/deployment/boxt/boxt.cxx @@ -35,8 +35,6 @@ #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/frame/XStatusListener.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" -#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" @@ -45,7 +43,6 @@ #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/URL.hpp" #include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase3.hxx" #include "cppuhelper/implementationentry.hxx" #include "cppuhelper/weak.hxx" @@ -61,21 +58,6 @@ namespace { namespace css = com::sun::star; -namespace service { - -rtl::OUString getImplementationName() { - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); -} - -css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { - rtl::OUString name( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); - return css::uno::Sequence< rtl::OUString >(&name, 1); -} - -} - class Service: public cppu::WeakImplHelper3< css::lang::XServiceInfo, css::frame::XDispatchProvider, @@ -83,14 +65,24 @@ class Service: private boost::noncopyable { public: - Service() {} + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const &) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Service); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); private: + Service() {} + virtual ~Service() {} virtual rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) - { return service::getImplementationName(); } + { return static_getImplementationName(); } virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) throw (css::uno::RuntimeException) @@ -98,7 +90,7 @@ private: virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) - { return service::getSupportedServiceNames(); } + { return static_getSupportedServiceNames(); } virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( css::util::URL const &, rtl::OUString const &, sal_Int32) @@ -128,6 +120,17 @@ private: {} }; +rtl::OUString Service::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); +} + +css::uno::Sequence< rtl::OUString > Service::static_getSupportedServiceNames() { + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > Service::queryDispatches( css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) @@ -155,61 +158,10 @@ void Service::dispatch( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test"))); } -class Factory: - public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, - private boost::noncopyable -{ -public: - Factory() {} - -private: - virtual ~Factory() {} - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const &) - throw (css::uno::Exception, css::uno::RuntimeException) - { return static_cast< cppu::OWeakObject * >(new Service); } - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const &, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) - { return createInstanceWithContext(Context); } -}; - -css::uno::Reference< css::uno::XInterface > SAL_CALL dummy( - css::uno::Reference< css::uno::XComponentContext > const &) - SAL_THROW((css::uno::Exception)) -{ - OSL_ASSERT(false); - return css::uno::Reference< css::uno::XInterface >(); -} - -rtl::OUString SAL_CALL getImplementationName() { - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); -} - -css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { - rtl::OUString name( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); - return css::uno::Sequence< rtl::OUString >(&name, 1); -} - -css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL -createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()) -{ - return new Factory; -} - static cppu::ImplementationEntry const services[] = { - { &dummy, &service::getImplementationName, - &service::getSupportedServiceNames, &createFactory, 0, 0 }, + { &Service::static_create, &Service::static_getImplementationName, + &Service::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, { 0, 0, 0, 0, 0, 0 } }; diff --git a/desktop/test/deployment/boxt/makefile.mk b/desktop/test/deployment/boxt/makefile.mk index 11d736448d44..88e72aef4ab8 100644 --- a/desktop/test/deployment/boxt/makefile.mk +++ b/desktop/test/deployment/boxt/makefile.mk @@ -46,7 +46,7 @@ SHL1OBJS = $(SLO)/boxt.obj SHL1RPATH = BOXT SHL1STDLIBS = \ $(CPPUHELPERLIB) $(CPPULIB) $(MSFILTERLIB) $(SALLIB) $(TOOLSLIB) $(VCLLIB) -SHL1VERSIONMAP = $(SOLARENV)/src/component.map +SHL1VERSIONMAP = $(SOLARENV)/src/reg-component.map DEF1NAME = $(SHL1TARGET) .INCLUDE: target.mk diff --git a/desktop/test/deployment/locationtest/makefile.mk b/desktop/test/deployment/locationtest/makefile.mk index 8fe189791961..24be56c28d7e 100644 --- a/desktop/test/deployment/locationtest/makefile.mk +++ b/desktop/test/deployment/locationtest/makefile.mk @@ -80,5 +80,8 @@ $(MISC)$/$(TARGET)_resort : manifest.xml $(JARTARGETN) $(MISC)$/$(ZIP1TARGET).cr $(COPY) description.xml $(MISC)$/$(TARGET)$/description.xml $(TOUCH) $@ +.IF "$(ZIP1TARGETN)"!="" $(ZIP1TARGETN) : $(MISC)$/$(TARGET)_resort $(MISC)$/$(ZIP1TARGET).createdir +.ENDIF # "$(ZIP1TARGETN)"!="" + diff --git a/desktop/test/deployment/passive/Addons.xcu b/desktop/test/deployment/passive/Addons.xcu new file mode 100644 index 000000000000..61578d7426e9 --- /dev/null +++ b/desktop/test/deployment/passive/Addons.xcu @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="Addons"> + <node o:name="AddonUI"> + <node o:name="OfficeMenuBar"> + <node o:name="org.openoffice.test.desktop.deployment.passive" + o:op="replace"> + <prop o:name="Title" xml:lang="en-US"> + <value>passive</value> + </prop> + <node o:name="Submenu"> + <node o:name="1" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_native:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>native</value> + </prop> + </node> + <node o:name="2" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_java:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>java</value> + </prop> + </node> + <node o:name="3" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_python:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>python</value> + </prop> + </node> + </node> + </node> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/passive/Dispatch.java b/desktop/test/deployment/passive/Dispatch.java new file mode 100644 index 000000000000..295f34d599da --- /dev/null +++ b/desktop/test/deployment/passive/Dispatch.java @@ -0,0 +1,101 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.awt.MessageBoxButtons; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XStatusListener; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch +{ + public Dispatch(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return false; //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public void dispatch(URL URL, PropertyValue[] Arguments) { + try { + XMultiComponentFactory smgr = UnoRuntime.queryInterface( + XMultiComponentFactory.class, context.getServiceManager()); + XMessageBox box = UnoRuntime.queryInterface( + XMessageBoxFactory.class, + smgr.createInstanceWithContext( + "com.sun.star.awt.Toolkit", context)). + createMessageBox( + UnoRuntime.queryInterface( + XWindowPeer.class, + (UnoRuntime.queryInterface( + XDesktop.class, + smgr.createInstanceWithContext( + "com.sun.star.frame.Desktop", context)). + getCurrentFrame().getComponentWindow())), + new Rectangle(), "infobox", MessageBoxButtons.BUTTONS_OK, + "passive", "java"); + box.execute(); + UnoRuntime.queryInterface(XComponent.class, box).dispose(); + } catch (com.sun.star.uno.RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException( + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java_singleton"; + + static final String[] serviceNames = new String[0]; +} diff --git a/desktop/test/deployment/passive/MANIFEST.MF b/desktop/test/deployment/passive/MANIFEST.MF new file mode 100644 index 000000000000..45a04bf263dc --- /dev/null +++ b/desktop/test/deployment/passive/MANIFEST.MF @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.passive_java.Services +UNO-Type-Path: diff --git a/desktop/test/deployment/passive/ProtocolHandler.xcu b/desktop/test/deployment/passive/ProtocolHandler.xcu new file mode 100644 index 000000000000..bc0355be41df --- /dev/null +++ b/desktop/test/deployment/passive/ProtocolHandler.xcu @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="ProtocolHandler"> + <node o:name="HandlerSet"> + <node o:name="com.sun.star.test.deployment.passive_native" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_native:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.passive_java" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_java:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.passive_python" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_python:*</value> + </prop> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/passive/Provider.java b/desktop/test/deployment/passive/Provider.java new file mode 100644 index 000000000000..6f74ed9eb89e --- /dev/null +++ b/desktop/test/deployment/passive/Provider.java @@ -0,0 +1,81 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Provider extends WeakBase + implements XServiceInfo, XDispatchProvider +{ + public Provider(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return ServiceName.equals(getSupportedServiceNames()[0]); //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public XDispatch queryDispatch( + URL URL, String TargetFrameName, int SearchFlags) + { + return UnoRuntime.queryInterface( + XDispatch.class, + context.getValueByName( + "/singletons/" + + "com.sun.star.test.deployment.passive_java_singleton")); + } + + public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { + XDispatch[] s = new XDispatch[Requests.length]; + for (int i = 0; i < s.length; ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; + } + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java"; + + static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.passive_java" }; +} diff --git a/desktop/test/deployment/passive/Services.java b/desktop/test/deployment/passive/Services.java new file mode 100644 index 000000000000..799df3e70222 --- /dev/null +++ b/desktop/test/deployment/passive/Services.java @@ -0,0 +1,49 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; + +public final class Services { + private Services() {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + if (implementation.equals(Dispatch.implementationName)) { + return Factory.createComponentFactory( + Dispatch.class, Dispatch.implementationName, + Dispatch.serviceNames); + } else if (implementation.equals(Provider.implementationName)) { + return Factory.createComponentFactory( + Provider.class, Provider.implementationName, + Provider.serviceNames); + } else { + return null; + } + } +} diff --git a/desktop/test/deployment/passive/description.xml b/desktop/test/deployment/passive/description.xml new file mode 100644 index 000000000000..468dfa065fb1 --- /dev/null +++ b/desktop/test/deployment/passive/description.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<d:description xmlns:d="http://openoffice.org/extensions/description/2006"> + <d:identifier + value="org.openoffice/framework/desktop/test/deployment/passive"/> + <d:version value="1"/> + <d:dependencies> + <d:OpenOffice.org-minimal-version d:name="OpenOffice.org 3.4" value="3.4"/> + </d:dependencies> +</d:description> diff --git a/desktop/test/deployment/passive/makefile.mk b/desktop/test/deployment/passive/makefile.mk new file mode 100644 index 000000000000..019e5dcab837 --- /dev/null +++ b/desktop/test/deployment/passive/makefile.mk @@ -0,0 +1,136 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = ../../.. +PRJNAME = desktop +TARGET = test_deployment_passive + +ENABLE_EXCEPTIONS = TRUE + +PACKAGE = com/sun/star/comp/test/deployment/passive_java +JAVAFILES = Dispatch.java Provider.java Services.java +JARFILES = juh.jar ridl.jar unoil.jar + +my_platform_components = passive_native +my_generic_components = passive_java passive_python + +.INCLUDE: settings.mk + +DLLPRE = + +SLOFILES = $(SHL1OBJS) + +SHL1TARGET = passive_native.uno +SHL1OBJS = $(SLO)/passive_native.obj +SHL1RPATH = OXT +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk + +ALLTAR : $(MISC)/passive.oxt + +$(MISC)/passive.oxt : manifest.xml description.xml Addons.xcu \ + ProtocolHandler.xcu $(MISC)/$(TARGET)/platform.components \ + $(MISC)/$(TARGET)/generic.components $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/passive_java.jar passive_python.py + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/passive.oxt-zip + $(MKDIR) $(MISC)/$(TARGET)/passive.oxt-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/passive.oxt-zip/META-INF + $(SED) -e 's|@PLATFORM@|$(RTL_OS:l)_$(RTL_ARCH:l)|g' < manifest.xml \ + > $(MISC)/$(TARGET)/passive.oxt-zip/META-INF/manifest.xml + $(COPY) description.xml Addons.xcu ProtocolHandler.xcu \ + $(MISC)/$(TARGET)/platform.components \ + $(MISC)/$(TARGET)/generic.components $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/passive_java.jar passive_python.py \ + $(MISC)/$(TARGET)/passive.oxt-zip/ + cd $(MISC)/$(TARGET)/passive.oxt-zip && zip ../../passive.oxt \ + META-INF/manifest.xml description.xml Addons.xcu ProtocolHandler.xcu \ + platform.components generic.components $(SHL1TARGETN:f) \ + passive_java.jar passive_python.py + +$(MISC)/$(TARGET)/platform.components : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/platform.components.input \ + $(my_platform_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/platform.components.input + +$(MISC)/$(TARGET)/platform.components.input : + $(MKDIRHIER) $(@:d) + echo '<list>' \ + '$(my_platform_components:^"<filename>":+".component</filename>")' \ + '</list>' > $@ + +$(MISC)/$(TARGET)/generic.components : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/generic.components.input \ + $(my_generic_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/generic.components.input + +$(MISC)/$(TARGET)/generic.components.input : + $(MKDIRHIER) $(@:d) + echo '<list>' \ + '$(my_generic_components:^"<filename>":+".component</filename>")' \ + '</list>' > $@ + +$(MISC)/$(TARGET)/passive_native.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_native.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_native.component + +$(MISC)/$(TARGET)/passive_java.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_java.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)passive_java.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_java.component + +$(MISC)/$(TARGET)/passive_python.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_python.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)passive_python.py' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_python.component + +$(MISC)/$(TARGET)/passive_java.jar : MANIFEST.MF $(JAVATARGET) + $(MKDIRHIER) $(@:d) + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/passive_java.jar-zip + $(MKDIR) $(MISC)/$(TARGET)/passive_java.jar-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/passive_java.jar-zip/META-INF \ + $(MISC)/$(TARGET)/passive_java.jar-zip/$(PACKAGE) + $(COPY) MANIFEST.MF $(MISC)/$(TARGET)/passive_java.jar-zip/META-INF/ + $(COPY) $(foreach,i,$(JAVAFILES:b) $(CLASSDIR)/$(PACKAGE)/$i.class) \ + $(MISC)/$(TARGET)/passive_java.jar-zip/$(PACKAGE)/ + cd $(MISC)/$(TARGET)/passive_java.jar-zip && zip ../passive_java.jar \ + META-INF/MANIFEST.MF $(foreach,i,$(JAVAFILES:b) $(PACKAGE)/$i.class) diff --git a/desktop/test/deployment/passive/manifest.xml b/desktop/test/deployment/passive/manifest.xml new file mode 100644 index 000000000000..5b8ac8419bb9 --- /dev/null +++ b/desktop/test/deployment/passive/manifest.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<m:manifest xmlns:m="http://openoffice.org/2001/manifest"> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="Addons.xcu"/> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="ProtocolHandler.xcu"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-components;platform=@PLATFORM@" + m:full-path="platform.components"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-components" + m:full-path="generic.components"/> +</m:manifest> diff --git a/desktop/test/deployment/passive/passive_java.component b/desktop/test/deployment/passive/passive_java.component new file mode 100644 index 000000000000..74be57177dfe --- /dev/null +++ b/desktop/test/deployment/passive/passive_java.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_java"> + <service name="com.sun.star.test.deployment.passive_java"/> + </implementation> + <implementation + name="com.sun.star.comp.test.deployment.passive_java_singleton"> + <singleton name="com.sun.star.test.deployment.passive_java_singleton"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_native.component b/desktop/test/deployment/passive/passive_native.component new file mode 100644 index 000000000000..c14fd7ff0062 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_native"> + <service name="com.sun.star.test.deployment.passive_native"/> + </implementation> + <implementation + name="com.sun.star.comp.test.deployment.passive_native_singleton"> + <singleton name="com.sun.star.test.deployment.passive_native_singleton"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx new file mode 100644 index 000000000000..39101257ad67 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.cxx @@ -0,0 +1,289 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_desktop.hxx" +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/awt/MessageBoxButtons.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/XMessageBox.hpp" +#include "com/sun/star/awt/XMessageBoxFactory.hpp" +#include "com/sun/star/awt/XWindowPeer.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/frame/DispatchDescriptor.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatch.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/frame/XStatusListener.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/util/URL.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/diagnose.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +namespace { + +namespace css = com::sun::star; + +class Provider: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatchProvider >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Provider(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + +private: + Provider( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Provider() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Provider::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.passive_native")); +} + +css::uno::Sequence< rtl::OUString > Provider::static_getSupportedServiceNames() +{ + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.test.deployment.passive_native")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +css::uno::Reference< css::frame::XDispatch > Provider::queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::frame::XDispatch > dispatch; + if (!(context_->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.test.deployment." + "passive_native_singleton"))) >>= + dispatch) || + !dispatch.is()) + { + throw css::uno::DeploymentException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "component context fails to supply singleton" + " com.sun.star.test.deployment.passive_native_singleton of" + " type com.sun.star.frame.XDispatch")), + context_); + } + return dispatch; +} + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Provider::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s( + Requests.getLength()); + for (sal_Int32 i = 0; i < s.getLength(); ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; +} + +class Dispatch: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatch >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Dispatch(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames() + { return css::uno::Sequence< rtl::OUString >(); } + +private: + Dispatch( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Dispatch() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &) + throw (css::uno::RuntimeException) + { return false; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Dispatch::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.passive_native_singleton")); +} + +void Dispatch::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( + context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( + css::uno::Reference< css::awt::XMessageBoxFactory >( + smgr->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.awt.Toolkit")), context_), + css::uno::UNO_QUERY_THROW)->createMessageBox( + css::uno::Reference< css::awt::XWindowPeer >( + css::uno::Reference< css::frame::XFrame >( + css::uno::Reference< css::frame::XDesktop >( + smgr->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop")), + context_), + css::uno::UNO_QUERY_THROW)->getCurrentFrame(), + css::uno::UNO_SET_THROW)->getComponentWindow(), + css::uno::UNO_QUERY_THROW), + css::awt::Rectangle(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("infobox")), + css::awt::MessageBoxButtons::BUTTONS_OK, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("passive")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("native"))), + css::uno::UNO_SET_THROW); + box->execute(); + css::uno::Reference< css::lang::XComponent >( + box, css::uno::UNO_QUERY_THROW)->dispose(); +} + +static cppu::ImplementationEntry const services[] = { + { &Provider::static_create, &Provider::static_getImplementationName, + &Provider::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { &Dispatch::static_create, &Dispatch::static_getImplementationName, + &Dispatch::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} diff --git a/desktop/test/deployment/passive/passive_python.component b/desktop/test/deployment/passive/passive_python.component new file mode 100644 index 000000000000..ea7a1992b534 --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Python" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_python"> + <service name="com.sun.star.test.deployment.passive_python"/> + </implementation> + <implementation + name="com.sun.star.comp.test.deployment.passive_python_singleton"> + <singleton name="com.sun.star.test.deployment.passive_python_singleton"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_python.py b/desktop/test/deployment/passive/passive_python.py new file mode 100644 index 000000000000..dda68cccdb2f --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.py @@ -0,0 +1,101 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo + +class Provider(unohelper.Base, XServiceInfo, XDispatchProvider): + implementationName = "com.sun.star.comp.test.deployment.passive_python" + + serviceNames = ("com.sun.star.test.deployment.passive_python",) + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self.context.getValueByName( \ + "/singletons/com.sun.star.test.deployment.passive_python_singleton") + + def queryDispatches(self, Requests): + tuple( \ + self.queryDispatch(i.FeatureURL, i.FrameName, i.SearchFlags) \ + for i in Requests) + +class Dispatch(unohelper.Base, XServiceInfo, XDispatch): + implementationName = \ + "com.sun.star.comp.test.deployment.passive_python_singleton" + + serviceNames = () + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def dispatch(self, URL, Arguments): + smgr = self.context.getServiceManager() + box = smgr.createInstanceWithContext( \ + "com.sun.star.awt.Toolkit", self.context).createMessageBox( \ + smgr.createInstanceWithContext( \ + "com.sun.star.frame.Desktop", self.context). \ + getCurrentFrame().getComponentWindow(), \ + Rectangle(), "infobox", BUTTONS_OK, "passive", "python") + box.execute(); + box.dispose(); + + def addStatusListener(self, Control, URL): + pass + + def removeStatusListener(self, Control, URL): + pass + +g_ImplementationHelper = unohelper.ImplementationHelper() +g_ImplementationHelper.addImplementation( \ + Provider, Provider.implementationName, Provider.serviceNames) +g_ImplementationHelper.addImplementation( \ + Dispatch, Dispatch.implementationName, Dispatch.serviceNames) diff --git a/desktop/test/deployment/update/updateinfocreation/build/makefile.mk b/desktop/test/deployment/update/updateinfocreation/build/makefile.mk index 6af3928279e0..b0479c942b4f 100755 --- a/desktop/test/deployment/update/updateinfocreation/build/makefile.mk +++ b/desktop/test/deployment/update/updateinfocreation/build/makefile.mk @@ -84,5 +84,8 @@ $(MISC)$/$(TARGET)_resort : manifest.xml $(JARTARGETN) $(MISC)$/$(ZIP1TARGET).cr $(GNUCOPY) -u description.xml $(MISC)$/$(TARGET)$/description.xml $(TOUCH) $@ +.IF "$(ZIP1TARGETN)"!="" $(ZIP1TARGETN) : $(MISC)$/$(TARGET)_resort $(MISC)$/$(ZIP1TARGET).createdir +.ENDIF # "$(ZIP1TARGETN)"!="" + diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index 8bc39767f04a..17af6818551e 100644..100755 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -25,21 +25,7 @@ * *************************************************************************/ -#define VERSION 3 -#define SUBVERSION 3 -//#define VERVARIANT 0 -// .0 + VER_CONCEPT -// .100 + VER_ALPHA -// .200 + VER_BETA -// .300 + VER_GAMMA -// .500 + VER_FINAL -//#define VER_CONCEPT 0 -//#define VER_BETA 6 -#define VER_FINAL 0 - -#define VER_DAY 1 -#define VER_MONTH 1 -#define VER_YEAR 2010 +#include "version.hrc" // ----------------------------------------------------------------------- diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 73683884e2bd..893c572a3086 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -2017,7 +2017,7 @@ namespace if(nTextLength + nTextIndex > nStringLength) { - nTextLength = nStringLength - nTextIndex; + nTextLength = nTextIndex > nStringLength ? 0 : nStringLength - nTextIndex; } if(nTextLength && rPropertyHolders.Current().getTextColorActive()) diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index 9d432f73a731..d53bfcf1aaf2 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -694,7 +694,6 @@ #include "svtools/apearcfg.hxx" #include "svl/brdcst.hxx" #include "unotools/cacheoptions.hxx" -#include "svl/cancel.hxx" #include "svl/cjkoptions.hxx" #include "unotools/cmdoptions.hxx" #include "svl/cntwall.hxx" diff --git a/embeddedobj/prj/build.lst b/embeddedobj/prj/build.lst index a61305e19221..c2f366c4deec 100644 --- a/embeddedobj/prj/build.lst +++ b/embeddedobj/prj/build.lst @@ -1,4 +1,4 @@ -eo embeddedobj : offuh sal cppu cppuhelper comphelper tools unotools vos NULL +eo embeddedobj : offuh sal cppu cppuhelper comphelper tools unotools vos LIBXSLT:libxslt NULL eo embeddedobj usr1 - all eo_mkout NULL eo embeddedobj\inc nmake - all eo_inc NULL eo embeddedobj\source\commonembedding nmake - all eo_commonembed eo_inc NULL diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 9aa7df919e3e..f4c0c90162ed 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -39,6 +39,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/mimeconfighelper.hxx> #include "closepreventer.hxx" #include "intercept.hxx" @@ -240,6 +241,14 @@ void OCommonEmbeddedObject::LinkInit_Impl( OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!\n" ); + m_bReadOnly = sal_True; + if ( m_aLinkFilterName.getLength() ) + { + ::comphelper::MimeConfigurationHelper aHelper( m_xFactory ); + ::rtl::OUString aExportFilterName = aHelper.GetExportFilterFromImportFilter( m_aLinkFilterName ); + m_bReadOnly = !( aExportFilterName.equals( m_aLinkFilterName ) ); + } + m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, sal_False ); uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor; diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 0312d28315a6..6929f93d9c7b 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -229,11 +229,11 @@ static uno::Reference< util::XCloseable > CreateDocument( const uno::Reference< } catch( const uno::Exception& ) { - // some of our embedded object implementations (in particular chart) do neither support - // the EmbeddedObject, nor the EmbeddedScriptSupport argument. Also, they do not support - // XInitialization, which means the default factory from cppuhelper will throw an + // if an embedded object implementation does not support XInitialization, + // the default factory from cppuhelper will throw an // IllegalArgumentException when we try to create the instance with arguments. // Okay, so we fall back to creating the instance without any arguments. + OSL_ASSERT("Consider implementing interface XInitialization to avoid duplicate construction"); xDocument = _rxFactory->createInstance( _rDocumentServiceName ); } @@ -978,7 +978,21 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( if ( m_bWaitSaveCompleted ) { if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT ) - saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) ); + { + // saveCompleted is expected, handle it accordingly + if ( m_xNewParentStorage == xStorage && m_aNewEntryName.equals( sEntName ) ) + { + saveCompleted( sal_True ); + return; + } + + // if a completely different entry is provided, switch first back to the old persistence in saveCompleted + // and then switch to the target persistence + sal_Bool bSwitchFurther = ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ); + saveCompleted( sal_False ); + if ( !bSwitchFurther ) + return; + } else throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), diff --git a/eventattacher/prj/build.lst b/eventattacher/prj/build.lst index aa931705fd75..dda1cd7a4893 100644 --- a/eventattacher/prj/build.lst +++ b/eventattacher/prj/build.lst @@ -1,4 +1,4 @@ -ea eventattacher : offapi cppuhelper vos NULL +ea eventattacher : offapi cppuhelper vos LIBXSLT:libxslt NULL ea eventattacher usr1 - all ea_mkout NULL ea eventattacher\prj get - all ea_prj NULL ea eventattacher\source nmake - all ea_source NULL diff --git a/fileaccess/prj/build.lst b/fileaccess/prj/build.lst index a60a92e9c12b..0349810c3838 100644 --- a/fileaccess/prj/build.lst +++ b/fileaccess/prj/build.lst @@ -1,3 +1,3 @@ -fa fileaccess : unotools rdbmaker tools ucbhelper NULL +fa fileaccess : unotools rdbmaker tools ucbhelper LIBXSLT:libxslt NULL fa fileaccess usr1 - all fa_mkout NULL fa fileaccess\source nmake - all fa_src NULL diff --git a/formula/prj/build.lst b/formula/prj/build.lst index f26377c4578d..109a798ea3eb 100644 --- a/formula/prj/build.lst +++ b/formula/prj/build.lst @@ -1,4 +1,4 @@ -fml formula : BOOST:boost comphelper svx NULL +fml formula : BOOST:boost LIBXSLT:libxslt comphelper svx NULL fml formula usr1 - all fml_mkout NULL fml formula\inc nmake - all fml_inc NULL fml formula\source\core\api nmake - all fml_api fml_inc NULL diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst index 434f22660f33..52d99ec0759a 100644 --- a/fpicker/prj/build.lst +++ b/fpicker/prj/build.lst @@ -1,4 +1,4 @@ -fp fpicker : l10n rdbmaker svtools NULL +fp fpicker : LIBXSLT:libxslt l10n rdbmaker svtools NULL 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 diff --git a/framework/AllLangResTarget_fwe.mk b/framework/AllLangResTarget_fwe.mk new file mode 100644 index 000000000000..031cb24117d7 --- /dev/null +++ b/framework/AllLangResTarget_fwe.mk @@ -0,0 +1,63 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_AllLangResTarget_AllLangResTarget,fwe)) + +$(eval $(call gb_AllLangResTarget_set_reslocation,fwe,framework)) + +$(eval $(call gb_AllLangResTarget_add_srs,fwe,\ + fwe/fwk_classes \ + fwe/fwk_services \ +)) + + +$(eval $(call gb_SrsTarget_SrsTarget,fwe/fwk_classes)) + +$(eval $(call gb_SrsTarget_set_include,fwe/fwk_classes,\ + $$(INCLUDE) \ + -I$(SRCDIR)/framework/inc \ + -I$(SRCDIR)/framework/inc/classes \ + -I$(OUTDIR)/inc \ +)) + +$(eval $(call gb_SrsTarget_add_files,fwe/fwk_classes,\ + framework/source/classes/resource.src \ +)) + +$(eval $(call gb_SrsTarget_SrsTarget,fwe/fwk_services)) + +$(eval $(call gb_SrsTarget_set_include,fwe/fwk_services,\ + $$(INCLUDE) \ + -I$(SRCDIR)/framework/inc \ + -I$(SRCDIR)/framework/inc/services \ + -I$(OUTDIR)/inc \ +)) + +$(eval $(call gb_SrsTarget_add_files,fwe/fwk_services,\ + framework/source/services/fwk_services.src \ +)) +# vim: set noet sw=4 ts=4: diff --git a/framework/Library_fwe.mk b/framework/Library_fwe.mk new file mode 100644 index 000000000000..33d8959a474e --- /dev/null +++ b/framework/Library_fwe.mk @@ -0,0 +1,115 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,fwe)) + +$(eval $(call gb_Library_set_include,fwe,\ + -I$(SRCDIR)/framework/inc/pch \ + -I$(SRCDIR)/framework/source/inc \ + -I$(SRCDIR)/framework/inc \ + -I$(WORKDIR)/inc/framework/ \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/framework \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_set_defs,fwe,\ + $$(DEFS) \ + -DFWE_DLLIMPLEMENTATION\ +)) + +$(eval $(call gb_Library_add_linked_libs,fwe,\ + comphelper \ + cppu \ + cppuhelper \ + fwi \ + sal \ + stl \ + svl \ + svt \ + tl \ + utl \ + vcl \ + vos3 \ +)) + +$(eval $(call gb_Library_add_exception_objects,fwe,\ + framework/source/fwe/classes/actiontriggercontainer \ + framework/source/fwe/classes/actiontriggerpropertyset \ + framework/source/fwe/classes/actiontriggerseparatorpropertyset \ + framework/source/fwe/classes/addonmenu \ + framework/source/fwe/classes/addonsoptions \ + framework/source/fwe/classes/bmkmenu \ + framework/source/fwe/classes/framelistanalyzer \ + framework/source/fwe/classes/fwkresid \ + framework/source/fwe/classes/imagewrapper \ + framework/source/fwe/classes/menuextensionsupplier \ + framework/source/fwe/classes/rootactiontriggercontainer \ + framework/source/fwe/classes/sfxhelperfunctions \ + framework/source/fwe/dispatch/interaction \ + framework/source/fwe/helper/acceleratorinfo \ + framework/source/fwe/helper/actiontriggerhelper \ + framework/source/fwe/helper/configimporter \ + framework/source/fwe/helper/imageproducer \ + framework/source/fwe/helper/propertysetcontainer \ + framework/source/fwe/helper/titlehelper \ + framework/source/fwe/helper/uiconfigelementwrapperbase \ + framework/source/fwe/helper/uielementwrapperbase \ + framework/source/fwe/interaction/preventduplicateinteraction \ + framework/source/fwe/xml/eventsconfiguration \ + framework/source/fwe/xml/eventsdocumenthandler \ + framework/source/fwe/xml/imagesconfiguration \ + framework/source/fwe/xml/imagesdocumenthandler \ + framework/source/fwe/xml/menuconfiguration \ + framework/source/fwe/xml/menudocumenthandler \ + framework/source/fwe/xml/saxnamespacefilter \ + framework/source/fwe/xml/statusbarconfiguration \ + framework/source/fwe/xml/statusbardocumenthandler \ + framework/source/fwe/xml/toolboxconfiguration \ + framework/source/fwe/xml/toolboxdocumenthandler \ + framework/source/fwe/xml/xmlnamespaces \ +)) + +ifeq ($(OS),LINUX) + +$(eval $(call gb_Library_set_cxxflags,fwe,$$(filter-out -fvisibility=hidden,$$(CXXFLAGS)))) + +$(eval $(call gb_Library_add_linked_libs,fwe,\ + dl \ + m \ + pthread \ +)) +endif +ifeq ($(OS),WNT) +$(eval $(call gb_Library_add_linked_libs,fwe,\ + kernel32 \ + msvcrt \ + uwinapi \ +)) +endif +# TODO: visibility +# vim: set noet sw=4 ts=4: diff --git a/framework/Library_fwi.mk b/framework/Library_fwi.mk new file mode 100644 index 000000000000..568f0a1eb22a --- /dev/null +++ b/framework/Library_fwi.mk @@ -0,0 +1,97 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,fwi)) + +$(eval $(call gb_Library_add_package_headers,fwi,framework_inc)) + +$(eval $(call gb_Library_set_defs,fwi,\ + $$(DEFS) \ + -DFWI_DLLIMPLEMENTATION \ +)) + +$(eval $(call gb_Library_set_include,fwi,\ + -I$(SRCDIR)/framework/inc/pch \ + -I$(SRCDIR)/framework/source/inc \ + -I$(SRCDIR)/framework/inc \ + -I$(WORKDIR)/inc/framework/ \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/framework \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_linked_libs,fwi,\ + comphelper \ + cppu \ + cppuhelper \ + i18nisolang1 \ + sal \ + stl \ + svl \ + svt \ + tk \ + tl \ + utl \ + vcl \ + vos3 \ +)) + +$(eval $(call gb_Library_add_exception_objects,fwi,\ + framework/source/fwi/classes/converter \ + framework/source/fwi/classes/propertysethelper \ + framework/source/fwi/classes/protocolhandlercache \ + framework/source/fwi/helper/mischelper \ + framework/source/fwi/helper/networkdomain \ + framework/source/fwi/helper/shareablemutex \ + framework/source/fwi/jobs/configaccess \ + framework/source/fwi/jobs/jobconst \ + framework/source/fwi/threadhelp/lockhelper \ + framework/source/fwi/threadhelp/transactionmanager \ + framework/source/fwi/uielement/constitemcontainer \ + framework/source/fwi/uielement/itemcontainer \ + framework/source/fwi/uielement/rootitemcontainer \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,fwi,\ + dl \ + m \ + pthread \ +)) +endif +ifeq ($(OS),WNT) +$(eval $(call gb_Library_add_linked_libs,fwi,\ + advapi32 \ + kernel32 \ + msvcrt \ + stl \ + unicows \ + uwinapi \ +)) +endif +# TODO: visibility +# vim: set noet sw=4 ts=4: diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk new file mode 100644 index 000000000000..50c16b83b42a --- /dev/null +++ b/framework/Library_fwk.mk @@ -0,0 +1,199 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,fwk)) + +$(eval $(call gb_Library_add_precompiled_header,fwk,$(SRCDIR)/framework/inc/pch/precompiled_framework)) + +$(eval $(call gb_Library_set_componentfile,fwk,framework/util/fwk)) + +$(eval $(call gb_Library_set_include,fwk,\ + -I$(SRCDIR)/framework/inc/pch \ + -I$(SRCDIR)/framework/source/inc \ + -I$(SRCDIR)/framework/inc \ + -I$(WORKDIR)/inc/framework/ \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/framework \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_linked_libs,fwk,\ + comphelper \ + cppu \ + cppuhelper \ + fwe \ + fwi \ + i18nisolang1 \ + sal \ + sot \ + stl \ + svl \ + svt \ + tk \ + tl \ + ucbhelper \ + utl \ + vcl \ +)) + +$(eval $(call gb_Library_add_exception_objects,fwk,\ + framework/source/accelerators/acceleratorcache \ + framework/source/accelerators/acceleratorconfiguration \ + framework/source/accelerators/documentacceleratorconfiguration \ + framework/source/accelerators/globalacceleratorconfiguration \ + framework/source/accelerators/keymapping \ + framework/source/accelerators/moduleacceleratorconfiguration \ + framework/source/accelerators/presethandler \ + framework/source/accelerators/storageholder \ + framework/source/classes/droptargetlistener \ + framework/source/classes/framecontainer \ + framework/source/classes/fwktabwindow \ + framework/source/classes/menumanager \ + framework/source/classes/taskcreator \ + framework/source/constant/containerquery \ + framework/source/constant/contenthandler \ + framework/source/constant/frameloader \ + framework/source/dispatch/closedispatcher \ + framework/source/dispatch/dispatchinformationprovider \ + framework/source/dispatch/dispatchprovider \ + framework/source/dispatch/helpagentdispatcher \ + framework/source/dispatch/interceptionhelper \ + framework/source/dispatch/loaddispatcher \ + framework/source/dispatch/menudispatcher \ + framework/source/dispatch/startmoduledispatcher \ + framework/source/dispatch/windowcommanddispatch \ + framework/source/helper/dockingareadefaultacceptor \ + framework/source/helper/ocomponentaccess \ + framework/source/helper/ocomponentenumeration \ + framework/source/helper/oframes \ + framework/source/helper/persistentwindowstate \ + framework/source/helper/statusindicator \ + framework/source/helper/statusindicatorfactory \ + framework/source/helper/tagwindowasmodified \ + framework/source/helper/titlebarupdate \ + framework/source/helper/vclstatusindicator \ + framework/source/helper/wakeupthread \ + framework/source/interaction/quietinteraction \ + framework/source/jobs/job \ + framework/source/jobs/jobdata \ + framework/source/jobs/jobdispatch \ + framework/source/jobs/jobexecutor \ + framework/source/jobs/jobresult \ + framework/source/jobs/joburl \ + framework/source/layoutmanager/helpers \ + framework/source/layoutmanager/layoutmanager \ + framework/source/layoutmanager/panel \ + framework/source/layoutmanager/panelmanager \ + framework/source/layoutmanager/toolbarlayoutmanager \ + framework/source/layoutmanager/uielement \ + framework/source/loadenv/loadenv \ + framework/source/loadenv/targethelper \ + framework/source/register/registerservices \ + framework/source/services/autorecovery \ + framework/source/services/backingcomp \ + framework/source/services/backingwindow \ + framework/source/services/desktop \ + framework/source/services/frame \ + framework/source/services/modelwinservice \ + framework/source/services/modulemanager \ + framework/source/services/pathsettings \ + framework/source/services/sessionlistener \ + framework/source/services/substitutepathvars \ + framework/source/services/tabwindowservice \ + framework/source/services/taskcreatorsrv \ + framework/source/services/uriabbreviation \ + framework/source/services/urltransformer \ + framework/source/uiconfiguration/globalsettings \ + framework/source/uiconfiguration/graphicnameaccess \ + framework/source/uiconfiguration/imagemanager \ + framework/source/uiconfiguration/imagemanagerimpl \ + framework/source/uiconfiguration/moduleimagemanager \ + framework/source/uiconfiguration/moduleuicfgsupplier \ + framework/source/uiconfiguration/moduleuiconfigurationmanager \ + framework/source/uiconfiguration/uicategorydescription \ + framework/source/uiconfiguration/uiconfigurationmanager \ + framework/source/uiconfiguration/uiconfigurationmanagerimpl \ + framework/source/uiconfiguration/windowstateconfiguration \ + framework/source/uielement/addonstoolbarmanager \ + framework/source/uielement/addonstoolbarwrapper \ + framework/source/uielement/buttontoolbarcontroller \ + framework/source/uielement/comboboxtoolbarcontroller \ + framework/source/uielement/complextoolbarcontroller \ + framework/source/uielement/controlmenucontroller \ + framework/source/uielement/dropdownboxtoolbarcontroller \ + framework/source/uielement/edittoolbarcontroller \ + framework/source/uielement/generictoolbarcontroller \ + framework/source/uielement/imagebuttontoolbarcontroller \ + framework/source/uielement/langselectionstatusbarcontroller \ + framework/source/uielement/menubarmanager \ + framework/source/uielement/menubarmerger \ + framework/source/uielement/menubarwrapper \ + framework/source/uielement/objectmenucontroller \ + framework/source/uielement/panelwindow \ + framework/source/uielement/panelwrapper \ + framework/source/uielement/progressbarwrapper \ + framework/source/uielement/recentfilesmenucontroller \ + framework/source/uielement/spinfieldtoolbarcontroller \ + framework/source/uielement/statusbar \ + framework/source/uielement/statusbarmanager \ + framework/source/uielement/statusbarwrapper \ + framework/source/uielement/statusindicatorinterfacewrapper \ + framework/source/uielement/togglebuttontoolbarcontroller \ + framework/source/uielement/toolbar \ + framework/source/uielement/toolbarmanager \ + framework/source/uielement/toolbarmerger \ + framework/source/uielement/toolbarwrapper \ + framework/source/uielement/uicommanddescription \ + framework/source/uifactory/addonstoolboxfactory \ + framework/source/uifactory/factoryconfiguration \ + framework/source/uifactory/menubarfactory \ + framework/source/uifactory/popupmenucontrollerfactory \ + framework/source/uifactory/statusbarcontrollerfactory \ + framework/source/uifactory/statusbarfactory \ + framework/source/uifactory/toolbarcontrollerfactory \ + framework/source/uifactory/toolboxfactory \ + framework/source/uifactory/uielementfactorymanager \ + framework/source/uifactory/windowcontentfactorymanager \ + framework/source/xml/acceleratorconfigurationreader \ + framework/source/xml/acceleratorconfigurationwriter \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,fwk,\ + dl \ + m \ + pthread \ +)) +endif +ifeq ($(OS),WNT) +$(eval $(call gb_Library_add_linked_libs,fwk,\ + kernel32 \ + msvcrt \ + uwinapi \ +)) +endif +# vim: set noet sw=4 ts=4: diff --git a/framework/Library_fwl.mk b/framework/Library_fwl.mk new file mode 100644 index 000000000000..d2002115eaf0 --- /dev/null +++ b/framework/Library_fwl.mk @@ -0,0 +1,99 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,fwl)) + +$(eval $(call gb_Library_set_componentfile,fwl,framework/util/fwl)) + +$(eval $(call gb_Library_set_include,fwl,\ + -I$(SRCDIR)/framework/inc \ + -I$(SRCDIR)/framework/inc/pch \ + -I$(SRCDIR)/framework/source/inc \ + -I$(WORKDIR)/inc/framework/ \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/framework \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_linked_libs,fwl,\ + comphelper \ + cppu \ + cppuhelper \ + fwe \ + fwi \ + i18nisolang1 \ + sal \ + stl \ + svl \ + svt \ + tk \ + tl \ + utl \ + vcl \ +)) + +$(eval $(call gb_Library_add_exception_objects,fwl,\ + framework/source/classes/fwlresid \ + framework/source/dispatch/mailtodispatcher \ + framework/source/dispatch/oxt_handler \ + framework/source/dispatch/popupmenudispatcher \ + framework/source/dispatch/servicehandler \ + framework/source/recording/dispatchrecorder \ + framework/source/recording/dispatchrecordersupplier \ + framework/source/register/registertemp \ + framework/source/services/dispatchhelper \ + framework/source/services/license \ + framework/source/services/mediatypedetectionhelper \ + framework/source/services/uriabbreviation \ + framework/source/uielement/fontmenucontroller \ + framework/source/uielement/fontsizemenucontroller \ + framework/source/uielement/footermenucontroller \ + framework/source/uielement/headermenucontroller \ + framework/source/uielement/langselectionmenucontroller \ + framework/source/uielement/logoimagestatusbarcontroller \ + framework/source/uielement/logotextstatusbarcontroller \ + framework/source/uielement/macrosmenucontroller \ + framework/source/uielement/newmenucontroller \ + framework/source/uielement/popupmenucontroller \ + framework/source/uielement/simpletextstatusbarcontroller \ + framework/source/uielement/toolbarsmenucontroller \ +)) +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,fwl,\ + dl \ + m \ + pthread \ +)) +endif +ifeq ($(OS),WNT) +$(eval $(call gb_Library_add_linked_libs,fwl,\ + kernel32 \ + msvcrt \ + uwinapi \ +)) +endif +# vim: set noet sw=4 ts=4: diff --git a/framework/Library_fwm.mk b/framework/Library_fwm.mk new file mode 100644 index 000000000000..9ff49719148a --- /dev/null +++ b/framework/Library_fwm.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,fwm)) + +$(eval $(call gb_Library_set_componentfile,fwm,framework/util/fwm)) + +$(eval $(call gb_Library_set_include,fwm,\ + -I$(SRCDIR)/framework/inc/pch \ + -I$(SRCDIR)/framework/inc \ + -I$(SRCDIR)/framework/source/inc \ + -I$(WORKDIR)/inc/framework/ \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/framework \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_linked_libs,fwm,\ + comphelper \ + cppu \ + cppuhelper \ + fwi \ + sal \ + stl \ + svl \ + svt \ + tk \ + tl \ + utl \ + vcl \ + vos3 \ +)) + +$(eval $(call gb_Library_add_exception_objects,fwm,\ + framework/source/dispatch/systemexec \ + framework/source/jobs/helponstartup \ + framework/source/jobs/shelljob \ + framework/source/register/register3rdcomponents \ + framework/source/tabwin/tabwindow \ + framework/source/tabwin/tabwinfactory \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_linked_libs,fwm,\ + dl \ + m \ + pthread \ +)) +endif +ifeq ($(OS),WNT) +$(eval $(call gb_Library_add_linked_libs,fwm,\ + kernel32 \ + msvcrt \ + uwinapi \ +)) +endif +# vim: set noet sw=4 ts=4: diff --git a/sfx2/source/explorer/makefile.mk b/framework/Makefile index 75a15ebdb862..a79aff831024 100644 --- a/sfx2/source/explorer/makefile.mk +++ b/framework/Makefile @@ -25,23 +25,14 @@ # #************************************************************************* -PRJ=..$/.. +ifeq ($(strip $(SOLARENV)),) +$(error No environment set!) +endif -PRJNAME=sfx2 -TARGET=explorer -ENABLE_EXCEPTIONS=TRUE +gb_PARTIALBUILD := T +GBUILDDIR := $(SOLARENV)/gbuild +include $(GBUILDDIR)/gbuild.mk -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/nochaos.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk +$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk))) +# vim: set noet sw=4 ts=4: diff --git a/framework/Module_framework.mk b/framework/Module_framework.mk new file mode 100644 index 000000000000..28b2e087b60f --- /dev/null +++ b/framework/Module_framework.mk @@ -0,0 +1,43 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Module_Module,framework)) + +$(eval $(call gb_Module_add_targets,framework,\ + AllLangResTarget_fwe \ + Library_fwe \ + Library_fwi \ + Library_fwk \ + Library_fwl \ + Library_fwm \ + Package_dtd \ + Package_inc \ + Package_uiconfig \ + Package_unotypes \ +)) + +# vim: set noet ts=4 sw=4: diff --git a/framework/inc/makefile.mk b/framework/Package_dtd.mk index e2f1bedf4e98..db23783c4ef9 100644 --- a/framework/inc/makefile.mk +++ b/framework/Package_dtd.mk @@ -2,7 +2,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2009 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite # @@ -14,34 +14,22 @@ # # 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 +# 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 +# version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # #************************************************************************* -PRJ=.. - -PRJNAME=framework -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" +$(eval $(call gb_Package_Package,framework_dtd,$(SRCDIR)/framework/dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/accelerator.dtd,accelerator.dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/event.dtd,event.dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/groupuinames.dtd,groupuinames.dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/image.dtd,image.dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/menubar.dtd,menubar.dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/statusbar.dtd,statusbar.dtd)) +$(eval $(call gb_Package_add_file,framework_dtd,bin/toolbar.dtd,toolbar.dtd)) diff --git a/framework/Package_inc.mk b/framework/Package_inc.mk new file mode 100644 index 000000000000..adefc3ccbd56 --- /dev/null +++ b/framework/Package_inc.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,framework_inc,$(SRCDIR)/framework/inc)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/acceleratorinfo.hxx,framework/acceleratorinfo.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/actiontriggerhelper.hxx,framework/actiontriggerhelper.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/addonmenu.hxx,framework/addonmenu.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/addonsoptions.hxx,framework/addonsoptions.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/bmkmenu.hxx,framework/bmkmenu.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/configimporter.hxx,framework/configimporter.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/eventsconfiguration.hxx,framework/eventsconfiguration.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/framelistanalyzer.hxx,framework/framelistanalyzer.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imageproducer.hxx,framework/imageproducer.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imagesconfiguration.hxx,framework/imagesconfiguration.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/interaction.hxx,framework/interaction.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/menuconfiguration.hxx,framework/menuconfiguration.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/menuextensionsupplier.hxx,framework/menuextensionsupplier.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/preventduplicateinteraction.hxx,framework/preventduplicateinteraction.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/sfxhelperfunctions.hxx,framework/sfxhelperfunctions.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/titlehelper.hxx,framework/titlehelper.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/toolboxconfiguration.hxx,framework/toolboxconfiguration.hxx)) +$(eval $(call gb_Package_add_file,framework_inc,inc/framework/fwedllapi.h,framework/fwedllapi.h)) +$(eval $(call gb_Package_add_file,framework_inc,inc/fwkdllapi.h,fwkdllapi.h)) +$(eval $(call gb_Package_add_file,framework_inc,inc/fwidllapi.h,fwidllapi.h)) diff --git a/framework/qa/complex/dispatches/helper/makefile.mk b/framework/Package_uiconfig.mk index 2b2ccab5ebef..295be6c87252 100644 --- a/framework/qa/complex/dispatches/helper/makefile.mk +++ b/framework/Package_uiconfig.mk @@ -2,7 +2,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2009 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite # @@ -14,34 +14,18 @@ # # 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 +# 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 +# version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # #************************************************************************* -PRJ = ../../../.. -TARGET = checkdispatchapi -PRJNAME = framework -PACKAGE = complex/dispatches/helper - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar Generator.jar -JAVAFILES = Interceptor.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)/$(PACKAGE)/$(i:b).class) - -MAXLINELENGTH = 100000 - -.INCLUDE : target.mk - - +$(eval $(call gb_Package_Package,framework_uiconfig,$(SRCDIR)/framework/uiconfig)) +$(eval $(call gb_Package_add_file,framework_uiconfig,xml/uiconfig/modules/StartModule/menubar/menubar.xml,startmodule/menubar/menubar.xml)) +$(eval $(call gb_Package_add_file,framework_uiconfig,xml/uiconfig/modules/StartModule/statusbar/statusbar.xml,startmodule/statusbar/statusbar.xml)) +$(eval $(call gb_Package_add_file,framework_uiconfig,xml/uiconfig/modules/StartModule/toolbar/standardbar.xml,startmodule/toolbar/standardbar.xml)) diff --git a/framework/Package_unotypes.mk b/framework/Package_unotypes.mk new file mode 100644 index 000000000000..01069ae93dc4 --- /dev/null +++ b/framework/Package_unotypes.mk @@ -0,0 +1,30 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,framework_unotypes,$(SRCDIR)/framework/source/unotypes)) +$(eval $(call gb_Package_add_file,framework_unotypes,xml/fwk.xml,fwk.xml)) +$(eval $(call gb_Package_add_file,framework_unotypes,xml/fwl.xml,fwl.xml)) diff --git a/framework/inc/classes/actiontriggercontainer.hxx b/framework/inc/classes/actiontriggercontainer.hxx index 034252c2ae63..936f6cf0cdbb 100644 --- a/framework/inc/classes/actiontriggercontainer.hxx +++ b/framework/inc/classes/actiontriggercontainer.hxx @@ -32,14 +32,16 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> +#include <framework/fwedllapi.h> #define SERVICENAME_ACTIONTRIGGERCONTAINER "com.sun.star.ui.ActionTriggerContainer" #define IMPLEMENTATIONNAME_ACTIONTRIGGERCONTAINER "com.sun.star.comp.ui.ActionTriggerContainer" + namespace framework { -class ActionTriggerContainer : public PropertySetContainer, +class FWE_DLLPUBLIC ActionTriggerContainer : public PropertySetContainer, public com::sun::star::lang::XMultiServiceFactory, public com::sun::star::lang::XServiceInfo, public com::sun::star::lang::XTypeProvider diff --git a/framework/inc/classes/actiontriggerpropertyset.hxx b/framework/inc/classes/actiontriggerpropertyset.hxx index 203fa6eb67eb..3f373f272afd 100644 --- a/framework/inc/classes/actiontriggerpropertyset.hxx +++ b/framework/inc/classes/actiontriggerpropertyset.hxx @@ -41,6 +41,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <framework/fwedllapi.h> #define SERVICENAME_ACTIONTRIGGER "com.sun.star.ui.ActionTrigger" #define IMPLEMENTATIONNAME_ACTIONTRIGGER "com.sun.star.comp.ui.ActionTrigger" @@ -48,7 +49,7 @@ namespace framework { -class ActionTriggerPropertySet : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. +class ActionTriggerPropertySet : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::com::sun::star::lang::XServiceInfo , public ::com::sun::star::lang::XTypeProvider, public ::cppu::OBroadcastHelper , @@ -56,23 +57,23 @@ class ActionTriggerPropertySet : public ThreadHelpBase public ::cppu::OWeakObject { public: - ActionTriggerPropertySet( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - virtual ~ActionTriggerPropertySet(); + FWE_DLLPUBLIC ActionTriggerPropertySet( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + FWE_DLLPUBLIC virtual ~ActionTriggerPropertySet(); // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw (); - virtual void SAL_CALL release() throw (); + virtual FWE_DLLPUBLIC void SAL_CALL acquire() throw (); + virtual FWE_DLLPUBLIC void SAL_CALL release() throw (); // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); // XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); private: //--------------------------------------------------------------------------------------------------------- diff --git a/framework/inc/classes/actiontriggerseparatorpropertyset.hxx b/framework/inc/classes/actiontriggerseparatorpropertyset.hxx index 7cb1488c1112..f3579e98fcc1 100644 --- a/framework/inc/classes/actiontriggerseparatorpropertyset.hxx +++ b/framework/inc/classes/actiontriggerseparatorpropertyset.hxx @@ -37,10 +37,12 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <framework/fwedllapi.h> #define SERVICENAME_ACTIONTRIGGERSEPARATOR "com.sun.star.ui.ActionTriggerSeparator" #define IMPLEMENTATIONNAME_ACTIONTRIGGERSEPARATOR "com.sun.star.comp.ui.ActionTriggerSeparator" + namespace framework { diff --git a/framework/inc/classes/converter.hxx b/framework/inc/classes/converter.hxx index bd53b127f800..43972eeefa1b 100644 --- a/framework/inc/classes/converter.hxx +++ b/framework/inc/classes/converter.hxx @@ -47,6 +47,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <tools/datetime.hxx> +#include <fwidllapi.h> //_________________________________________________________________________________________________________________ // namespace @@ -62,7 +63,7 @@ namespace framework{ // exported definitions //_________________________________________________________________________________________________________________ -class Converter +class FWI_DLLPUBLIC Converter { public: // Seq<Any> <=> Seq<beans.PropertyValue> diff --git a/framework/inc/classes/fwkresid.hxx b/framework/inc/classes/fwkresid.hxx index c18eef0d77c3..6cfe3fc7a0dd 100644 --- a/framework/inc/classes/fwkresid.hxx +++ b/framework/inc/classes/fwkresid.hxx @@ -29,11 +29,12 @@ #define __FRAMEWORK_CLASSES_FWKRESID_HXX_ #include <tools/resid.hxx> +#include <framework/fwedllapi.h> namespace framework { -class FwkResId : public ResId +class FWE_DLLPUBLIC FwkResId : public ResId { public: FwkResId( USHORT nId ); diff --git a/framework/inc/classes/imagewrapper.hxx b/framework/inc/classes/imagewrapper.hxx index fe4c9f5c9641..2001314e9edb 100644 --- a/framework/inc/classes/imagewrapper.hxx +++ b/framework/inc/classes/imagewrapper.hxx @@ -34,11 +34,12 @@ #include <com/sun/star/lang/XTypeProvider.hpp> #include <cppuhelper/implbase2.hxx> #include <vcl/image.hxx> +#include <framework/fwedllapi.h> namespace framework { -class ImageWrapper : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. +class FWE_DLLPUBLIC ImageWrapper : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::WeakImplHelper2< ::com::sun::star::awt::XBitmap, ::com::sun::star::lang::XUnoTunnel > { diff --git a/framework/inc/classes/propertysethelper.hxx b/framework/inc/classes/propertysethelper.hxx index f1c5648470b9..d62debc5b2a2 100644 --- a/framework/inc/classes/propertysethelper.hxx +++ b/framework/inc/classes/propertysethelper.hxx @@ -49,6 +49,7 @@ // other includes #include <cppuhelper/weakref.hxx> +#include <fwidllapi.h> //_________________________________________________________________________________________________________________ // namespace @@ -66,7 +67,7 @@ namespace framework{ * Further the derived and this base class share the same lock. * So it's possible to be threadsafe if it's needed. */ -class PropertySetHelper : public css::beans::XPropertySet +class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet , public css::beans::XPropertySetInfo { //------------------------------------------------------------------------- diff --git a/framework/inc/classes/protocolhandlercache.hxx b/framework/inc/classes/protocolhandlercache.hxx index 77c4ca6a7f93..ffdcaa1f253b 100644 --- a/framework/inc/classes/protocolhandlercache.hxx +++ b/framework/inc/classes/protocolhandlercache.hxx @@ -47,6 +47,7 @@ #include <unotools/configitem.hxx> #include <rtl/ustring.hxx> +#include <fwidllapi.h> //_________________________________________________________________________________________________________________ // namespace @@ -76,7 +77,7 @@ namespace framework{ This struct holds the information about one such registered protocol handler. A list of handler objects is defined as ProtocolHandlerHash. see below */ -struct ProtocolHandler +struct FWI_DLLPUBLIC ProtocolHandler { /* member */ public: @@ -94,7 +95,7 @@ struct ProtocolHandler uno implementation names as value. Overloading of the index operator makes it possible to search for a key by using a full qualified URL on list of all possible pattern keys. */ -class PatternHash : public BaseHash< ::rtl::OUString > +class FWI_DLLPUBLIC PatternHash : public BaseHash< ::rtl::OUString > { /* interface */ public: @@ -133,7 +134,7 @@ typedef BaseHash< ProtocolHandler > HandlerHash; */ class HandlerCFGAccess; -class HandlerCache +class FWI_DLLPUBLIC HandlerCache { /* member */ private: @@ -178,7 +179,7 @@ class HandlerCache @modified 30.04.2002 09:58, as96863 */ -class HandlerCFGAccess : public ::utl::ConfigItem +class FWI_DLLPUBLIC HandlerCFGAccess : public ::utl::ConfigItem { private: HandlerCache* m_pCache; diff --git a/framework/inc/classes/rootactiontriggercontainer.hxx b/framework/inc/classes/rootactiontriggercontainer.hxx index 5d7a820983f7..e3c26d190ce9 100644 --- a/framework/inc/classes/rootactiontriggercontainer.hxx +++ b/framework/inc/classes/rootactiontriggercontainer.hxx @@ -35,6 +35,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> +#include <framework/fwedllapi.h> #define IMPLEMENTATIONNAME_ROOTACTIONTRIGGERCONTAINER "com.sun.star.comp.ui.RootActionTriggerContainer" @@ -42,7 +43,7 @@ namespace framework { -class RootActionTriggerContainer : public PropertySetContainer, +class FWE_DLLPUBLIC RootActionTriggerContainer : public PropertySetContainer, public com::sun::star::lang::XMultiServiceFactory, public com::sun::star::lang::XServiceInfo, public com::sun::star::lang::XUnoTunnel, diff --git a/framework/inc/dispatch/interaction.hxx b/framework/inc/dispatch/interaction.hxx deleted file mode 100644 index 28b5d817251b..000000000000 --- a/framework/inc/dispatch/interaction.hxx +++ /dev/null @@ -1,325 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FRAMEWORK_DISPATCH_INTERACTION_HXX_ -#define __FRAMEWORK_DISPATCH_INTERACTION_HXX_ - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ - -#include <com/sun/star/task/XInteractionRequest.hpp> -#include <com/sun/star/task/XInteractionContinuation.hpp> -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/task/XInteractionApprove.hpp> -#include <com/sun/star/task/XInteractionDisapprove.hpp> -#include <com/sun/star/task/XInteractionRetry.hpp> -#include <com/sun/star/document/XInteractionFilterSelect.hpp> -#include <com/sun/star/document/NoSuchFilterRequest.hpp> -#include <com/sun/star/document/AmbigousFilterRequest.hpp> -#include <com/sun/star/uno/RuntimeException.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ -#include <rtl/ustring.hxx> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -namespace framework{ - -//_________________________________________________________________________________________________________________ -// non exported const -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// non exported definitions -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short base for continuation classes - @descr An interaction continuation could be used on XInteractionHandler/XInteractionRequest - to abort or react for it. - Base functionality is everytime the same - handler mark right continuation by calling - interface method "select()". User of interaction can detect it by testing c++ method "isSelected()"! - Superclasses can add additional interfaces or methods to support additional features ... - but selection of it is supported here! - - @implements XInterface - XTypeProvider (supported by WeakImplHelper!) - XInteractionContinuation - - @base WeakImplHelper1 - - @devstatus ready to use - @threadsafe no (used on once position only!) -*//*-*************************************************************************************************************/ -template< class TContinuationType > -class ContinuationBase : public ::cppu::WeakImplHelper1< TContinuationType > -{ - // c++ interface - public: - - //--------------------------------------------------------------------------------------------------------- - // initialize continuation with right start values - //--------------------------------------------------------------------------------------------------------- - ContinuationBase() - : m_bSelected( sal_False ) - { - } - - //--------------------------------------------------------------------------------------------------------- - // was continuation selected by handler? - //--------------------------------------------------------------------------------------------------------- - sal_Bool isSelected() const - { - return m_bSelected; - } - - //--------------------------------------------------------------------------------------------------------- - // make using more then once possible - //--------------------------------------------------------------------------------------------------------- - void reset() - { - m_bSelected = sal_False; - } - - // uno interface - public: - - //--------------------------------------------------------------------------------------------------------- - // called by handler to mark continuation as the only possible solution for started interaction - //--------------------------------------------------------------------------------------------------------- - virtual void SAL_CALL select() throw( ::com::sun::star::uno::RuntimeException ) - { - m_bSelected = sal_True; - } - - // member - private: - - sal_Bool m_bSelected; - -}; // class ContinuationBase - -/*-************************************************************************************************************//** - @short declaration of some simple continuations - @descr These derived classes implements some simple continuations, which doesnt need and additional - interfaces or methods. Her selected state is the only neccessary feature. User of it can - distinguish by type between different functionality! - - @implements - - - @base ContinuationBase - - @devstatus ready to use - @threadsafe no (used on once position only!) -*//*-*************************************************************************************************************/ -typedef ContinuationBase< ::com::sun::star::task::XInteractionAbort > ContinuationAbort; -typedef ContinuationBase< ::com::sun::star::task::XInteractionApprove > ContinuationApprove; -typedef ContinuationBase< ::com::sun::star::task::XInteractionDisapprove > ContinuationDisapprove; -typedef ContinuationBase< ::com::sun::star::task::XInteractionRetry > ContinuationRetry; - -/*-************************************************************************************************************//** - @short declaration of special continuation for filter selection - @descr Sometimes filter detection during loading document failed. Then we need a possibility - to ask user for his decision. These continuation transport selected filter by user to - code user of interaction. - - @attention This implementation could be used one times only. We don't support a resetable continuation yet! - Why? Normaly interaction should show a filter selection dialog and ask user for his decision. - He can select any filter - then instances of these class will be called by handler ... or user - close dialog without any selection. Then another continuation should be slected by handler to - abort continuations ... Retrying isn't very usefull here ... I think. - - @implements XInteractionFilterSelect - - @base ImplInheritanceHelper1 - ContinuationBase - - @devstatus ready to use - @threadsafe no (used on once position only!) -*//*-*************************************************************************************************************/ -class ContinuationFilterSelect : public ContinuationBase< ::com::sun::star::document::XInteractionFilterSelect > -{ - // c++ interface - public: - ContinuationFilterSelect(); - - // uno interface - public: - virtual void SAL_CALL setFilter( const ::rtl::OUString& sFilter ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::rtl::OUString SAL_CALL getFilter( ) throw( ::com::sun::star::uno::RuntimeException ); - - // member - private: - ::rtl::OUString m_sFilter; - -}; // class ContinuationFilterSelect - -/*-************************************************************************************************************//** - @short special request for interaction to ask user for right filter - @descr These helper can be used to ask user for right filter, if filter detection failed. - It capsulate communication with any interaction handler and supports an easy - access on interaction results for user of these class. - Use it and forget complex mechanism of interaction ... - - @example RequestFilterSelect* pRequest = new RequestFilterSelect; - Reference< XInteractionRequest > xRequest ( pRequest ); - xInteractionHandler->handle( xRequest ); - if( ! pRequest.isAbort() ) - { - OUString sFilter = pRequest->getFilter(); - } - - @implements XInteractionRequest - - @base WeakImplHelper1 - - @devstatus ready to use - @threadsafe no (used on once position only!) -*//*-*************************************************************************************************************/ -class RequestFilterSelect : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - // c++ interface - public: - RequestFilterSelect( const ::rtl::OUString& sURL ); - sal_Bool isAbort () const; - ::rtl::OUString getFilter() const; - - // uno interface - public: - virtual ::com::sun::star::uno::Any SAL_CALL getRequest () throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException ); - - // member - private: - ::com::sun::star::uno::Any m_aRequest ; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations; - ContinuationAbort* m_pAbort ; - ContinuationFilterSelect* m_pFilter ; - -}; // class RequestFilterSelect - -/*-************************************************************************************************************//** - @short special request for interaction - @descr User must decide between a preselected and another detected filter. - It capsulate communication with any interaction handler and supports an easy - access on interaction results for user of these class. - - @implements XInteractionRequest - - @base WeakImplHelper1 - - @devstatus ready to use - @threadsafe no (used on once position only!) -*//*-*************************************************************************************************************/ -class RequestAmbigousFilter : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - // c++ interface - public: - RequestAmbigousFilter( const ::rtl::OUString& sURL , - const ::rtl::OUString& sSelectedFilter , - const ::rtl::OUString& sDetectedFilter ); - sal_Bool isAbort () const; - ::rtl::OUString getFilter() const; - - // uno interface - public: - virtual ::com::sun::star::uno::Any SAL_CALL getRequest () throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException ); - - // member - private: - ::com::sun::star::uno::Any m_aRequest ; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations; - ContinuationAbort* m_pAbort ; - ContinuationFilterSelect* m_pFilter ; - -}; // class RequestFilterSelect - -/*-************************************************************************************************************//** - @short special request for interaction - @descr User must decide between a preselected and another detected filter. - It capsulate communication with any interaction handler and supports an easy - access on interaction results for user of these class. - - @implements XInteractionRequest - - @base WeakImplHelper1 - - @devstatus ready to use - @threadsafe no (used on once position only!) -*//*-*************************************************************************************************************/ -class InteractionRequest : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - // c++ interface - public: - InteractionRequest( const ::com::sun::star::uno::Any& aRequest , - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations ) - { - m_aRequest = aRequest ; - m_lContinuations = lContinuations; - } - - // uno interface - public: - virtual ::com::sun::star::uno::Any SAL_CALL getRequest() - throw( ::com::sun::star::uno::RuntimeException ) - { - return m_aRequest; - } - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() - throw( ::com::sun::star::uno::RuntimeException ) - { - return m_lContinuations; - } - - // member - private: - ::com::sun::star::uno::Any m_aRequest ; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations; - -}; // class RequestFilterSelect - -} // namespace framework - -#endif // #define __FRAMEWORK_DISPATCH_INTERACTION_HXX_ diff --git a/framework/inc/helper/acceleratorinfo.hxx b/framework/inc/framework/acceleratorinfo.hxx index bb529303df89..6b0519ceed98 100644 --- a/framework/inc/helper/acceleratorinfo.hxx +++ b/framework/inc/framework/acceleratorinfo.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <vcl/keycod.hxx> #include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> namespace framework { diff --git a/framework/inc/helper/actiontriggerhelper.hxx b/framework/inc/framework/actiontriggerhelper.hxx index 4e387a42509a..67c4115a3621 100644 --- a/framework/inc/helper/actiontriggerhelper.hxx +++ b/framework/inc/framework/actiontriggerhelper.hxx @@ -33,11 +33,12 @@ // #110897# #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <vcl/menu.hxx> +#include <framework/fwedllapi.h> namespace framework { - class ActionTriggerHelper + class FWE_DLLPUBLIC ActionTriggerHelper { public: // Fills the submitted menu with the structure contained in the second diff --git a/framework/inc/classes/addonmenu.hxx b/framework/inc/framework/addonmenu.hxx index 4bc5bb8f5990..183c6937b39e 100644 --- a/framework/inc/classes/addonmenu.hxx +++ b/framework/inc/framework/addonmenu.hxx @@ -40,6 +40,7 @@ //_________________________________________________________________________________________________________________ #include <vcl/menu.hxx> +#include <framework/fwedllapi.h> #define ADDONMENU_ITEMID_START 2000 #define ADDONMENU_ITEMID_END 3000 @@ -47,7 +48,7 @@ namespace framework { -class AddonMenu : public PopupMenu +class FWE_DLLPUBLIC AddonMenu : public PopupMenu { public: AddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); @@ -58,7 +59,7 @@ class AddonMenu : public PopupMenu }; class AddonMenuManager; -class AddonPopupMenu : public AddonMenu +class FWE_DLLPUBLIC AddonPopupMenu : public AddonMenu { public: ~AddonPopupMenu(); @@ -80,7 +81,7 @@ class AddonPopupMenu : public AddonMenu friend class AddonMenuManager; }; -class AddonMenuManager +class FWE_DLLPUBLIC AddonMenuManager { public: enum MenuType diff --git a/framework/inc/classes/addonsoptions.hxx b/framework/inc/framework/addonsoptions.hxx index 1824dd7b3f45..6e41fcbafdd1 100644 --- a/framework/inc/classes/addonsoptions.hxx +++ b/framework/inc/framework/addonsoptions.hxx @@ -38,7 +38,7 @@ #include <vcl/svapp.hxx> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> - +#include <framework/fwedllapi.h> //_________________________________________________________________________________________________________________ // types, enums, ... //_________________________________________________________________________________________________________________ @@ -81,7 +81,7 @@ namespace framework typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > MergeMenuDefinition; -struct MergeMenuInstruction +struct FWE_DLLPUBLIC MergeMenuInstruction { ::rtl::OUString aMergePoint; ::rtl::OUString aMergeCommand; @@ -92,7 +92,7 @@ struct MergeMenuInstruction }; typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer; -struct MergeToolbarInstruction +struct FWE_DLLPUBLIC MergeToolbarInstruction { ::rtl::OUString aMergeToolbar; ::rtl::OUString aMergePoint; @@ -132,7 +132,7 @@ class AddonsOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class AddonsOptions +class FWE_DLLPUBLIC AddonsOptions { //------------------------------------------------------------------------------------------------------------- // public methods diff --git a/framework/inc/classes/bmkmenu.hxx b/framework/inc/framework/bmkmenu.hxx index 11668d285d69..db6e2977f8b5 100644 --- a/framework/inc/classes/bmkmenu.hxx +++ b/framework/inc/framework/bmkmenu.hxx @@ -27,13 +27,13 @@ #ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX #define __FRAMEWORK_CLASSES_BMKMENU_HXX -#include "classes/addonmenu.hxx" +#include "framework/addonmenu.hxx" //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ #include <com/sun/star/frame/XFrame.hpp> - +#include <framework/fwedllapi.h> //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ @@ -50,7 +50,7 @@ namespace framework { class BmkMenu_Impl; -class BmkMenu : public AddonMenu +class FWE_DLLPUBLIC BmkMenu : public AddonMenu { public: enum BmkMenuType diff --git a/framework/inc/helper/configimporter.hxx b/framework/inc/framework/configimporter.hxx index bbe465d85692..6038f7bdd325 100644 --- a/framework/inc/helper/configimporter.hxx +++ b/framework/inc/framework/configimporter.hxx @@ -34,10 +34,11 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> namespace framework { - class UIConfigurationImporterOOo1x + class FWE_DLLPUBLIC UIConfigurationImporterOOo1x { public: static sal_Bool ImportCustomToolbars( diff --git a/framework/inc/xml/eventsconfiguration.hxx b/framework/inc/framework/eventsconfiguration.hxx index e5e1ab474a2a..4c07be58d1c7 100644 --- a/framework/inc/xml/eventsconfiguration.hxx +++ b/framework/inc/framework/eventsconfiguration.hxx @@ -28,6 +28,7 @@ #ifndef __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_ #define __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_ +#include <framework/fwedllapi.h> #include <svl/svarray.hxx> #include <tools/string.hxx> #include <tools/stream.hxx> @@ -40,13 +41,13 @@ namespace framework { -struct EventsConfig +struct FWE_DLLPUBLIC EventsConfig { ::com::sun::star::uno::Sequence< ::rtl::OUString > aEventNames; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aEventsProperties; }; -class EventsConfiguration +class FWE_DLLPUBLIC EventsConfiguration { public: // #110897# diff --git a/framework/inc/classes/framelistanalyzer.hxx b/framework/inc/framework/framelistanalyzer.hxx index 4ab3c4532cdc..d6f2cd734237 100644 --- a/framework/inc/classes/framelistanalyzer.hxx +++ b/framework/inc/framework/framelistanalyzer.hxx @@ -34,6 +34,7 @@ //_______________________________________________ // other includes +#include <framework/fwedllapi.h> //_______________________________________________ // namespace @@ -53,7 +54,7 @@ namespace framework{ to switch into the backing mode, close the current active frame only or exit the whole application explicitly or implicitly. */ -class FrameListAnalyzer +class FWE_DLLPUBLIC FrameListAnalyzer { //_______________________________________ // types diff --git a/framework/inc/framework/fwedllapi.h b/framework/inc/framework/fwedllapi.h new file mode 100644 index 000000000000..c3aa1bb81d1d --- /dev/null +++ b/framework/inc/framework/fwedllapi.h @@ -0,0 +1,13 @@ +#ifndef INCLUDED_FWEDLLAPI_H +#define INCLUDED_FWEDLLAPI_H + +#include "sal/types.h" + +#if defined(FWE_DLLIMPLEMENTATION) +#define FWE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define FWE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define FWE_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_FWEDLLAPI_H */ diff --git a/framework/inc/helper/imageproducer.hxx b/framework/inc/framework/imageproducer.hxx index dff0ccfd1049..595b4c913744 100644 --- a/framework/inc/helper/imageproducer.hxx +++ b/framework/inc/framework/imageproducer.hxx @@ -35,15 +35,16 @@ #include <com/sun/star/frame/XFrame.hpp> #include <vcl/image.hxx> #include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> namespace framework { typedef Image ( *pfunc_getImage)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); -pfunc_getImage SAL_CALL SetImageProducer( pfunc_getImage pGetImageFunc ); +pfunc_getImage FWE_DLLPUBLIC SAL_CALL SetImageProducer( pfunc_getImage pGetImageFunc ); -Image SAL_CALL GetImageFromURL( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); +Image FWE_DLLPUBLIC SAL_CALL GetImageFromURL( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); } diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/framework/imagesconfiguration.hxx index 733822db8beb..0771e2d8f7f1 100644 --- a/framework/inc/xml/imagesconfiguration.hxx +++ b/framework/inc/framework/imagesconfiguration.hxx @@ -28,6 +28,7 @@ #ifndef __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_ #define __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_ +#include <framework/fwedllapi.h> #include <svl/svarray.hxx> #include <tools/string.hxx> #include <tools/stream.hxx> @@ -49,7 +50,7 @@ enum ImageMaskMode ImageMaskMode_Bitmap }; -struct ImageItemDescriptor +struct FWE_DLLPUBLIC ImageItemDescriptor { ImageItemDescriptor() : nIndex( -1 ) {} @@ -57,7 +58,7 @@ struct ImageItemDescriptor long nIndex; // index of the bitmap inside the bitmaplist }; -struct ExternalImageItemDescriptor +struct FWE_DLLPUBLIC ExternalImageItemDescriptor { String aCommandURL; // URL command to dispatch String aURL; // a URL to an external bitmap @@ -69,7 +70,7 @@ SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2) typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr; SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2) -struct ImageListItemDescriptor +struct FWE_DLLPUBLIC ImageListItemDescriptor { ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ), pImageItemList( 0 ) {} @@ -88,7 +89,7 @@ struct ImageListItemDescriptor typedef ImageListItemDescriptor* ImageListItemDescriptorPtr; SV_DECL_PTRARR_DEL( ImageListDescriptor, ImageListItemDescriptorPtr, 10, 2) -struct ImageListsDescriptor +struct FWE_DLLPUBLIC ImageListsDescriptor { ImageListsDescriptor() : pImageList( 0 ), pExternalImageList( 0 ) {} @@ -98,7 +99,7 @@ struct ImageListsDescriptor ExternalImageItemListDescriptor* pExternalImageList; }; -class ImagesConfiguration +class FWE_DLLPUBLIC ImagesConfiguration { public: // #110897# diff --git a/framework/inc/framework/interaction.hxx b/framework/inc/framework/interaction.hxx new file mode 100644 index 000000000000..03c8fde19736 --- /dev/null +++ b/framework/inc/framework/interaction.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_DISPATCH_INTERACTION_HXX_ +#define __FRAMEWORK_DISPATCH_INTERACTION_HXX_ + +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <com/sun/star/task/XInteractionContinuation.hpp> +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/task/XInteractionApprove.hpp> +#include <com/sun/star/task/XInteractionDisapprove.hpp> +#include <com/sun/star/task/XInteractionRetry.hpp> +#include <com/sun/star/document/XInteractionFilterSelect.hpp> +#include <com/sun/star/document/NoSuchFilterRequest.hpp> +#include <com/sun/star/document/AmbigousFilterRequest.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <framework/fwedllapi.h> + +namespace framework{ + +/*-************************************************************************************************************//** + @short special request for interaction to ask user for right filter + @descr These helper can be used to ask user for right filter, if filter detection failed. + It capsulate communication with any interaction handler and supports an easy + access on interaction results for user of these class. + Use it and forget complex mechanism of interaction ... + + @example RequestFilterSelect* pRequest = new RequestFilterSelect; + Reference< XInteractionRequest > xRequest ( pRequest ); + xInteractionHandler->handle( xRequest ); + if( ! pRequest.isAbort() ) + { + OUString sFilter = pRequest->getFilter(); + } + + @implements XInteractionRequest + + @base WeakImplHelper1 + + @devstatus ready to use + @threadsafe no (used on once position only!) +*//*-*************************************************************************************************************/ +class RequestFilterSelect_Impl; +class FWE_DLLPUBLIC RequestFilterSelect +{ + RequestFilterSelect_Impl* pImp; + + public: + RequestFilterSelect( const ::rtl::OUString& sURL ); + ~RequestFilterSelect(); + sal_Bool isAbort () const; + ::rtl::OUString getFilter() const; + com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest(); +}; + +/*-************************************************************************************************************//** + @short special request for interaction + @descr User must decide between a preselected and another detected filter. + It capsulate communication with any interaction handler and supports an easy + access on interaction results for user of these class. + + @implements XInteractionRequest + + @base WeakImplHelper1 + + @devstatus ready to use + @threadsafe no (used on once position only!) +*//*-*************************************************************************************************************/ +class FWE_DLLPUBLIC InteractionRequest +{ +public: + static com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > + CreateRequest( const ::com::sun::star::uno::Any& aRequest, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations ); +}; + +/*-************************************************************************************************************//** + @short special request for interaction + @descr User must decide between a preselected and another detected filter. + It capsulate communication with any interaction handler and supports an easy + access on interaction results for user of these class. + + @implements XInteractionRequest + + @base WeakImplHelper1 + + @devstatus ready to use + @threadsafe no (used on once position only!) +*//*-*************************************************************************************************************/ +/* +class RequestAmbigousFilter_Impl; +class RequestAmbigousFilter // seems to be unused currently +{ + RequestAmbigousFilter_Impl* pImp; + + // c++ interface +public: + RequestAmbigousFilter( const ::rtl::OUString& sURL, + const ::rtl::OUString& sSelectedFilter , + const ::rtl::OUString& sDetectedFilter ); + ~RequestAmbigousFilter(); + sal_Bool isAbort () const; + ::rtl::OUString getFilter() const; + com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest(); +}; + */ + +} // namespace framework + +#endif // #define __FRAMEWORK_DISPATCH_INTERACTION_HXX_ diff --git a/framework/inc/xml/menuconfiguration.hxx b/framework/inc/framework/menuconfiguration.hxx index ad43ee07997d..dee6c23a8f8e 100644 --- a/framework/inc/xml/menuconfiguration.hxx +++ b/framework/inc/framework/menuconfiguration.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <framework/fwedllapi.h> //_________________________________________________________________________________________________________________ // includes of other projects @@ -70,7 +71,7 @@ const USHORT ITEMID_ADDONHELP = FWK_SID_ADDONHELP; namespace framework { -class MenuConfiguration +class FWE_DLLPUBLIC MenuConfiguration { public: struct Attributes diff --git a/framework/inc/classes/menuextensionsupplier.hxx b/framework/inc/framework/menuextensionsupplier.hxx index 04fe3352fa31..f6ca60d4fecc 100644 --- a/framework/inc/classes/menuextensionsupplier.hxx +++ b/framework/inc/framework/menuextensionsupplier.hxx @@ -29,8 +29,9 @@ #define __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_ #include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> -struct MenuExtensionItem +struct FWE_DLLPUBLIC MenuExtensionItem { rtl::OUString aLabel; rtl::OUString aURL; @@ -41,9 +42,9 @@ typedef MenuExtensionItem ( *pfunc_setMenuExtensionSupplier)(); namespace framework { -pfunc_setMenuExtensionSupplier SAL_CALL SetMenuExtensionSupplier( pfunc_setMenuExtensionSupplier pSetMenuExtensionSupplier ); +FWE_DLLPUBLIC pfunc_setMenuExtensionSupplier SAL_CALL SetMenuExtensionSupplier( pfunc_setMenuExtensionSupplier pSetMenuExtensionSupplier ); -MenuExtensionItem SAL_CALL GetMenuExtension(); +FWE_DLLPUBLIC MenuExtensionItem SAL_CALL GetMenuExtension(); } diff --git a/framework/inc/interaction/preventduplicateinteraction.hxx b/framework/inc/framework/preventduplicateinteraction.hxx index 4ba9554b21f9..e7f26b354f28 100644 --- a/framework/inc/interaction/preventduplicateinteraction.hxx +++ b/framework/inc/framework/preventduplicateinteraction.hxx @@ -28,6 +28,7 @@ #ifndef __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_ #define __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_ +#include <framework/fwedllapi.h> //_________________________________________________________________________________________________________________ // my own includes //_________________________________________________________________________________________________________________ @@ -82,7 +83,7 @@ struct ThreadHelpBase2 mutable ::osl::Mutex m_aLock; }; -class PreventDuplicateInteraction : private ThreadHelpBase2 +class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2 ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 > { //_____________________________________ diff --git a/framework/inc/classes/sfxhelperfunctions.hxx b/framework/inc/framework/sfxhelperfunctions.hxx index ac3fa472f249..fd4292fc340f 100644 --- a/framework/inc/classes/sfxhelperfunctions.hxx +++ b/framework/inc/framework/sfxhelperfunctions.hxx @@ -28,6 +28,7 @@ #ifndef __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_ #define __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_ +#include <framework/fwedllapi.h> #include <com/sun/star/frame/XFrame.hpp> #include <rtl/ustring.hxx> #include <vcl/toolbox.hxx> @@ -45,29 +46,29 @@ typedef void ( *pfunc_activateToolPanel)( const ::com::sun::star::uno::Reference namespace framework { -pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator ); +FWE_DLLPUBLIC pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator ); -svt::ToolboxController* SAL_CALL CreateToolBoxController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ); +FWE_DLLPUBLIC svt::ToolboxController* SAL_CALL CreateToolBoxController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ); -pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator ); +FWE_DLLPUBLIC pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator ); -svt::StatusbarController* SAL_CALL CreateStatusBarController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL ); +FWE_DLLPUBLIC svt::StatusbarController* SAL_CALL CreateStatusBarController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL ); -pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc ); +FWE_DLLPUBLIC pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc ); -void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); +FWE_DLLPUBLIC void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); -pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow ); +FWE_DLLPUBLIC pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow ); -void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); +FWE_DLLPUBLIC void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); -pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible ); +FWE_DLLPUBLIC pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible ); -bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); +FWE_DLLPUBLIC bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); -pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator ); +FWE_DLLPUBLIC pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator ); -void SAL_CALL ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ); +FWE_DLLPUBLIC void SAL_CALL ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ); } #endif // __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_ diff --git a/framework/inc/xml/statusbarconfiguration.hxx b/framework/inc/framework/statusbarconfiguration.hxx index 8619ae423622..bd93831cba7a 100644 --- a/framework/inc/xml/statusbarconfiguration.hxx +++ b/framework/inc/framework/statusbarconfiguration.hxx @@ -1,6 +1,33 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> |