diff options
Diffstat (limited to 'desktop')
45 files changed, 2912 insertions, 670 deletions
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/app/app.cxx b/desktop/source/app/app.cxx index 1b3eb1aa5a4a..a49cabc90bed 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -121,6 +121,7 @@ #include <osl/module.h> #include <osl/file.hxx> #include <osl/signal.h> +#include <osl/thread.hxx> #include <rtl/uuid.h> #include <rtl/uri.hxx> #include <unotools/pathoptions.hxx> @@ -347,10 +348,8 @@ CommandLineArgs* Desktop::GetCommandLineArgs() { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); if ( !pArgs ) - { pArgs = new CommandLineArgs; } - } return pArgs; } @@ -785,7 +784,6 @@ BOOL Desktop::QueryExit() { RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); utl::ConfigManager::GetConfigManager()->StoreConfigItems(); - FlushConfiguration(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); } catch ( RuntimeException& ) @@ -817,6 +815,7 @@ BOOL Desktop::QueryExit() } else { + FlushConfiguration(); try { // it is no problem to call DisableOfficeIPCThread() more than once @@ -1552,7 +1551,7 @@ void Desktop::Main() Reference< ::com::sun::star::task::XRestartManager > xRestartManager; sal_Bool bRestartRequested( sal_False ); sal_Bool bUseSystemFileDialog(sal_True); - int nAcquireCount( 0 ); + int nAcquireCount( 0 ); Reference < css::document::XEventListener > xGlobalBroadcaster; try { @@ -1619,25 +1618,6 @@ void Desktop::Main() } String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String(); delete pLabelResMgr; -/* - // locale and UI locale in AppSettings are now retrieved from configuration or system directly via SvtSysLocale - // no reason to set while starting - // set UI language and locale - RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ set locale settings" ); - //LanguageSelection langselect; - OUString aUILocaleString = LanguageSelection::getLanguageString(); - Locale aUILocale = LanguageSelection::IsoStringToLocale(aUILocaleString); - LanguageType eLanguage = SvtSysLocale().GetLanguage(); - - // #i39040#, do not call anything between GetSettings and SetSettings that might have - // a side effect on the settings (like, eg, SvtSysLocaleOptions().GetLocaleLanguageType(), - // which changes the MiscSettings !!! ) - AllSettings aSettings( Application::GetSettings() ); - aSettings.SetUILocale( aUILocale ); - aSettings.SetLanguage( eLanguage ); - Application::SetSettings( aSettings ); - RTL_LOGFILE_CONTEXT_TRACE( aLog, "} set locale settings" ); -*/ // Check for StarOffice/Suite specific extensions runs also with OpenOffice installation sets OUString aTitleString( aTitle ); @@ -1657,12 +1637,9 @@ void Desktop::Main() #endif SetDisplayName( aTitle ); -// SetSplashScreenProgress(30); RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create SvtPathOptions and SvtLanguageOptions" ); pPathOptions.reset( new SvtPathOptions); -// SetSplashScreenProgress(40); -// pLanguageOptions = new SvtLanguageOptions(sal_True); -// SetSplashScreenProgress(45); + SetSplashScreenProgress(40); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" ); // Check special env variable #111015# @@ -1744,6 +1721,7 @@ void Desktop::Main() } SetSplashScreenProgress(50); + // Backing Component sal_Bool bCrashed = sal_False; sal_Bool bExistsRecoveryData = sal_False; @@ -1773,43 +1751,37 @@ void Desktop::Main() if ( !bRestartRequested ) { - if ( - (pCmdLineArgs->IsEmptyOrAcceptOnly() ) && + if ((!pCmdLineArgs->WantsToLoadDocument() ) && (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) && (!bExistsRecoveryData ) && (!bExistsSessionData ) && - (!Application::AnyInput( INPUT_APPEVENT ) ) - ) + (!Application::AnyInput( INPUT_APPEVENT ) )) { - RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" ); - Reference< XFrame > xDesktopFrame( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - if (xDesktopFrame.is()) - { - // SetSplashScreenProgress(60); - Reference< XFrame > xBackingFrame; - Reference< ::com::sun::star::awt::XWindow > xContainerWindow; - - xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); - if (xBackingFrame.is()) - xContainerWindow = xBackingFrame->getContainerWindow(); - if (xContainerWindow.is()) - { - // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank" - // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, - // otherwise documents loaded into this frame will later on miss functionality depending on the style. - Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" ); - pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); - - SetSplashScreenProgress(75); - Sequence< Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - - Reference< XController > xBackingComp( - xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), - UNO_QUERY); - // SetSplashScreenProgress(80); + RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" ); + Reference< XFrame > xDesktopFrame( xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); + if (xDesktopFrame.is()) + { + Reference< XFrame > xBackingFrame; + Reference< ::com::sun::star::awt::XWindow > xContainerWindow; + + xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); + if (xBackingFrame.is()) + xContainerWindow = xBackingFrame->getContainerWindow(); + if (xContainerWindow.is()) + { + // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank" + // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, + // otherwise documents loaded into this frame will later on miss functionality depending on the style. + Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" ); + pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); + + SetSplashScreenProgress(75); + Sequence< Any > lArgs(1); + lArgs[0] <<= xContainerWindow; + + Reference< XController > xBackingComp( + xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), UNO_QUERY); if (xBackingComp.is()) { Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); @@ -1840,16 +1812,6 @@ void Desktop::Main() FatalError( MakeStartupErrorMessage(e.Message) ); return; } - /* - catch ( ... ) - { - FatalError( MakeStartupErrorMessage( - OUString::createFromAscii( - "Unknown error during startup (Office wrapper service).\nInstallation could be damaged."))); - return; - } - */ -// SetSplashScreenProgress(55); SvtFontSubstConfig().Apply(); @@ -1858,7 +1820,6 @@ void Desktop::Main() aAppearanceCfg.SetApplicationDefaults( this ); SvtAccessibilityOptions aOptions; aOptions.SetVCLSettings(); -// SetSplashScreenProgress(60); if ( !bRestartRequested ) { @@ -1892,15 +1853,6 @@ void Desktop::Main() FatalError( MakeStartupErrorMessage(e.Message) ); return; } - /* - catch ( ... ) - { - FatalError( MakeStartupErrorMessage( - OUString::createFromAscii( - "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged."))); - return; - } - */ // Post user event to startup first application component window // We have to send this OpenClients message short before execute() to @@ -2219,12 +2171,7 @@ IMPL_LINK( Desktop, OpenClients_Impl, void*, EMPTYARG ) // CloseStartupScreen(); CloseSplashScreen(); - CheckFirstRun( ); - - // allow ipc interaction -// OfficeIPCThread::SetReady(); - EnableOleAutomation(); if (getenv ("OOO_EXIT_POST_STARTUP")) @@ -2721,16 +2668,6 @@ void Desktop::OpenClients() if ( ! bAllowRecoveryAndSessionManagement ) { - /* - ::comphelper::ConfigurationHelper::writeDirectKey( - ::comphelper::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("Enabled"), - ::com::sun::star::uno::makeAny(sal_False), - ::comphelper::ConfigurationHelper::E_STANDARD); - - */ try { Reference< XDispatch > xRecovery( diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 0625191ee2ea..14b4fd1d6ddc 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -142,15 +142,16 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) UNO_QUERY); // parse command line arguments - sal_Bool bPrintEvent = sal_False; - sal_Bool bOpenEvent = sal_True; - sal_Bool bViewEvent = sal_False; - sal_Bool bStartEvent = sal_False; - sal_Bool bPrintToEvent = sal_False; - sal_Bool bPrinterName = sal_False; - sal_Bool bForceOpenEvent = sal_False; - sal_Bool bForceNewEvent = sal_False; - sal_Bool bDisplaySpec = sal_False; + bool bOpenEvent(true); + bool bPrintEvent(false); + bool bViewEvent(false); + bool bStartEvent(false); + bool bPrintToEvent(false); + bool bPrinterName(false); + bool bForceOpenEvent(false); + bool bForceNewEvent(false); + bool bDisplaySpec(false); + bool bOpenDoc(false); m_eArgumentCount = NONE; @@ -169,8 +170,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) if (tmp.getLength() > 0) aArg = tmp; } - String aArgStr = aArg; + String aArgStr = aArg; if ( aArg.getLength() > 0 ) { m_eArgumentCount = m_eArgumentCount == NONE ? ONE : MANY; @@ -182,98 +183,98 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) if ( aArgStr.EqualsIgnoreCaseAscii( "-n" )) { // force new documents based on the following documents - bForceNewEvent = sal_True; - bOpenEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bPrintEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; - } + bForceNewEvent = true; + bOpenEvent = false; + bForceOpenEvent = false; + bPrintToEvent = false; + bPrintEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = false; + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-o" )) { - // force open documents regards if they are templates or not - bForceOpenEvent = sal_True; - bOpenEvent = sal_False; - bForceNewEvent = sal_False; - bPrintToEvent = sal_False; - bPrintEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; - } + // force open documents regardless if they are templates or not + bForceOpenEvent = true; + bOpenEvent = false; + bForceNewEvent = false; + bPrintToEvent = false; + bPrintEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = false; + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-pt" )) { // Print to special printer - bPrintToEvent = sal_True; - bPrinterName = sal_True; - bPrintEvent = sal_False; - bOpenEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; - bForceOpenEvent = sal_False; - } - else if ( aArgStr.EqualsIgnoreCaseAscii( "-p" )) - { + bPrintToEvent = true; + bPrinterName = true; + bPrintEvent = false; + bOpenEvent = false; + bForceNewEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = false; + bForceOpenEvent = false; + } + else if ( aArgStr.EqualsIgnoreCaseAscii( "-p" )) + { // Print to default printer - bPrintEvent = sal_True; - bPrintToEvent = sal_False; - bOpenEvent = sal_False; - bForceNewEvent = sal_False; - bForceOpenEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; - } - else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" )) - { + bPrintEvent = true; + bPrintToEvent = false; + bOpenEvent = false; + bForceNewEvent = false; + bForceOpenEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = false; + } + else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" )) + { // open in viewmode - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bForceOpenEvent = sal_False; - bViewEvent = sal_True; - bStartEvent = sal_False; - bDisplaySpec = sal_False; - } + bOpenEvent = false; + bPrintEvent = false; + bPrintToEvent = false; + bForceNewEvent = false; + bForceOpenEvent = false; + bViewEvent = true; + bStartEvent = false; + bDisplaySpec = false; + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-show" )) { // open in viewmode - bOpenEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_True; - bPrintEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bForceOpenEvent = sal_False; - bDisplaySpec = sal_False; + bOpenEvent = false; + bViewEvent = false; + bStartEvent = true; + bPrintEvent = false; + bPrintToEvent = false; + bForceNewEvent = false; + bForceOpenEvent = false; + bDisplaySpec = false; } else if ( aArgStr.EqualsIgnoreCaseAscii( "-display" )) { // set display - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_True; + bOpenEvent = false; + bPrintEvent = false; + bForceOpenEvent = false; + bPrintToEvent = false; + bForceNewEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = true; } else if ( aArgStr.EqualsIgnoreCaseAscii( "-language" )) { - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; + bOpenEvent = false; + bPrintEvent = false; + bForceOpenEvent = false; + bPrintToEvent = false; + bForceNewEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = false; } #ifdef MACOSX @@ -285,14 +286,14 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL ) { // finder argument from MacOSX - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; + bOpenEvent = false; + bPrintEvent = false; + bForceOpenEvent = false; + bPrintToEvent = false; + bForceNewEvent = false; + bViewEvent = false; + bStartEvent = false; + bDisplaySpec = false; } #endif } @@ -308,29 +309,54 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) { // handle this argument as a filename if ( bOpenEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArgStr ); + bOpenDoc = true; + } else if ( bViewEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_VIEWLIST, aArgStr ); + bOpenDoc = true; + } else if ( bStartEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_STARTLIST, aArgStr ); + bOpenDoc = true; + } else if ( bPrintEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_PRINTLIST, aArgStr ); + bOpenDoc = true; + } else if ( bPrintToEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_PRINTTOLIST, aArgStr ); + bOpenDoc = true; + } else if ( bForceNewEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_FORCENEWLIST, aArgStr ); + bOpenDoc = true; + } else if ( bForceOpenEvent ) + { AddStringListParam_Impl( CMD_STRINGPARAM_FORCEOPENLIST, aArgStr ); - else if ( bDisplaySpec ){ + bOpenDoc = true; + } + else if ( bDisplaySpec ) + { AddStringListParam_Impl( CMD_STRINGPARAM_DISPLAY, aArgStr ); - bDisplaySpec = sal_False; // only one display, not a lsit - bOpenEvent = sal_True; // set back to standard + bDisplaySpec = false; // only one display, not a lsit + bOpenEvent = true; // set back to standard } } } } } } + + if ( bOpenDoc ) + m_bDocumentArgs = true; } void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ) @@ -432,8 +458,8 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-help" )) - || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" )) - || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-?" ))) + || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" )) + || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-?" ))) { SetBoolParam_Impl( CMD_BOOLPARAM_HELP, sal_True ); return sal_True; @@ -473,18 +499,18 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True ); return sal_True; } - #ifdef MACOSX - /* #i84053# ignore -psn on Mac - Platform dependent #ifdef here is ugly, however this is currently - the only platform dependent parameter. Should more appear - we should find a better solution - */ +#ifdef MACOSX + /* #i84053# ignore -psn on Mac + Platform dependent #ifdef here is ugly, however this is currently + the only platform dependent parameter. Should more appear + we should find a better solution + */ else if ( aArg.compareToAscii( "-psn", 4 ) == 0 ) { SetBoolParam_Impl( CMD_BOOLPARAM_PSN, sal_True ); return sal_True; } - #endif +#endif else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" )) { AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) ); @@ -496,7 +522,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& return sal_True; } else if ( aArgStr.CompareIgnoreCaseToAscii( "-portal," , - RTL_CONSTASCII_LENGTH( "-portal," )) == COMPARE_EQUAL ) + RTL_CONSTASCII_LENGTH( "-portal," )) == COMPARE_EQUAL ) { AddStringListParam_Impl( CMD_STRINGPARAM_PORTAL, aArgStr.Copy( RTL_CONSTASCII_LENGTH( "-portal," )) ); return sal_True; @@ -504,13 +530,10 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& else if ( aArgStr.Copy( 0, 7 ).EqualsIgnoreCaseAscii( "-userid" )) { if ( aArgStr.Len() > 8 ) - { - rtl::OUString aUserDir = aArgStr; - AddStringListParam_Impl( - CMD_STRINGPARAM_USERDIR, - ::rtl::Uri::decode( aUserDir.copy( 8 ), - rtl_UriDecodeWithCharset, - RTL_TEXTENCODING_UTF8 ) ); + { + rtl::OUString aUserDir = aArgStr; + AddStringListParam_Impl( CMD_STRINGPARAM_USERDIR, + ::rtl::Uri::decode( aUserDir.copy( 8 ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ) ); } return sal_True; } @@ -533,56 +556,64 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-calc" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_CALC ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_CALC, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_CALC, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-draw" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_DRAW ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_DRAW, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_DRAW, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-impress" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_IMPRESS ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_IMPRESS, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_IMPRESS, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-base" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_BASE ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_BASE, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_BASE, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-global" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_GLOBAL ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_GLOBAL, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_GLOBAL, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-math" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_MATH ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_MATH, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_MATH, sal_True ); + m_bDocumentArgs = true; return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-web" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WEB ); if ( !bAlreadySet ) - SetBoolParam_Impl( CMD_BOOLPARAM_WEB, sal_True ); + SetBoolParam_Impl( CMD_BOOLPARAM_WEB, sal_True ); + m_bDocumentArgs = true; return sal_True; } @@ -605,12 +636,12 @@ sal_Bool CommandLineArgs::CheckGroupMembers( GroupParamId nGroupId, BoolParam nE void CommandLineArgs::ResetParamValues() { int i; - for ( i = 0; i < CMD_BOOLPARAM_COUNT; i++ ) m_aBoolParams[i] = sal_False; for ( i = 0; i < CMD_STRINGPARAM_COUNT; i++ ) m_aStrSetParams[i] = sal_False; m_eArgumentCount = NONE; + m_bDocumentArgs = false; } void CommandLineArgs::SetBoolParam( BoolParam eParam, sal_Bool bNewValue ) @@ -897,4 +928,10 @@ sal_Bool CommandLineArgs::IsEmptyOrAcceptOnly() const ( ( m_eArgumentCount == ONE ) && m_aBoolParams[ CMD_BOOLPARAM_PSN ] ); } +sal_Bool CommandLineArgs::WantsToLoadDocument() const +{ + osl::MutexGuard aMutexGuard( m_aMutex ); + return m_bDocumentArgs; +} + } // namespace desktop diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 615577098c2d..a1c70bf5df72 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -38,7 +38,7 @@ namespace desktop class CommandLineArgs { public: - enum BoolParam // must be zero based! + enum BoolParam // must be zero based! { CMD_BOOLPARAM_MINIMIZED, CMD_BOOLPARAM_INVISIBLE, @@ -71,7 +71,7 @@ class CommandLineArgs CMD_BOOLPARAM_HELPIMPRESS, CMD_BOOLPARAM_HELPBASE, CMD_BOOLPARAM_PSN, - CMD_BOOLPARAM_COUNT // must be last element! + CMD_BOOLPARAM_COUNT // must be last element! }; enum StringParam // must be zero based! @@ -92,7 +92,7 @@ class CommandLineArgs CMD_STRINGPARAM_PRINTERNAME, CMD_STRINGPARAM_DISPLAY, CMD_STRINGPARAM_LANGUAGE, - CMD_STRINGPARAM_COUNT // must be last element! + CMD_STRINGPARAM_COUNT // must be last element! }; enum GroupParamId @@ -101,7 +101,8 @@ class CommandLineArgs CMD_GRPID_COUNT }; - struct Supplier { + struct Supplier + { // Thrown from constructors and next: class Exception { public: @@ -122,86 +123,88 @@ class CommandLineArgs boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; } // generic methods to access parameter - void SetBoolParam( BoolParam eParam, sal_Bool bNewValue ); + void SetBoolParam( BoolParam eParam, sal_Bool bNewValue ); // Access to bool parameters - sal_Bool IsMinimized() const; - sal_Bool IsInvisible() const; - sal_Bool IsNoRestore() const; - sal_Bool IsNoDefault() const; - sal_Bool IsBean() const; - sal_Bool IsServer() const; - sal_Bool IsHeadless() const; - sal_Bool IsQuickstart() const; - sal_Bool IsNoQuickstart() const; - sal_Bool IsTerminateAfterInit() const; - sal_Bool IsNoFirstStartWizard() const; - sal_Bool IsNoLogo() const; - sal_Bool IsNoLockcheck() const; - sal_Bool IsHelp() const; - sal_Bool IsHelpWriter() const; - sal_Bool IsHelpCalc() const; - sal_Bool IsHelpDraw() const; - sal_Bool IsHelpImpress() const; - sal_Bool IsHelpBase() const; - sal_Bool IsHelpMath() const; - sal_Bool IsHelpBasic() const; - sal_Bool IsWriter() const; - sal_Bool IsCalc() const; - sal_Bool IsDraw() const; - sal_Bool IsImpress() const; - sal_Bool IsBase() const; - sal_Bool IsGlobal() const; - sal_Bool IsMath() const; - sal_Bool IsWeb() const; - sal_Bool HasModuleParam() const; + sal_Bool IsMinimized() const; + sal_Bool IsInvisible() const; + sal_Bool IsNoRestore() const; + sal_Bool IsNoDefault() const; + sal_Bool IsBean() const; + sal_Bool IsServer() const; + sal_Bool IsHeadless() const; + sal_Bool IsQuickstart() const; + sal_Bool IsNoQuickstart() const; + sal_Bool IsTerminateAfterInit() const; + sal_Bool IsNoFirstStartWizard() const; + sal_Bool IsNoLogo() const; + sal_Bool IsNoLockcheck() const; + sal_Bool IsHelp() const; + sal_Bool IsHelpWriter() const; + sal_Bool IsHelpCalc() const; + sal_Bool IsHelpDraw() const; + sal_Bool IsHelpImpress() const; + sal_Bool IsHelpBase() const; + sal_Bool IsHelpMath() const; + sal_Bool IsHelpBasic() const; + sal_Bool IsWriter() const; + sal_Bool IsCalc() const; + sal_Bool IsDraw() const; + sal_Bool IsImpress() const; + sal_Bool IsBase() const; + sal_Bool IsGlobal() const; + sal_Bool IsMath() const; + sal_Bool IsWeb() const; + sal_Bool HasModuleParam() const; + sal_Bool WantsToLoadDocument() const; // Access to string parameters - sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const; - sal_Bool GetAcceptString( ::rtl::OUString& rPara) const; - sal_Bool GetUnAcceptString( ::rtl::OUString& rPara) const; - sal_Bool GetOpenList( ::rtl::OUString& rPara) const; - sal_Bool GetViewList( ::rtl::OUString& rPara) const; - sal_Bool GetStartList( ::rtl::OUString& rPara) const; - sal_Bool GetForceOpenList( ::rtl::OUString& rPara) const; - sal_Bool GetForceNewList( ::rtl::OUString& rPara) const; - sal_Bool GetPrintList( ::rtl::OUString& rPara) const; - sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const; - sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const; - sal_Bool GetLanguage( ::rtl::OUString& rPara ) const; + sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const; + sal_Bool GetAcceptString( ::rtl::OUString& rPara) const; + sal_Bool GetUnAcceptString( ::rtl::OUString& rPara) const; + sal_Bool GetOpenList( ::rtl::OUString& rPara) const; + sal_Bool GetViewList( ::rtl::OUString& rPara) const; + sal_Bool GetStartList( ::rtl::OUString& rPara) const; + sal_Bool GetForceOpenList( ::rtl::OUString& rPara) const; + sal_Bool GetForceNewList( ::rtl::OUString& rPara) const; + sal_Bool GetPrintList( ::rtl::OUString& rPara) const; + sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const; + sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const; + sal_Bool GetLanguage( ::rtl::OUString& rPara ) const; // Special analyzed states (does not match directly to a command line parameter!) - sal_Bool IsPrinting() const; - sal_Bool IsEmpty() const; - sal_Bool IsEmptyOrAcceptOnly() const; + sal_Bool IsPrinting() const; + sal_Bool IsEmpty() const; + sal_Bool IsEmptyOrAcceptOnly() const; private: enum Count { NONE, ONE, MANY }; struct GroupDefinition { - sal_Int32 nCount; - BoolParam* pGroupMembers; + sal_Int32 nCount; + BoolParam* pGroupMembers; }; // no copy and operator= CommandLineArgs( const CommandLineArgs& ); CommandLineArgs operator=( const CommandLineArgs& ); - sal_Bool InterpretCommandLineParameter( const ::rtl::OUString& ); - void ParseCommandLine_Impl( Supplier& supplier ); - void ResetParamValues(); - sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const; + sal_Bool InterpretCommandLineParameter( const ::rtl::OUString& ); + void ParseCommandLine_Impl( Supplier& supplier ); + void ResetParamValues(); + sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const; - void AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ); - void SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue ); + void AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ); + void SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue ); boost::optional< rtl::OUString > m_cwdUrl; - sal_Bool m_aBoolParams[ CMD_BOOLPARAM_COUNT ]; // Stores boolean parameters - rtl::OUString m_aStrParams[ CMD_STRINGPARAM_COUNT ]; // Stores string parameters - sal_Bool m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline - Count m_eArgumentCount; // Number of Args - mutable ::osl::Mutex m_aMutex; + sal_Bool m_aBoolParams[ CMD_BOOLPARAM_COUNT ]; // Stores boolean parameters + rtl::OUString m_aStrParams[ CMD_STRINGPARAM_COUNT ]; // Stores string parameters + sal_Bool m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline + Count m_eArgumentCount; // Number of Args + bool m_bDocumentArgs; // A document creation/open/load arg is used + mutable ::osl::Mutex m_aMutex; // static definition for groups where only one member can be true static GroupDefinition m_pGroupDefinitions[ CMD_GRPID_COUNT ]; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index d54175a94cc8..54495de410dc 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -71,30 +71,35 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_pPublisher( NULL ), m_xPackage( xPackage ) { - m_sTitle = xPackage->getDisplayName(); - m_sVersion = xPackage->getVersion(); - m_sDescription = xPackage->getDescription(); + try + { + 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; - m_sPublisherURL = aInfo.Second; + beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); + m_sPublisher = aInfo.First; + m_sPublisherURL = aInfo.Second; - // get the icons for the package if there are any - uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); - if ( xGraphic.is() ) - m_aIcon = Image( xGraphic ); + // get the icons for the package if there are any + uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); + if ( xGraphic.is() ) + m_aIcon = Image( xGraphic ); - xGraphic = xPackage->getIcon( true ); - if ( xGraphic.is() ) - m_aIconHC = Image( xGraphic ); - else - m_aIconHC = m_aIcon; + xGraphic = xPackage->getIcon( true ); + if ( xGraphic.is() ) + m_aIconHC = Image( xGraphic ); + else + m_aIconHC = m_aIcon; - if ( eState == AMBIGUOUS ) - m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); - else if ( eState == NOT_REGISTERED ) - checkDependencies(); + if ( eState == AMBIGUOUS ) + m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); + else if ( eState == NOT_REGISTERED ) + checkDependencies(); + } + catch (deployment::ExtensionRemovedException &) {} + catch (uno::RuntimeException &) {} } //------------------------------------------------------------------------------ @@ -964,6 +969,11 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & bool bLocked = m_pManager->isReadOnly( xPackage ); TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) ); + + // Don't add empty entries + if ( ! pEntry->m_sTitle.Len() ) + return 0; + xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); ::osl::ClearableMutexGuard guard(m_entriesMutex); 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/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 4b5ef4d7d1c9..20fc2a8dc7e1 100755 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -297,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 4ce5981cd3b0..262bbef420f2 100755 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -989,16 +989,20 @@ OUString BackendImpl::PackageImpl::getDescription() if (sRelativeURL.getLength()) { OUString sURL = m_url_expanded + OUSTR("/") + sRelativeURL; - sDescription = getTextFromURL( - css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL); + try + { + sDescription = getTextFromURL( css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL ); + } + catch ( css::deployment::DeploymentException& ) + { + OSL_ENSURE( 0, ::rtl::OUStringToOString( ::comphelper::anyToString( ::cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 ).getStr() ); + } } + if (sDescription.getLength()) return sDescription; - else if(m_oldDescription.getLength()) - return m_oldDescription; - else - return OUString(); + return m_oldDescription; } //______________________________________________________________________________ diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 3e9836fa2e84..3e9836fa2e84 100755..100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index fb58692c81ee..fb58692c81ee 100755..100644 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx index 81a789a613b9..5cc90577aaff 100644 --- a/desktop/source/migration/wizard.cxx +++ b/desktop/source/migration/wizard.cxx @@ -209,7 +209,6 @@ FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAccep m_aDefaultPath = defineWizardPagesDependingFromContext(); activatePath(m_aDefaultPath, sal_True); - enterState(STATE_WELCOME); ActivatePage(); // set text of finish putton: 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/verinfo.rc b/desktop/util/verinfo.rc index 7d589956ec83..7d589956ec83 100644..100755 --- a/desktop/util/verinfo.rc +++ b/desktop/util/verinfo.rc diff --git a/desktop/win32/source/applauncher/ooo/verinfo.rc b/desktop/win32/source/applauncher/ooo/verinfo.rc index c13e723527fc..c13e723527fc 100644..100755 --- a/desktop/win32/source/applauncher/ooo/verinfo.rc +++ b/desktop/win32/source/applauncher/ooo/verinfo.rc diff --git a/desktop/win32/source/applauncher/verinfo.rc b/desktop/win32/source/applauncher/verinfo.rc index c0ff71494014..c0ff71494014 100644..100755 --- a/desktop/win32/source/applauncher/verinfo.rc +++ b/desktop/win32/source/applauncher/verinfo.rc |