diff options
-rw-r--r-- | desktop/inc/app.hxx | 19 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 139 | ||||
-rw-r--r-- | desktop/source/app/desktop.hrc | 1 | ||||
-rw-r--r-- | desktop/source/app/desktop.src | 5 | ||||
-rwxr-xr-x | desktop/source/app/sofficemain.cxx | 21 | ||||
-rw-r--r-- | vcl/aqua/source/app/salsys.cxx | 19 | ||||
-rw-r--r-- | vcl/generic/app/gensys.cxx | 60 | ||||
-rw-r--r-- | vcl/inc/aqua/salsys.h | 2 | ||||
-rw-r--r-- | vcl/inc/generic/gensys.h | 2 | ||||
-rw-r--r-- | vcl/inc/ios/salsys.h | 2 | ||||
-rw-r--r-- | vcl/inc/salsys.hxx | 7 | ||||
-rw-r--r-- | vcl/inc/win/salsys.h | 2 | ||||
-rw-r--r-- | vcl/ios/source/app/salsys.cxx | 19 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/svdata.cxx | 12 | ||||
-rw-r--r-- | vcl/win/source/app/salinfo.cxx | 2 |
16 files changed, 172 insertions, 142 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 8fd717ec6f18..b1577b2afbe1 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -103,15 +103,16 @@ class Desktop : public Application static ResMgr* GetDesktopResManager(); static CommandLineArgs& GetCommandLineArgs(); - void HandleBootstrapErrors( BootstrapError ); - void SetBootstrapError( BootstrapError nError ) + void HandleBootstrapErrors( + BootstrapError nError, OUString const & aMessage ); + void SetBootstrapError( + BootstrapError nError, OUString const & aMessage ) { if ( m_aBootstrapError == BE_OK ) + { m_aBootstrapError = nError; - } - BootstrapError GetBootstrapError() const - { - return m_aBootstrapError; + m_aBootstrapErrorMessage = aMessage; + } } void SetBootstrapStatus( BootstrapStatus nStatus ) @@ -135,8 +136,6 @@ class Desktop : public Application void SetSplashScreenText( const ::rtl::OUString& rText ); void SetSplashScreenProgress( sal_Int32 ); - static void ensureProcessServiceFactory(); - private: // Bootstrap methods static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager(); @@ -159,9 +158,6 @@ class Desktop : public Application void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg ); void StartSetup( const ::rtl::OUString& aParameters ); - // Get a resource message string securely e.g. if resource cannot be retrieved return aFaultBackMsg - ::rtl::OUString GetMsgString( sal_uInt16 nId, const ::rtl::OUString& aFaultBackMsg ); - // Create a error message depending on bootstrap failure code and an optional file url ::rtl::OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode, const ::rtl::OUString& aFileURL ); @@ -200,6 +196,7 @@ class Desktop : public Application bool m_bCleanedExtensionCache; bool m_bServicesRegistered; BootstrapError m_aBootstrapError; + OUString m_aBootstrapErrorMessage; BootstrapStatus m_aBootstrapStatus; std::auto_ptr< Lockfile > m_pLockfile; diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 1781d66b1e1a..fad99085058a 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -378,28 +378,34 @@ ResMgr* Desktop::GetDesktopResManager() return Desktop::pResMgr; } +namespace { + // ---------------------------------------------------------------------------- // Get a message string securely. There is a fallback string if the resource // is not available. -OUString Desktop::GetMsgString( sal_uInt16 nId, const OUString& aFaultBackMsg ) +OUString GetMsgString( + sal_uInt16 nId, const OUString& aFaultBackMsg, + bool bAlwaysUseFaultBackMsg = false ) { - ResMgr* resMgr = GetDesktopResManager(); - if ( !resMgr ) - return aFaultBackMsg; - else - return OUString( String( ResId( nId, *resMgr ))); + if ( !bAlwaysUseFaultBackMsg ) + { + ResMgr* resMgr = Desktop::GetDesktopResManager(); + if ( resMgr ) + return OUString( String( ResId( nId, *resMgr ))); + } + return aFaultBackMsg; } -OUString MakeStartupErrorMessage(OUString const & aErrorMessage) +OUString MakeStartupErrorMessage( + OUString const & aErrorMessage, bool bAlwaysUseFaultBackMsg = false ) { OUStringBuffer aDiagnosticMessage( 100 ); - ResMgr* pResMgr = Desktop::GetDesktopResManager(); - if ( pResMgr ) - aDiagnosticMessage.append( OUString(String(ResId(STR_BOOTSTRAP_ERR_CANNOT_START, *pResMgr))) ); - else - aDiagnosticMessage.appendAscii( "The program cannot be started." ); + aDiagnosticMessage.append( + GetMsgString( + STR_BOOTSTRAP_ERR_CANNOT_START, "The program cannot be started.", + bAlwaysUseFaultBackMsg ) ); aDiagnosticMessage.appendAscii( "\n" ); @@ -468,9 +474,8 @@ static bool ShouldSuppressUI(const CommandLineArgs& rCmdLine) rCmdLine.IsQuickstart(); } -namespace -{ - struct theCommandLineArgs : public rtl::Static< CommandLineArgs, theCommandLineArgs > {}; +struct theCommandLineArgs : public rtl::Static< CommandLineArgs, theCommandLineArgs > {}; + } CommandLineArgs& Desktop::GetCommandLineArgs() @@ -591,29 +596,30 @@ void Desktop::Init() // We need to have service factory before going further, but see fdo#37195. // Doing this will mmap common.rdb, making it not overwritable on windows, // so this can't happen before the synchronization above. Lets rework this - // so that the above is called *from* ensureProcessServiceFactory or + // so that the above is called *from* CreateApplicationServiceManager or // something to enforce this gotcha - ensureProcessServiceFactory(); - - if( !::comphelper::getProcessServiceFactory().is()) + try + { + comphelper::setProcessServiceFactory(CreateApplicationServiceManager()); + } + catch (css::uno::Exception & e) { - OSL_FAIL("Service factory should have been crated in soffice_main()."); - SetBootstrapError( BE_UNO_SERVICEMANAGER ); + SetBootstrapError( BE_UNO_SERVICEMANAGER, e.Message ); } - if ( GetBootstrapError() == BE_OK ) + if ( m_aBootstrapError == BE_OK ) { // prepare language if ( !LanguageSelection::prepareLanguage() ) { if ( LanguageSelection::getStatus() == LanguageSelection::LS_STATUS_CANNOT_DETERMINE_LANGUAGE ) - SetBootstrapError( BE_LANGUAGE_MISSING ); + SetBootstrapError( BE_LANGUAGE_MISSING, OUString() ); else - SetBootstrapError( BE_OFFICECONFIG_BROKEN ); + SetBootstrapError( BE_OFFICECONFIG_BROKEN, OUString() ); } } - if ( GetBootstrapError() == BE_OK ) + if ( m_aBootstrapError == BE_OK ) { const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs(); // start ipc thread only for non-remote offices @@ -621,7 +627,7 @@ void Desktop::Init() OfficeIPCThread::Status aStatus = OfficeIPCThread::EnableOfficeIPCThread(); if ( aStatus == OfficeIPCThread::IPC_STATUS_BOOTSTRAP_ERROR ) { - SetBootstrapError( BE_PATHINFO_MISSING ); + SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); } else if ( aStatus == OfficeIPCThread::IPC_STATUS_2ND_OFFICE ) { @@ -644,29 +650,6 @@ void Desktop::InitFinished() CloseSplashScreen(); } -// GetCommandLineArgs() requires this code to work, otherwise it will abort, and -// on Unix command line args needs to be checked before Desktop::Init() -void Desktop::ensureProcessServiceFactory() -{ - if (!comphelper::getProcessServiceFactory().is()) - { - try - { - comphelper::setProcessServiceFactory( - CreateApplicationServiceManager()); - } - catch (const css::uno::Exception& e) - { - // Application::ShowNativeErrorBox would only work after InitVCL, so - // all we can realistically do here is hope the user can see stderr: - std::cerr << "UNO Exception: " << e.Message << std::endl; - // Let exceptions escape and tear down the process, it is completely - // broken anyway: - throw; - } - } -} - void Desktop::DeInit() { RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::DeInit" ); @@ -881,7 +864,8 @@ void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStat return MakeStartupErrorMessage( aMsg ); } -void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError ) +void Desktop::HandleBootstrapErrors( + BootstrapError aBootstrapError, OUString const & aErrorMessage ) { if ( aBootstrapError == BE_PATHINFO_MISSING ) { @@ -962,16 +946,18 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError ) // PropertyValue is available). To give the user a hint even if // generating and displaying a message box below crashes, print a // hard-coded message on stderr first: - fputs( - aBootstrapError == BE_UNO_SERVICEMANAGER - ? ("The application cannot be started. " "\n" - "The component manager is not available." "\n") - // STR_BOOTSTRAP_ERR_CANNOT_START, STR_BOOTSTRAP_ERR_NO_SERVICE - : ("The application cannot be started. " "\n" - "The configuration service is not available." "\n"), - // STR_BOOTSTRAP_ERR_CANNOT_START, - // STR_BOOTSTRAP_ERR_NO_CFG_SERVICE - stderr); + std::cerr + << "The application cannot be started.\n" + // STR_BOOTSTRAP_ERR_CANNOT_START + << (aBootstrapError == BE_UNO_SERVICEMANAGER + ? "The component manager is not available.\n" + // STR_BOOTSTRAP_ERR_NO_SERVICE + : "The configuration service is not available.\n"); + // STR_BOOTSTRAP_ERR_NO_CFG_SERVICE + if ( !aErrorMessage.isEmpty() ) + { + std::cerr << "(\"" << aErrorMessage << "\")\n"; + } // First sentence. We cannot bootstrap office further! OUString aMessage; @@ -980,24 +966,32 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError ) OUString aErrorMsg; if ( aBootstrapError == BE_UNO_SERVICEMANAGER ) - aErrorMsg = GetMsgString( STR_BOOTSTRAP_ERR_NO_SERVICE, - OUString( "The service manager is not available." ) ); + aErrorMsg = "The service manager is not available."; else aErrorMsg = GetMsgString( STR_BOOTSTRAP_ERR_NO_CFG_SERVICE, OUString( "The configuration service is not available." ) ); aDiagnosticMessage.append( aErrorMsg ); aDiagnosticMessage.appendAscii( "\n" ); + if ( !aErrorMessage.isEmpty() ) + { + aDiagnosticMessage.appendAscii( "(\"" ); + aDiagnosticMessage.append( aErrorMessage ); + aDiagnosticMessage.appendAscii( "\")\n" ); + } // Due to the fact the we haven't a backup applicat.rdb file anymore it is not possible to // repair the installation with the setup executable besides the office executable. Now // we have to ask the user to start the setup on CD/installation directory manually!! OUString aStartSetupManually( GetMsgString( STR_ASK_START_SETUP_MANUALLY, - OUString( "Start setup application to repair the installation from CD, or the folder containing the installation packages." ) )); + OUString( "Start setup application to repair the installation from CD, or the folder containing the installation packages." ), + aBootstrapError == BE_UNO_SERVICEMANAGER ) ); aDiagnosticMessage.append( aStartSetupManually ); - aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() ); + aMessage = MakeStartupErrorMessage( + aDiagnosticMessage.makeStringAndClear(), + aBootstrapError == BE_UNO_SERVICEMANAGER ); FatalError( aMessage); } @@ -1378,10 +1372,9 @@ int Desktop::Main() com::sun::star::uno::ContextLayer layer( com::sun::star::uno::getCurrentContext() ); - BootstrapError eError = GetBootstrapError(); - if ( eError != BE_OK ) + if ( m_aBootstrapError != BE_OK ) { - HandleBootstrapErrors( eError ); + HandleBootstrapErrors( m_aBootstrapError, m_aBootstrapErrorMessage ); return EXIT_FAILURE; } @@ -1415,11 +1408,12 @@ int Desktop::Main() { OSL_FAIL("userinstall failed"); if ( inst_fin == UserInstall::E_NoDiskSpace ) - HandleBootstrapErrors( BE_USERINSTALL_NOTENOUGHDISKSPACE ); + HandleBootstrapErrors( + BE_USERINSTALL_NOTENOUGHDISKSPACE, OUString() ); else if ( inst_fin == UserInstall::E_NoWriteAccess ) - HandleBootstrapErrors( BE_USERINSTALL_NOWRITEACCESS ); + HandleBootstrapErrors( BE_USERINSTALL_NOWRITEACCESS, OUString() ); else - HandleBootstrapErrors( BE_USERINSTALL_FAILED ); + HandleBootstrapErrors( BE_USERINSTALL_FAILED, OUString() ); return EXIT_FAILURE; } // refresh path information @@ -1797,9 +1791,10 @@ bool Desktop::InitializeConfiguration() comphelper::getProcessComponentContext() ); return true; } - catch( const ::com::sun::star::lang::ServiceNotRegisteredException& ) + catch( ::com::sun::star::lang::ServiceNotRegisteredException & e ) { - this->HandleBootstrapErrors( Desktop::BE_UNO_SERVICE_CONFIG_MISSING ); + this->HandleBootstrapErrors( + Desktop::BE_UNO_SERVICE_CONFIG_MISSING, e.Message ); } catch( const ::com::sun::star::configuration::MissingBootstrapFileException& e ) { diff --git a/desktop/source/app/desktop.hrc b/desktop/source/app/desktop.hrc index 3b01f2444db1..5551db8c2c80 100644 --- a/desktop/source/app/desktop.hrc +++ b/desktop/source/app/desktop.hrc @@ -51,7 +51,6 @@ #define STR_BOOTSTRAP_ERR_NO_SUPPORT (RID_DESKTOP_STRING_START+107) #define STR_BOOTSTRAP_ERR_LANGUAGE_MISSING (RID_DESKTOP_STRING_START+108) -#define STR_BOOTSTRAP_ERR_NO_SERVICE (RID_DESKTOP_STRING_START+120) #define STR_BOOTSTRAP_ERR_NO_CFG_SERVICE (RID_DESKTOP_STRING_START+121) #define STR_BOOTSTRAP_ERR_CFG_DATAACCESS (RID_DESKTOP_STRING_START+122) #define STR_BOOTSTRAP_ERR_NO_PATHSET_SERVICE (RID_DESKTOP_STRING_START+123) diff --git a/desktop/source/app/desktop.src b/desktop/source/app/desktop.src index 67651bc96f84..4e4270fcff4c 100644 --- a/desktop/source/app/desktop.src +++ b/desktop/source/app/desktop.src @@ -88,11 +88,6 @@ String STR_BOOTSTRAP_ERR_LANGUAGE_MISSING Text [ en-US ] = "The user interface language cannot be determined."; }; -String STR_BOOTSTRAP_ERR_NO_SERVICE -{ - Text [ en-US ] = "The component manager is not available."; -}; - String STR_BOOTSTRAP_ERR_NO_CFG_SERVICE { Text [ en-US ] = "The configuration service is not available."; diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index a0fba044922e..e867601df0ee 100755 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -38,21 +38,14 @@ #include <rtl/bootstrap.hxx> #include <tools/extendapplicationenvironment.hxx> -#if defined WNT -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#endif - int SVMain(); // -=-= main() -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= extern "C" int DESKTOP_DLLPUBLIC soffice_main() { -#if defined ANDROID || defined WNT +#if defined ANDROID try { -#endif -#if defined(ANDROID) rtl::Bootstrap::setIniFilename( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///assets/program/lofficerc"))); #endif @@ -83,20 +76,10 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() } #endif return SVMain(); -#if defined ANDROID || defined WNT - } catch (const ::com::sun::star::uno::Exception &e) { #if defined ANDROID + } catch (const ::com::sun::star::uno::Exception &e) { fprintf (stderr, "Not handled UNO exception at main: '%s'\n", rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); -#elif defined WNT - MessageBoxW( - 0, - reinterpret_cast< LPCWSTR >( - rtl::OUString("Unhandled exception:\n" + e.Message).getStr()), - reinterpret_cast< LPCWSTR >(rtl::OUString("Fatal Error").getStr()), - (MB_OK | MB_ICONERROR | MB_DEFBUTTON1 | MB_TASKMODAL - | MB_SETFOREGROUND | MB_TOPMOST)); -#endif throw; // to get exception type printed } #endif diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx index 7c6f683751c8..6c65178cae92 100644 --- a/vcl/aqua/source/app/salsys.cxx +++ b/vcl/aqua/source/app/salsys.cxx @@ -106,9 +106,13 @@ rtl::OUString AquaSalSystem::GetDisplayScreenName( unsigned int nScreen ) return aRet; } -static NSString* getStandardString( int nButtonId ) +static NSString* getStandardString( int nButtonId, bool bUseResources ) { - rtl::OUString aText( Button::GetStandardText( nButtonId ) ); + rtl::OUString aText; + if( bUseResources ) + { + aText = Button::GetStandardText( nButtonId ); + } if( aText.isEmpty() ) // this is for bad cases, we might be missing the vcl resource { switch( nButtonId ) @@ -127,7 +131,7 @@ static NSString* getStandardString( int nButtonId ) int AquaSalSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton) + int nDefaultButton, bool bUseResources) { NSString* pTitle = CreateNSString( rTitle ); NSString* pMessage = CreateNSString( rMessage ); @@ -166,11 +170,14 @@ int AquaSalSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, if( aButtonIds[nC].nDefaultButton == nDefaultButton ) { if( aButtonIds[nC].nTextIds[0] != -1 ) - pDefText = getStandardString( aButtonIds[nC].nTextIds[0] ); + pDefText = getStandardString( + aButtonIds[nC].nTextIds[0], bUseResources ); if( aButtonIds[nC].nTextIds[1] != -1 ) - pAltText = getStandardString( aButtonIds[nC].nTextIds[1] ); + pAltText = getStandardString( + aButtonIds[nC].nTextIds[1], bUseResources ); if( aButtonIds[nC].nTextIds[2] != -1 ) - pOthText = getStandardString( aButtonIds[nC].nTextIds[2] ); + pOthText = getStandardString( + aButtonIds[nC].nTextIds[2], bUseResources ); break; } } diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx index ded4900e8809..4a26a4b19968 100644 --- a/vcl/generic/app/gensys.cxx +++ b/vcl/generic/app/gensys.cxx @@ -47,6 +47,47 @@ using namespace com::sun::star; +namespace { + +OUString GetNativeMessageBoxButtonText( int nButtonId, bool bUseResources ) +{ + OUString aText; + if( bUseResources ) + { + aText = Button::GetStandardText( nButtonId ); + } + if( aText.isEmpty() ) + { + switch( nButtonId ) + { + case BUTTON_OK: + aText = "OK"; + break; + case BUTTON_CANCEL: + aText = "Cancel"; + break; + case BUTTON_ABORT: + aText = "Abort"; + break; + case BUTTON_RETRY: + aText = "Retry"; + break; + case BUTTON_IGNORE: + aText = "Ignore"; + break; + case BUTTON_YES: + aText = "Yes"; + break; + case BUTTON_NO: + aText = "No"; + break; + } + } + return aText; +} + +} + SalGenericSystem::SalGenericSystem() { } @@ -56,7 +97,8 @@ SalGenericSystem::~SalGenericSystem() } int SalGenericSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, - int nButtonCombination, int nDefaultButton ) + int nButtonCombination, int nDefaultButton, + bool bUseResources ) { int nDefButton = 0; std::list< rtl::OUString > aButtons; @@ -67,15 +109,15 @@ int SalGenericSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const r if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK || nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL ) { - aButtons.push_back( Button::GetStandardText( BUTTON_OK ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_OK, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; } if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL || nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO ) { - aButtons.push_back( Button::GetStandardText( BUTTON_YES ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_YES, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; - aButtons.push_back( Button::GetStandardText( BUTTON_NO ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_NO, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO ) nDefButton = 1; @@ -86,21 +128,21 @@ int SalGenericSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const r { if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL ) { - aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; } - aButtons.push_back( Button::GetStandardText( BUTTON_CANCEL ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_CANCEL, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL ) nDefButton = aButtons.size()-1; } if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE ) { - aButtons.push_back( Button::GetStandardText( BUTTON_ABORT ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_ABORT, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; - aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; - aButtons.push_back( Button::GetStandardText( BUTTON_IGNORE ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_IGNORE, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; switch( nDefaultButton ) { diff --git a/vcl/inc/aqua/salsys.h b/vcl/inc/aqua/salsys.h index 6491cab50048..d352ebb87ddb 100644 --- a/vcl/inc/aqua/salsys.h +++ b/vcl/inc/aqua/salsys.h @@ -52,7 +52,7 @@ public: virtual int ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton); + int nDefaultButton, bool bUseResources); }; diff --git a/vcl/inc/generic/gensys.h b/vcl/inc/generic/gensys.h index abe7fee3648a..eb80beaef650 100644 --- a/vcl/inc/generic/gensys.h +++ b/vcl/inc/generic/gensys.h @@ -50,7 +50,7 @@ class VCL_DLLPUBLIC SalGenericSystem : public SalSystem virtual int ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton); + int nDefaultButton, bool bUseResources); // simple helpers primarily for X Windowing W_CLASS hints static const char *getFrameResName(); diff --git a/vcl/inc/ios/salsys.h b/vcl/inc/ios/salsys.h index 2184d2b23c30..17c831cf88a2 100644 --- a/vcl/inc/ios/salsys.h +++ b/vcl/inc/ios/salsys.h @@ -46,7 +46,7 @@ public: virtual int ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton); + int nDefaultButton, bool bUseResources); }; #endif // _SV_SALSYS_H diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx index 6c9eb37ae011..60b89ad917f6 100644 --- a/vcl/inc/salsys.hxx +++ b/vcl/inc/salsys.hxx @@ -133,6 +133,10 @@ public: The effect of specifying a button that doesn't belong to the specified button combination is undefined. + @param bUseResources + If false, assume initialization of the application failed early and do + not try to access any resources. + @returns the identifier of the button that was pressed by the user. See button identifier above. If the function fails the return value is 0. @@ -140,7 +144,8 @@ public: virtual int ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton) = 0; + int nDefaultButton, + bool bUseResources ) = 0; }; SalSystem* ImplGetSalSystem(); diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index b15c1a773600..c70b03219730 100644 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h @@ -76,7 +76,7 @@ public: virtual int ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton); + int nDefaultButton, bool bUseResources); bool initMonitors(); // discards monitorinfo; used by WM_DISPLAYCHANGED handler void clearMonitors(); diff --git a/vcl/ios/source/app/salsys.cxx b/vcl/ios/source/app/salsys.cxx index 02cd6442525a..8501e3f6ba8d 100644 --- a/vcl/ios/source/app/salsys.cxx +++ b/vcl/ios/source/app/salsys.cxx @@ -106,9 +106,13 @@ rtl::OUString IosSalSystem::GetDisplayScreenName( unsigned int nScreen ) return aRet; } -static NSString* getStandardString( int nButtonId ) +static NSString* getStandardString( int nButtonId, bool bUseResources ) { - rtl::OUString aText( Button::GetStandardText( nButtonId ) ); + rtl::OUString aText; + if( bUseResources ) + { + aText = Button::GetStandardText( nButtonId ); + } if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource { switch( nButtonId ) @@ -150,7 +154,7 @@ static NSString* getStandardString( int nButtonId ) int IosSalSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, - int nDefaultButton) + int nDefaultButton, bool bUseResources) { NSString* pTitle = CreateNSString( rTitle ); NSString* pMessage = CreateNSString( rMessage ); @@ -189,11 +193,14 @@ int IosSalSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, if( aButtonIds[nC].nDefaultButton == nDefaultButton ) { if( aButtonIds[nC].nTextIds[0] != -1 ) - pDefText = getStandardString( aButtonIds[nC].nTextIds[0] ); + pDefText = getStandardString( + aButtonIds[nC].nTextIds[0], bUseResources ); if( aButtonIds[nC].nTextIds[1] != -1 ) - pAltText = getStandardString( aButtonIds[nC].nTextIds[1] ); + pAltText = getStandardString( + aButtonIds[nC].nTextIds[1], bUseResources ); if( aButtonIds[nC].nTextIds[2] != -1 ) - pOthText = getStandardString( aButtonIds[nC].nTextIds[2] ); + pOthText = getStandardString( + aButtonIds[nC].nTextIds[2], bUseResources ); break; } } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index c78bb97606dc..97c987a80641 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1716,7 +1716,7 @@ void Application::ShowNativeErrorBox(const String& sTitle , sTitle, sMessage, SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, false); if (btn != SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK) { OSL_TRACE("ShowNativeMessageBox returned %d", btn); } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 01a16c8248e3..909626fcd2db 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -407,7 +407,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) aTitle, ReplaceJavaErrorMessages(aMessage.makeStringAndClear()), SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, true); // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) @@ -430,7 +430,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) aTitle, ReplaceJavaErrorMessages(aMessage.makeStringAndClear()), SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, true); // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) @@ -453,7 +453,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) aTitle, ReplaceJavaErrorMessages(aMessage.makeStringAndClear()), SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, true); // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) @@ -476,7 +476,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) aTitle, ReplaceJavaErrorMessages(aMessage.makeStringAndClear()), SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, true); // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) @@ -515,7 +515,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) aTitle, ReplaceJavaErrorMessages(aMessage.makeStringAndClear()), SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, true); // Do not change the setting in case the user chooses to cancel if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret ) @@ -529,7 +529,7 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled) aTitle, ReplaceJavaErrorMessages(aMessage.makeStringAndClear()), SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, - SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK); + SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, true); } } } diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index b5576c97ebb1..0a0dcacc79d6 100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx @@ -220,7 +220,7 @@ static int DEFAULT_BTN_MAPPING_TABLE[][8] = { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 } //RETRY_CANCEL }; -int WinSalSystem::ShowNativeMessageBox(const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, int nDefaultButton) +int WinSalSystem::ShowNativeMessageBox(const rtl::OUString& rTitle, const rtl::OUString& rMessage, int nButtonCombination, int nDefaultButton, SAL_UNUSED_PARAMETER bool) { DBG_ASSERT( nButtonCombination >= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK && nButtonCombination <= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL && |