summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-18 12:40:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-18 15:08:56 +0200
commitcccc6bcfa095121c91e8bbc396f5bcf7e95424b9 (patch)
treef94a97a9698e3376405a36decc7612a2c523c9fd /vcl
parenta0659cc41d7764dd104bce82f8c5b3f0b8073173 (diff)
Don't access broken service mgr during bootstrap failure
...so that displaying a (non-translated) error box upon BE_UNO_SERVICEMANAGER works after all. Augment the error text with an exception message where appropriate. This allows to revert fdfb7a3c4b3a89b73ab5546b9620348bc4984d8f "Related fdo#51252: Report uncaught exceptions with MessageBox on Windows" as that was to catch and display failures from instantiating the service mgr. Change-Id: I049a38e95342634796eb0e940e2ee8e55193c9d3
Diffstat (limited to 'vcl')
-rw-r--r--vcl/aqua/source/app/salsys.cxx19
-rw-r--r--vcl/generic/app/gensys.cxx60
-rw-r--r--vcl/inc/aqua/salsys.h2
-rw-r--r--vcl/inc/generic/gensys.h2
-rw-r--r--vcl/inc/ios/salsys.h2
-rw-r--r--vcl/inc/salsys.hxx7
-rw-r--r--vcl/inc/win/salsys.h2
-rw-r--r--vcl/ios/source/app/salsys.cxx19
-rw-r--r--vcl/source/app/svapp.cxx2
-rw-r--r--vcl/source/app/svdata.cxx12
-rw-r--r--vcl/win/source/app/salinfo.cxx2
11 files changed, 95 insertions, 34 deletions
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 &&