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