Kaydet (Commit) 4ff62bf4 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

add warning message if you close unsaved referenced document

üst 7a3ef271
...@@ -600,8 +600,9 @@ ...@@ -600,8 +600,9 @@
#define STR_ERR_NAME_INVALID 464 #define STR_ERR_NAME_INVALID 464
#define STR_UNSAVED_EXT_REF 465 #define STR_UNSAVED_EXT_REF 465
#define STR_CLOSE_WITH_UNSAVED_REFS 466
#define STR_COUNT 466 #define STR_COUNT 467
#endif #endif
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "viewdata.hxx" #include "viewdata.hxx"
#include "tabvwsh.hxx" #include "tabvwsh.hxx"
#include "sc.hrc" #include "sc.hrc"
#include "globstr.hrc"
#include "sfx2/app.hxx" #include "sfx2/app.hxx"
#include "sfx2/docfilt.hxx" #include "sfx2/docfilt.hxx"
...@@ -61,6 +62,7 @@ ...@@ -61,6 +62,7 @@
#include "tools/urlobj.hxx" #include "tools/urlobj.hxx"
#include "unotools/ucbhelper.hxx" #include "unotools/ucbhelper.hxx"
#include "unotools/localfilehelper.hxx" #include "unotools/localfilehelper.hxx"
#include "vcl/msgbox.hxx"
#include <memory> #include <memory>
#include <algorithm> #include <algorithm>
...@@ -2704,6 +2706,15 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -2704,6 +2706,15 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint )
sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId(); sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
switch ( nEventId ) switch ( nEventId )
{ {
case SFX_EVENT_PREPARECLOSEDOC:
{
SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell();
ScDocShell* pDocShell = static_cast< ScDocShell* >( pObjShell );
WarningBox aBox( pDocShell->GetActiveDialogParent(), WinBits( WB_OK ),
ScGlobal::GetRscString( STR_CLOSE_WITH_UNSAVED_REFS ) );
aBox.Execute();
}
break;
case SFX_EVENT_SAVEDOCDONE: case SFX_EVENT_SAVEDOCDONE:
case SFX_EVENT_SAVEASDOCDONE: case SFX_EVENT_SAVEASDOCDONE:
{ {
......
...@@ -1855,5 +1855,9 @@ Resource RID_GLOBSTR ...@@ -1855,5 +1855,9 @@ Resource RID_GLOBSTR
{ {
Text [ en-US ] = "This Document contains external references to unsaved documents.\n\nDo you want to continue?"; Text [ en-US ] = "This Document contains external references to unsaved documents.\n\nDo you want to continue?";
}; };
String STR_CLOSE_WITH_UNSAVED_REFS
{
Text [ en-US ] = "This Document is referenced by another document and not yet saved. Closing it without saving will result in data loss.";
};
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment