diff options
author | Joachim Lingner <jl@openoffice.org> | 2011-01-04 12:01:53 +0100 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2011-01-04 12:01:53 +0100 |
commit | 7508b11431ad7e08ab49a8a239a79ee9ae80334d (patch) | |
tree | 661469b3352f6c1f0faa9581eba30b6de5fa49aa /desktop | |
parent | 2e54587cb31ebf2c747297ffd86cd79e2d54a4a0 (diff) | |
parent | 794c821e4d48c34aa376cdc7b6ab2cb029d9574d (diff) |
jl160 merge with DEV300m96
Diffstat (limited to 'desktop')
98 files changed, 4577 insertions, 1406 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index fa7550812bbe..8eb4dd3cc25b 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -155,6 +155,7 @@ class Desktop : public Application sal_Bool InitializeInstallation( const rtl::OUString& rAppFilename ); sal_Bool InitializeConfiguration(); + void FlushConfiguration(); sal_Bool InitializeQuickstartMode( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr ); void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg ); diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index dc5d7a99b2d6..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 @@ -41,3 +41,7 @@ dt desktop\registry\data\org\openoffice\Office nmake - a dt desktop\source\registration\com\sun\star\servicetag\resources get - all sn_svctagres NULL 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/prj/d.lst b/desktop/prj/d.lst index 92a4853c2bed..b6e14a5ce722 100644 --- a/desktop/prj/d.lst +++ b/desktop/prj/d.lst @@ -143,3 +143,11 @@ mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs ..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar ..\%__SRC%\misc\registry\spool\org\openoffice\Office\Jobs\*.xcu %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs +..\%__SRC%\misc\deployment.component %_DEST%\xml%_EXT%\deployment.component +..\%__SRC%\misc\deploymentgui.component %_DEST%\xml%_EXT%\deploymentgui.component +..\%__SRC%\misc\migrationoo2.component %_DEST%\xml%_EXT%\migrationoo2.component +..\%__SRC%\misc\migrationoo3.component %_DEST%\xml%_EXT%\migrationoo3.component +..\%__SRC%\misc\offacc.component %_DEST%\xml%_EXT%\offacc.component +..\%__SRC%\misc\productregistration.jar.component %_DEST%\xml%_EXT%\productregistration.jar.component +..\%__SRC%\misc\socomp.component %_DEST%\xml%_EXT%\socomp.component +..\%__SRC%\misc\spl.component %_DEST%\xml%_EXT%\spl.component diff --git a/desktop/qa/deployment_misc/makefile.mk b/desktop/qa/deployment_misc/makefile.mk index 15faef0dc46e..16223914e740 100644 --- a/desktop/qa/deployment_misc/makefile.mk +++ b/desktop/qa/deployment_misc/makefile.mk @@ -35,20 +35,22 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: $(PRJ)$/source$/deployment$/inc$/dp_misc.mk CFLAGSCXX += $(CPPUNIT_CFLAGS) -DLLPRE = # no leading "lib" on .so files + +# TODO: On Windows, test_dp_version.cxx fails due to BOOL redefinition between +# windef.h and tools/solar.h caused by including "precompiled_desktop.hxx"; this +# hack to temporarily disable PCH will become unnecessary with the fix for issue +# 112600: +CFLAGSCXX += -DDISABLE_PCH_HACK SHL1TARGET = $(TARGET) SHL1OBJS = $(SLO)$/test_dp_version.obj -SHL1STDLIBS = $(CPPUNITLIB) $(DEPLOYMENTMISCLIB) $(SALLIB) $(TESTSHL2LIB) +SHL1STDLIBS = $(CPPUNITLIB) $(DEPLOYMENTMISCLIB) $(SALLIB) SHL1VERSIONMAP = version.map +SHL1RPATH = NONE SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) SLOFILES = $(SHL1OBJS) .INCLUDE: target.mk - -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - $(TESTSHL2) $(SHL1TARGETN) +.INCLUDE : _cppunit.mk diff --git a/desktop/qa/deployment_misc/test_dp_version.cxx b/desktop/qa/deployment_misc/test_dp_version.cxx index 7b974a8bae73..a5d50f4ac6be 100644 --- a/desktop/qa/deployment_misc/test_dp_version.cxx +++ b/desktop/qa/deployment_misc/test_dp_version.cxx @@ -32,7 +32,10 @@ #include <cstddef> -#include "testshl/simpleheader.hxx" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -83,8 +86,8 @@ void Test::test() { } } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/desktop/qa/deployment_misc/version.map b/desktop/qa/deployment_misc/version.map index 7321bbca16ad..3308588ef6f8 100644 --- a/desktop/qa/deployment_misc/version.map +++ b/desktop/qa/deployment_misc/version.map @@ -27,7 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index 0215f88d1ff0..b5494f9c9727 100644 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -43,15 +43,14 @@ export SAL_ENABLE_FILE_LOCKING #@# export JITC_PROCESSOR_TYPE=6 # resolve installation directory -sd_cwd="`pwd`" -if [ -h "$0" ] ; then - sd_basename=`basename "$0"` - sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` - cd "`dirname "$0"`" - cd "`dirname "$sd_script"`" -else - cd "`dirname "$0"`" -fi +sd_cwd=`pwd` +sd_res=$0 +while [ -h "$sd_res" ] ; do + cd "`dirname "$sd_res"`" + sd_basename=`basename "$sd_res"` + sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"` +done +cd "`dirname "$sd_res"`" sd_prog=`pwd` cd "$sd_cwd" @@ -96,7 +95,7 @@ if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"` if [ -n "$my_path" ] ; then - LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH} + LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH fi fi diff --git a/desktop/scripts/unoinfo.sh b/desktop/scripts/unoinfo.sh index 081e414365cf..a7566155aa0d 100644 --- a/desktop/scripts/unoinfo.sh +++ b/desktop/scripts/unoinfo.sh @@ -29,14 +29,13 @@ set -e # resolve installation directory -if [ -h "$0" ] ; then - sd_basename=`basename "$0"` - sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` - cd "`dirname "$0"`" - cd "`dirname "$sd_script"`" -else - cd "`dirname "$0"`" -fi +sd_res=$0 +while [ -h "$sd_res" ] ; do + cd "`dirname "$sd_res"`" + sd_basename=`basename "$sd_res"` + sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"` +done +cd "`dirname "$sd_res"`" sd_prog=`pwd` case $1 in diff --git a/desktop/scripts/unopkg.sh b/desktop/scripts/unopkg.sh index 0828c7f9dbb1..5020b89194d1 100644 --- a/desktop/scripts/unopkg.sh +++ b/desktop/scripts/unopkg.sh @@ -31,15 +31,14 @@ SAL_ENABLE_FILE_LOCKING=1 export SAL_ENABLE_FILE_LOCKING # resolve installation directory -sd_cwd="`pwd`" -if [ -h "$0" ] ; then - sd_basename=`basename "$0"` - sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` - cd "`dirname "$0"`" - cd "`dirname "$sd_script"`" -else - cd "`dirname "$0"`" -fi +sd_cwd=`pwd` +sd_res=$0 +while [ -h "$sd_res" ] ; do + cd "`dirname "$sd_res"`" + sd_basename=`basename "$sd_res"` + sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"` +done +cd "`dirname "$sd_res"`" sd_prog=`pwd` cd "$sd_cwd" @@ -68,7 +67,7 @@ if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS $JVMFWKPARAMS \ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"` if [ -n "$my_path" ] ; then - LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH} + LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH fi fi diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index aec805ed9d33..d569b1f61d1e 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> @@ -348,10 +349,8 @@ CommandLineArgs* Desktop::GetCommandLineArgs() { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); if ( !pArgs ) - { pArgs = new CommandLineArgs; } - } return pArgs; } @@ -799,6 +798,7 @@ void Desktop::DeInit() // instead of removing of the configManager just let it commit all the changes RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); utl::ConfigManager::GetConfigManager()->StoreConfigItems(); + FlushConfiguration(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); // close splashscreen if it's still open @@ -860,6 +860,7 @@ BOOL Desktop::QueryExit() } else { + FlushConfiguration(); try { // it is no problem to call DisableOfficeIPCThread() more than once @@ -1481,18 +1482,7 @@ USHORT Desktop::Exception(USHORT nError) if ( bAllowRecoveryAndSessionManagement ) bRestart = SaveTasks(); - // because there is no method to flush the condiguration data, we must dispose the ConfigManager - Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); - if (xCFGFlush.is()) - { - xCFGFlush->flush(); - } - else - { - Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); - if (xCFGDispose.is()) - xCFGDispose->dispose(); - } + FlushConfiguration(); switch( nError & EXC_MAJORTYPE ) { @@ -1606,7 +1596,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 { @@ -1673,25 +1663,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 ); @@ -1711,12 +1682,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# @@ -1798,6 +1766,7 @@ void Desktop::Main() } SetSplashScreenProgress(50); + // Backing Component sal_Bool bCrashed = sal_False; sal_Bool bExistsRecoveryData = sal_False; @@ -1827,43 +1796,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); @@ -1894,16 +1857,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(); @@ -1912,7 +1865,6 @@ void Desktop::Main() aAppearanceCfg.SetApplicationDefaults( this ); SvtAccessibilityOptions aOptions; aOptions.SetVCLSettings(); -// SetSplashScreenProgress(60); if ( !bRestartRequested ) { @@ -1946,15 +1898,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 @@ -2021,6 +1964,7 @@ void Desktop::Main() // remove temp directory RemoveTemporaryDirectory(); + FlushConfiguration(); // The acceptors in the AcceptorMap must be released (in DeregisterServices) // with the solar mutex unlocked, to avoid deadlock: nAcquireCount = Application::ReleaseSolarMutex(); @@ -2118,6 +2062,22 @@ sal_Bool Desktop::InitializeConfiguration() return bOk; } +void Desktop::FlushConfiguration() +{ + Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); + if (xCFGFlush.is()) + { + xCFGFlush->flush(); + } + else + { + // because there is no method to flush the condiguration data, we must dispose the ConfigManager + Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); + if (xCFGDispose.is()) + xCFGDispose->dispose(); + } +} + sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& rSMgr ) { try @@ -2256,12 +2216,7 @@ IMPL_LINK( Desktop, OpenClients_Impl, void*, EMPTYARG ) // CloseStartupScreen(); CloseSplashScreen(); - CheckFirstRun( ); - - // allow ipc interaction -// OfficeIPCThread::SetReady(); - EnableOleAutomation(); if (getenv ("OOO_EXIT_POST_STARTUP")) @@ -2758,16 +2713,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/app/desktop.src b/desktop/source/app/desktop.src index 2f6897adf80e..98ee68685917 100644 --- a/desktop/source/app/desktop.src +++ b/desktop/source/app/desktop.src @@ -159,6 +159,7 @@ InfoBox INFOBOX_CMDLINEHELP ModalDialog DLG_CMDLINEHELP { + HelpID = "desktop:ModalDialog:DLG_CMDLINEHELP"; Text = "Help Message..."; Size = MAP_APPFONT(250, 365); Border = True; diff --git a/desktop/source/app/exports.dxp b/desktop/source/app/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/desktop/source/app/exports.dxp +++ b/desktop/source/app/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/desktop/source/deployment/deployment.component b/desktop/source/deployment/deployment.component new file mode 100644 index 000000000000..11385c7aa8d9 --- /dev/null +++ b/desktop/source/deployment/deployment.component @@ -0,0 +1,64 @@ +<?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.deployment.ExtensionManager"> + <service name="com.sun.star.comp.deployment.ExtensionManager"/> + <singleton name="com.sun.star.deployment.ExtensionManager"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.PackageInformationProvider"> + <service name="com.sun.star.comp.deployment.PackageInformationProvider"/> + <singleton name="com.sun.star.deployment.PackageInformationProvider"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.PackageManagerFactory"> + <service name="com.sun.star.comp.deployment.PackageManagerFactory"/> + <singleton name="com.sun.star.deployment.thePackageManagerFactory"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.ProgressLog"> + <service name="com.sun.star.comp.deployment.ProgressLog"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.component.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.configuration.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.executable.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.help.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.script.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.sfwk.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> +</component> diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx index f7ebf66355ba..f3dc75ae39c5 100644 --- a/desktop/source/deployment/dp_services.cxx +++ b/desktop/source/deployment/dp_services.cxx @@ -92,27 +92,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, - registry::XRegistryKey * pRegistryKey ) -{ - return component_writeInfoHelper( - pServiceManager, pRegistryKey, - dp_registry::backend::configuration::serviceDecl, - dp_registry::backend::component::serviceDecl, - dp_registry::backend::help::serviceDecl, - dp_registry::backend::script::serviceDecl, - dp_registry::backend::sfwk::serviceDecl, - dp_registry::backend::executable::serviceDecl, - dp_manager::factory::serviceDecl, - dp_log::serviceDecl, - dp_info::serviceDecl, - dp_manager::serviceDecl) && - dp_manager::factory::singleton_entries( pRegistryKey ) && - dp_info::singleton_entries( pRegistryKey ) && - dp_manager::singleton_entries( pRegistryKey); -} - void * SAL_CALL component_getFactory( sal_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/desktop/source/deployment/gui/deploymentgui.component b/desktop/source/deployment/gui/deploymentgui.component new file mode 100644 index 000000000000..d613f482e791 --- /dev/null +++ b/desktop/source/deployment/gui/deploymentgui.component @@ -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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.deployment.ui.LicenseDialog"> + <service name="com.sun.star.deployment.ui.LicenseDialog"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.ui.PackageManagerDialog"> + <service name="com.sun.star.deployment.ui.PackageManagerDialog"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.ui.UpdateRequiredDialog"> + <service name="com.sun.star.deployment.ui.UpdateRequiredDialog"/> + </implementation> +</component> diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 5f52b042edf3..dcde55654a30 100755 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -106,7 +106,7 @@ #define RID_DLG_UPDATE_LINE 8 #define RID_DLG_UPDATE_HELP 9 #define RID_DLG_UPDATE_OK 10 -#define RID_DLG_UPDATE_CANCEL 11 +#define RID_DLG_UPDATE_CLOSE 11 #define RID_DLG_UPDATE_NORMALALERT 12 #define RID_DLG_UPDATE_HIGHCONTRASTALERT 13 #define RID_DLG_UPDATE_ERROR 14 @@ -127,6 +127,11 @@ #define RID_DLG_UPDATE_RELEASENOTES_LINK 29 #define RID_DLG_UPDATE_NOUPDATE 30 #define RID_DLG_UPDATE_VERSION 31 +#define RID_DLG_UPDATE_IGNORE 32 +#define RID_DLG_UPDATE_ENABLE 33 +#define RID_DLG_UPDATE_IGNORE_ALL 34 +#define RID_DLG_UPDATE_IGNORED_UPDATE 35 + #define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20) @@ -163,6 +168,7 @@ #define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95) #define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96) #define RID_STR_ERROR_MISSING_LICENSE (RID_DEPLOYMENT_GUI_START+97) +#define RID_STR_SHOW_LICENSE_CMD (RID_DEPLOYMENT_GUI_START+98) #define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100) @@ -172,6 +178,7 @@ #define RID_WARNINGBOX_REMOVE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+104) #define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105) #define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106) +#define RID_DLG_SHOW_LICENSE (RID_DEPLOYMENT_GUI_START+107) #define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.src b/desktop/source/deployment/gui/dp_gui_dependencydialog.src index fa7465678326..e7adbce9992b 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.src +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.src @@ -34,6 +34,7 @@ #define LOCAL_LIST_HEIGHT (6 * RSC_BS_CHARHEIGHT) ModalDialog RID_DLG_DEPENDENCIES { + HelpID = "desktop:ModalDialog:RID_DLG_DEPENDENCIES"; Size = MAP_APPFONT( (RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT), @@ -52,6 +53,7 @@ ModalDialog RID_DLG_DEPENDENCIES { NoLabel = TRUE; }; ListBox RID_DLG_DEPENDENCIES_LIST { + HelpID = "desktop:ListBox:RID_DLG_DEPENDENCIES:RID_DLG_DEPENDENCIES_LIST"; Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, (RSC_SP_DLG_INNERBORDER_TOP + LOCAL_TEXT_HEIGHT + diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index 15823288ee20..c9fd19c25592 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -119,6 +119,11 @@ String RID_STR_ERROR_MISSING_LICENSE Text [ en-US ] = "This extension is disabled because you haven't accepted the license yet.\n"; }; +String RID_STR_SHOW_LICENSE_CMD +{ + Text [ en-US ] = "Show license"; +}; + // Dialog layout // --------------------------------------------------- // row 1 | multi line edit @@ -169,6 +174,7 @@ String RID_STR_ERROR_MISSING_LICENSE ModalDialog RID_DLG_LICENSE { + HelpID = "desktop:ModalDialog:RID_DLG_LICENSE"; Text [ en-US ] = "Extension Software License Agreement"; Size = MAP_APPFONT(LIC_DLG_WIDTH, LIC_DLG_HEIGHT); @@ -181,6 +187,7 @@ ModalDialog RID_DLG_LICENSE MultiLineEdit ML_LICENSE { + HelpID = "desktop:MultiLineEdit:RID_DLG_LICENSE:ML_LICENSE"; Pos = MAP_APPFONT(COL1_X, ROW1_Y); Size = MAP_APPFONT(BODYWIDTH, ROW1_HEIGHT); Border = TRUE; @@ -230,6 +237,7 @@ ModalDialog RID_DLG_LICENSE }; PushButton PB_LICENSE_DOWN { + HelpID = "desktop:PushButton:RID_DLG_LICENSE:PB_LICENSE_DOWN"; TabStop = TRUE ; Pos = MAP_APPFONT(COL5_X , ROW3_Y) ; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT) ; @@ -290,6 +298,35 @@ ModalDialog RID_DLG_LICENSE }; +ModalDialog RID_DLG_SHOW_LICENSE +{ + Text [ en-US ] = "Extension Software License Agreement"; + Size = MAP_APPFONT( 300, 200 ); + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + Closeable = TRUE; + Sizeable = TRUE; + + MultiLineEdit ML_LICENSE + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 300 - 10, 200 - 15 - RSC_CD_PUSHBUTTON_HEIGHT ); + Border = TRUE; + VScroll = TRUE; + ReadOnly = TRUE; + }; + + OKButton RID_EM_BTN_CLOSE + { + TabStop = TRUE; + DefButton = TRUE; + Text [ en-US ] = "Close"; + Pos = MAP_APPFONT( (300-RSC_CD_PUSHBUTTON_WIDTH)/2, 200 - 5 - RSC_CD_PUSHBUTTON_HEIGHT ); + Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; +}; + WarningBox RID_WARNINGBOX_INSTALL_EXTENSION { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 78b29624b16e..8fd0f4c754d0 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -39,8 +39,10 @@ #include "dp_gui_theextmgr.hxx" #include "dp_gui_extensioncmdqueue.hxx" #include "dp_misc.h" +#include "dp_ucb.h" #include "dp_update.hxx" #include "dp_identifier.hxx" +#include "dp_descriptioninfoset.hxx" #include "vcl/ctrl.hxx" #include "vcl/menu.hxx" @@ -118,7 +120,8 @@ enum MENU_COMMAND CMD_REMOVE = 1, CMD_ENABLE, CMD_DISABLE, - CMD_UPDATE + CMD_UPDATE, + CMD_SHOW_LICENSE }; class ExtBoxWithBtns_Impl : public ExtensionBox_Impl @@ -224,13 +227,10 @@ const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const // ----------------------------------------------------------------------- void ExtBoxWithBtns_Impl::RecalcAll() { - ExtensionBox_Impl::RecalcAll(); - const sal_Int32 nActive = getSelIndex(); if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { - SetButtonPos( GetEntryRect( nActive ) ); SetButtonStatus( GetEntryData( nActive) ); } else @@ -239,6 +239,11 @@ void ExtBoxWithBtns_Impl::RecalcAll() m_pEnableBtn->Hide(); m_pRemoveBtn->Hide(); } + + ExtensionBox_Impl::RecalcAll(); + + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + SetButtonPos( GetEntryRect( nActive ) ); } @@ -382,6 +387,9 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); } + if ( GetEntryData( nPos )->m_sLicenseText.Len() ) + aPopup.InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) ); + return (MENU_COMMAND) aPopup.Execute( this, rPos ); } @@ -407,6 +415,12 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) break; case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage ); break; + case CMD_SHOW_LICENSE: + { + ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage ); + aLicenseDlg.Execute(); + break; + } } } else if ( rMEvt.IsLeft() ) @@ -1740,6 +1754,42 @@ void UpdateRequiredDialog::disableAllEntries() m_aCloseBtn.SetText( m_sCloseText ); } +//------------------------------------------------------------------------------ +// ShowLicenseDialog +//------------------------------------------------------------------------------ +ShowLicenseDialog::ShowLicenseDialog( Window * pParent, + const uno::Reference< deployment::XPackage > &xPackage ) : + ModalDialog( pParent, DialogHelper::getResId( RID_DLG_SHOW_LICENSE ) ), + m_aLicenseText( this, DialogHelper::getResId( ML_LICENSE ) ), + m_aCloseBtn( this, DialogHelper::getResId( RID_EM_BTN_CLOSE ) ) +{ + FreeResource(); + + OUString aText = xPackage->getLicenseText(); + m_aLicenseText.SetText( aText ); +} + +//------------------------------------------------------------------------------ +ShowLicenseDialog::~ShowLicenseDialog() +{} + +//------------------------------------------------------------------------------ +void ShowLicenseDialog::Resize() +{ + Size aTotalSize( GetOutputSizePixel() ); + Size aTextSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_TOP - 2*RSC_SP_DLG_INNERBORDER_BOTTOM + - m_aCloseBtn.GetSizePixel().Height() ); + + m_aLicenseText.SetPosSizePixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ), + aTextSize ); + + Point aBtnPos( (aTotalSize.Width() - m_aCloseBtn.GetSizePixel().Width())/2, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM + - m_aCloseBtn.GetSizePixel().Height() ); + m_aCloseBtn.SetPosPixel( aBtnPos ); +} + //================================================================================= // UpdateRequiredDialogService //================================================================================= diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index f0a85cce98c0..755c3aadcbdf 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -35,6 +35,7 @@ #include "svtools/fixedhyper.hxx" #include "svtools/prgsbar.hxx" +#include "svtools/svmedit.hxx" #include "osl/conditn.hxx" #include "osl/mutex.hxx" @@ -246,6 +247,20 @@ public: }; //============================================================================== +class ShowLicenseDialog : public ModalDialog +{ + MultiLineEdit m_aLicenseText; + OKButton m_aCloseBtn; + +public: + ShowLicenseDialog( Window * pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + virtual ~ShowLicenseDialog(); + + virtual void Resize(); +}; + +//============================================================================== class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog > { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src index 7c47365999a0..996c96b1d083 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.src +++ b/desktop/source/deployment/gui/dp_gui_dialog2.src @@ -43,6 +43,7 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER PushButton RID_EM_BTN_ADD { + HelpID = "desktop:PushButton:RID_DLG_EXTENSION_MANAGER:RID_EM_BTN_ADD"; TabStop = TRUE; Text [ en-US ] = "~Add..."; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); @@ -50,6 +51,7 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER PushButton RID_EM_BTN_CHECK_UPDATES { + HelpID = "desktop:PushButton:RID_DLG_EXTENSION_MANAGER:RID_EM_BTN_CHECK_UPDATES"; TabStop = TRUE; Text [ en-US ] = "Check for ~Updates..."; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); @@ -131,6 +133,7 @@ ModalDialog RID_DLG_UPDATE_REQUIRED PushButton RID_EM_BTN_CHECK_UPDATES { + HelpID = "desktop:PushButton:RID_DLG_UPDATE_REQUIRED:RID_EM_BTN_CHECK_UPDATES"; TabStop = TRUE; Text [ en-US ] = "Check for ~Updates..."; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); @@ -138,6 +141,7 @@ ModalDialog RID_DLG_UPDATE_REQUIRED PushButton RID_EM_BTN_CLOSE { + HelpID = "desktop:PushButton:RID_DLG_UPDATE_REQUIRED:RID_EM_BTN_CLOSE"; TabStop = TRUE; DefButton = TRUE; Text [ en-US ] = "Disable all"; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 24b47aa223e3..54495de410dc 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -71,29 +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(); - - beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); - m_sPublisher = aInfo.First; - m_sPublisherURL = aInfo.Second; - - // get the icons for the package if there are any - uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); - if ( xGraphic.is() ) - m_aIcon = Image( xGraphic ); - - xGraphic = xPackage->getIcon( true ); - if ( xGraphic.is() ) - m_aIconHC = Image( xGraphic ); - else - m_aIconHC = m_aIcon; + 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; + + // 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; - 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 &) {} } //------------------------------------------------------------------------------ @@ -963,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/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 762f50296690..cbf9e27a8da1 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -81,6 +81,7 @@ struct Entry_Impl String m_sPublisher; String m_sPublisherURL; String m_sErrorText; + String m_sLicenseText; Image m_aIcon; Image m_aIconHC; svt::FixedHyperlink *m_pPublisher; diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 29bedf1b229f..567eb9756386 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -356,14 +356,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, - registry::XRegistryKey * pRegistryKey ) -{ - return component_writeInfoHelper( - pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl ); -} - void * SAL_CALL component_getFactory( sal_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index 76eb8af31e8e..1112de0b34e8 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -28,6 +28,7 @@ #define INCLUDED_DP_GUI_UPDATEDATA_HXX #include "sal/config.h" +#include "tools/solar.h" #include "rtl/ustring.hxx" #include "com/sun/star/uno/Reference.hxx" @@ -80,6 +81,10 @@ struct UpdateData //are to be ignored. ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aUpdateSource; + + // ID to find this entry in the update listbox + USHORT m_nID; + bool m_bIgnored; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 37bc836a345d..b1dbcdf861e9 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -50,7 +50,9 @@ #include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/container/XNameContainer.hpp" #include "com/sun/star/deployment/DeploymentException.hpp" #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" @@ -62,6 +64,7 @@ #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/lang/IllegalArgumentException.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/system/XSystemShellExecute.hpp" #include "com/sun/star/task/XAbortChannel.hpp" @@ -76,6 +79,7 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/URL.hpp" +#include "com/sun/star/util/XChangesBatch.hpp" #include "com/sun/star/util/XURLTransformer.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/XNode.hpp" @@ -129,16 +133,23 @@ namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } -namespace css = ::com::sun::star; - +using namespace ::com::sun::star; using dp_gui::UpdateDialog; namespace { static sal_Unicode const LF = 0x000A; static sal_Unicode const CR = 0x000D; +static const USHORT CMD_ENABLE_UPDATE = 1; +static const USHORT CMD_IGNORE_UPDATE = 2; +static const USHORT CMD_IGNORE_ALL_UPDATES = 3; + +#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) + +#define IGNORED_UPDATES OUSTR("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates") +#define PROPERTY_VERSION OUSTR("Version") -enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, GENERAL_ERROR, SPECIFIC_ERROR }; +enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, SPECIFIC_ERROR }; rtl::OUString confineToParagraph(rtl::OUString const & text) { // Confine arbitrary text to a single paragraph in a dp_gui::AutoScrollEdit. @@ -151,86 +162,64 @@ rtl::OUString confineToParagraph(rtl::OUString const & text) { struct UpdateDialog::DisabledUpdate { rtl::OUString name; - css::uno::Sequence< rtl::OUString > unsatisfiedDependencies; + uno::Sequence< rtl::OUString > unsatisfiedDependencies; // We also want to show release notes and publisher for disabled updates ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo; + USHORT m_nID; }; struct UpdateDialog::SpecificError { rtl::OUString name; rtl::OUString message; + USHORT m_nID; }; -union UpdateDialog::IndexUnion{ - std::vector< dp_gui::UpdateData >::size_type enabledUpdate; - std::vector< UpdateDialog::DisabledUpdate >::size_type disabledUpdate; - std::vector< rtl::OUString >::size_type generalError; - std::vector< UpdateDialog::SpecificError >::size_type specificError; -}; - -struct UpdateDialog::Index { - static std::auto_ptr< UpdateDialog::Index const > newEnabledUpdate( - std::vector< dp_gui::UpdateData >::size_type n); - - static std::auto_ptr< UpdateDialog::Index const > newDisabledUpdate( - std::vector< UpdateDialog::DisabledUpdate >::size_type n); +//------------------------------------------------------------------------------ +struct UpdateDialog::IgnoredUpdate { + rtl::OUString sExtensionID; + rtl::OUString sVersion; + bool bRemoved; - static std::auto_ptr< UpdateDialog::Index const > newGeneralError( - std::vector< rtl::OUString >::size_type n); - - static std::auto_ptr< UpdateDialog::Index const > newSpecificError( - std::vector< UpdateDialog::SpecificError >::size_type n); - - Kind kind; - IndexUnion index; - -private: - explicit Index(Kind theKind); + IgnoredUpdate( const rtl::OUString &rExtensionID, const rtl::OUString &rVersion ); }; -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newEnabledUpdate( - std::vector< dp_gui::UpdateData >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(ENABLED_UPDATE); - p->index.enabledUpdate = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} - -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newDisabledUpdate( - std::vector< UpdateDialog::DisabledUpdate >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(DISABLED_UPDATE); - p->index.disabledUpdate = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} +//------------------------------------------------------------------------------ +UpdateDialog::IgnoredUpdate::IgnoredUpdate( const rtl::OUString &rExtensionID, const rtl::OUString &rVersion ): + sExtensionID( rExtensionID ), + sVersion( rVersion ), + bRemoved( false ) +{} -std::auto_ptr< UpdateDialog::Index const > UpdateDialog::Index::newGeneralError( - std::vector< rtl::OUString >::size_type n) +//------------------------------------------------------------------------------ +struct UpdateDialog::Index { - UpdateDialog::Index * p = new UpdateDialog::Index(GENERAL_ERROR); - p->index.generalError = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} + Kind m_eKind; + bool m_bIgnored; + USHORT m_nID; + USHORT m_nIndex; + rtl::OUString m_aName; -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newSpecificError( - std::vector< UpdateDialog::SpecificError >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(SPECIFIC_ERROR); - p->index.specificError = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} + Index( Kind theKind, USHORT nID, USHORT nIndex, const rtl::OUString &rName ); +}; -UpdateDialog::Index::Index(Kind theKind): kind(theKind) {} +//------------------------------------------------------------------------------ +UpdateDialog::Index::Index( Kind theKind, USHORT nID, USHORT nIndex, const rtl::OUString &rName ): + m_eKind( theKind ), + m_bIgnored( false ), + m_nID( nID ), + m_nIndex( nIndex ), + m_aName( rName ) +{} +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ class UpdateDialog::Thread: public dp_gui::Thread { public: Thread( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< css::uno::Reference< css::deployment::XPackage > > & vExtensionList); + const std::vector< uno::Reference< deployment::XPackage > > & vExtensionList); void stop(); @@ -240,16 +229,16 @@ private: struct Entry { explicit Entry( - css::uno::Reference< css::deployment::XPackage > const & thePackage, + uno::Reference< deployment::XPackage > const & thePackage, rtl::OUString const & theVersion); - css::uno::Reference< css::deployment::XPackage > package; + uno::Reference< deployment::XPackage > package; rtl::OUString version; //Indicates that the extension provides its own update URLs. //If this is true, then we must not use the default update //URL to find the update information. bool bProvidesOwnUpdate; - css::uno::Reference< css::xml::dom::XNode > info; + uno::Reference< xml::dom::XNode > info; UpdateDialog::DisabledUpdate disableUpdate; dp_gui::UpdateData updateData; }; @@ -261,20 +250,20 @@ private: virtual void execute(); #if 0 - void handleGeneralError(css::uno::Any const & exception) const; + void handleGeneralError(uno::Any const & exception) const; #endif void handleSpecificError( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Any const & exception) const; + uno::Reference< deployment::XPackage > const & package, + uno::Any const & exception) const; - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > + uno::Sequence< uno::Reference< xml::dom::XElement > > getUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Sequence< rtl::OUString > const & urls, + uno::Reference< deployment::XPackage > const & package, + uno::Sequence< rtl::OUString > const & urls, rtl::OUString const & identifier) const; void getOwnUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, + uno::Reference< deployment::XPackage > const & package, Map * map); ::rtl::OUString getUpdateDisplayString( @@ -286,40 +275,40 @@ private: dp_gui::UpdateData & out_data) const; bool update( - UpdateDialog::DisabledUpdate const & du, - dp_gui::UpdateData const & data) const; + UpdateDialog::DisabledUpdate & du, + dp_gui::UpdateData & data) const; - css::uno::Reference< css::uno::XComponentContext > m_context; + uno::Reference< uno::XComponentContext > m_context; UpdateDialog & m_dialog; - std::vector< css::uno::Reference< css::deployment::XPackage > > m_vExtensionList; - css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation; - css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHdl; + std::vector< uno::Reference< deployment::XPackage > > m_vExtensionList; + uno::Reference< deployment::XUpdateInformationProvider > m_updateInformation; + uno::Reference< task::XInteractionHandler > m_xInteractionHdl; // guarded by Application::GetSolarMutex(): - css::uno::Reference< css::task::XAbortChannel > m_abort; + uno::Reference< task::XAbortChannel > m_abort; bool m_stop; }; UpdateDialog::Thread::Thread( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< css::uno::Reference< css::deployment::XPackage > > &vExtensionList): + const std::vector< uno::Reference< deployment::XPackage > > &vExtensionList): m_context(context), m_dialog(dialog), m_vExtensionList(vExtensionList), m_updateInformation( - css::deployment::UpdateInformationProvider::create(context)), + deployment::UpdateInformationProvider::create(context)), m_stop(false) { if( m_context.is() ) { - css::uno::Reference< css::lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); + uno::Reference< lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); if( xServiceManager.is() ) { - m_xInteractionHdl = css::uno::Reference< css::task::XInteractionHandler > ( + m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( xServiceManager->createInstanceWithContext( OUSTR( "com.sun.star.task.InteractionHandler" ), m_context), - css::uno::UNO_QUERY ); + uno::UNO_QUERY ); if ( m_xInteractionHdl.is() ) m_updateInformation->setInteractionHandler( m_xInteractionHdl ); } @@ -327,7 +316,7 @@ UpdateDialog::Thread::Thread( } void UpdateDialog::Thread::stop() { - css::uno::Reference< css::task::XAbortChannel > abort; + uno::Reference< task::XAbortChannel > abort; { vos::OGuard g(Application::GetSolarMutex()); abort = m_abort; @@ -340,7 +329,7 @@ void UpdateDialog::Thread::stop() { } UpdateDialog::Thread::Entry::Entry( - css::uno::Reference< css::deployment::XPackage > const & thePackage, + uno::Reference< deployment::XPackage > const & thePackage, rtl::OUString const & theVersion): package(thePackage), @@ -353,7 +342,7 @@ UpdateDialog::Thread::Entry::Entry( UpdateDialog::Thread::~Thread() { if ( m_xInteractionHdl.is() ) - m_updateInformation->setInteractionHandler( css::uno::Reference< css::task::XInteractionHandler > () ); + m_updateInformation->setInteractionHandler( uno::Reference< task::XInteractionHandler > () ); } void UpdateDialog::Thread::execute() @@ -364,16 +353,16 @@ void UpdateDialog::Thread::execute() return; } } - css::uno::Reference<css::deployment::XExtensionManager> extMgr = - css::deployment::ExtensionManager::get(m_context); + uno::Reference<deployment::XExtensionManager> extMgr = + deployment::ExtensionManager::get(m_context); - std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, css::uno::Any > > errors; + std::vector<std::pair<uno::Reference<deployment::XPackage>, uno::Any > > errors; dp_misc::UpdateInfoMap updateInfoMap = dp_misc::getOnlineUpdateInfos( m_context, extMgr, m_updateInformation, &m_vExtensionList, errors); - typedef std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, - css::uno::Any> >::const_iterator ITERROR; + typedef std::vector<std::pair<uno::Reference<deployment::XPackage>, + uno::Any> >::const_iterator ITERROR; for (ITERROR ite = errors.begin(); ite != errors.end(); ite ++) handleSpecificError(ite->first, ite->second); @@ -392,12 +381,12 @@ void UpdateDialog::Thread::execute() rtl::OUString sVersionUser; rtl::OUString sVersionShared; rtl::OUString sVersionBundled; - css::uno::Sequence< css::uno::Reference< css::deployment::XPackage> > extensions; + uno::Sequence< uno::Reference< deployment::XPackage> > extensions; try { extensions = extMgr->getExtensionsWithSameIdentifier( dp_misc::getIdentifier(info.extension), info.extension->getName(), - css::uno::Reference<css::ucb::XCommandEnvironment>()); - } catch (css::lang::IllegalArgumentException& ) { + uno::Reference<ucb::XCommandEnvironment>()); + } catch (lang::IllegalArgumentException& ) { OSL_ASSERT(0); continue; } catch (css::ucb::CommandFailedException& ) { @@ -419,7 +408,7 @@ void UpdateDialog::Thread::execute() dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension( bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion); - css::uno::Reference<css::deployment::XPackage> updateSource; + uno::Reference<deployment::XPackage> updateSource; if (sourceUser != dp_misc::UPDATE_SOURCE_NONE) { if (sourceUser == dp_misc::UPDATE_SOURCE_SHARED) @@ -456,11 +445,11 @@ void UpdateDialog::Thread::execute() } } #if 0 -void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) +void UpdateDialog::Thread::handleGeneralError(uno::Any const & exception) const { rtl::OUString message; - css::uno::Exception e; + uno::Exception e; if (exception >>= e) { message = e.Message; } @@ -472,13 +461,13 @@ void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) #endif //Parameter package can be null void UpdateDialog::Thread::handleSpecificError( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Any const & exception) const + uno::Reference< deployment::XPackage > const & package, + uno::Any const & exception) const { UpdateDialog::SpecificError data; if (package.is()) data.name = package->getDisplayName(); - css::uno::Exception e; + uno::Exception e; if (exception >>= e) { data.message = e.Message; } @@ -520,7 +509,7 @@ void UpdateDialog::Thread::handleSpecificError( /** out_data will only be filled if all dependencies are ok. */ void UpdateDialog::Thread::prepareUpdateData( - css::uno::Reference< css::xml::dom::XNode > const & updateInfo, + uno::Reference< xml::dom::XNode > const & updateInfo, UpdateDialog::DisabledUpdate & out_du, dp_gui::UpdateData & out_data) const { @@ -528,7 +517,7 @@ void UpdateDialog::Thread::prepareUpdateData( return; dp_misc::DescriptionInfoset infoset(m_context, updateInfo); OSL_ASSERT(infoset.getVersion().getLength() != 0); - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > ds( + uno::Sequence< uno::Reference< xml::dom::XElement > > ds( dp_misc::Dependencies::check(infoset)); out_du.aUpdateInfo = updateInfo; @@ -551,8 +540,8 @@ void UpdateDialog::Thread::prepareUpdateData( } bool UpdateDialog::Thread::update( - UpdateDialog::DisabledUpdate const & du, - dp_gui::UpdateData const & data) const + UpdateDialog::DisabledUpdate & du, + dp_gui::UpdateData & data) const { bool ret = false; if (du.unsatisfiedDependencies.getLength() == 0) @@ -574,9 +563,9 @@ bool UpdateDialog::Thread::update( // UpdateDialog ---------------------------------------------------------- UpdateDialog::UpdateDialog( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, Window * parent, - const std::vector<css::uno::Reference< css::deployment::XPackage > > &vExtensionList, + const std::vector<uno::Reference< deployment::XPackage > > &vExtensionList, std::vector< dp_gui::UpdateData > * updateData): ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)), m_context(context), @@ -596,7 +585,7 @@ UpdateDialog::UpdateDialog( m_line(this, DpGuiResId(RID_DLG_UPDATE_LINE)), m_help(this, DpGuiResId(RID_DLG_UPDATE_HELP)), m_ok(this, DpGuiResId(RID_DLG_UPDATE_OK)), - m_cancel(this, DpGuiResId(RID_DLG_UPDATE_CANCEL)), + m_close(this, DpGuiResId(RID_DLG_UPDATE_CLOSE)), m_error(String(DpGuiResId(RID_DLG_UPDATE_ERROR))), m_none(String(DpGuiResId(RID_DLG_UPDATE_NONE))), m_noInstallable(String(DpGuiResId(RID_DLG_UPDATE_NOINSTALLABLE))), @@ -608,71 +597,84 @@ UpdateDialog::UpdateDialog( m_noDependencyCurVer(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY_CUR_VER))), m_browserbased(String(DpGuiResId(RID_DLG_UPDATE_BROWSERBASED))), m_version(String(DpGuiResId(RID_DLG_UPDATE_VERSION))), + m_ignoredUpdate(String(DpGuiResId(RID_DLG_UPDATE_IGNORED_UPDATE))), m_updateData(*updateData), m_thread( new UpdateDialog::Thread( context, *this, vExtensionList)), m_nFirstLineDelta(0), - m_nOneLineMissing(0) + m_nOneLineMissing(0), + m_nLastID(1), + m_bModified( false ) // TODO: check! // , // m_extensionManagerDialog(extensionManagerDialog) { OSL_ASSERT(updateData != NULL); - m_xExtensionManager = css::deployment::ExtensionManager::get( context ); + m_xExtensionManager = deployment::ExtensionManager::get( context ); - css::uno::Reference< css::awt::XToolkit > toolkit; + uno::Reference< awt::XToolkit > toolkit; try { - toolkit = css::uno::Reference< css::awt::XToolkit >( - (css::uno::Reference< css::lang::XMultiComponentFactory >( + toolkit = uno::Reference< awt::XToolkit >( + (uno::Reference< lang::XMultiComponentFactory >( m_context->getServiceManager(), - css::uno::UNO_QUERY_THROW)-> + uno::UNO_QUERY_THROW)-> createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")), m_context)), - css::uno::UNO_QUERY_THROW); - } catch (css::uno::RuntimeException &) { + uno::UNO_QUERY_THROW); + } catch (uno::RuntimeException &) { throw; - } catch (css::uno::Exception & e) { - throw css::uno::RuntimeException(e.Message, e.Context); + } catch (uno::Exception & e) { + throw uno::RuntimeException(e.Message, e.Context); } Control c(this, DpGuiResId(RID_DLG_UPDATE_THROBBER)); Point pos(c.GetPosPixel()); Size size(c.GetSizePixel()); try { - m_throbber = css::uno::Reference< css::awt::XThrobber >( + m_throbber = uno::Reference< awt::XThrobber >( toolkit->createWindow( - css::awt::WindowDescriptor( - css::awt::WindowClass_SIMPLE, + awt::WindowDescriptor( + awt::WindowClass_SIMPLE, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber")), GetComponentInterface(), 0, - css::awt::Rectangle( + awt::Rectangle( pos.X(), pos.Y(), size.Width(), size.Height()), - css::awt::WindowAttribute::SHOW)), - css::uno::UNO_QUERY_THROW); - } catch (css::lang::IllegalArgumentException & e) { - throw css::uno::RuntimeException(e.Message, e.Context); + awt::WindowAttribute::SHOW)), + uno::UNO_QUERY_THROW); + } catch (lang::IllegalArgumentException & e) { + throw uno::RuntimeException(e.Message, e.Context); } m_updates.SetSelectHdl(LINK(this, UpdateDialog, selectionHandler)); m_all.SetToggleHdl(LINK(this, UpdateDialog, allHandler)); m_ok.SetClickHdl(LINK(this, UpdateDialog, okHandler)); - m_cancel.SetClickHdl(LINK(this, UpdateDialog, cancelHandler)); + m_close.SetClickHdl(LINK(this, UpdateDialog, closeHandler)); if ( ! dp_misc::office_is_running()) m_help.Disable(); FreeResource(); initDescription(); + getIgnoredUpdates(); } -UpdateDialog::~UpdateDialog() { - for (USHORT i = 0; i < m_updates.getItemCount(); ++i) { - delete static_cast< UpdateDialog::Index const * >( - m_updates.GetEntryData(i)); +//------------------------------------------------------------------------------ +UpdateDialog::~UpdateDialog() +{ + storeIgnoredUpdates(); + + for ( std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); i != m_ListboxEntries.end(); ++i ) + { + delete (*i); + } + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + delete (*i); } } +//------------------------------------------------------------------------------ BOOL UpdateDialog::Close() { m_thread->stop(); return ModalDialog::Close(); @@ -684,29 +686,45 @@ short UpdateDialog::Execute() { return ModalDialog::Execute(); } -UpdateDialog::CheckListBox::CheckListBox( - UpdateDialog & dialog, ResId const & resource, - Image const & normalStaticImage, Image const & highContrastStaticImage): - SvxCheckListBox( - &dialog, resource, normalStaticImage, highContrastStaticImage), +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +UpdateDialog::CheckListBox::CheckListBox( UpdateDialog & dialog, ResId const & resource, + Image const & normalStaticImage, + Image const & highContrastStaticImage ): + SvxCheckListBox( &dialog, resource, normalStaticImage, highContrastStaticImage ), + m_ignoreUpdate( String( DpGuiResId( RID_DLG_UPDATE_IGNORE ) ) ), + m_ignoreAllUpdates( String( DpGuiResId( RID_DLG_UPDATE_IGNORE_ALL ) ) ), + m_enableUpdate( String( DpGuiResId( RID_DLG_UPDATE_ENABLE ) ) ), m_dialog(dialog) {} +//------------------------------------------------------------------------------ UpdateDialog::CheckListBox::~CheckListBox() {} +//------------------------------------------------------------------------------ USHORT UpdateDialog::CheckListBox::getItemCount() const { ULONG i = GetEntryCount(); OSL_ASSERT(i <= std::numeric_limits< USHORT >::max()); return sal::static_int_cast< USHORT >(i); } -void UpdateDialog::CheckListBox::MouseButtonDown(MouseEvent const & event) { +//------------------------------------------------------------------------------ +void UpdateDialog::CheckListBox::MouseButtonDown( MouseEvent const & event ) +{ // When clicking on a selected entry in an SvxCheckListBox, the entry's // checkbox is toggled on mouse button down: - SvxCheckListBox::MouseButtonDown(event); + SvxCheckListBox::MouseButtonDown( event ); + + if ( event.IsRight() ) + { + handlePopupMenu( event.GetPosPixel() ); + } + m_dialog.enableOk(); } +//------------------------------------------------------------------------------ void UpdateDialog::CheckListBox::MouseButtonUp(MouseEvent const & event) { // When clicking on an entry's checkbox in an SvxCheckListBox, the entry's // checkbox is toggled on mouse button up: @@ -719,25 +737,82 @@ void UpdateDialog::CheckListBox::KeyInput(KeyEvent const & event) { m_dialog.enableOk(); } -void UpdateDialog::insertItem( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, SvLBoxButtonKind kind) +//------------------------------------------------------------------------------ +void UpdateDialog::CheckListBox::handlePopupMenu( const Point &rPos ) { - m_updates.InsertEntry( - name, position, - const_cast< void * >(static_cast< void const * >(index.release())), - kind); - //TODO #i72487#: UpdateDialog::Index potentially leaks as the exception - // behavior of SvxCheckListBox::InsertEntry is unspecified + SvListEntry *pData = GetEntry( rPos ); + + if ( pData ) + { + USHORT nEntryPos = GetSelectEntryPos(); + UpdateDialog::Index * p = static_cast< UpdateDialog::Index * >( GetEntryData( nEntryPos ) ); + + if ( ( p->m_eKind == ENABLED_UPDATE ) || ( p->m_eKind == DISABLED_UPDATE ) ) + { + PopupMenu aPopup; + + if ( p->m_bIgnored ) + aPopup.InsertItem( CMD_ENABLE_UPDATE, m_enableUpdate ); + else + { + aPopup.InsertItem( CMD_IGNORE_UPDATE, m_ignoreUpdate ); + aPopup.InsertItem( CMD_IGNORE_ALL_UPDATES, m_ignoreAllUpdates ); + } + + USHORT aCmd = aPopup.Execute( this, rPos ); + if ( ( aCmd == CMD_IGNORE_UPDATE ) || ( aCmd == CMD_IGNORE_ALL_UPDATES ) ) + { + p->m_bIgnored = true; + if ( p->m_eKind == ENABLED_UPDATE ) + { + RemoveEntry( nEntryPos ); + m_dialog.addAdditional( p, SvLBoxButtonKind_disabledCheckbox ); + } + if ( aCmd == CMD_IGNORE_UPDATE ) + m_dialog.setIgnoredUpdate( p, true, false ); + else + m_dialog.setIgnoredUpdate( p, true, true ); + // TODO: reselect entry to display new description! + } + else if ( aCmd == CMD_ENABLE_UPDATE ) + { + p->m_bIgnored = false; + if ( p->m_eKind == ENABLED_UPDATE ) + { + RemoveEntry( nEntryPos ); + m_dialog.insertItem( p, SvLBoxButtonKind_enabledCheckbox ); + } + m_dialog.setIgnoredUpdate( p, false, false ); + } + } + } } -void UpdateDialog::addAdditional( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, SvLBoxButtonKind kind) +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +USHORT UpdateDialog::insertItem( UpdateDialog::Index *pEntry, SvLBoxButtonKind kind ) +{ + m_updates.InsertEntry( pEntry->m_aName, LISTBOX_APPEND, static_cast< void * >( pEntry ), kind ); + + for ( USHORT i = m_updates.getItemCount(); i != 0 ; ) + { + i -= 1; + UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData( i ) ); + if ( p == pEntry ) + return i; + } + OSL_ASSERT(0); + return 0; +} + +//------------------------------------------------------------------------------ +void UpdateDialog::addAdditional( UpdateDialog::Index * index, SvLBoxButtonKind kind ) { m_all.Enable(); - if (m_all.IsChecked()) { - insertItem(name, position, index, kind); + if (m_all.IsChecked()) + { + insertItem( index, kind ); m_update.Enable(); m_updates.Enable(); m_description.Enable(); @@ -745,71 +820,81 @@ void UpdateDialog::addAdditional( } } -void UpdateDialog::addEnabledUpdate( - rtl::OUString const & name, dp_gui::UpdateData const & data) +//------------------------------------------------------------------------------ +void UpdateDialog::addEnabledUpdate( rtl::OUString const & name, + dp_gui::UpdateData & data ) { - std::vector< dp_gui::UpdateData >::size_type n = m_enabledUpdates.size(); - m_enabledUpdates.push_back(data); - insertItem( - name, sal::static_int_cast< USHORT >(n), - UpdateDialog::Index::newEnabledUpdate(n), - SvLBoxButtonKind_enabledCheckbox); - // position overflow is rather harmless - m_updates.CheckEntryPos(sal::static_int_cast< USHORT >(n)); - //TODO #i72487#: fragile computation; insertItem should instead return - // pos + USHORT nIndex = sal::static_int_cast< USHORT >( m_enabledUpdates.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( ENABLED_UPDATE, m_nLastID, nIndex, name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_enabledUpdates.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + if ( ! isIgnoredUpdate( pEntry ) ) + { + USHORT nPos = insertItem( pEntry, SvLBoxButtonKind_enabledCheckbox ); + m_updates.CheckEntryPos( nPos ); + } + else + addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox ); + m_update.Enable(); m_updates.Enable(); m_description.Enable(); m_descriptions.Enable(); } -void UpdateDialog::addDisabledUpdate(UpdateDialog::DisabledUpdate const & data) +//------------------------------------------------------------------------------ +void UpdateDialog::addDisabledUpdate( UpdateDialog::DisabledUpdate & data ) { - std::vector< UpdateDialog::DisabledUpdate >::size_type n = - m_disabledUpdates.size(); - m_disabledUpdates.push_back(data); - addAdditional( - data.name, sal::static_int_cast< USHORT >(m_enabledUpdates.size() + n), - UpdateDialog::Index::newDisabledUpdate(n), - SvLBoxButtonKind_disabledCheckbox); - // position overflow is rather harmless -} -#if 0 -void UpdateDialog::addGeneralError(rtl::OUString const & message) { - std::vector< rtl::OUString >::size_type n = m_generalErrors.size(); - m_generalErrors.push_back(message); - addAdditional( - m_error, - sal::static_int_cast< USHORT >( - m_enabledUpdates.size() + m_disabledUpdates.size() + n), - UpdateDialog::Index::newGeneralError(n), SvLBoxButtonKind_staticImage); - // position overflow is rather harmless + USHORT nIndex = sal::static_int_cast< USHORT >( m_disabledUpdates.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, m_nLastID, nIndex, data.name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_disabledUpdates.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + isIgnoredUpdate( pEntry ); + addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox ); } -#endif -void UpdateDialog::addSpecificError(UpdateDialog::SpecificError const & data) { - std::vector< UpdateDialog::SpecificError >::size_type n = - m_specificErrors.size(); - m_specificErrors.push_back(data); - addAdditional( - data.name, LISTBOX_APPEND, UpdateDialog::Index::newSpecificError(n), - SvLBoxButtonKind_staticImage); + +//------------------------------------------------------------------------------ +void UpdateDialog::addSpecificError( UpdateDialog::SpecificError & data ) +{ + USHORT nIndex = sal::static_int_cast< USHORT >( m_specificErrors.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, m_nLastID, nIndex, data.name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_specificErrors.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + addAdditional( pEntry, SvLBoxButtonKind_staticImage); } void UpdateDialog::checkingDone() { m_checking.Hide(); m_throbber->stop(); - css::uno::Reference< css::awt::XWindow >( - m_throbber, css::uno::UNO_QUERY_THROW)->setVisible(false); + uno::Reference< awt::XWindow >( + m_throbber, uno::UNO_QUERY_THROW)->setVisible(false); if (m_updates.getItemCount() == 0) { clearDescription(); m_description.Enable(); m_descriptions.Enable(); - showDescription( - ( m_disabledUpdates.empty() && m_generalErrors.empty() && m_specificErrors.empty() ) - ? m_none : m_noInstallable, false ); + + if ( m_disabledUpdates.empty() && m_specificErrors.empty() && m_ignoredUpdates.empty() ) + showDescription( m_none, false ); + else + showDescription( m_noInstallable, false ); } + enableOk(); } @@ -821,7 +906,7 @@ void UpdateDialog::enableOk() { // ********************************************************************************* void UpdateDialog::createNotifyJob( bool bPrepareOnly, - css::uno::Sequence< css::uno::Sequence< rtl::OUString > > &rItemList ) + uno::Sequence< uno::Sequence< rtl::OUString > > &rItemList ) { if ( !dp_misc::office_is_running() ) return; @@ -829,51 +914,51 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, // notify update check job try { - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xConfigProvider( xFactory->createInstance( OUSTR( "com.sun.star.configuration.ConfigurationProvider" )), - css::uno::UNO_QUERY_THROW); + uno::UNO_QUERY_THROW); - css::beans::PropertyValue aProperty; + beans::PropertyValue aProperty; aProperty.Name = OUSTR( "nodepath" ); - aProperty.Value = css::uno::makeAny( OUSTR("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); + aProperty.Value = uno::makeAny( OUSTR("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); - css::uno::Sequence< css::uno::Any > aArgumentList( 1 ); - aArgumentList[0] = css::uno::makeAny( aProperty ); + uno::Sequence< uno::Any > aArgumentList( 1 ); + aArgumentList[0] = uno::makeAny( aProperty ); - css::uno::Reference< css::container::XNameAccess > xNameAccess( + uno::Reference< container::XNameAccess > xNameAccess( xConfigProvider->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ), - css::uno::UNO_QUERY_THROW ); + uno::UNO_QUERY_THROW ); - css::util::URL aURL; + util::URL aURL; xNameAccess->getByName(OUSTR("URL")) >>= aURL.Complete; - css::uno::Reference < css::util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), - css::uno::UNO_QUERY_THROW ); + uno::Reference < util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), + uno::UNO_QUERY_THROW ); xTransformer->parseStrict(aURL); - css::uno::Reference < css::frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), - css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), - css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); + uno::Reference < frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); if( xDispatch.is() ) { - css::uno::Sequence< css::beans::PropertyValue > aPropList(2); + uno::Sequence< beans::PropertyValue > aPropList(2); aProperty.Name = OUSTR( "updateList" ); - aProperty.Value = css::uno::makeAny( rItemList ); + aProperty.Value = uno::makeAny( rItemList ); aPropList[0] = aProperty; aProperty.Name = OUSTR( "prepareOnly" ); - aProperty.Value = css::uno::makeAny( bPrepareOnly ); + aProperty.Value = uno::makeAny( bPrepareOnly ); aPropList[1] = aProperty; xDispatch->dispatch(aURL, aPropList ); } } - catch( const css::uno::Exception& e ) + catch( const uno::Exception& e ) { dp_misc::TRACE( OUSTR("Caught exception: ") + e.Message + OUSTR("\n thread terminated.\n\n")); @@ -886,26 +971,26 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) if ( !dp_misc::office_is_running() ) return; - css::uno::Sequence< css::uno::Sequence< rtl::OUString > > aItemList; + uno::Sequence< uno::Sequence< rtl::OUString > > aItemList; sal_Int32 nCount = 0; if ( ! bRecheckOnly ) { for ( sal_Int16 i = 0; i < m_updates.getItemCount(); ++i ) { - css::uno::Sequence< rtl::OUString > aItem(2); + uno::Sequence< rtl::OUString > aItem(2); UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >(m_updates.GetEntryData(i)); - if ( p->kind == ENABLED_UPDATE ) + if ( p->m_eKind == ENABLED_UPDATE ) { - dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->index.enabledUpdate ]; + dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->m_nIndex ]; aItem[0] = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); dp_misc::DescriptionInfoset aInfoset( m_context, aUpdData.aUpdateInfo ); aItem[1] = aInfoset.getVersion(); } - else if ( p->kind == DISABLED_UPDATE ) + else if ( p->m_eKind == DISABLED_UPDATE ) continue; else continue; @@ -915,6 +1000,8 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) nCount += 1; } } + + storeIgnoredUpdates(); createNotifyJob( bPrepareOnly, aItemList ); } @@ -988,17 +1075,17 @@ void UpdateDialog::clearDescription() m_descriptions.SetPosSizePixel( m_aFirstLinePos, m_aFirstLineSize ); } -bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > const & aUpdateInfo) +bool UpdateDialog::showDescription(uno::Reference< xml::dom::XNode > const & aUpdateInfo) { dp_misc::DescriptionInfoset infoset(m_context, aUpdateInfo); return showDescription(infoset.getLocalizedPublisherNameAndURL(), infoset.getLocalizedReleaseNotesURL()); } -bool UpdateDialog::showDescription(css::uno::Reference< css::deployment::XPackage > const & aExtension) +bool UpdateDialog::showDescription(uno::Reference< deployment::XPackage > const & aExtension) { OSL_ASSERT(aExtension.is()); - css::beans::StringPair pubInfo = aExtension->getPublisherInfo(); + beans::StringPair pubInfo = aExtension->getPublisherInfo(); return showDescription(std::make_pair(pubInfo.First, pubInfo.Second), OUSTR("")); } @@ -1061,7 +1148,7 @@ bool UpdateDialog::showDescription( const String& rDescription, bool bWithPublis return true; } -bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const +bool UpdateDialog::isReadOnly( const uno::Reference< deployment::XPackage > &xPackage ) const { if ( m_xExtensionManager.is() && xPackage.is() ) { @@ -1071,6 +1158,162 @@ bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPack return true; } +//------------------------------------------------------------------------------ +void UpdateDialog::getIgnoredUpdates() +{ + uno::Reference< lang::XMultiServiceFactory > xConfig( m_context->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.configuration.ConfigurationProvider"), m_context ), uno::UNO_QUERY_THROW); + beans::NamedValue aValue( OUSTR("nodepath"), uno::Any( IGNORED_UPDATES ) ); + uno::Sequence< uno::Any > args(1); + args[0] <<= aValue; + + uno::Reference< container::XNameAccess > xNameAccess( xConfig->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), args), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames(); + + for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) + { + ::rtl::OUString aIdentifier = aElementNames[i]; + ::rtl::OUString aVersion; + + uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); + aPropValue >>= aVersion; + IgnoredUpdate *pData = new IgnoredUpdate( aIdentifier, aVersion ); + m_ignoredUpdates.push_back( pData ); + } +} + +//------------------------------------------------------------------------------ +void UpdateDialog::storeIgnoredUpdates() +{ + if ( m_bModified && ( m_ignoredUpdates.size() != 0 ) ) + { + uno::Reference< lang::XMultiServiceFactory > xConfig( m_context->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.configuration.ConfigurationProvider"), m_context ), uno::UNO_QUERY_THROW ); + beans::NamedValue aValue( OUSTR("nodepath"), uno::Any( IGNORED_UPDATES ) ); + uno::Sequence< uno::Any > args(1); + args[0] <<= aValue; + + uno::Reference< container::XNameContainer > xNameContainer( xConfig->createInstanceWithArguments( + OUSTR("com.sun.star.configuration.ConfigurationUpdateAccess"), args ), uno::UNO_QUERY_THROW ); + + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( xNameContainer->hasByName( (*i)->sExtensionID ) ) + { + if ( (*i)->bRemoved ) + xNameContainer->removeByName( (*i)->sExtensionID ); + else + uno::Reference< beans::XPropertySet >( xNameContainer->getByName( (*i)->sExtensionID ), uno::UNO_QUERY_THROW )->setPropertyValue( PROPERTY_VERSION, uno::Any( (*i)->sVersion ) ); + } + else if ( ! (*i)->bRemoved ) + { + uno::Reference< beans::XPropertySet > elem( uno::Reference< lang::XSingleServiceFactory >( xNameContainer, uno::UNO_QUERY_THROW )->createInstance(), uno::UNO_QUERY_THROW ); + elem->setPropertyValue( PROPERTY_VERSION, uno::Any( (*i)->sVersion ) ); + xNameContainer->insertByName( (*i)->sExtensionID, uno::Any( elem ) ); + } + } + + uno::Reference< util::XChangesBatch > xChangesBatch( xNameContainer, uno::UNO_QUERY ); + if ( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) + xChangesBatch->commitChanges(); + } + + m_bModified = false; +} + +//------------------------------------------------------------------------------ +bool UpdateDialog::isIgnoredUpdate( UpdateDialog::Index * index ) +{ + bool bIsIgnored = false; + + if ( m_ignoredUpdates.size() != 0 ) + { + rtl::OUString aExtensionID; + rtl::OUString aVersion; + + if ( index->m_eKind == ENABLED_UPDATE ) + { + dp_gui::UpdateData aUpdData = m_enabledUpdates[ index->m_nIndex ]; + aExtensionID = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); + aVersion = aUpdData.updateVersion; + } + else if ( index->m_eKind == DISABLED_UPDATE ) + { + DisabledUpdate &rData = m_disabledUpdates[ index->m_nIndex ]; + dp_misc::DescriptionInfoset aInfoset( m_context, rData.aUpdateInfo ); + ::boost::optional< ::rtl::OUString > aID( aInfoset.getIdentifier() ); + if ( aID ) + aExtensionID = *aID; + aVersion = aInfoset.getVersion(); + } + + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( (*i)->sExtensionID == aExtensionID ) + { + if ( ( (*i)->sVersion.getLength() == 0 ) || ( (*i)->sVersion == aVersion ) ) + { + bIsIgnored = true; + index->m_bIgnored = true; + } + else // when we find another update of an ignored version, we will remove the old one to keep the ignored list small + (*i)->bRemoved = true; + break; + } + } + } + + return bIsIgnored; +} + +//------------------------------------------------------------------------------ +void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ) +{ + rtl::OUString aExtensionID; + rtl::OUString aVersion; + + m_bModified = true; + + if ( pIndex->m_eKind == ENABLED_UPDATE ) + { + dp_gui::UpdateData aUpdData = m_enabledUpdates[ pIndex->m_nIndex ]; + aExtensionID = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); + if ( !bIgnoreAll ) + aVersion = aUpdData.updateVersion; + } + else if ( pIndex->m_eKind == DISABLED_UPDATE ) + { + DisabledUpdate &rData = m_disabledUpdates[ pIndex->m_nIndex ]; + dp_misc::DescriptionInfoset aInfoset( m_context, rData.aUpdateInfo ); + ::boost::optional< ::rtl::OUString > aID( aInfoset.getIdentifier() ); + if ( aID ) + aExtensionID = *aID; + if ( !bIgnoreAll ) + aVersion = aInfoset.getVersion(); + } + + if ( aExtensionID.getLength() ) + { + bool bFound = false; + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( (*i)->sExtensionID == aExtensionID ) + { + (*i)->sVersion = aVersion; + (*i)->bRemoved = !bIgnore; + bFound = true; + break; + } + } + if ( bIgnore && !bFound ) + { + IgnoredUpdate *pData = new IgnoredUpdate( aExtensionID, aVersion ); + m_ignoredUpdates.push_back( pData ); + } + } +} + +//------------------------------------------------------------------------------ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) { rtl::OUStringBuffer b; @@ -1079,38 +1322,32 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) m_updates.GetEntryData(m_updates.GetSelectEntryPos())); clearDescription(); - if (p != NULL) + if ( p != NULL ) { - //When the index is greater or equal than the amount of enabled updates then the "Show all" - //button is probably checked. Then we show first all enabled and then the disabled - //updates. - USHORT pos = m_updates.GetSelectEntryPos(); - const std::vector< dp_gui::UpdateData >::size_type sizeEnabled = - m_enabledUpdates.size(); - const std::vector< UpdateDialog::DisabledUpdate >::size_type sizeDisabled = - m_disabledUpdates.size(); - if (pos < sizeEnabled) - { - if (m_enabledUpdates[pos].aUpdateSource.is()) - bInserted = showDescription(m_enabledUpdates[pos].aUpdateSource); - else - bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo); - } - else if (pos >= sizeEnabled - && pos < (sizeEnabled + sizeDisabled)) - bInserted = showDescription(m_disabledUpdates[pos - sizeEnabled].aUpdateInfo); + USHORT pos = p->m_nIndex; - switch (p->kind) + switch (p->m_eKind) { case ENABLED_UPDATE: { - b.append(m_noDescription); + if ( m_enabledUpdates[ pos ].aUpdateSource.is() ) + bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateSource ); + else + bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateInfo ); + + if ( p->m_bIgnored ) + b.append( m_ignoredUpdate ); + break; } case DISABLED_UPDATE: { - UpdateDialog::DisabledUpdate & data = m_disabledUpdates[ - p->index.disabledUpdate]; + bInserted = showDescription( m_disabledUpdates[pos].aUpdateInfo ); + + if ( p->m_bIgnored ) + b.append( m_ignoredUpdate ); + + UpdateDialog::DisabledUpdate & data = m_disabledUpdates[ pos ]; if (data.unsatisfiedDependencies.getLength() != 0) { // create error string for version mismatch @@ -1143,23 +1380,12 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) } break; } - case GENERAL_ERROR: - { - rtl::OUString & msg = m_generalErrors[p->index.generalError]; - b.append(m_failure); - b.append(LF); - b.append(msg.getLength() == 0 ? m_unknownError : msg); - break; - } case SPECIFIC_ERROR: { - UpdateDialog::SpecificError & data = m_specificErrors[ - p->index.specificError]; + UpdateDialog::SpecificError & data = m_specificErrors[ pos ]; b.append(m_failure); b.append(LF); - b.append( - data.message.getLength() == 0 - ? m_unknownError : data.message); + b.append( data.message.getLength() == 0 ? m_unknownError : data.message ); break; } default: @@ -1168,56 +1394,37 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) } } + if ( b.getLength() == 0 ) + b.append( m_noDescription ); + showDescription( b.makeStringAndClear(), bInserted ); return 0; } -IMPL_LINK(UpdateDialog, allHandler, void *, EMPTYARG) { - if (m_all.IsChecked()) { +IMPL_LINK(UpdateDialog, allHandler, void *, EMPTYARG) +{ + if (m_all.IsChecked()) + { m_update.Enable(); m_updates.Enable(); m_description.Enable(); m_descriptions.Enable(); - std::vector< UpdateDialog::DisabledUpdate >::size_type n1 = 0; - for (std::vector< UpdateDialog::DisabledUpdate >::iterator i( - m_disabledUpdates.begin()); - i != m_disabledUpdates.end(); ++i) - { - insertItem( - i->name, LISTBOX_APPEND, - UpdateDialog::Index::newDisabledUpdate(n1++), - SvLBoxButtonKind_disabledCheckbox); - } - std::vector< rtl::OUString >::size_type n2 = 0; - for (std::vector< rtl::OUString >::iterator i(m_generalErrors.begin()); - i != m_generalErrors.end(); ++i) + + for (std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); + i != m_ListboxEntries.end(); ++i ) { - insertItem( - m_error, LISTBOX_APPEND, - UpdateDialog::Index::newGeneralError(n2++), - SvLBoxButtonKind_staticImage); + if ( (*i)->m_bIgnored || ( (*i)->m_eKind != ENABLED_UPDATE ) ) + insertItem( (*i), SvLBoxButtonKind_disabledCheckbox ); } - std::vector< UpdateDialog::SpecificError >::size_type n3 = 0; - for (std::vector< UpdateDialog::SpecificError >::iterator i( - m_specificErrors.begin()); - i != m_specificErrors.end(); ++i) + } + else + { + for ( USHORT i = 0; i < m_updates.getItemCount(); ) { - insertItem( - i->name, LISTBOX_APPEND, - UpdateDialog::Index::newSpecificError(n3++), - SvLBoxButtonKind_staticImage); - } - } else { - for (USHORT i = 0; i < m_updates.getItemCount();) { - UpdateDialog::Index const * p = - static_cast< UpdateDialog::Index const * >( - m_updates.GetEntryData(i)); - if (p->kind != ENABLED_UPDATE) { + UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i) ); + if ( p->m_bIgnored || ( p->m_eKind != ENABLED_UPDATE ) ) + { m_updates.RemoveEntry(i); - //TODO #i72487#: UpdateDialog::Index potentially leaks as - // SvxCheckListBox::RemoveEntry's exception behavior is - // unspecified - delete p; } else { ++i; } @@ -1264,8 +1471,8 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i)); - if (p->kind == ENABLED_UPDATE && m_updates.IsChecked(i)) { - m_updateData.push_back(m_enabledUpdates[p->index.enabledUpdate]); + if (p->m_eKind == ENABLED_UPDATE && m_updates.IsChecked(i)) { + m_updateData.push_back( m_enabledUpdates[ p->m_nIndex ] ); } } @@ -1273,7 +1480,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) return 0; } -IMPL_LINK(UpdateDialog, cancelHandler, void *, EMPTYARG) { +IMPL_LINK(UpdateDialog, closeHandler, void *, EMPTYARG) { m_thread->stop(); EndDialog(RET_CANCEL); return 0; @@ -1289,15 +1496,15 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) try { - css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( + uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_context->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), - m_context), css::uno::UNO_QUERY_THROW); - //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException + m_context), uno::UNO_QUERY_THROW); + //throws lang::IllegalArgumentException, system::SystemShellExecuteException xSystemShellExecute->execute( - sURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS); + sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); } - catch (css::uno::Exception& ) + catch (uno::Exception& ) { } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 32c317cb8735..54e645f195d8 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -112,8 +112,7 @@ private: struct DisabledUpdate; struct SpecificError; - union IndexUnion; - friend union IndexUnion; + struct IgnoredUpdate; struct Index; friend struct Index; class Thread; @@ -135,40 +134,36 @@ private: void operator =(UpdateDialog::CheckListBox &); // not defined virtual void MouseButtonDown(MouseEvent const & event); - virtual void MouseButtonUp(MouseEvent const & event); - virtual void KeyInput(KeyEvent const & event); + void handlePopupMenu( const Point &rPos ); + + rtl::OUString m_ignoreUpdate; + rtl::OUString m_ignoreAllUpdates; + rtl::OUString m_enableUpdate; UpdateDialog & m_dialog; }; friend class CheckListBox; - void insertItem( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, - SvLBoxButtonKind kind); - - void addAdditional( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, - SvLBoxButtonKind kind); + USHORT insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); + void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); + bool isIgnoredUpdate( UpdateDialog::Index *pIndex ); + void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ); - void addEnabledUpdate( - rtl::OUString const & name, dp_gui::UpdateData const & data); - - void addDisabledUpdate(UpdateDialog::DisabledUpdate const & data); -#if 0 - void addGeneralError(rtl::OUString const & message); -#endif - void addSpecificError(UpdateDialog::SpecificError const & data); + void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data ); + void addDisabledUpdate( UpdateDialog::DisabledUpdate & data ); + void addSpecificError( UpdateDialog::SpecificError & data ); void checkingDone(); void enableOk(); + void getIgnoredUpdates(); + void storeIgnoredUpdates(); + void initDescription(); void clearDescription(); bool showDescription(::com::sun::star::uno::Reference< @@ -183,7 +178,7 @@ private: DECL_LINK(selectionHandler, void *); DECL_LINK(allHandler, void *); DECL_LINK(okHandler, void *); - DECL_LINK(cancelHandler, void *); + DECL_LINK(closeHandler, void *); DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *); com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > @@ -202,7 +197,7 @@ private: FixedLine m_line; HelpButton m_help; PushButton m_ok; - CancelButton m_cancel; + PushButton m_close; rtl::OUString m_error; rtl::OUString m_none; rtl::OUString m_noInstallable; @@ -214,18 +209,22 @@ private: rtl::OUString m_noDependencyCurVer; rtl::OUString m_browserbased; rtl::OUString m_version; + rtl::OUString m_ignoredUpdate; std::vector< dp_gui::UpdateData > m_enabledUpdates; std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates; - std::vector< rtl::OUString > m_generalErrors; std::vector< UpdateDialog::SpecificError > m_specificErrors; + std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates; + std::vector< Index* > m_ListboxEntries; std::vector< dp_gui::UpdateData > & m_updateData; rtl::Reference< UpdateDialog::Thread > m_thread; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; - Point m_aFirstLinePos; - Size m_aFirstLineSize; - long m_nFirstLineDelta; - long m_nOneLineMissing; + Point m_aFirstLinePos; + Size m_aFirstLineSize; + long m_nFirstLineDelta; + long m_nOneLineMissing; + USHORT m_nLastID; + bool m_bModified; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src index 325d98c88d48..4da431733e31 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.src +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src @@ -86,6 +86,7 @@ ModalDialog RID_DLG_UPDATE { TabStop = TRUE; }; CheckBox RID_DLG_UPDATE_ALL { + HelpID = "desktop:CheckBox:RID_DLG_UPDATE:RID_DLG_UPDATE_ALL"; Disable = TRUE; Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, @@ -150,6 +151,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "Release Notes"; }; MultiLineEdit RID_DLG_UPDATE_DESCRIPTIONS { + HelpID = "desktop:MultiLineEdit:RID_DLG_UPDATE:RID_DLG_UPDATE_DESCRIPTIONS"; Disable = TRUE; Border = TRUE; Pos = MAP_APPFONT( @@ -183,6 +185,7 @@ ModalDialog RID_DLG_UPDATE { Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT); }; PushButton RID_DLG_UPDATE_OK { + HelpID = "desktop:PushButton:RID_DLG_UPDATE:RID_DLG_UPDATE_OK"; Disable = TRUE; Pos = MAP_APPFONT( (RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH - @@ -196,7 +199,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "~Install"; DefButton = TRUE; }; - CancelButton RID_DLG_UPDATE_CANCEL { + PushButton RID_DLG_UPDATE_CLOSE { Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH, (RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT + @@ -205,6 +208,7 @@ ModalDialog RID_DLG_UPDATE { RSC_SP_CTRL_DESC_Y + LOCAL_LIST_HEIGHT2 + RSC_SP_FLGR_SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_Y)); Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT); + Text[en-US] = "Close"; }; Image RID_DLG_UPDATE_NORMALALERT { @@ -224,7 +228,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "No new updates are available."; }; String RID_DLG_UPDATE_NOINSTALLABLE { - Text[en-US] = "No installable updates are available. To see all updates, mark the check box 'Show all updates'."; + Text[en-US] = "No installable updates are available. To see ignored or disabled updates, mark the check box 'Show all updates'."; }; String RID_DLG_UPDATE_FAILURE { Text[en-US] = "An error occurred:"; @@ -233,7 +237,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "Unknown error."; }; String RID_DLG_UPDATE_NODESCRIPTION { - Text[en-US] = "No descriptions available for this extension."; + Text[en-US] = "No more details are available for this update."; }; String RID_DLG_UPDATE_NOINSTALL { Text[en-US] = "The extension cannot be updated because:"; @@ -247,10 +251,21 @@ ModalDialog RID_DLG_UPDATE { String RID_DLG_UPDATE_BROWSERBASED { Text[en-US] = "browser based update"; }; - String RID_DLG_UPDATE_VERSION { Text[en-US] = "Version"; }; + String RID_DLG_UPDATE_IGNORE { + Text[en-US] = "Ignore this Update"; + }; + String RID_DLG_UPDATE_IGNORE_ALL { + Text[en-US] = "Ignore all Updates"; + }; + String RID_DLG_UPDATE_ENABLE { + Text[en-US] = "Enable Updates"; + }; + String RID_DLG_UPDATE_IGNORED_UPDATE { + Text[en-US] = "This update will be ignored.\n"; + }; }; WarningBox RID_WARNINGBOX_UPDATE_SHARED_EXTENSION diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src index d77dd256582c..f7cc93493b5d 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src @@ -90,6 +90,7 @@ ModalDialog RID_DLG_UPDATEINSTALL { }; MultiLineEdit RID_DLG_UPDATE_INSTALL_INFO { + HelpID = "desktop:MultiLineEdit:RID_DLG_UPDATEINSTALL:RID_DLG_UPDATE_INSTALL_INFO"; Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT + diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk index 52092a077a4b..fe3921bf506b 100644 --- a/desktop/source/deployment/gui/makefile.mk +++ b/desktop/source/deployment/gui/makefile.mk @@ -107,3 +107,11 @@ RESLIB1IMAGES= $(PRJ)$/res .INCLUDE : target.mk + +ALLTAR : $(MISC)/deploymentgui.component + +$(MISC)/deploymentgui.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt deploymentgui.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt deploymentgui.component diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk index 6d83a5c1004b..991ba7026d72 100644 --- a/desktop/source/deployment/makefile.mk +++ b/desktop/source/deployment/makefile.mk @@ -110,3 +110,11 @@ RESLIB1SRSFILES += $(SRS)$/deployment_misc.srs .INCLUDE : target.mk + +ALLTAR : $(MISC)/deployment.component + +$(MISC)/deployment.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + deployment.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt deployment.component diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx index c2801ba1d965..0de1f9e96e91 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.cxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -31,6 +31,8 @@ #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/deployment/LicenseException.hpp" #include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/deployment/DependencyException.hpp" +#include "com/sun/star/deployment/PlatformException.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionHandler.hpp" @@ -250,7 +252,43 @@ void NoLicenseCommandEnv::handle( handle_(approve, abort, xRequest); } +// SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv( +// css::uno::Reference< css::task::XInteractionHandler> const & handler): +// BaseCommandEnv(handler) +// { +// } +SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv() +{ +} + +void SilentCheckPrerequisitesCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + deployment::LicenseException licExc; + deployment::PlatformException platformExc; + deployment::DependencyException depExc; + bool approve = false; + bool abort = false; + + if (request >>= licExc) + { + approve = true; + handle_(approve, abort, xRequest); + } + else if ((request >>= platformExc) + || (request >>= depExc)) + { + m_Exception = request; + } + else + { + m_UnknownException = request; + } +} // NoExceptionCommandEnv::NoExceptionCommandEnv( // css::uno::Reference< css::task::XInteractionHandler> const & handler, // css::uno::Type const & type): diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx index aa21f8281c72..bea11586d462 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.hxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx @@ -135,6 +135,29 @@ public: }; +/* For use in XExtensionManager::addExtension in the call to + XPackage::checkPrerequisites + It prevents all user interactions. The license is always accepted. + It remembers if there was a platform or a dependency exception in + the member m_bException. if there was any other exception then m_bUnknownException + is set. + + */ +class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv +{ +public: + SilentCheckPrerequisitesCommandEnv(); + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) + throw (css::uno::RuntimeException); + + // Set to true if a PlatformException or a DependencyException were handled. + css::uno::Any m_Exception; + // Set to true if an unknown exception was handled. + css::uno::Any m_UnknownException; +}; + // class NoExceptionCommandEnv : public BaseCommandEnv // { // css::uno::Type m_type; diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 81c0751fc4cd..fb01dc838459 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -139,6 +139,37 @@ void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const OUSTR("Failed to update") + url, 0, exc); } } + +class ExtensionRemoveGuard +{ + css::uno::Reference<css::deployment::XPackage> m_extension; + css::uno::Reference<css::deployment::XPackageManager> m_xPackageManager; + +public: + ExtensionRemoveGuard( + css::uno::Reference<css::deployment::XPackage> const & extension, + css::uno::Reference<css::deployment::XPackageManager> const & xPackageManager): + m_extension(extension), m_xPackageManager(xPackageManager) {} + ~ExtensionRemoveGuard(); + + void reset(css::uno::Reference<css::deployment::XPackage> const & extension) { + m_extension = extension; + } +}; + +ExtensionRemoveGuard::~ExtensionRemoveGuard() +{ + try { + if (m_xPackageManager.is() && m_extension.is()) + m_xPackageManager->removePackage( + dp_misc::getIdentifier(m_extension), ::rtl::OUString(), + css::uno::Reference<css::task::XAbortChannel>(), + css::uno::Reference<css::ucb::XCommandEnvironment>()); + } catch (...) { + OSL_ASSERT(0); + } +} + } //end namespace namespace dp_manager { @@ -513,6 +544,107 @@ ExtensionManager::getSupportedPackageTypes() { return getUserRepository()->getSupportedPackageTypes(); } +//Do some necessary checks and user interaction. This function does not +//aquire the extension manager mutex and that mutex must not be aquired +//when this function is called. doChecksForAddExtension does synchronous +//user interactions which may require aquiring the solar mutex. +//Returns true if the extension can be installed. +bool ExtensionManager::doChecksForAddExtension( + Reference<deploy::XPackageManager> const & xPackageMgr, + uno::Sequence<beans::NamedValue> const & properties, + css::uno::Reference<css::deployment::XPackage> const & xTmpExtension, + Reference<task::XAbortChannel> const & xAbortChannel, + Reference<ucb::XCommandEnvironment> const & xCmdEnv, + Reference<deploy::XPackage> & out_existingExtension ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + Reference<deploy::XPackage> xOldExtension; + const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); + const OUString sFileName = xTmpExtension->getName(); + const OUString sDisplayName = xTmpExtension->getDisplayName(); + const OUString sVersion = xTmpExtension->getVersion(); + + try + { + xOldExtension = xPackageMgr->getDeployedPackage( + sIdentifier, sFileName, xCmdEnv); + out_existingExtension = xOldExtension; + } + catch (lang::IllegalArgumentException &) + { + } + bool bCanInstall = false; + + //This part is not guarded against other threads removing, adding, disabling ... + //etc. the same extension. + //checkInstall is safe because it notifies the user if the extension is not yet + //installed in the same repository. Because addExtension has its own guard + //(m_addMutex), another thread cannot add the extension in the meantime. + //checkUpdate is called if the same extension exists in the same + //repository. The user is asked if they want to replace it. Another + //thread + //could already remove the extension. So asking the user was not + //necessary. No harm is done. The other thread may also ask the user + //if he wants to remove the extension. This depends on the + //XCommandEnvironment which it passes to removeExtension. + if (xOldExtension.is()) + { + //throws a CommandFailedException if the user cancels + //the action. + checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + } + else + { + //throws a CommandFailedException if the user cancels + //the action. + checkInstall(sDisplayName, xCmdEnv); + } + //Prevent showing the license if requested. + Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); + ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>()); + + dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); + const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = + info.getSimpleLicenseAttributes(); + + if (licenseAttributes && licenseAttributes->suppressIfRequired + && props.isSuppressedLicense()) + _xCmdEnv = Reference<ucb::XCommandEnvironment>( + new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); + + bCanInstall = xTmpExtension->checkPrerequisites( + xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; + + return bCanInstall; + } + catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (uno::Exception &) { + uno::Any excOccurred = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this), excOccurred); + throw exc; + } catch (...) { + throw uno::RuntimeException( + OUSTR("Extension Manager: unexpected exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this)); + } +} // Only add to shared and user repository Reference<deploy::XPackage> ExtensionManager::addExtension( @@ -530,172 +662,190 @@ Reference<deploy::XPackage> ExtensionManager::addExtension( //Determine the repository to use Reference<deploy::XPackageManager> xPackageManager; if (repository.equals(OUSTR("user"))) - xPackageManager = getUserRepository(); + xPackageManager = m_userRepository; else if (repository.equals(OUSTR("shared"))) - xPackageManager = getSharedRepository(); + xPackageManager = m_sharedRepository; else throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast<cppu::OWeakObject*>(this), 0); - ::osl::MutexGuard guard(getMutex()); + //We must make sure that the xTmpExtension is not create twice, because this + //would remove the first one. + ::osl::MutexGuard addGuard(m_addMutex); + Reference<deploy::XPackage> xTmpExtension = getTempExtension(url, xAbortChannel, xCmdEnv); + //Make sure the extension is removed from the tmp repository in case + //of an exception + ExtensionRemoveGuard tmpExtensionRemoveGuard(xTmpExtension, m_tmpRepository); const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); const OUString sFileName = xTmpExtension->getName(); - const OUString sDisplayName = xTmpExtension->getDisplayName(); - const OUString sVersion = xTmpExtension->getVersion(); - dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); - const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = - info.getSimpleLicenseAttributes(); Reference<deploy::XPackage> xOldExtension; Reference<deploy::XPackage> xExtensionBackup; - uno::Any excOccurred1; uno::Any excOccurred2; bool bUserDisabled = false; - try + bool bCanInstall = doChecksForAddExtension( + xPackageManager, + properties, + xTmpExtension, + xAbortChannel, + xCmdEnv, + xOldExtension ); + { - bUserDisabled = isUserDisabled(sIdentifier, sFileName); - try - { - xOldExtension = xPackageManager->getDeployedPackage( - sIdentifier, sFileName, xCmdEnv); - } - catch (lang::IllegalArgumentException &) - { - } - bool bCanInstall = false; - try + // In this garded section (getMutex) we must not use the argument xCmdEnv + // because it may bring up dialogs (XInteractionHandler::handle) this + //may potententially deadlock. See issue + //http://qa.openoffice.org/issues/show_bug.cgi?id=114933 + //By not providing xCmdEnv the underlying APIs will throw an exception if + //the XInteractionRequest cannot be handled + ::osl::MutexGuard guard(getMutex()); + + if (bCanInstall) { - if (xOldExtension.is()) + try { - //throws a CommandFailedException if the user cancels - //the action. - checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + bUserDisabled = isUserDisabled(sIdentifier, sFileName); + if (xOldExtension.is()) + { + try + { + xOldExtension->revokePackage( + xAbortChannel, Reference<ucb::XCommandEnvironment>()); + //save the old user extension in case the user aborts + //store the extension in the tmp repository, this will overwrite + //xTmpPackage (same identifier). Do not let the user abort or + //interact + //importing the old extension in the tmp repository will remove + //the xTmpExtension + //no command environment supplied, only this class shall interact + //with the user! + xExtensionBackup = getTmpRepository->importExtension( + xOldExtension, Reference<task::XAbortChannel>(), + Reference<ucb::XCommandEnvironment>()); + tmpExtensionRemoveGuard.reset(xExtensionBackup); + //xTmpExtension will later be used to check the dependencies + //again. However, only xExtensionBackup will be later removed + //from the tmp repository + xTmpExtension = xExtensionBackup; + OSL_ASSERT(xTmpExtension.is()); + } + catch (lang::DisposedException &) + { + //Another thread might have removed the extension meanwhile + } + } + //check again dependencies but prevent user interaction, + //We can disregard the license, because the user must have already + //accepted it, whe we called checkPrerequisites the first time + SilentCheckPrerequisitesCommandEnv * pSilentCommandEnv = + new SilentCheckPrerequisitesCommandEnv(); + Reference<ucb::XCommandEnvironment> silentCommandEnv(pSilentCommandEnv); + + sal_Int32 failedPrereq = xTmpExtension->checkPrerequisites( + xAbortChannel, silentCommandEnv, true); + if (failedPrereq == 0) + { + xNewExtension = xPackageManager->addPackage( + url, properties, OUString(), xAbortChannel, + Reference<ucb::XCommandEnvironment>()); + //If we add a user extension and there is already one which was + //disabled by a user, then the newly installed one is enabled. If we + //add to another repository then the user extension remains + //disabled. + bool bUserDisabled2 = bUserDisabled; + if (repository.equals(OUSTR("user"))) + bUserDisabled2 = false; + + activateExtension( + dp_misc::getIdentifier(xNewExtension), + xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, + Reference<ucb::XCommandEnvironment>()); + } + else + { + if (pSilentCommandEnv->m_Exception.hasValue()) + ::cppu::throwException(pSilentCommandEnv->m_Exception); + else if ( pSilentCommandEnv->m_UnknownException.hasValue()) + ::cppu::throwException(pSilentCommandEnv->m_UnknownException); + else + throw deploy::DeploymentException ( + OUSTR("Extension Manager: exception during addExtension, ckeckPrerequisites failed"), + static_cast<OWeakObject*>(this), uno::Any()); + } } - else - { - //throws a CommandFailedException if the user cancels - //the action. - checkInstall(sDisplayName, xCmdEnv); + catch (deploy::DeploymentException& ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (...) { + excOccurred2 = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during addExtension, url: ") + + url, static_cast<OWeakObject*>(this), excOccurred2); + excOccurred2 <<= exc; } - //Prevent showing the license if requested. - Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); - ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>()); - if (licenseAttributes && licenseAttributes->suppressIfRequired - && props.isSuppressedLicense()) - _xCmdEnv = Reference<ucb::XCommandEnvironment>( - new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); - - bCanInstall = xTmpExtension->checkPrerequisites( - xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; - } - catch (deploy::DeploymentException& ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (ucb::CommandFailedException & ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (ucb::CommandAbortedException & ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (lang::IllegalArgumentException &) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (uno::RuntimeException &) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (...) { - excOccurred1 = ::cppu::getCaughtException(); - deploy::DeploymentException exc( - OUSTR("Extension Manager: exception during addExtension, url: ") - + url, static_cast<OWeakObject*>(this), excOccurred1); - excOccurred1 <<= exc; } - if (bCanInstall) + if (excOccurred2.hasValue()) { - if (xOldExtension.is()) + //It does not matter what exception is thrown. We try to + //recover the original status. + //If the user aborted installation then a ucb::CommandAbortedException + //is thrown. + //Use a private AbortChannel so the user cannot interrupt. + try { - xOldExtension->revokePackage(xAbortChannel, xCmdEnv); - //save the old user extension in case the user aborts - //store the extension in the tmp repository, this will overwrite - //xTmpPackage (same identifier). Do not let the user abort or - //interact - Reference<ucb::XCommandEnvironment> tmpCmdEnv( - new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); - //importing the old extension in the tmp repository will remove - //the xTmpExtension - xTmpExtension = 0; - xExtensionBackup = getTmpRepository()->importExtension( - xOldExtension, Reference<task::XAbortChannel>(), - tmpCmdEnv); + if (xExtensionBackup.is()) + { + Reference<deploy::XPackage> xRestored = + xPackageManager->importExtension( + xExtensionBackup, Reference<task::XAbortChannel>(), + Reference<ucb::XCommandEnvironment>()); + } + activateExtension( + sIdentifier, sFileName, bUserDisabled, false, + Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); } - xNewExtension = xPackageManager->addPackage( - url, properties, OUString(), xAbortChannel, xCmdEnv); - //If we add a user extension and there is already one which was - //disabled by a user, then the newly installed one is enabled. If we - //add to another repository then the user extension remains - //disabled. - bool bUserDisabled2 = bUserDisabled; - if (repository.equals(OUSTR("user"))) - bUserDisabled2 = false; - activateExtension( - dp_misc::getIdentifier(xNewExtension), - xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, xCmdEnv); - fireModified(); + catch (...) + { + } + ::cppu::throwException(excOccurred2); } - } - catch (deploy::DeploymentException& ) { - excOccurred2 = ::cppu::getCaughtException(); + } // leaving the garded section (getMutex()) + + try + { + fireModified(); + + }catch (deploy::DeploymentException& ) { + throw; } catch (ucb::CommandFailedException & ) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (ucb::CommandAbortedException & ) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (lang::IllegalArgumentException &) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (uno::RuntimeException &) { - excOccurred2 = ::cppu::getCaughtException(); - } catch (...) { - excOccurred2 = ::cppu::getCaughtException(); + throw; + } catch (uno::Exception &) { + uno::Any excOccurred = ::cppu::getCaughtException(); deploy::DeploymentException exc( - OUSTR("Extension Manager: exception during addExtension, url: ") - + url, static_cast<OWeakObject*>(this), excOccurred2); - excOccurred2 <<= exc; - } - - if (excOccurred2.hasValue()) - { - //It does not matter what exception is thrown. We try to - //recover the original status. - //If the user aborted installation then a ucb::CommandAbortedException - //is thrown. - //Use a private AbortChannel so the user cannot interrupt. - try - { - Reference<ucb::XCommandEnvironment> tmpCmdEnv( - new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); - if (xExtensionBackup.is()) - { - Reference<deploy::XPackage> xRestored = - xPackageManager->importExtension( - xExtensionBackup, Reference<task::XAbortChannel>(), - tmpCmdEnv); - } - activateExtension( - sIdentifier, sFileName, bUserDisabled, false, - Reference<task::XAbortChannel>(), tmpCmdEnv); - if (xTmpExtension.is() || xExtensionBackup.is()) - getTmpRepository()->removePackage( - sIdentifier, OUString(), xAbortChannel, xCmdEnv); - fireModified(); - } - catch (...) - { - } - ::cppu::throwException(excOccurred2); + OUSTR("Extension Manager: exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this), excOccurred); + throw exc; + } catch (...) { + throw uno::RuntimeException( + OUSTR("Extension Manager: unexpected exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this)); } - if (xTmpExtension.is() || xExtensionBackup.is()) - getTmpRepository()->removePackage( - sIdentifier,OUString(), xAbortChannel, xCmdEnv); - - if (excOccurred1.hasValue()) - ::cppu::throwException(excOccurred1); return xNewExtension; } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index b3570e311828..e7a180a05de1 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -237,6 +237,8 @@ private: css::uno::Reference< css::uno::XComponentContext> m_xContext; css::uno::Reference<css::deployment::XPackageManagerFactory> m_xPackageManagerFactory; + //only to be used within addExtension + ::osl::Mutex m_addMutex; /* contains the names of all repositories (except tmp) in order of there priority. That is, the first element is "user" follod by "shared" and then "bundled" @@ -303,6 +305,21 @@ private: css::uno::Reference<css::deployment::XPackageManager> getPackageManager(::rtl::OUString const & repository) throw (css::lang::IllegalArgumentException); + + bool doChecksForAddExtension( + css::uno::Reference<css::deployment::XPackageManager> const & xPackageMgr, + css::uno::Sequence<css::beans::NamedValue> const & properties, + css::uno::Reference<css::deployment::XPackage> const & xTmpExtension, + css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel, + css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv, + css::uno::Reference<css::deployment::XPackage> & out_existingExtension ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + }; } diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src index 0d341122af16..ae810d2c7851 100644..100755 --- a/desktop/source/deployment/misc/dp_misc.src +++ b/desktop/source/deployment/misc/dp_misc.src @@ -32,7 +32,7 @@ String RID_DEPLYOMENT_DEPENDENCIES_UNKNOWN { }; String RID_DEPLYOMENT_DEPENDENCIES_MIN { - Text[en-US] = "Extensions requires at least OpenOffice.org %VERSION"; + Text[en-US] = "Extension requires at least OpenOffice.org %VERSION"; }; String RID_DEPLYOMENT_DEPENDENCIES_MAX { diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx index 52011f1f0ca0..fb6efe0b79aa 100755..100644 --- a/desktop/source/deployment/misc/dp_update.cxx +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -90,8 +90,6 @@ getUpdateInformation( Reference<deployment::XUpdateInformationProvider > const & Sequence<Reference< xml::dom::XElement > >(); } -//Put in anonymous namespace - void getOwnUpdateInfos( Reference<uno::XComponentContext> const & xContext, Reference<deployment::XUpdateInformationProvider > const & updateInformation, @@ -185,6 +183,56 @@ void getDefaultUpdateInfos( } } +bool containsBundledOnly(Sequence<Reference<deployment::XPackage> > const & sameIdExtensions) +{ + OSL_ASSERT(sameIdExtensions.getLength() == 3); + if (!sameIdExtensions[0].is() && !sameIdExtensions[1].is() && sameIdExtensions[2].is()) + return true; + else + return false; +} +/** Returns true if the list of extensions are bundled extensions and there are no + other extensions with the same identifier in the shared or user repository. + If extensionList is NULL, then it is checked if there are only bundled extensions. +*/ +bool onlyBundledExtensions( + Reference<deployment::XExtensionManager> const & xExtMgr, + std::vector< Reference<deployment::XPackage > > const * extensionList) +{ + OSL_ASSERT(xExtMgr.is()); + bool onlyBundled = true; + if (extensionList) + { + typedef std::vector<Reference<deployment::XPackage > >::const_iterator CIT; + for (CIT i = extensionList->begin(); i != extensionList->end(); i++) + { + Sequence<Reference<deployment::XPackage> > seqExt = xExtMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(*i), (*i)->getName(), Reference<ucb::XCommandEnvironment>()); + + if (!containsBundledOnly(seqExt)) + { + onlyBundled = false; + break; + } + + } + } + else + { + const uno::Sequence< uno::Sequence< Reference<deployment::XPackage > > > seqAllExt = + xExtMgr->getAllExtensions(Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); + + for (int pos = seqAllExt.getLength(); pos --; ) + { + if (!containsBundledOnly(seqAllExt[pos])) + { + onlyBundled = false; + break; + } + } + } + return onlyBundled; +} } // anon namespace @@ -233,13 +281,14 @@ UPDATE_SOURCE isUpdateUserExtension( retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} } else { @@ -278,13 +327,14 @@ UPDATE_SOURCE isUpdateSharedExtension( else if (index == 3) retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} return retVal; } @@ -332,7 +382,7 @@ UpdateInfoMap getOnlineUpdateInfos( { OSL_ASSERT(xExtMgr.is()); UpdateInfoMap infoMap; - if (!xExtMgr.is()) + if (!xExtMgr.is() || onlyBundledExtensions(xExtMgr, extensionList)) return infoMap; if (!extensionList) diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index d15b4bc25980..f094925a45a7 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, @@ -295,13 +352,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 @@ -542,6 +593,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;" @@ -557,13 +615,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; @@ -736,6 +795,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( @@ -828,11 +898,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: @@ -908,16 +1017,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; @@ -939,6 +1059,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: @@ -955,13 +1087,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: @@ -975,13 +1107,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 ); @@ -990,22 +1122,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 ); } //______________________________________________________________________________ @@ -1088,62 +1413,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 @@ -1237,221 +1538,72 @@ 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()->revokeEntryFromDb(url); } @@ -1495,7 +1647,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 */ ) ); } @@ -1561,11 +1714,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()) @@ -1585,6 +1740,97 @@ void BackendImpl::TypelibraryPackageImpl::processPackage_( } } +BackendImpl * BackendImpl::ComponentsPackageImpl::getMyBackend() const +{ + BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); + if (NULL == pBackend) + { + //Throws a DisposedException + check(); + //We should never get here... + throw RuntimeException( + OUSTR("Failed to get the BackendImpl"), + static_cast<OWeakObject*>(const_cast<ComponentsPackageImpl *>(this))); + } + return pBackend; +} + +beans::Optional< beans::Ambiguous<sal_Bool> > +BackendImpl::ComponentsPackageImpl::isRegistered_( + ::osl::ResettableMutexGuard &, + ::rtl::Reference<AbortChannel> const &, + Reference<XCommandEnvironment> const & ) +{ + return beans::Optional< beans::Ambiguous<sal_Bool> >( + true, + beans::Ambiguous<sal_Bool>( + getMyBackend()->hasInUnoRc(RCITEM_COMPONENTS, getURL()), false)); +} + +void BackendImpl::ComponentsPackageImpl::processPackage_( + ::osl::ResettableMutexGuard &, + bool doRegisterPackage, + bool startup, + ::rtl::Reference<AbortChannel> const & abortChannel, + Reference<XCommandEnvironment> const & xCmdEnv ) +{ + BackendImpl * that = getMyBackend(); + rtl::OUString url(getURL()); + if (doRegisterPackage) { + ComponentBackendDb::Data data; + data.javaTypeLibrary = false; + std::vector< css::uno::Reference< css::uno::XInterface > > factories; + css::uno::Reference< css::uno::XComponentContext > context( + that->getObject(url), css::uno::UNO_QUERY); + if (!context.is()) { + context.set( + that->insertObject( + url, + raise_uno_process( + that->getComponentContext(), abortChannel)), + css::uno::UNO_QUERY_THROW); + } + css::uno::Reference< css::registry::XSimpleRegistry > registry( + css::uno::Reference< css::lang::XMultiComponentFactory >( + that->getComponentContext()->getServiceManager(), + css::uno::UNO_SET_THROW)->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry")), + that->getComponentContext()), + css::uno::UNO_QUERY_THROW); + registry->open(expandUnoRcUrl(url), true, false); + getMyBackend()->extractComponentData( + context, + that->openRegistryKey( + registry->getRootKey(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IMPLEMENTATIONS"))), + &data, &factories, 0, 0); + registry->close(); + if (!startup) { + that->componentLiveInsertion(data, factories); + } + that->addDataToDb(url, data); + that->addToUnoRc(RCITEM_COMPONENTS, url, xCmdEnv); + } else { // revoke + that->removeFromUnoRc(RCITEM_COMPONENTS, url, xCmdEnv); + if (!startup) { + that->componentLiveRemoval(that->readDataFromDb(url)); + } + that->releaseObject(url); + that->deleteDataFromDb(url); + } +} + +BackendImpl::ComponentsPackageImpl::ComponentsPackageImpl( + ::rtl::Reference<PackageRegistryBackend> const & myBackend, + OUString const & url, OUString const & name, + Reference<deployment::XPackageTypeInfo> const & xPackageType, + bool bRemoved, OUString const & identifier) + : Package( myBackend, url, name, name /* display-name */, + xPackageType, bRemoved, identifier) +{} + } // anon namespace namespace sdecl = comphelper::service_decl; diff --git a/desktop/source/deployment/registry/component/dp_component.hrc b/desktop/source/deployment/registry/component/dp_component.hrc index 53085a48d185..4a8c4184a994 100644 --- a/desktop/source/deployment/registry/component/dp_component.hrc +++ b/desktop/source/deployment/registry/component/dp_component.hrc @@ -33,6 +33,7 @@ #define RID_STR_DYN_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+10) #define RID_STR_JAVA_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+11) #define RID_STR_PYTHON_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+12) +#define RID_STR_COMPONENTS (RID_DEPLOYMENT_COMPONENT_START+13) #define RID_STR_RDB_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+20) #define RID_STR_JAVA_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+21) diff --git a/desktop/source/deployment/registry/component/dp_component.src b/desktop/source/deployment/registry/component/dp_component.src index 36f2a1cc4a5c..9e9ab1a82bbf 100644 --- a/desktop/source/deployment/registry/component/dp_component.src +++ b/desktop/source/deployment/registry/component/dp_component.src @@ -42,6 +42,11 @@ String RID_STR_PYTHON_COMPONENT Text [ en-US ] = "UNO Python Component"; }; +String RID_STR_COMPONENTS +{ + Text [ en-US ] = "UNO Components"; +}; + String RID_STR_RDB_TYPELIB { Text [ en-US ] = "UNO RDB Type Library"; diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 9aeb656eb65c..266d4406cfde 100644..100755 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -526,6 +526,15 @@ OUString Package::getDescription() throw ( } //______________________________________________________________________________ +OUString Package::getLicenseText() throw ( + deployment::ExtensionRemovedException,RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + return OUString(); +} + +//______________________________________________________________________________ Sequence<OUString> Package::getUpdateInformationURLs() throw ( deployment::ExtensionRemovedException, RuntimeException) { diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 5949dc0dd634..0adb63614828 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -472,7 +472,7 @@ void BackendImpl::implProcessHelp( aJarFile, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.zip://" ); aDestBasePath += aEncodedJarFilePath; aDestBasePath += rtl::OUString::createFromAscii( "/" ); diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 2561c3a32b66..80aec2402a59 100644..100755 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -237,6 +237,9 @@ public: virtual ::rtl::OUString SAL_CALL getDescription() throw (css::deployment::ExtensionRemovedException, css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLicenseText() + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getUpdateInformationURLs() throw (css::deployment::ExtensionRemovedException, @@ -294,7 +297,7 @@ protected: ::rtl::OUString m_context; // currently only for library containers: - enum context { + enum { CONTEXT_UNKNOWN, CONTEXT_USER, CONTEXT_SHARED,CONTEXT_BUNDLED, CONTEXT_TMP, CONTEXT_BUNDLED_PREREG, CONTEXT_DOCUMENT diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 302b36603619..d247597a808f 100644..100755 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -190,6 +190,9 @@ class BackendImpl : public ImplBaseT virtual OUString SAL_CALL getDescription() throw (deployment::ExtensionRemovedException, RuntimeException); + virtual OUString SAL_CALL getLicenseText() + throw (deployment::ExtensionRemovedException, RuntimeException); + virtual void SAL_CALL exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, @@ -1004,16 +1007,45 @@ 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; +} + +//______________________________________________________________________________ +OUString BackendImpl::PackageImpl::getLicenseText() + throw (deployment::ExtensionRemovedException, RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + + OUString sLicense; + DescriptionInfoset aInfo = getDescriptionInfoset(); + + ::boost::optional< SimpleLicenseAttributes > aSimplLicAttr = aInfo.getSimpleLicenseAttributes(); + if ( aSimplLicAttr ) + { + OUString aLicenseURL = aInfo.getLocalizedLicenseURL(); + + if ( aLicenseURL.getLength() ) + { + OUString aFullURL = m_url_expanded + OUSTR("/") + aLicenseURL; + sLicense = getTextFromURL( Reference< ucb::XCommandEnvironment >(), aFullURL); + } + } + + return sLicense; } //______________________________________________________________________________ diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index a24512095bc0..7e4be0f4e35a 100644..100755 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -88,6 +88,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString const & identifier); // XPackage virtual OUString SAL_CALL getDescription() throw (RuntimeException); + virtual OUString SAL_CALL getLicenseText() throw (RuntimeException); }; friend class PackageImpl; @@ -137,6 +138,12 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) } //______________________________________________________________________________ +OUString BackendImpl::PackageImpl::getLicenseText() throw (RuntimeException) +{ + return Package::getDescription(); +} + +//______________________________________________________________________________ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference<BackendImpl> const & myBackend, OUString const & url, OUString const & libType, bool bRemoved, diff --git a/desktop/source/inc/helpid.hrc b/desktop/source/inc/helpid.hrc index 2619c4398881..d96b12196342 100644 --- a/desktop/source/inc/helpid.hrc +++ b/desktop/source/inc/helpid.hrc @@ -28,51 +28,40 @@ #if ! defined INCLUDED_DESKTOP_HELPID_HRC #define INCLUDED_DESKTOP_HELPID_HRC -#include "svl/solar.hrc" +#define HID_PACKAGE_MANAGER "DESKTOP_HID_PACKAGE_MANAGER" +#define HID_PACKAGE_MANAGER_TREELISTBOX "DESKTOP_HID_PACKAGE_MANAGER_TREELISTBOX" +#define HID_PACKAGE_MANAGER_PROGRESS "DESKTOP_HID_PACKAGE_MANAGER_PROGRESS" +#define HID_PACKAGE_MANAGER_PROGRESS_CANCEL "DESKTOP_HID_PACKAGE_MANAGER_PROGRESS_CANCEL" +#define HID_PACKAGE_MANAGER_MENU_ITEM "DESKTOP_HID_PACKAGE_MANAGER_MENU_ITEM" -#define HID_GLOBAL_FALLBACK 0xFFFFFFFF +#define HID_FIRSTSTART_DIALOG "DESKTOP_HID_FIRSTSTART_DIALOG" +#define HID_FIRSTSTART_WELCOME "DESKTOP_HID_FIRSTSTART_WELCOME" +#define HID_FIRSTSTART_LICENSE "DESKTOP_HID_FIRSTSTART_LICENSE" +#define HID_FIRSTSTART_MIGRATION "DESKTOP_HID_FIRSTSTART_MIGRATION" +#define HID_FIRSTSTART_REGISTRATION "DESKTOP_HID_FIRSTSTART_REGISTRATION" +#define HID_FIRSTSTART_USER "DESKTOP_HID_FIRSTSTART_USER" +#define HID_FIRSTSTART_PREV "DESKTOP_HID_FIRSTSTART_PREV" +#define HID_FIRSTSTART_NEXT "DESKTOP_HID_FIRSTSTART_NEXT" +#define HID_FIRSTSTART_CANCEL "DESKTOP_HID_FIRSTSTART_CANCEL" +#define HID_FIRSTSTART_FINISH "DESKTOP_HID_FIRSTSTART_FINISH" +#define UID_FIRSTSTART_HELP "DESKTOP_UID_FIRSTSTART_HELP" +#define UID_BTN_LICENSE_ACCEPT "DESKTOP_UID_BTN_LICENSE_ACCEPT" +#define HID_FIRSTSTART_UPDATE_CHECK "DESKTOP_HID_FIRSTSTART_UPDATE_CHECK" +#define HID_DEPLOYMENT_GUI_UPDATE "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE" +#define HID_DEPLOYMENT_GUI_UPDATEINSTALL "DESKTOP_HID_DEPLOYMENT_GUI_UPDATEINSTALL" +#define HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER" +#define HID_DEPLOYMENT_GUI_UPDATE_RELEASENOTES "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_RELEASENOTES" +#define HID_DEPLOYMENT_GUI_UPDATE_AVAILABLE_UPDATES "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_AVAILABLE_UPDATES" -#define HID_PACKAGE_MANAGER (HID_DESKTOP_START + 0) -#define HID_PACKAGE_MANAGER_TREELISTBOX (HID_DESKTOP_START + 1) -#define HID_PACKAGE_MANAGER_PROGRESS (HID_DESKTOP_START + 2) -#define HID_PACKAGE_MANAGER_PROGRESS_CANCEL (HID_DESKTOP_START + 3) -#define HID_PACKAGE_MANAGER_MENU_ITEM (HID_DESKTOP_START + 4) +#define HID_EXTENSION_MANAGER_LISTBOX "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX" +#define HID_EXTENSION_MANAGER_LISTBOX_OPTIONS "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_OPTIONS" +#define HID_EXTENSION_MANAGER_LISTBOX_ENABLE "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_ENABLE" +#define HID_EXTENSION_MANAGER_LISTBOX_DISABLE "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_DISABLE" +#define HID_EXTENSION_MANAGER_LISTBOX_REMOVE "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_REMOVE" -#define HID_FIRSTSTART_DIALOG (HID_DESKTOP_START + 5) -#define HID_FIRSTSTART_WELCOME (HID_DESKTOP_START + 6) -#define HID_FIRSTSTART_LICENSE (HID_DESKTOP_START + 7) -#define HID_FIRSTSTART_MIGRATION (HID_DESKTOP_START + 8) -#define HID_FIRSTSTART_REGISTRATION (HID_DESKTOP_START + 9) -#define HID_FIRSTSTART_USER (HID_DESKTOP_START + 10) -#define HID_FIRSTSTART_PREV (HID_DESKTOP_START + 11) -#define HID_FIRSTSTART_NEXT (HID_DESKTOP_START + 12) -#define HID_FIRSTSTART_CANCEL (HID_DESKTOP_START + 13) -#define HID_FIRSTSTART_FINISH (HID_DESKTOP_START + 14) -#define UID_FIRSTSTART_HELP (HID_DESKTOP_START + 15) -#define UID_BTN_LICENSE_ACCEPT (HID_DESKTOP_START + 16) -#define HID_FIRSTSTART_UPDATE_CHECK (HID_DESKTOP_START + 17) -#define HID_DEPLOYMENT_GUI_UPDATE (HID_DESKTOP_START + 18) -#define HID_DEPLOYMENT_GUI_UPDATEINSTALL (HID_DESKTOP_START + 19) -#define HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER (HID_DESKTOP_START + 20) -#define HID_DEPLOYMENT_GUI_UPDATE_RELEASENOTES (HID_DESKTOP_START + 21) -#define HID_DEPLOYMENT_GUI_UPDATE_AVAILABLE_UPDATES (HID_DESKTOP_START + 22) +#define HID_EXTENSION_DEPENDENCIES "DESKTOP_HID_EXTENSION_DEPENDENCIES" -#define HID_EXTENSION_MANAGER_LISTBOX (HID_DESKTOP_START + 23) -#define HID_EXTENSION_MANAGER_LISTBOX_OPTIONS (HID_DESKTOP_START + 24) -#define HID_EXTENSION_MANAGER_LISTBOX_ENABLE (HID_DESKTOP_START + 25) -#define HID_EXTENSION_MANAGER_LISTBOX_DISABLE (HID_DESKTOP_START + 26) -#define HID_EXTENSION_MANAGER_LISTBOX_REMOVE (HID_DESKTOP_START + 27) - -#define HID_EXTENSION_DEPENDENCIES (HID_DESKTOP_START + 28) - -#define HID_PACKAGE_MANAGER_UPD_REQ (HID_DESKTOP_START + 29) - -#define ACT_DESKTOP_HID_END HID_PACKAGE_MANAGER_UPD_REQ - -// check bounds: -#if ACT_DESKTOP_HID_END > HID_DESKTOP_END -#error Resource overflow in #line, #file -#endif +#define HID_PACKAGE_MANAGER_UPD_REQ "DESKTOP_HID_PACKAGE_MANAGER_UPD_REQ" #endif diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx index cf9a9ab30b0c..d869993f39c3 100644 --- a/desktop/source/migration/services/cexports.cxx +++ b/desktop/source/migration/services/cexports.cxx @@ -63,13 +63,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx index 695b6b810808..589701d534d5 100755..100644 --- a/desktop/source/migration/services/cexportsoo3.cxx +++ b/desktop/source/migration/services/cexportsoo3.cxx @@ -51,13 +51,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk index 2f3eb9308ebd..38f97084b36e 100644 --- a/desktop/source/migration/services/makefile.mk +++ b/desktop/source/migration/services/makefile.mk @@ -87,7 +87,7 @@ DEF1NAME=$(SHL1TARGET) COMP2TYPELIST = migrationoo3 SHL2TARGET=migrationoo3.uno -SHL2VERSIONMAP = migrationoo3.map +SHL2VERSIONMAP = $(SOLARENV)/src/component.map SHL2OBJS= \ $(SLO)$/cexportsoo3.obj \ @@ -117,3 +117,18 @@ DEF2NAME=$(SHL2TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/migrationoo3.component + +$(MISC)/migrationoo3.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo3.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo3.component + +ALLTAR : $(MISC)/migrationoo2.component + +$(MISC)/migrationoo2.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo2.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo2.component diff --git a/desktop/source/migration/services/migrationoo2.component b/desktop/source/migration/services/migrationoo2.component new file mode 100644 index 000000000000..2b21ab123b9e --- /dev/null +++ b/desktop/source/migration/services/migrationoo2.component @@ -0,0 +1,37 @@ +<?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.desktop.migration.Basic"> + <service name="com.sun.star.migration.Basic"/> + </implementation> + <implementation name="com.sun.star.comp.desktop.migration.Wordbooks"> + <service name="com.sun.star.migration.Wordbooks"/> + </implementation> +</component> diff --git a/desktop/source/migration/services/migrationoo3.component b/desktop/source/migration/services/migrationoo3.component new file mode 100644 index 000000000000..380c389ab7b9 --- /dev/null +++ b/desktop/source/migration/services/migrationoo3.component @@ -0,0 +1,34 @@ +<?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.desktop.migration.OOo3Extensions"> + <service name="com.sun.star.migration.Extensions"/> + </implementation> +</component> diff --git a/desktop/source/migration/services/migrationoo3.map b/desktop/source/migration/services/migrationoo3.map deleted file mode 100755 index ac2c3750bfe0..000000000000 --- a/desktop/source/migration/services/migrationoo3.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; 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/source/migration/wizard.src b/desktop/source/migration/wizard.src index 9c1ab5496d39..e690e130c74f 100644 --- a/desktop/source/migration/wizard.src +++ b/desktop/source/migration/wizard.src @@ -188,6 +188,7 @@ TabPage TP_LICENSE }; MultiLineEdit ML_LICENSE { + HelpID = "desktop:MultiLineEdit:TP_LICENSE:ML_LICENSE"; PosSize = MAP_APPFONT (MARGINLEFT+INDENT, MARGINTOP + 8*ROWHEIGHT, BODYWIDTH-INDENT , BODYHEIGHT - 8*ROWHEIGHT - 20-2*MARGINBOTTOM) ; Border = TRUE; VScroll = TRUE; @@ -195,6 +196,7 @@ TabPage TP_LICENSE }; PushButton PB_LICENSE_DOWN { + HelpID = "desktop:PushButton:TP_LICENSE:PB_LICENSE_DOWN"; TabStop = TRUE ; Pos = MAP_APPFONT ( TP_WIDTH-MARGINRIGHT-50 , TP_HEIGHT-MARGINBOTTOM-18 ) ; Size = MAP_APPFONT ( 50, 15 ) ; @@ -240,6 +242,7 @@ TabPage TP_MIGRATION CheckBox CB_MIGRATION { + HelpID = "desktop:CheckBox:TP_MIGRATION:CB_MIGRATION"; Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*10); Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*2); Check = TRUE; @@ -275,6 +278,7 @@ TabPage TP_UPDATE_CHECK CheckBox CB_UPDATE_CHECK { + HelpID = "desktop:CheckBox:TP_UPDATE_CHECK:CB_UPDATE_CHECK"; Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*10); Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*2); Check = TRUE; @@ -321,6 +325,7 @@ TabPage TP_USER }; Edit ED_USER_FIRST { + HelpID = "desktop:Edit:TP_USER:ED_USER_FIRST"; Border = TRUE; Pos = MAP_APPFONT(MARGINLEFT+USERINDENT, MARGINTOP+ROWHEIGHT*7); Size = MAP_APPFONT(BODYWIDTH-USERINDENT, EDHEIGHT); @@ -333,6 +338,7 @@ TabPage TP_USER }; Edit ED_USER_LAST { + HelpID = "desktop:Edit:TP_USER:ED_USER_LAST"; Border = TRUE; Pos = MAP_APPFONT(MARGINLEFT+USERINDENT, MARGINTOP+ROWHEIGHT*9); Size = MAP_APPFONT(BODYWIDTH-USERINDENT, EDHEIGHT); @@ -345,6 +351,7 @@ TabPage TP_USER }; Edit ED_USER_INITIALS { + HelpID = "desktop:Edit:TP_USER:ED_USER_INITIALS"; Border = TRUE; Pos = MAP_APPFONT(MARGINLEFT+USERINDENT, MARGINTOP+ROWHEIGHT*11); Size = MAP_APPFONT(INITIALSWIDTH, EDHEIGHT); @@ -359,6 +366,7 @@ TabPage TP_USER }; Edit ED_USER_FATHER { + HelpID = "desktop:Edit:TP_USER:ED_USER_FATHER"; Border = TRUE; Hide = TRUE; Pos = MAP_APPFONT(MARGINLEFT+USERINDENT*2+INITIALSWIDTH+10, MARGINTOP+ROWHEIGHT*11); @@ -391,6 +399,7 @@ TabPage TP_REGISTRATION }; RadioButton RB_REGISTRATION_NOW { + HelpID = "desktop:RadioButton:TP_REGISTRATION:RB_REGISTRATION_NOW"; Text [ en-US ] = "I want to register ~now"; Pos = MAP_APPFONT(MARGINLEFT+INDENT2, ROWHEIGHT*12+2); Size = MAP_APPFONT(BODYWIDTH-INDENT2, RSC_CD_CHECKBOX_HEIGHT); @@ -398,12 +407,14 @@ TabPage TP_REGISTRATION }; RadioButton RB_REGISTRATION_LATER { + HelpID = "desktop:RadioButton:TP_REGISTRATION:RB_REGISTRATION_LATER"; Text [ en-US ] = "I want to register ~later"; Pos = MAP_APPFONT(MARGINLEFT+INDENT2, ROWHEIGHT*12+2+RB_HEIGHT); Size = MAP_APPFONT(BODYWIDTH-INDENT2, RSC_CD_CHECKBOX_HEIGHT); }; RadioButton RB_REGISTRATION_NEVER { + HelpID = "desktop:RadioButton:TP_REGISTRATION:RB_REGISTRATION_NEVER"; Text [ en-US ] = "I do not want to ~register"; Pos = MAP_APPFONT(MARGINLEFT+INDENT2, ROWHEIGHT*12+2+RB_HEIGHT*2); Size = MAP_APPFONT(BODYWIDTH-INDENT2, RSC_CD_CHECKBOX_HEIGHT); diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index 4e100fd99665..430737106a59 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -317,23 +317,6 @@ component_getImplementationEnvironment(const sal_Char **ppEnvironmentTypeName, u *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo(void *pServiceManager, void *pRegistryKey) -{ - Reference< XMultiServiceFactory > xMan(reinterpret_cast< XMultiServiceFactory* >(pServiceManager)); - Reference< XRegistryKey > xKey(reinterpret_cast< XRegistryKey* >(pRegistryKey)); - - // register service - ::rtl::OUString aTempStr; - ::rtl::OUString aImpl(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += Acceptor::impl_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - Reference< XRegistryKey > xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(Acceptor::impl_getSupportedServiceNames()[0]); - - return sal_True; -} - void * SAL_CALL component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void *) { diff --git a/desktop/source/offacc/makefile.mk b/desktop/source/offacc/makefile.mk index c2d53930b580..809c28414bef 100644 --- a/desktop/source/offacc/makefile.mk +++ b/desktop/source/offacc/makefile.mk @@ -60,3 +60,11 @@ SHL1STDLIBS= \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/offacc.component + +$(MISC)/offacc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + offacc.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt offacc.component diff --git a/desktop/source/offacc/offacc.component b/desktop/source/offacc/offacc.component new file mode 100644 index 000000000000..6f0d4a97a2d2 --- /dev/null +++ b/desktop/source/offacc/offacc.component @@ -0,0 +1,34 @@ +<?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.office.comp.Acceptor"> + <service name="com.sun.star.office.Acceptor"/> + </implementation> +</component> diff --git a/desktop/source/registration/com/sun/star/registration/Registration.java b/desktop/source/registration/com/sun/star/registration/Registration.java index 7fc24b80398f..e5c98dd51ab8 100644 --- a/desktop/source/registration/com/sun/star/registration/Registration.java +++ b/desktop/source/registration/com/sun/star/registration/Registration.java @@ -63,10 +63,6 @@ public class Registration { return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Registration.class.getName(), _serviceName, regKey); - } - static final String _serviceName = "com.sun.star.comp.framework.DoRegistrationJob"; static public class _Registration implements XJob { diff --git a/desktop/source/registration/com/sun/star/registration/makefile.mk b/desktop/source/registration/com/sun/star/registration/makefile.mk index 9784166eb91b..859802256256 100644 --- a/desktop/source/registration/com/sun/star/registration/makefile.mk +++ b/desktop/source/registration/com/sun/star/registration/makefile.mk @@ -53,3 +53,10 @@ CUSTOMMANIFESTFILE = manifest .INCLUDE : target.mk +ALLTAR : $(MISC)/productregistration.jar.component + +$(MISC)/productregistration.jar.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt productregistration.jar.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_JAVA)productregistration.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt productregistration.jar.component diff --git a/desktop/source/registration/com/sun/star/registration/productregistration.jar.component b/desktop/source/registration/com/sun/star/registration/productregistration.jar.component new file mode 100644 index 000000000000..c022a98ae010 --- /dev/null +++ b/desktop/source/registration/com/sun/star/registration/productregistration.jar.component @@ -0,0 +1,34 @@ +<?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.registration.Registration"> + <service name="com.sun.star.comp.framework.DoRegistrationJob"/> + </implementation> +</component> diff --git a/desktop/source/so_comp/makefile.mk b/desktop/source/so_comp/makefile.mk index 590f99518c68..7f9ceb4b646a 100644 --- a/desktop/source/so_comp/makefile.mk +++ b/desktop/source/so_comp/makefile.mk @@ -75,3 +75,10 @@ SHL1STDLIBS= \ .INCLUDE : target.mk +ALLTAR : $(MISC)/socomp.component + +$(MISC)/socomp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + socomp.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt socomp.component diff --git a/desktop/source/so_comp/services.cxx b/desktop/source/so_comp/services.cxx index d1a2b3139e91..e28d762fc69b 100644 --- a/desktop/source/so_comp/services.cxx +++ b/desktop/source/so_comp/services.cxx @@ -100,32 +100,6 @@ component_getImplementationEnvironment( *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo( - void* pServiceManager, - void* pRegistryKey) -{ - Reference<XMultiServiceFactory> xMan( - reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - Reference<XRegistryKey> xKey( - reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; - - // iterate over service names and register them... - OUString aImpl; - const char* pServiceName = NULL; - const char* pImplName = NULL; - for (int i = 0; (pServices[i]!=NULL)&&(pImplementations[i]!=NULL); i++) { - pServiceName= pServices[i]; - pImplName = pImplementations[i]; - aImpl = OUString::createFromAscii("/") - + OUString::createFromAscii(pImplName) - + OUString::createFromAscii("/UNO/SERVICES"); - Reference<XRegistryKey> xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(OUString::createFromAscii(pServiceName)); - } - return sal_True; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, diff --git a/desktop/source/so_comp/socomp.component b/desktop/source/so_comp/socomp.component new file mode 100644 index 000000000000..a53035223c39 --- /dev/null +++ b/desktop/source/so_comp/socomp.component @@ -0,0 +1,37 @@ +<?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.desktop.Evaluation"> + <service name="com.sun.star.office.Evaluation"/> + </implementation> + <implementation name="com.sun.star.comp.desktop.OEMPreloadJob"> + <service name="com.sun.star.office.OEMPreloadJob"/> + </implementation> +</component> diff --git a/desktop/source/splash/makefile.mk b/desktop/source/splash/makefile.mk index 89609687438c..02483aae83dd 100644 --- a/desktop/source/splash/makefile.mk +++ b/desktop/source/splash/makefile.mk @@ -87,3 +87,11 @@ DO_PHONY=.PHONY $(INCCOM)$/introbmpnames.hxx $(DO_PHONY): echo const char INTRO_BITMAP_STRINGLIST[]=$(EMQ)"$(INTRO_BITMAPS:f:t",")$(EMQ)"$(EMQ); > $@ echo LASTTIME_INTRO_BITMAPS=$(INTRO_BITMAPS:f) > $(MISC)$/intro_bmp_names.mk + +ALLTAR : $(MISC)/spl.component + +$(MISC)/spl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + spl.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt spl.component diff --git a/desktop/source/splash/services_spl.cxx b/desktop/source/splash/services_spl.cxx index 349ec2ec0a78..4b1130c71cdf 100755 --- a/desktop/source/splash/services_spl.cxx +++ b/desktop/source/splash/services_spl.cxx @@ -97,32 +97,6 @@ component_getImplementationEnvironment( *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo( - void* pServiceManager, - void* pRegistryKey) -{ - Reference<XMultiServiceFactory> xMan( - reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - Reference<XRegistryKey> xKey( - reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; - - // iterate over service names and register them... - OUString aImpl; - const char* pServiceName = NULL; - const char* pImplName = NULL; - for (int i = 0; (pServices[i]!=NULL)&&(pImplementations[i]!=NULL); i++) { - pServiceName= pServices[i]; - pImplName = pImplementations[i]; - aImpl = OUString::createFromAscii("/") - + OUString::createFromAscii(pImplName) - + OUString::createFromAscii("/UNO/SERVICES"); - Reference<XRegistryKey> xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(OUString::createFromAscii(pServiceName)); - } - return sal_True; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, diff --git a/desktop/source/splash/spl.component b/desktop/source/splash/spl.component new file mode 100644 index 000000000000..2caecf5c0e4b --- /dev/null +++ b/desktop/source/splash/spl.component @@ -0,0 +1,37 @@ +<?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.desktop.FirstStart"> + <service name="com.sun.star.task.Job"/> + </implementation> + <implementation name="com.sun.star.office.comp.SplashScreen"> + <service name="com.sun.star.office.SplashScreen"/> + </implementation> +</component> diff --git a/desktop/test/deployment/active/Addons.xcu b/desktop/test/deployment/active/Addons.xcu new file mode 100644 index 000000000000..cc75f2ab8f64 --- /dev/null +++ b/desktop/test/deployment/active/Addons.xcu @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="Addons"> + <node o:name="AddonUI"> + <node o:name="OfficeMenuBar"> + <node o:name="org.openoffice.test.desktop.deployment.active" + o:op="replace"> + <prop o:name="Title" xml:lang="en-US"> + <value>active</value> + </prop> + <node o:name="Submenu"> + <node o:name="1" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.active_native:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>native</value> + </prop> + </node> + <node o:name="2" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.active_java:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>java</value> + </prop> + </node> + <node o:name="3" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.active_python:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>python</value> + </prop> + </node> + </node> + </node> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/active/Dispatch.java b/desktop/test/deployment/active/Dispatch.java new file mode 100644 index 000000000000..25443f96e092 --- /dev/null +++ b/desktop/test/deployment/active/Dispatch.java @@ -0,0 +1,101 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.awt.MessageBoxButtons; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XStatusListener; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch +{ + public Dispatch(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return false; //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public void dispatch(URL URL, PropertyValue[] Arguments) { + try { + XMultiComponentFactory smgr = UnoRuntime.queryInterface( + XMultiComponentFactory.class, context.getServiceManager()); + XMessageBox box = UnoRuntime.queryInterface( + XMessageBoxFactory.class, + smgr.createInstanceWithContext( + "com.sun.star.awt.Toolkit", context)). + createMessageBox( + UnoRuntime.queryInterface( + XWindowPeer.class, + (UnoRuntime.queryInterface( + XDesktop.class, + smgr.createInstanceWithContext( + "com.sun.star.frame.Desktop", context)). + getCurrentFrame().getComponentWindow())), + new Rectangle(), "infobox", MessageBoxButtons.BUTTONS_OK, + "active", "java"); + box.execute(); + UnoRuntime.queryInterface(XComponent.class, box).dispose(); + } catch (com.sun.star.uno.RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException( + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.active_java_singleton"; + + static final String[] serviceNames = new String[0]; +} diff --git a/desktop/test/deployment/active/MANIFEST.MF b/desktop/test/deployment/active/MANIFEST.MF new file mode 100644 index 000000000000..63480874dd55 --- /dev/null +++ b/desktop/test/deployment/active/MANIFEST.MF @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.active_java.Services +UNO-Type-Path: diff --git a/desktop/test/deployment/active/ProtocolHandler.xcu b/desktop/test/deployment/active/ProtocolHandler.xcu new file mode 100644 index 000000000000..017bdea72bea --- /dev/null +++ b/desktop/test/deployment/active/ProtocolHandler.xcu @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="ProtocolHandler"> + <node o:name="HandlerSet"> + <node o:name="com.sun.star.test.deployment.active_native" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.active_native:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.active_java" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.active_java:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.active_python" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.active_python:*</value> + </prop> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/active/Provider.java b/desktop/test/deployment/active/Provider.java new file mode 100644 index 000000000000..df31979f4b9d --- /dev/null +++ b/desktop/test/deployment/active/Provider.java @@ -0,0 +1,81 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Provider extends WeakBase + implements XServiceInfo, XDispatchProvider +{ + public Provider(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return ServiceName.equals(getSupportedServiceNames()[0]); //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public XDispatch queryDispatch( + URL URL, String TargetFrameName, int SearchFlags) + { + return UnoRuntime.queryInterface( + XDispatch.class, + context.getValueByName( + "/singletons/" + + "com.sun.star.test.deployment.active_java_singleton")); + } + + public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { + XDispatch[] s = new XDispatch[Requests.length]; + for (int i = 0; i < s.length; ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; + } + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.active_java"; + + static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.active_java" }; +} diff --git a/desktop/test/deployment/active/Services.java b/desktop/test/deployment/active/Services.java new file mode 100644 index 000000000000..4ea19f4b7a71 --- /dev/null +++ b/desktop/test/deployment/active/Services.java @@ -0,0 +1,72 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.registry.InvalidRegistryException; +import com.sun.star.registry.XRegistryKey; + +public final class Services { + private Services() {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + if (implementation.equals(Dispatch.implementationName)) { + return Factory.createComponentFactory( + Dispatch.class, Dispatch.implementationName, + Dispatch.serviceNames); + } else if (implementation.equals(Provider.implementationName)) { + return Factory.createComponentFactory( + Provider.class, Provider.implementationName, + Provider.serviceNames); + } else { + return null; + } + } + + public static boolean __writeRegistryServiceInfo(XRegistryKey key) { + if (!(Factory.writeRegistryServiceInfo( + Dispatch.implementationName, Dispatch.serviceNames, key) && + Factory.writeRegistryServiceInfo( + Provider.implementationName, Provider.serviceNames, key))) + { + return false; + } + try { + key. + createKey( + "/" + Dispatch.implementationName + + "/UNO/SINGLETONS/" + + "com.sun.star.test.deployment.active_java_singleton"). + setStringValue(Dispatch.implementationName); + } catch (InvalidRegistryException e) { + return false; + } + return true; + } +} diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx new file mode 100644 index 000000000000..a34d8de88a61 --- /dev/null +++ b/desktop/test/deployment/active/active_native.cxx @@ -0,0 +1,320 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_desktop.hxx" +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/awt/MessageBoxButtons.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/XMessageBox.hpp" +#include "com/sun/star/awt/XMessageBoxFactory.hpp" +#include "com/sun/star/awt/XWindowPeer.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/frame/DispatchDescriptor.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatch.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/frame/XStatusListener.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/util/URL.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/diagnose.h" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +namespace { + +namespace css = com::sun::star; + +class Provider: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatchProvider >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Provider(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + +private: + Provider( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Provider() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Provider::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.active_native")); +} + +css::uno::Sequence< rtl::OUString > Provider::static_getSupportedServiceNames() +{ + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.test.deployment.active_native")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +css::uno::Reference< css::frame::XDispatch > Provider::queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::frame::XDispatch > dispatch; + if (!(context_->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.test.deployment." + "active_native_singleton"))) >>= + dispatch) || + !dispatch.is()) + { + throw css::uno::DeploymentException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "component context fails to supply singleton" + " com.sun.star.test.deployment.active_native_singleton of" + " type com.sun.star.frame.XDispatch")), + context_); + } + return dispatch; +} + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Provider::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s( + Requests.getLength()); + for (sal_Int32 i = 0; i < s.getLength(); ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; +} + +class Dispatch: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatch >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Dispatch(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames() + { return css::uno::Sequence< rtl::OUString >(); } + +private: + Dispatch( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Dispatch() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &) + throw (css::uno::RuntimeException) + { return false; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Dispatch::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.active_native_singleton")); +} + +void Dispatch::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( + context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( + css::uno::Reference< css::awt::XMessageBoxFactory >( + smgr->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.awt.Toolkit")), context_), + css::uno::UNO_QUERY_THROW)->createMessageBox( + css::uno::Reference< css::awt::XWindowPeer >( + css::uno::Reference< css::frame::XFrame >( + css::uno::Reference< css::frame::XDesktop >( + smgr->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop")), + context_), + css::uno::UNO_QUERY_THROW)->getCurrentFrame(), + css::uno::UNO_SET_THROW)->getComponentWindow(), + css::uno::UNO_QUERY_THROW), + css::awt::Rectangle(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("infobox")), + css::awt::MessageBoxButtons::BUTTONS_OK, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("active")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("native"))), + css::uno::UNO_SET_THROW); + box->execute(); + css::uno::Reference< css::lang::XComponent >( + box, css::uno::UNO_QUERY_THROW)->dispose(); +} + +static cppu::ImplementationEntry const services[] = { + { &Provider::static_create, &Provider::static_getImplementationName, + &Provider::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { &Dispatch::static_create, &Dispatch::static_getImplementationName, + &Dispatch::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +extern "C" sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey) +{ + if (!component_writeInfoHelper(pServiceManager, pRegistryKey, services)) { + return false; + } + try { + css::uno::Reference< css::registry::XRegistryKey >( + (css::uno::Reference< css::registry::XRegistryKey >( + static_cast< css::registry::XRegistryKey * >(pRegistryKey))-> + createKey( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + + Dispatch::static_getImplementationName() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/UNO/SINGLETONS/com.sun.star.test.deployment." + "active_native_singleton")))), + css::uno::UNO_SET_THROW)-> + setStringValue(Dispatch::static_getImplementationName()); + } catch (css::uno::Exception & e) { + (void) e; + OSL_TRACE( + "active_native component_writeInfo exception: %s", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + return false; + } + return true; +} diff --git a/desktop/test/deployment/active/active_python.py b/desktop/test/deployment/active/active_python.py new file mode 100644 index 000000000000..8ba0947b6bf8 --- /dev/null +++ b/desktop/test/deployment/active/active_python.py @@ -0,0 +1,120 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo +from com.sun.star.registry import InvalidRegistryException + +class Provider(unohelper.Base, XServiceInfo, XDispatchProvider): + implementationName = "com.sun.star.comp.test.deployment.active_python" + + serviceNames = ("com.sun.star.test.deployment.active_python",) + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self.context.getValueByName( \ + "/singletons/com.sun.star.test.deployment.active_python_singleton") + + def queryDispatches(self, Requests): + tuple( \ + self.queryDispatch(i.FeatureURL, i.FrameName, i.SearchFlags) \ + for i in Requests) + +class Dispatch(unohelper.Base, XServiceInfo, XDispatch): + implementationName = \ + "com.sun.star.comp.test.deployment.active_python_singleton" + + serviceNames = () + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def dispatch(self, URL, Arguments): + smgr = self.context.getServiceManager() + box = smgr.createInstanceWithContext( \ + "com.sun.star.awt.Toolkit", self.context).createMessageBox( \ + smgr.createInstanceWithContext( \ + "com.sun.star.frame.Desktop", self.context). \ + getCurrentFrame().getComponentWindow(), \ + Rectangle(), "infobox", BUTTONS_OK, "active", "python") + box.execute(); + box.dispose(); + + def addStatusListener(self, Control, URL): + pass + + def removeStatusListener(self, Control, URL): + pass + +def getComponentFactory(implementationName, smgr, regKey): + if implementationName == Provider.implementationName: + return unohelper.createSingleServiceFactory( \ + Provider, Provider.implementationName, Provider.serviceNames) + elif implementationName == Dispatch.implementationName: + return unohelper.createSingleServiceFactory( \ + Dispatch, Dispatch.implementationName, Dispatch.serviceNames) + else: + return None + +def writeRegistryInfo(smgr, regKey): + try: + for i in (Provider, Dispatch): + key = regKey.createKey("/" + i.implementationName + "/UNO") + for j in i.serviceNames: + key.createKey("/SERVICES/" + j); + regKey.createKey( \ + "/" + Dispatch.implementationName + "/UNO/SINGLETONS/" \ + "com.sun.star.test.deployment.active_python_singleton"). \ + setStringValue(Dispatch.implementationName) + except InvalidRegistryException: + return False + return True diff --git a/desktop/test/deployment/active/description.xml b/desktop/test/deployment/active/description.xml new file mode 100644 index 000000000000..fd7049e0cc3d --- /dev/null +++ b/desktop/test/deployment/active/description.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<d:description xmlns:d="http://openoffice.org/extensions/description/2006"> + <d:identifier + value="org.openoffice/framework/desktop/test/deployment/active"/> + <d:version value="1"/> + <d:dependencies> + <d:OpenOffice.org-minimal-version d:name="OpenOffice.org 3.4" value="3.4"/> + </d:dependencies> +</d:description> diff --git a/desktop/test/deployment/active/makefile.mk b/desktop/test/deployment/active/makefile.mk new file mode 100644 index 000000000000..5511a39c8baf --- /dev/null +++ b/desktop/test/deployment/active/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = ../../.. +PRJNAME = desktop +TARGET = test_deployment_active + +ENABLE_EXCEPTIONS = TRUE + +PACKAGE = com/sun/star/comp/test/deployment/active_java +JAVAFILES = Dispatch.java Provider.java Services.java +JARFILES = juh.jar ridl.jar unoil.jar + +.INCLUDE: settings.mk + +DLLPRE = + +SLOFILES = $(SHL1OBJS) + +SHL1TARGET = active_native.uno +SHL1OBJS = $(SLO)/active_native.obj +SHL1RPATH = OXT +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/reg-component.map +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk + +ALLTAR : $(MISC)/active.oxt + +$(MISC)/active.oxt : manifest.xml description.xml Addons.xcu \ + ProtocolHandler.xcu $(SHL1TARGETN) $(MISC)/$(TARGET)/active_java.jar \ + active_python.py + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/active.oxt-zip + $(MKDIR) $(MISC)/$(TARGET)/active.oxt-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/active.oxt-zip/META-INF + $(SED) -e 's|@PATH@|$(SHL1TARGETN:f)|g' \ + -e 's|@PLATFORM@|$(RTL_OS:l)_$(RTL_ARCH:l)|g' < manifest.xml \ + > $(MISC)/$(TARGET)/active.oxt-zip/META-INF/manifest.xml + $(COPY) description.xml Addons.xcu ProtocolHandler.xcu $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/active_java.jar active_python.py \ + $(MISC)/$(TARGET)/active.oxt-zip/ + cd $(MISC)/$(TARGET)/active.oxt-zip && zip ../../active.oxt \ + META-INF/manifest.xml description.xml Addons.xcu ProtocolHandler.xcu \ + $(SHL1TARGETN:f) active_java.jar active_python.py + +$(MISC)/$(TARGET)/active_java.jar : MANIFEST.MF $(JAVATARGET) + $(MKDIRHIER) $(@:d) + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/active_java.jar-zip + $(MKDIR) $(MISC)/$(TARGET)/active_java.jar-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/active_java.jar-zip/META-INF \ + $(MISC)/$(TARGET)/active_java.jar-zip/$(PACKAGE) + $(COPY) MANIFEST.MF $(MISC)/$(TARGET)/active_java.jar-zip/META-INF/ + $(COPY) $(foreach,i,$(JAVAFILES:b) $(CLASSDIR)/$(PACKAGE)/$i.class) \ + $(MISC)/$(TARGET)/active_java.jar-zip/$(PACKAGE)/ + cd $(MISC)/$(TARGET)/active_java.jar-zip && zip ../active_java.jar \ + META-INF/MANIFEST.MF $(foreach,i,$(JAVAFILES:b) $(PACKAGE)/$i.class) diff --git a/desktop/test/deployment/active/manifest.xml b/desktop/test/deployment/active/manifest.xml new file mode 100644 index 000000000000..4f076696663b --- /dev/null +++ b/desktop/test/deployment/active/manifest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<m:manifest xmlns:m="http://openoffice.org/2001/manifest"> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="Addons.xcu"/> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="ProtocolHandler.xcu"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=native;platform=@PLATFORM@" + m:full-path="@PATH@"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=Java" + m:full-path="active_java.jar"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=Python" + m:full-path="active_python.py"/> +</m:manifest> diff --git a/desktop/test/deployment/boxt/boxt.cxx b/desktop/test/deployment/boxt/boxt.cxx index dc82c0c004d6..245617a2ad12 100644 --- a/desktop/test/deployment/boxt/boxt.cxx +++ b/desktop/test/deployment/boxt/boxt.cxx @@ -35,8 +35,6 @@ #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/frame/XStatusListener.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" -#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" @@ -45,7 +43,6 @@ #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/URL.hpp" #include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase3.hxx" #include "cppuhelper/implementationentry.hxx" #include "cppuhelper/weak.hxx" @@ -61,21 +58,6 @@ namespace { namespace css = com::sun::star; -namespace service { - -rtl::OUString getImplementationName() { - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); -} - -css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { - rtl::OUString name( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); - return css::uno::Sequence< rtl::OUString >(&name, 1); -} - -} - class Service: public cppu::WeakImplHelper3< css::lang::XServiceInfo, css::frame::XDispatchProvider, @@ -83,14 +65,24 @@ class Service: private boost::noncopyable { public: - Service() {} + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const &) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Service); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); private: + Service() {} + virtual ~Service() {} virtual rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) - { return service::getImplementationName(); } + { return static_getImplementationName(); } virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) throw (css::uno::RuntimeException) @@ -98,7 +90,7 @@ private: virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) - { return service::getSupportedServiceNames(); } + { return static_getSupportedServiceNames(); } virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( css::util::URL const &, rtl::OUString const &, sal_Int32) @@ -128,6 +120,17 @@ private: {} }; +rtl::OUString Service::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); +} + +css::uno::Sequence< rtl::OUString > Service::static_getSupportedServiceNames() { + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > Service::queryDispatches( css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) @@ -155,61 +158,10 @@ void Service::dispatch( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test"))); } -class Factory: - public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, - private boost::noncopyable -{ -public: - Factory() {} - -private: - virtual ~Factory() {} - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const &) - throw (css::uno::Exception, css::uno::RuntimeException) - { return static_cast< cppu::OWeakObject * >(new Service); } - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const &, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) - { return createInstanceWithContext(Context); } -}; - -css::uno::Reference< css::uno::XInterface > SAL_CALL dummy( - css::uno::Reference< css::uno::XComponentContext > const &) - SAL_THROW((css::uno::Exception)) -{ - OSL_ASSERT(false); - return css::uno::Reference< css::uno::XInterface >(); -} - -rtl::OUString SAL_CALL getImplementationName() { - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); -} - -css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { - rtl::OUString name( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); - return css::uno::Sequence< rtl::OUString >(&name, 1); -} - -css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL -createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()) -{ - return new Factory; -} - static cppu::ImplementationEntry const services[] = { - { &dummy, &service::getImplementationName, - &service::getSupportedServiceNames, &createFactory, 0, 0 }, + { &Service::static_create, &Service::static_getImplementationName, + &Service::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, { 0, 0, 0, 0, 0, 0 } }; diff --git a/desktop/test/deployment/boxt/makefile.mk b/desktop/test/deployment/boxt/makefile.mk index 11d736448d44..88e72aef4ab8 100644 --- a/desktop/test/deployment/boxt/makefile.mk +++ b/desktop/test/deployment/boxt/makefile.mk @@ -46,7 +46,7 @@ SHL1OBJS = $(SLO)/boxt.obj SHL1RPATH = BOXT SHL1STDLIBS = \ $(CPPUHELPERLIB) $(CPPULIB) $(MSFILTERLIB) $(SALLIB) $(TOOLSLIB) $(VCLLIB) -SHL1VERSIONMAP = $(SOLARENV)/src/component.map +SHL1VERSIONMAP = $(SOLARENV)/src/reg-component.map DEF1NAME = $(SHL1TARGET) .INCLUDE: target.mk diff --git a/desktop/test/deployment/locationtest/makefile.mk b/desktop/test/deployment/locationtest/makefile.mk index 8fe189791961..24be56c28d7e 100644 --- a/desktop/test/deployment/locationtest/makefile.mk +++ b/desktop/test/deployment/locationtest/makefile.mk @@ -80,5 +80,8 @@ $(MISC)$/$(TARGET)_resort : manifest.xml $(JARTARGETN) $(MISC)$/$(ZIP1TARGET).cr $(COPY) description.xml $(MISC)$/$(TARGET)$/description.xml $(TOUCH) $@ +.IF "$(ZIP1TARGETN)"!="" $(ZIP1TARGETN) : $(MISC)$/$(TARGET)_resort $(MISC)$/$(ZIP1TARGET).createdir +.ENDIF # "$(ZIP1TARGETN)"!="" + diff --git a/desktop/test/deployment/passive/Addons.xcu b/desktop/test/deployment/passive/Addons.xcu new file mode 100644 index 000000000000..61578d7426e9 --- /dev/null +++ b/desktop/test/deployment/passive/Addons.xcu @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="Addons"> + <node o:name="AddonUI"> + <node o:name="OfficeMenuBar"> + <node o:name="org.openoffice.test.desktop.deployment.passive" + o:op="replace"> + <prop o:name="Title" xml:lang="en-US"> + <value>passive</value> + </prop> + <node o:name="Submenu"> + <node o:name="1" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_native:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>native</value> + </prop> + </node> + <node o:name="2" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_java:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>java</value> + </prop> + </node> + <node o:name="3" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_python:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>python</value> + </prop> + </node> + </node> + </node> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/passive/Dispatch.java b/desktop/test/deployment/passive/Dispatch.java new file mode 100644 index 000000000000..295f34d599da --- /dev/null +++ b/desktop/test/deployment/passive/Dispatch.java @@ -0,0 +1,101 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.awt.MessageBoxButtons; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XStatusListener; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch +{ + public Dispatch(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return false; //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public void dispatch(URL URL, PropertyValue[] Arguments) { + try { + XMultiComponentFactory smgr = UnoRuntime.queryInterface( + XMultiComponentFactory.class, context.getServiceManager()); + XMessageBox box = UnoRuntime.queryInterface( + XMessageBoxFactory.class, + smgr.createInstanceWithContext( + "com.sun.star.awt.Toolkit", context)). + createMessageBox( + UnoRuntime.queryInterface( + XWindowPeer.class, + (UnoRuntime.queryInterface( + XDesktop.class, + smgr.createInstanceWithContext( + "com.sun.star.frame.Desktop", context)). + getCurrentFrame().getComponentWindow())), + new Rectangle(), "infobox", MessageBoxButtons.BUTTONS_OK, + "passive", "java"); + box.execute(); + UnoRuntime.queryInterface(XComponent.class, box).dispose(); + } catch (com.sun.star.uno.RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException( + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java_singleton"; + + static final String[] serviceNames = new String[0]; +} diff --git a/desktop/test/deployment/passive/MANIFEST.MF b/desktop/test/deployment/passive/MANIFEST.MF new file mode 100644 index 000000000000..45a04bf263dc --- /dev/null +++ b/desktop/test/deployment/passive/MANIFEST.MF @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.passive_java.Services +UNO-Type-Path: diff --git a/desktop/test/deployment/passive/ProtocolHandler.xcu b/desktop/test/deployment/passive/ProtocolHandler.xcu new file mode 100644 index 000000000000..bc0355be41df --- /dev/null +++ b/desktop/test/deployment/passive/ProtocolHandler.xcu @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="ProtocolHandler"> + <node o:name="HandlerSet"> + <node o:name="com.sun.star.test.deployment.passive_native" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_native:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.passive_java" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_java:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.passive_python" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_python:*</value> + </prop> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/passive/Provider.java b/desktop/test/deployment/passive/Provider.java new file mode 100644 index 000000000000..6f74ed9eb89e --- /dev/null +++ b/desktop/test/deployment/passive/Provider.java @@ -0,0 +1,81 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Provider extends WeakBase + implements XServiceInfo, XDispatchProvider +{ + public Provider(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return ServiceName.equals(getSupportedServiceNames()[0]); //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public XDispatch queryDispatch( + URL URL, String TargetFrameName, int SearchFlags) + { + return UnoRuntime.queryInterface( + XDispatch.class, + context.getValueByName( + "/singletons/" + + "com.sun.star.test.deployment.passive_java_singleton")); + } + + public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { + XDispatch[] s = new XDispatch[Requests.length]; + for (int i = 0; i < s.length; ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; + } + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java"; + + static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.passive_java" }; +} diff --git a/desktop/test/deployment/passive/Services.java b/desktop/test/deployment/passive/Services.java new file mode 100644 index 000000000000..799df3e70222 --- /dev/null +++ b/desktop/test/deployment/passive/Services.java @@ -0,0 +1,49 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; + +public final class Services { + private Services() {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + if (implementation.equals(Dispatch.implementationName)) { + return Factory.createComponentFactory( + Dispatch.class, Dispatch.implementationName, + Dispatch.serviceNames); + } else if (implementation.equals(Provider.implementationName)) { + return Factory.createComponentFactory( + Provider.class, Provider.implementationName, + Provider.serviceNames); + } else { + return null; + } + } +} diff --git a/desktop/test/deployment/passive/description.xml b/desktop/test/deployment/passive/description.xml new file mode 100644 index 000000000000..468dfa065fb1 --- /dev/null +++ b/desktop/test/deployment/passive/description.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<d:description xmlns:d="http://openoffice.org/extensions/description/2006"> + <d:identifier + value="org.openoffice/framework/desktop/test/deployment/passive"/> + <d:version value="1"/> + <d:dependencies> + <d:OpenOffice.org-minimal-version d:name="OpenOffice.org 3.4" value="3.4"/> + </d:dependencies> +</d:description> diff --git a/desktop/test/deployment/passive/makefile.mk b/desktop/test/deployment/passive/makefile.mk new file mode 100644 index 000000000000..019e5dcab837 --- /dev/null +++ b/desktop/test/deployment/passive/makefile.mk @@ -0,0 +1,136 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = ../../.. +PRJNAME = desktop +TARGET = test_deployment_passive + +ENABLE_EXCEPTIONS = TRUE + +PACKAGE = com/sun/star/comp/test/deployment/passive_java +JAVAFILES = Dispatch.java Provider.java Services.java +JARFILES = juh.jar ridl.jar unoil.jar + +my_platform_components = passive_native +my_generic_components = passive_java passive_python + +.INCLUDE: settings.mk + +DLLPRE = + +SLOFILES = $(SHL1OBJS) + +SHL1TARGET = passive_native.uno +SHL1OBJS = $(SLO)/passive_native.obj +SHL1RPATH = OXT +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk + +ALLTAR : $(MISC)/passive.oxt + +$(MISC)/passive.oxt : manifest.xml description.xml Addons.xcu \ + ProtocolHandler.xcu $(MISC)/$(TARGET)/platform.components \ + $(MISC)/$(TARGET)/generic.components $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/passive_java.jar passive_python.py + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/passive.oxt-zip + $(MKDIR) $(MISC)/$(TARGET)/passive.oxt-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/passive.oxt-zip/META-INF + $(SED) -e 's|@PLATFORM@|$(RTL_OS:l)_$(RTL_ARCH:l)|g' < manifest.xml \ + > $(MISC)/$(TARGET)/passive.oxt-zip/META-INF/manifest.xml + $(COPY) description.xml Addons.xcu ProtocolHandler.xcu \ + $(MISC)/$(TARGET)/platform.components \ + $(MISC)/$(TARGET)/generic.components $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/passive_java.jar passive_python.py \ + $(MISC)/$(TARGET)/passive.oxt-zip/ + cd $(MISC)/$(TARGET)/passive.oxt-zip && zip ../../passive.oxt \ + META-INF/manifest.xml description.xml Addons.xcu ProtocolHandler.xcu \ + platform.components generic.components $(SHL1TARGETN:f) \ + passive_java.jar passive_python.py + +$(MISC)/$(TARGET)/platform.components : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/platform.components.input \ + $(my_platform_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/platform.components.input + +$(MISC)/$(TARGET)/platform.components.input : + $(MKDIRHIER) $(@:d) + echo '<list>' \ + '$(my_platform_components:^"<filename>":+".component</filename>")' \ + '</list>' > $@ + +$(MISC)/$(TARGET)/generic.components : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/generic.components.input \ + $(my_generic_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/generic.components.input + +$(MISC)/$(TARGET)/generic.components.input : + $(MKDIRHIER) $(@:d) + echo '<list>' \ + '$(my_generic_components:^"<filename>":+".component</filename>")' \ + '</list>' > $@ + +$(MISC)/$(TARGET)/passive_native.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_native.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_native.component + +$(MISC)/$(TARGET)/passive_java.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_java.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)passive_java.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_java.component + +$(MISC)/$(TARGET)/passive_python.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_python.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)passive_python.py' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_python.component + +$(MISC)/$(TARGET)/passive_java.jar : MANIFEST.MF $(JAVATARGET) + $(MKDIRHIER) $(@:d) + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/passive_java.jar-zip + $(MKDIR) $(MISC)/$(TARGET)/passive_java.jar-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/passive_java.jar-zip/META-INF \ + $(MISC)/$(TARGET)/passive_java.jar-zip/$(PACKAGE) + $(COPY) MANIFEST.MF $(MISC)/$(TARGET)/passive_java.jar-zip/META-INF/ + $(COPY) $(foreach,i,$(JAVAFILES:b) $(CLASSDIR)/$(PACKAGE)/$i.class) \ + $(MISC)/$(TARGET)/passive_java.jar-zip/$(PACKAGE)/ + cd $(MISC)/$(TARGET)/passive_java.jar-zip && zip ../passive_java.jar \ + META-INF/MANIFEST.MF $(foreach,i,$(JAVAFILES:b) $(PACKAGE)/$i.class) diff --git a/desktop/test/deployment/passive/manifest.xml b/desktop/test/deployment/passive/manifest.xml new file mode 100644 index 000000000000..5b8ac8419bb9 --- /dev/null +++ b/desktop/test/deployment/passive/manifest.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<m:manifest xmlns:m="http://openoffice.org/2001/manifest"> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="Addons.xcu"/> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="ProtocolHandler.xcu"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-components;platform=@PLATFORM@" + m:full-path="platform.components"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-components" + m:full-path="generic.components"/> +</m:manifest> diff --git a/desktop/test/deployment/passive/passive_java.component b/desktop/test/deployment/passive/passive_java.component new file mode 100644 index 000000000000..74be57177dfe --- /dev/null +++ b/desktop/test/deployment/passive/passive_java.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_java"> + <service name="com.sun.star.test.deployment.passive_java"/> + </implementation> + <implementation + name="com.sun.star.comp.test.deployment.passive_java_singleton"> + <singleton name="com.sun.star.test.deployment.passive_java_singleton"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_native.component b/desktop/test/deployment/passive/passive_native.component new file mode 100644 index 000000000000..c14fd7ff0062 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_native"> + <service name="com.sun.star.test.deployment.passive_native"/> + </implementation> + <implementation + name="com.sun.star.comp.test.deployment.passive_native_singleton"> + <singleton name="com.sun.star.test.deployment.passive_native_singleton"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx new file mode 100644 index 000000000000..39101257ad67 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.cxx @@ -0,0 +1,289 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_desktop.hxx" +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/awt/MessageBoxButtons.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/XMessageBox.hpp" +#include "com/sun/star/awt/XMessageBoxFactory.hpp" +#include "com/sun/star/awt/XWindowPeer.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/frame/DispatchDescriptor.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatch.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/frame/XStatusListener.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/util/URL.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/diagnose.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +namespace { + +namespace css = com::sun::star; + +class Provider: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatchProvider >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Provider(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + +private: + Provider( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Provider() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Provider::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.passive_native")); +} + +css::uno::Sequence< rtl::OUString > Provider::static_getSupportedServiceNames() +{ + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.test.deployment.passive_native")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +css::uno::Reference< css::frame::XDispatch > Provider::queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::frame::XDispatch > dispatch; + if (!(context_->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.test.deployment." + "passive_native_singleton"))) >>= + dispatch) || + !dispatch.is()) + { + throw css::uno::DeploymentException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "component context fails to supply singleton" + " com.sun.star.test.deployment.passive_native_singleton of" + " type com.sun.star.frame.XDispatch")), + context_); + } + return dispatch; +} + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Provider::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s( + Requests.getLength()); + for (sal_Int32 i = 0; i < s.getLength(); ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; +} + +class Dispatch: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatch >, + private boost::noncopyable +{ +public: + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) + { return static_cast< cppu::OWeakObject * >(new Dispatch(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames() + { return css::uno::Sequence< rtl::OUString >(); } + +private: + Dispatch( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + + virtual ~Dispatch() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const &) + throw (css::uno::RuntimeException) + { return false; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return static_getSupportedServiceNames(); } + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Dispatch::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.passive_native_singleton")); +} + +void Dispatch::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( + context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( + css::uno::Reference< css::awt::XMessageBoxFactory >( + smgr->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.awt.Toolkit")), context_), + css::uno::UNO_QUERY_THROW)->createMessageBox( + css::uno::Reference< css::awt::XWindowPeer >( + css::uno::Reference< css::frame::XFrame >( + css::uno::Reference< css::frame::XDesktop >( + smgr->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop")), + context_), + css::uno::UNO_QUERY_THROW)->getCurrentFrame(), + css::uno::UNO_SET_THROW)->getComponentWindow(), + css::uno::UNO_QUERY_THROW), + css::awt::Rectangle(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("infobox")), + css::awt::MessageBoxButtons::BUTTONS_OK, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("passive")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("native"))), + css::uno::UNO_SET_THROW); + box->execute(); + css::uno::Reference< css::lang::XComponent >( + box, css::uno::UNO_QUERY_THROW)->dispose(); +} + +static cppu::ImplementationEntry const services[] = { + { &Provider::static_create, &Provider::static_getImplementationName, + &Provider::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { &Dispatch::static_create, &Dispatch::static_getImplementationName, + &Dispatch::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} diff --git a/desktop/test/deployment/passive/passive_python.component b/desktop/test/deployment/passive/passive_python.component new file mode 100644 index 000000000000..ea7a1992b534 --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Python" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_python"> + <service name="com.sun.star.test.deployment.passive_python"/> + </implementation> + <implementation + name="com.sun.star.comp.test.deployment.passive_python_singleton"> + <singleton name="com.sun.star.test.deployment.passive_python_singleton"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_python.py b/desktop/test/deployment/passive/passive_python.py new file mode 100644 index 000000000000..dda68cccdb2f --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.py @@ -0,0 +1,101 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo + +class Provider(unohelper.Base, XServiceInfo, XDispatchProvider): + implementationName = "com.sun.star.comp.test.deployment.passive_python" + + serviceNames = ("com.sun.star.test.deployment.passive_python",) + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self.context.getValueByName( \ + "/singletons/com.sun.star.test.deployment.passive_python_singleton") + + def queryDispatches(self, Requests): + tuple( \ + self.queryDispatch(i.FeatureURL, i.FrameName, i.SearchFlags) \ + for i in Requests) + +class Dispatch(unohelper.Base, XServiceInfo, XDispatch): + implementationName = \ + "com.sun.star.comp.test.deployment.passive_python_singleton" + + serviceNames = () + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def dispatch(self, URL, Arguments): + smgr = self.context.getServiceManager() + box = smgr.createInstanceWithContext( \ + "com.sun.star.awt.Toolkit", self.context).createMessageBox( \ + smgr.createInstanceWithContext( \ + "com.sun.star.frame.Desktop", self.context). \ + getCurrentFrame().getComponentWindow(), \ + Rectangle(), "infobox", BUTTONS_OK, "passive", "python") + box.execute(); + box.dispose(); + + def addStatusListener(self, Control, URL): + pass + + def removeStatusListener(self, Control, URL): + pass + +g_ImplementationHelper = unohelper.ImplementationHelper() +g_ImplementationHelper.addImplementation( \ + Provider, Provider.implementationName, Provider.serviceNames) +g_ImplementationHelper.addImplementation( \ + Dispatch, Dispatch.implementationName, Dispatch.serviceNames) diff --git a/desktop/test/deployment/update/updateinfocreation/build/makefile.mk b/desktop/test/deployment/update/updateinfocreation/build/makefile.mk index 6af3928279e0..b0479c942b4f 100755 --- a/desktop/test/deployment/update/updateinfocreation/build/makefile.mk +++ b/desktop/test/deployment/update/updateinfocreation/build/makefile.mk @@ -84,5 +84,8 @@ $(MISC)$/$(TARGET)_resort : manifest.xml $(JARTARGETN) $(MISC)$/$(ZIP1TARGET).cr $(GNUCOPY) -u description.xml $(MISC)$/$(TARGET)$/description.xml $(TOUCH) $@ +.IF "$(ZIP1TARGETN)"!="" $(ZIP1TARGETN) : $(MISC)$/$(TARGET)_resort $(MISC)$/$(ZIP1TARGET).createdir +.ENDIF # "$(ZIP1TARGETN)"!="" + diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index 8bc39767f04a..17af6818551e 100644..100755 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -25,21 +25,7 @@ * *************************************************************************/ -#define VERSION 3 -#define SUBVERSION 3 -//#define VERVARIANT 0 -// .0 + VER_CONCEPT -// .100 + VER_ALPHA -// .200 + VER_BETA -// .300 + VER_GAMMA -// .500 + VER_FINAL -//#define VER_CONCEPT 0 -//#define VER_BETA 6 -#define VER_FINAL 0 - -#define VER_DAY 1 -#define VER_MONTH 1 -#define VER_YEAR 2010 +#include "version.hrc" // ----------------------------------------------------------------------- |