sc/inc/globstr.hrc | 3 ++- sc/source/ui/docshell/externalrefmgr.cxx | 11 +++++++++++ sc/source/ui/src/globstr.src | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit 4ff62bf42a67ecc388413148c969d37087d9c999 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Jan 6 19:32:19 2012 +0100 add warning message if you close unsaved referenced document diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index a545a0e..48f4015 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -600,8 +600,9 @@ #define STR_ERR_NAME_INVALID 464 #define STR_UNSAVED_EXT_REF 465 +#define STR_CLOSE_WITH_UNSAVED_REFS 466 -#define STR_COUNT 466 +#define STR_COUNT 467 #endif diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 4ad9a91..83881a5 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -44,6 +44,7 @@ #include "viewdata.hxx" #include "tabvwsh.hxx" #include "sc.hrc" +#include "globstr.hrc" #include "sfx2/app.hxx" #include "sfx2/docfilt.hxx" @@ -61,6 +62,7 @@ #include "tools/urlobj.hxx" #include "unotools/ucbhelper.hxx" #include "unotools/localfilehelper.hxx" +#include "vcl/msgbox.hxx" #include <memory> #include <algorithm> @@ -2704,6 +2706,15 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint ) sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId(); 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_SAVEASDOCDONE: { diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 8d6425d..a5a1e6a 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1855,5 +1855,9 @@ Resource RID_GLOBSTR { 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."; + }; }; _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits