xref: /AOO41X/main/svx/source/unodraw/recoveryui.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //===============================================
32*cdf0e10cSrcweir // includes
33*cdf0e10cSrcweir #include "recoveryui.hxx"
34*cdf0e10cSrcweir #include "docrecovery.hxx"
35*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/frame/XFramesSupplier.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
38*cdf0e10cSrcweir #include <osl/file.hxx>
39*cdf0e10cSrcweir #include <rtl/bootstrap.hxx>
40*cdf0e10cSrcweir #include <comphelper/configurationhelper.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <vcl/svapp.hxx>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir //===============================================
45*cdf0e10cSrcweir // const
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #define IMPLEMENTATIONNAME_RECOVERYUI       ::rtl::OUString::createFromAscii("com.sun.star.comp.svx.RecoveryUI")
48*cdf0e10cSrcweir #define SERVICENAME_RECOVERYUI              ::rtl::OUString::createFromAscii("com.sun.star.dialog.RecoveryUI")
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir //===============================================
51*cdf0e10cSrcweir // namespace
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir namespace svx
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir namespace css   = ::com::sun::star;
57*cdf0e10cSrcweir namespace svxdr = ::svx::DocRecovery;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir using namespace ::rtl;
60*cdf0e10cSrcweir using namespace ::osl;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir //===============================================
63*cdf0e10cSrcweir RecoveryUI::RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
64*cdf0e10cSrcweir     : m_xSMGR        (xSMGR                    )
65*cdf0e10cSrcweir     , m_pParentWindow(0                        )
66*cdf0e10cSrcweir     , m_eJob         (RecoveryUI::E_JOB_UNKNOWN)
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir //===============================================
71*cdf0e10cSrcweir RecoveryUI::~RecoveryUI()
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir }
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir //===============================================
76*cdf0e10cSrcweir ::rtl::OUString SAL_CALL RecoveryUI::getImplementationName()
77*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir     return RecoveryUI::st_getImplementationName();
80*cdf0e10cSrcweir }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir //===============================================
83*cdf0e10cSrcweir sal_Bool SAL_CALL RecoveryUI::supportsService(const ::rtl::OUString& sServiceName)
84*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir     const css::uno::Sequence< ::rtl::OUString > lServices = RecoveryUI::st_getSupportedServiceNames();
87*cdf0e10cSrcweir           sal_Int32                             c         = lServices.getLength();
88*cdf0e10cSrcweir           sal_Int32                             i         = 0;
89*cdf0e10cSrcweir     for (i=0; i<c; ++i)
90*cdf0e10cSrcweir     {
91*cdf0e10cSrcweir         const ::rtl::OUString& sSupportedService = lServices[i];
92*cdf0e10cSrcweir         if (sSupportedService.equals(sServiceName))
93*cdf0e10cSrcweir             return sal_True;
94*cdf0e10cSrcweir     }
95*cdf0e10cSrcweir     return sal_False;
96*cdf0e10cSrcweir }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir //===============================================
99*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > SAL_CALL RecoveryUI::getSupportedServiceNames()
100*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir     return RecoveryUI::st_getSupportedServiceNames();
103*cdf0e10cSrcweir }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir //===============================================
106*cdf0e10cSrcweir css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL& aURL,
107*cdf0e10cSrcweir                                                    const css::uno::Sequence< css::beans::PropertyValue >& )
108*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
109*cdf0e10cSrcweir {
110*cdf0e10cSrcweir     // Internaly we use VCL ... every call into vcl based code must
111*cdf0e10cSrcweir     // be guarded by locking the global solar mutex.
112*cdf0e10cSrcweir     ::vos::OGuard aSolarLock(&Application::GetSolarMutex());
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     css::uno::Any aRet;
115*cdf0e10cSrcweir     RecoveryUI::EJob eJob = impl_classifyJob(aURL);
116*cdf0e10cSrcweir     // TODO think about outside arguments
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     switch(eJob)
119*cdf0e10cSrcweir     {
120*cdf0e10cSrcweir         case RecoveryUI::E_DO_EMERGENCY_SAVE :
121*cdf0e10cSrcweir         {
122*cdf0e10cSrcweir             sal_Bool bRet = impl_doEmergencySave();
123*cdf0e10cSrcweir             aRet <<= bRet;
124*cdf0e10cSrcweir             break;
125*cdf0e10cSrcweir         }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir         case RecoveryUI::E_DO_RECOVERY :
128*cdf0e10cSrcweir             impl_doRecovery();
129*cdf0e10cSrcweir             break;
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir         case RecoveryUI::E_DO_CRASHREPORT :
132*cdf0e10cSrcweir             impl_doCrashReport();
133*cdf0e10cSrcweir             break;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         default :
136*cdf0e10cSrcweir             break;
137*cdf0e10cSrcweir     }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     return aRet;
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir //===============================================
143*cdf0e10cSrcweir void SAL_CALL RecoveryUI::dispatch(const css::util::URL&                                  aURL      ,
144*cdf0e10cSrcweir                                    const css::uno::Sequence< css::beans::PropertyValue >& lArguments)
145*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir     // recycle this method :-)
148*cdf0e10cSrcweir     dispatchWithReturnValue(aURL, lArguments);
149*cdf0e10cSrcweir }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir //===============================================
152*cdf0e10cSrcweir void SAL_CALL RecoveryUI::addStatusListener(const css::uno::Reference< css::frame::XStatusListener >&, const css::util::URL& ) throw(css::uno::RuntimeException)
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir     // TODO
155*cdf0e10cSrcweir     OSL_ENSURE(sal_False, "RecoveryUI::addStatusListener()\nNot implemented yet!");
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir //===============================================
159*cdf0e10cSrcweir void SAL_CALL RecoveryUI::removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >&, const css::util::URL& )
160*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
161*cdf0e10cSrcweir {
162*cdf0e10cSrcweir     // TODO
163*cdf0e10cSrcweir     OSL_ENSURE(sal_False, "RecoveryUI::removeStatusListener()\nNot implemented yet!");
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir //===============================================
167*cdf0e10cSrcweir ::rtl::OUString RecoveryUI::st_getImplementationName()
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir     static ::rtl::OUString IMPLEMENTATIONNAME = IMPLEMENTATIONNAME_RECOVERYUI;
170*cdf0e10cSrcweir     return IMPLEMENTATIONNAME;
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir //===============================================
174*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > RecoveryUI::st_getSupportedServiceNames()
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir     css::uno::Sequence< ::rtl::OUString > lServiceNames(1);    lServiceNames.getArray() [0] = SERVICENAME_RECOVERYUI;
177*cdf0e10cSrcweir     return lServiceNames;
178*cdf0e10cSrcweir }
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir //===============================================
181*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > SAL_CALL RecoveryUI::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir     RecoveryUI* pNew = new RecoveryUI(xSMGR);
184*cdf0e10cSrcweir     return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XServiceInfo* >(pNew));
185*cdf0e10cSrcweir }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir //===============================================
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir static OUString GetCrashConfigDir()
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
193*cdf0e10cSrcweir 	OUString	ustrValue = OUString::createFromAscii("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}");
194*cdf0e10cSrcweir #elif defined(MACOSX)
195*cdf0e10cSrcweir 	OUString	ustrValue = OUString::createFromAscii("~");
196*cdf0e10cSrcweir #else
197*cdf0e10cSrcweir 	OUString	ustrValue = OUString::createFromAscii("$SYSUSERCONFIG");
198*cdf0e10cSrcweir #endif
199*cdf0e10cSrcweir 	Bootstrap::expandMacros( ustrValue );
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
202*cdf0e10cSrcweir 	ustrValue += OUString::createFromAscii("/user/crashdata");
203*cdf0e10cSrcweir #endif
204*cdf0e10cSrcweir 	return ustrValue;
205*cdf0e10cSrcweir }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir //===============================================
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir #if defined(WNT) || defined(OS2)
210*cdf0e10cSrcweir #define LCKFILE "crashdat.lck"
211*cdf0e10cSrcweir #else
212*cdf0e10cSrcweir #define LCKFILE ".crash_report_unsent"
213*cdf0e10cSrcweir #endif
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir static OUString GetUnsentURL()
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir 	OUString	aURL = GetCrashConfigDir();
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 	aURL += OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
221*cdf0e10cSrcweir 	aURL += OUString( RTL_CONSTASCII_USTRINGPARAM( LCKFILE ) );
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 	return aURL;
224*cdf0e10cSrcweir }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir //===============================================
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir static bool new_crash_pending()
229*cdf0e10cSrcweir {
230*cdf0e10cSrcweir 	OUString	aUnsentURL = GetUnsentURL();
231*cdf0e10cSrcweir 	File	aFile( aUnsentURL );
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 	if ( FileBase::E_None == aFile.open( OpenFlag_Read ) )
234*cdf0e10cSrcweir 	{
235*cdf0e10cSrcweir 		aFile.close();
236*cdf0e10cSrcweir 		return true;
237*cdf0e10cSrcweir 	}
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	return false;
240*cdf0e10cSrcweir }
241*cdf0e10cSrcweir //===============================================
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir static bool delete_pending_crash()
244*cdf0e10cSrcweir {
245*cdf0e10cSrcweir 	OUString	aUnsentURL = GetUnsentURL();
246*cdf0e10cSrcweir 	return ( FileBase::E_None == File::remove( aUnsentURL ) );
247*cdf0e10cSrcweir }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
250*cdf0e10cSrcweir {
251*cdf0e10cSrcweir     m_eJob = RecoveryUI::E_JOB_UNKNOWN;
252*cdf0e10cSrcweir     if (aURL.Protocol.equals(RECOVERY_CMDPART_PROTOCOL))
253*cdf0e10cSrcweir     {
254*cdf0e10cSrcweir         if (aURL.Path.equals(RECOVERY_CMDPART_DO_EMERGENCY_SAVE))
255*cdf0e10cSrcweir             m_eJob = RecoveryUI::E_DO_EMERGENCY_SAVE;
256*cdf0e10cSrcweir         else
257*cdf0e10cSrcweir         if (aURL.Path.equals(RECOVERY_CMDPART_DO_RECOVERY))
258*cdf0e10cSrcweir             m_eJob = RecoveryUI::E_DO_RECOVERY;
259*cdf0e10cSrcweir         else
260*cdf0e10cSrcweir         if (aURL.Path.equals(RECOVERY_CMDPART_DO_CRASHREPORT))
261*cdf0e10cSrcweir             m_eJob = RecoveryUI::E_DO_CRASHREPORT;
262*cdf0e10cSrcweir     }
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     return m_eJob;
265*cdf0e10cSrcweir }
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir //===============================================
268*cdf0e10cSrcweir sal_Bool RecoveryUI::impl_doEmergencySave()
269*cdf0e10cSrcweir {
270*cdf0e10cSrcweir     // create core service, which implements the real "emergency save" algorithm.
271*cdf0e10cSrcweir     svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xSMGR, sal_True);
272*cdf0e10cSrcweir     css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir     // create all needed dialogs for this operation
275*cdf0e10cSrcweir     // and bind it to the used core service
276*cdf0e10cSrcweir     svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery(m_pParentWindow);
277*cdf0e10cSrcweir     svxdr::IExtendedTabPage*   pPage1  = new svxdr::SaveDialog        (pWizard, pCore );
278*cdf0e10cSrcweir     pWizard->addTabPage(pPage1);
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir     // start the wizard
281*cdf0e10cSrcweir     short nRet = pWizard->Execute();
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir     delete pPage1 ;
284*cdf0e10cSrcweir     delete pWizard;
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir     return (nRet==DLG_RET_OK_AUTOLUNCH);
287*cdf0e10cSrcweir }
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir //===============================================
290*cdf0e10cSrcweir void RecoveryUI::impl_doRecovery()
291*cdf0e10cSrcweir {
292*cdf0e10cSrcweir     sal_Bool bRecoveryOnly( sal_False );
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir     ::rtl::OUString CFG_PACKAGE_RECOVERY( RTL_CONSTASCII_USTRINGPARAM  ( "org.openoffice.Office.Recovery/" ));
295*cdf0e10cSrcweir     ::rtl::OUString CFG_PATH_CRASHREPORTER( RTL_CONSTASCII_USTRINGPARAM( "CrashReporter"                 ));
296*cdf0e10cSrcweir     ::rtl::OUString CFG_ENTRY_ENABLED( RTL_CONSTASCII_USTRINGPARAM     ( "Enabled"                       ));
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir     sal_Bool bCrashRepEnabled( sal_True );
299*cdf0e10cSrcweir     css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
300*cdf0e10cSrcweir                                 m_xSMGR,
301*cdf0e10cSrcweir                                 CFG_PACKAGE_RECOVERY,
302*cdf0e10cSrcweir                                 CFG_PATH_CRASHREPORTER,
303*cdf0e10cSrcweir                                 CFG_ENTRY_ENABLED,
304*cdf0e10cSrcweir                                 ::comphelper::ConfigurationHelper::E_READONLY);
305*cdf0e10cSrcweir     aVal >>= bCrashRepEnabled;
306*cdf0e10cSrcweir     bRecoveryOnly = !bCrashRepEnabled;
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir     // create core service, which implements the real "emergency save" algorithm.
309*cdf0e10cSrcweir     svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xSMGR, sal_False);
310*cdf0e10cSrcweir     css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     // create all needed dialogs for this operation
313*cdf0e10cSrcweir     // and bind it to the used core service
314*cdf0e10cSrcweir     svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery   (m_pParentWindow);
315*cdf0e10cSrcweir     svxdr::IExtendedTabPage*   pPage1  = new svxdr::RecoveryDialog       (pWizard, pCore );
316*cdf0e10cSrcweir     svxdr::IExtendedTabPage*   pPage2  = 0;
317*cdf0e10cSrcweir     svxdr::IExtendedTabPage*   pPage3  = 0;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir     pWizard->addTabPage(pPage1);
320*cdf0e10cSrcweir     if ( !bRecoveryOnly && new_crash_pending() )
321*cdf0e10cSrcweir     {
322*cdf0e10cSrcweir         pPage2 = new svxdr::ErrorRepWelcomeDialog(pWizard        );
323*cdf0e10cSrcweir         pPage3 = new svxdr::ErrorRepSendDialog   (pWizard        );
324*cdf0e10cSrcweir         pWizard->addTabPage(pPage2);
325*cdf0e10cSrcweir         pWizard->addTabPage(pPage3);
326*cdf0e10cSrcweir     }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir     // start the wizard
329*cdf0e10cSrcweir     pWizard->Execute();
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir     impl_showAllRecoveredDocs();
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir     delete pPage3 ;
334*cdf0e10cSrcweir     delete pPage2 ;
335*cdf0e10cSrcweir     delete pPage1 ;
336*cdf0e10cSrcweir     delete pWizard;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	delete_pending_crash();
339*cdf0e10cSrcweir }
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir //===============================================
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir void RecoveryUI::impl_doCrashReport()
344*cdf0e10cSrcweir {
345*cdf0e10cSrcweir 	if ( new_crash_pending() )
346*cdf0e10cSrcweir 	{
347*cdf0e10cSrcweir 		svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery   (m_pParentWindow   );
348*cdf0e10cSrcweir 		svxdr::IExtendedTabPage*   pPage1  = new svxdr::ErrorRepWelcomeDialog(pWizard, sal_False);
349*cdf0e10cSrcweir 		svxdr::IExtendedTabPage*   pPage2  = new svxdr::ErrorRepSendDialog   (pWizard           );
350*cdf0e10cSrcweir 		pWizard->addTabPage(pPage1);
351*cdf0e10cSrcweir 		pWizard->addTabPage(pPage2);
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 		// start the wizard
354*cdf0e10cSrcweir 		pWizard->Execute();
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 		delete pPage2 ;
357*cdf0e10cSrcweir 		delete pPage1 ;
358*cdf0e10cSrcweir 		delete pWizard;
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 		delete_pending_crash();
361*cdf0e10cSrcweir 	}
362*cdf0e10cSrcweir }
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir //===============================================
365*cdf0e10cSrcweir void RecoveryUI::impl_showAllRecoveredDocs()
366*cdf0e10cSrcweir {
367*cdf0e10cSrcweir     css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
368*cdf0e10cSrcweir         m_xSMGR->createInstance(SERVICENAME_DESKTOP),
369*cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir     css::uno::Reference< css::container::XIndexAccess > xTaskContainer(
372*cdf0e10cSrcweir         xDesktop->getFrames(),
373*cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir     sal_Int32 c = xTaskContainer->getCount();
376*cdf0e10cSrcweir     sal_Int32 i = 0;
377*cdf0e10cSrcweir     for (i=0; i<c; ++i)
378*cdf0e10cSrcweir     {
379*cdf0e10cSrcweir         try
380*cdf0e10cSrcweir         {
381*cdf0e10cSrcweir             css::uno::Reference< css::frame::XFrame > xTask;
382*cdf0e10cSrcweir             xTaskContainer->getByIndex(i) >>= xTask;
383*cdf0e10cSrcweir             if (!xTask.is())
384*cdf0e10cSrcweir                 continue;
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir             css::uno::Reference< css::awt::XWindow > xWindow = xTask->getContainerWindow();
387*cdf0e10cSrcweir             if (!xWindow.is())
388*cdf0e10cSrcweir                 continue;
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir             xWindow->setVisible(sal_True);
391*cdf0e10cSrcweir         }
392*cdf0e10cSrcweir         catch(const css::uno::RuntimeException& exRun)
393*cdf0e10cSrcweir             { throw exRun; }
394*cdf0e10cSrcweir         catch(const css::uno::Exception&)
395*cdf0e10cSrcweir             { continue; }
396*cdf0e10cSrcweir     }
397*cdf0e10cSrcweir }
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir } // namespace svx
400