summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/inc/docrecovery.hxx1
-rw-r--r--svx/source/unodraw/recoveryui.cxx38
2 files changed, 39 insertions, 0 deletions
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
index 5ec8fab16e9c..6fce63ffd8a9 100644
--- a/svx/source/inc/docrecovery.hxx
+++ b/svx/source/inc/docrecovery.hxx
@@ -43,6 +43,7 @@
#define RECOVERY_CMDPART_DO_EMERGENCY_SAVE "/doEmergencySave"
#define RECOVERY_CMDPART_DO_RECOVERY "/doAutoRecovery"
+#define RECOVERY_CMDPART_DO_BRINGTOFRONT "/doBringToFront"
#define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE "vnd.sun.star.autorecovery:/doPrepareEmergencySave"
#define RECOVERY_CMD_DO_EMERGENCY_SAVE "vnd.sun.star.autorecovery:/doEmergencySave"
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
index 2a352ddb473a..fa2c0dce6212 100644
--- a/svx/source/unodraw/recoveryui.cxx
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -55,6 +55,7 @@ class RecoveryUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo
E_JOB_UNKNOWN,
E_DO_EMERGENCY_SAVE,
E_DO_RECOVERY,
+ E_DO_BRINGTOFRONT,
};
@@ -70,6 +71,9 @@ class RecoveryUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo
/** @short TODO */
RecoveryUI::EJob m_eJob;
+ // Active dialog
+ VclPtr<Dialog> m_pDialog;
+
// interface
public:
@@ -101,6 +105,7 @@ class RecoveryUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo
void impl_showAllRecoveredDocs();
+ bool impl_doBringToFront();
};
RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext)
@@ -152,6 +157,13 @@ css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL&
break;
}
+ case RecoveryUI::E_DO_BRINGTOFRONT:
+ {
+ bool bRet = impl_doBringToFront();
+ aRet <<= bRet;
+ break;
+ }
+
default:
{
aRet <<= false;
@@ -211,11 +223,25 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
m_eJob = RecoveryUI::E_DO_EMERGENCY_SAVE;
else if (aURL.Path == RECOVERY_CMDPART_DO_RECOVERY)
m_eJob = RecoveryUI::E_DO_RECOVERY;
+ else if (aURL.Path == RECOVERY_CMDPART_DO_BRINGTOFRONT)
+ m_eJob = RecoveryUI::E_DO_BRINGTOFRONT;
}
return m_eJob;
}
+struct DialogReleaseGuard
+{
+ VclPtr<Dialog>& m_rDialog;
+ template <class DialogPtrClass>
+ DialogReleaseGuard(VclPtr<Dialog>& rDialog, DialogPtrClass& p)
+ : m_rDialog(rDialog)
+ {
+ m_rDialog.set(p.get());
+ }
+ ~DialogReleaseGuard() { m_rDialog.reset(); }
+};
+
bool RecoveryUI::impl_doEmergencySave()
{
// create core service, which implements the real "emergency save" algorithm.
@@ -223,6 +249,7 @@ bool RecoveryUI::impl_doEmergencySave()
// create dialog for this operation and bind it to the used core service
ScopedVclPtrInstance<svxdr::SaveDialog> xDialog(m_pParentWindow, pCore.get());
+ DialogReleaseGuard dialogReleaseGuard(m_pDialog, xDialog);
// start the dialog
short nRet = xDialog->Execute();
@@ -237,6 +264,7 @@ bool RecoveryUI::impl_doRecovery()
// create all needed dialogs for this operation
// and bind it to the used core service
ScopedVclPtrInstance<svxdr::RecoveryDialog> xDialog(m_pParentWindow, pCore.get());
+ DialogReleaseGuard dialogReleaseGuard(m_pDialog, xDialog);
// start the dialog
short nRet = xDialog->Execute();
@@ -280,6 +308,16 @@ void RecoveryUI::impl_showAllRecoveredDocs()
}
}
+bool RecoveryUI::impl_doBringToFront()
+{
+ VclPtr<Dialog> pDialog(m_pDialog);
+ if (!pDialog || !pDialog->IsVisible())
+ return false;
+
+ pDialog->ToTop(ToTopFlags::RestoreWhenMin | ToTopFlags::ForegroundTask);
+ return true;
+}
+
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL