xref: /trunk/main/svx/source/inc/docrecovery.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVX_DOCRECOVERY_HXX
29 #define _SVX_DOCRECOVERY_HXX
30 
31 #include <vcl/tabpage.hxx>
32 #ifndef _SV_TABDIALOG_HXX
33 #include <vcl/tabdlg.hxx>
34 #endif
35 #include <vcl/dialog.hxx>
36 #ifndef _SV_BUTTON_HXX
37 #include <vcl/button.hxx>
38 #endif
39 #include <vcl/fixed.hxx>
40 #include <svtools/svmedit2.hxx>
41 #include <svtools/svtreebx.hxx>
42 #include <svx/simptabl.hxx>
43 
44 #include <cppuhelper/implbase1.hxx>
45 #include <cppuhelper/implbase2.hxx>
46 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
47 #include <com/sun/star/frame/XStatusListener.hpp>
48 #include <com/sun/star/frame/XDispatch.hpp>
49 #include <com/sun/star/lang/XComponent.hpp>
50 
51 //===============================================
52 // const
53 
54 #define RECOVERY_CMDPART_PROTOCOL                       ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:")
55 
56 #define RECOVERY_CMDPART_DO_PREPARE_EMERGENCY_SAVE      ::rtl::OUString::createFromAscii("/doPrepareEmergencySave"  )
57 #define RECOVERY_CMDPART_DO_EMERGENCY_SAVE              ::rtl::OUString::createFromAscii("/doEmergencySave"         )
58 #define RECOVERY_CMDPART_DO_RECOVERY                    ::rtl::OUString::createFromAscii("/doAutoRecovery"          )
59 #define RECOVERY_CMDPART_DO_CRASHREPORT                 ::rtl::OUString::createFromAscii("/doCrashReport"           )
60 #define RECOVERY_CMDPART_DO_ENTRY_BACKUP                ::rtl::OUString::createFromAscii("/doEntryBackup"           )
61 #define RECOVERY_CMDPART_DO_ENTRY_CLEANUP               ::rtl::OUString::createFromAscii("/doEntryCleanUp"          )
62 
63 #define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE          ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doPrepareEmergencySave")
64 #define RECOVERY_CMD_DO_EMERGENCY_SAVE                  ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEmergencySave"       )
65 #define RECOVERY_CMD_DO_RECOVERY                        ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doAutoRecovery"        )
66 #define RECOVERY_CMD_DO_CRASHREPORT                     ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doCrashReport"         )
67 #define RECOVERY_CMD_DO_ENTRY_BACKUP                    ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEntryBackup"         )
68 #define RECOVERY_CMD_DO_ENTRY_CLEANUP                   ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEntryCleanUp"        )
69 
70 #define SERVICENAME_PROGRESSFACTORY                     ::rtl::OUString::createFromAscii("com.sun.star.task.StatusIndicatorFactory")
71 #define SERVICENAME_URLTRANSFORMER                      ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer"        )
72 #define SERVICENAME_RECOVERYCORE                        ::rtl::OUString::createFromAscii("com.sun.star.frame.AutoRecovery"         )
73 #define SERVICENAME_FOLDERPICKER                        ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FolderPicker"    )
74 #define SERVICENAME_DESKTOP                             ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"              )
75 
76 #define PROP_PARENTWINDOW                               ::rtl::OUString::createFromAscii("Window"           )
77 #define PROP_STATUSINDICATOR                            ::rtl::OUString::createFromAscii("StatusIndicator"  )
78 #define PROP_DISPATCHASYNCHRON                          ::rtl::OUString::createFromAscii("DispatchAsynchron")
79 #define PROP_SAVEPATH                                   ::rtl::OUString::createFromAscii("SavePath"         )
80 #define PROP_ENTRYID                                    ::rtl::OUString::createFromAscii("EntryID"          )
81 #define PROP_ALLOWPARENTSHOW                            ::rtl::OUString::createFromAscii("AllowParentShow"  )
82 
83 #define STATEPROP_ID                                    ::rtl::OUString::createFromAscii("ID"           )
84 #define STATEPROP_STATE                                 ::rtl::OUString::createFromAscii("DocumentState")
85 #define STATEPROP_ORGURL                                ::rtl::OUString::createFromAscii("OriginalURL"  )
86 #define STATEPROP_TEMPURL                               ::rtl::OUString::createFromAscii("TempURL"      )
87 #define STATEPROP_FACTORYURL                            ::rtl::OUString::createFromAscii("FactoryURL"   )
88 #define STATEPROP_TEMPLATEURL                           ::rtl::OUString::createFromAscii("TemplateURL"  )
89 #define STATEPROP_TITLE                                 ::rtl::OUString::createFromAscii("Title"        )
90 #define STATEPROP_MODULE                                ::rtl::OUString::createFromAscii("Module"       )
91 
92 #define RECOVERY_OPERATIONSTATE_START                   ::rtl::OUString::createFromAscii("start" )
93 #define RECOVERY_OPERATIONSTATE_STOP                    ::rtl::OUString::createFromAscii("stop"  )
94 #define RECOVERY_OPERATIONSTATE_UPDATE                  ::rtl::OUString::createFromAscii("update")
95 
96 #define DLG_RET_UNKNOWN                                  -1
97 #define DLG_RET_OK                                        1
98 #define DLG_RET_CANCEL                                    0
99 #define DLG_RET_BACK                                    100
100 #define DLG_RET_OK_AUTOLUNCH                            101
101 
102 //===============================================
103 // namespace
104 
105 namespace svx{
106     namespace DocRecovery{
107 
108 #ifdef css
109 #   error "Who uses css? I need it as temp. namespace alias!"
110 #else
111 #   define css ::com::sun::star
112 #endif
113 
114 //===============================================
115 enum EDocStates
116 {
117     /* TEMP STATES */
118 
119     /// default state, if a document was new created or loaded
120     E_UNKNOWN = 0,
121     /// modified against the original file
122     E_MODIFIED = 1,
123     /// an active document can be postponed to be saved later.
124     E_POSTPONED = 2,
125     /// was already handled during one AutoSave/Recovery session.
126     E_HANDLED = 4,
127     /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */
128     E_TRY_SAVE = 8,
129     E_TRY_LOAD_BACKUP = 16,
130     E_TRY_LOAD_ORIGINAL = 32,
131 
132     /* FINAL STATES */
133 
134     /// the Auto/Emergency saved document isnt useable any longer
135     E_DAMAGED = 64,
136     /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing)
137     E_INCOMPLETE = 128,
138     /// the Auto/Emergency saved document was processed successfully
139     E_SUCCEDED = 512
140 };
141 
142 //===============================================
143 enum ERecoveryState
144 {
145     E_SUCCESSFULLY_RECOVERED,
146     E_ORIGINAL_DOCUMENT_RECOVERED,
147     E_RECOVERY_FAILED,
148     E_RECOVERY_IS_IN_PROGRESS,
149     E_NOT_RECOVERED_YET
150 };
151 
152 //===============================================
153 struct TURLInfo
154 {
155     public:
156 
157     /// unique ID, which is specified by the underlying autorecovery core!
158     sal_Int32 ID;
159 
160     /// the full qualified document URL
161     ::rtl::OUString OrgURL;
162 
163     /// the full qualified URL of the temp. file (if it's exists)
164     ::rtl::OUString TempURL;
165 
166     /// a may be existing factory URL (e.g. for untitled documents)
167     ::rtl::OUString FactoryURL;
168 
169     /// may be the document base on a template file !?
170     ::rtl::OUString TemplateURL;
171 
172     /// the pure file name, without path, disc etcpp.
173     ::rtl::OUString DisplayName;
174 
175     /// the application module, where this document was loaded
176     ::rtl::OUString Module;
177 
178     /// state info as e.g. VALID, CORRUPTED, NON EXISTING ...
179     sal_Int32 DocState;
180 
181     /// ui representation for DocState!
182     ERecoveryState RecoveryState;
183 
184     /// standard icon
185     Image StandardImage;
186 
187     /// high contrast icon
188     Image HCImage;
189 
190     public:
191 
192     TURLInfo()
193         : ID           (-1                 )
194         , DocState     (E_UNKNOWN          )
195         , RecoveryState(E_NOT_RECOVERED_YET)
196     {}
197 };
198 
199 //===============================================
200 typedef ::std::vector< TURLInfo > TURLList;
201 
202 //===============================================
203 class IRecoveryUpdateListener
204 {
205     public:
206 
207         // inform listener about changed items, which should be refreshed
208         virtual void updateItems() = 0;
209 
210         // inform listener about starting of the asynchronous recovery operation
211         virtual void start() = 0;
212 
213         // inform listener about ending of the asynchronous recovery operation
214         virtual void end() = 0;
215 
216         // TODO
217         virtual void stepNext(TURLInfo* pItem) = 0;
218 };
219 
220 //===============================================
221 class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
222 {
223     //-------------------------------------------
224     // types, const
225     public:
226 
227     //-------------------------------------------
228     // member
229     private:
230 
231         /// TODO
232         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
233 
234         /// TODO
235         css::uno::Reference< css::frame::XDispatch > m_xRealCore;
236 
237         /// TODO
238         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
239 
240         /// TODO
241         TURLList m_lURLs;
242 
243         /// TODO
244         IRecoveryUpdateListener* m_pListener;
245 
246         /** @short  knows the reason, why we listen on our internal m_xRealCore
247                     member.
248 
249             @descr  Because we listen for different operations
250                     on the core dispatch implementation, we must know,
251                     which URL we have to use for deregistration!
252          */
253         sal_Bool m_bListenForSaving;
254 
255     //-------------------------------------------
256     // native interface
257     public:
258 
259         //---------------------------------------
260         /** @short  TODO */
261         RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR         ,
262                            sal_Bool                                                bUsedForSaving);
263 
264         //---------------------------------------
265         /** @short  TODO */
266         virtual ~RecoveryCore();
267 
268         //---------------------------------------
269         /** @short  TODO */
270         virtual css::uno::Reference< css::lang::XMultiServiceFactory > getSMGR();
271 
272         //---------------------------------------
273         /** @short  TODO */
274         virtual TURLList* getURLListAccess();
275 
276         //---------------------------------------
277         /** @short  TODO */
278         virtual sal_Bool existsBrokenTempEntries();
279         virtual sal_Bool existsNonRecoveredEntries();
280         static sal_Bool isBrokenTempEntry(const TURLInfo& rInfo);
281         virtual void saveBrokenTempEntries(const ::rtl::OUString& sSaveDir);
282         virtual void saveAllTempEntries(const ::rtl::OUString& sSaveDir);
283         virtual void forgetBrokenTempEntries();
284         virtual void forgetAllRecoveryEntries();
285         void forgetBrokenRecoveryEntries();
286 
287         //---------------------------------------
288         /** @short  TODO */
289         virtual void setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress);
290 
291         //---------------------------------------
292         /** @short  TODO */
293         virtual void setUpdateListener(IRecoveryUpdateListener* pListener);
294 
295         //---------------------------------------
296         /** @short  TODO */
297         virtual void doEmergencySavePrepare();
298         virtual void doEmergencySave();
299         virtual void doRecovery();
300 
301         //---------------------------------------
302         /** @short  TODO */
303         static ERecoveryState mapDocState2RecoverState(sal_Int32 eDocState);
304 
305     //-------------------------------------------
306     // uno interface
307     public:
308 
309         // css.frame.XStatusListener
310         virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& aEvent)
311             throw(css::uno::RuntimeException);
312 
313         // css.lang.XEventListener
314         virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
315             throw(css::uno::RuntimeException);
316 
317     //-------------------------------------------
318     // helper
319     private:
320 
321         //---------------------------------------
322         /** @short  starts listening on the internal EmergencySave/AutoRecovery core.
323          */
324         void impl_startListening();
325 
326         //---------------------------------------
327         /** @short  stop listening on the internal EmergencySave/AutoRecovery core.
328          */
329         void impl_stopListening();
330 
331         //---------------------------------------
332         /** @short  TODO */
333         css::util::URL impl_getParsedURL(const ::rtl::OUString& sURL);
334 };
335 
336 //===============================================
337 class PluginProgressWindow : public Window
338 {
339     private:
340 
341         css::uno::Reference< css::lang::XComponent > m_xProgress;
342 
343     public:
344 
345         PluginProgressWindow(      Window*                                       pParent  ,
346                              const css::uno::Reference< css::lang::XComponent >& xProgress);
347         ~PluginProgressWindow();
348 };
349 
350 class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicator ,
351                                                        css::lang::XComponent       >
352 {
353 
354     //-------------------------------------------
355     // member
356     private:
357 
358         /** @short  TODO */
359         css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory;
360 
361         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
362 
363         PluginProgressWindow* m_pPlugProgressWindow;
364 
365     //-------------------------------------------
366     // native interface
367     public:
368 
369         //---------------------------------------
370         /** @short  TODO */
371         PluginProgress(      Window*                                                 pParent,
372                        const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR  );
373 
374         //---------------------------------------
375         /** @short  TODO */
376         virtual ~PluginProgress();
377 
378         //---------------------------------------
379         /** @short  TODO */
380         Window* getPlugWindow();
381 
382     //-------------------------------------------
383     // uno interface
384     public:
385 
386         //---------------------------------------
387         // XStatusIndicator
388         virtual void SAL_CALL start(const ::rtl::OUString& sText ,
389                                           sal_Int32        nRange)
390             throw(css::uno::RuntimeException);
391 
392         virtual void SAL_CALL end()
393             throw(css::uno::RuntimeException);
394 
395         virtual void SAL_CALL setText(const ::rtl::OUString& sText)
396             throw(css::uno::RuntimeException);
397 
398         virtual void SAL_CALL setValue(sal_Int32 nValue)
399             throw(css::uno::RuntimeException);
400 
401         virtual void SAL_CALL reset()
402             throw(css::uno::RuntimeException);
403 
404         //---------------------------------------
405         // XComponent
406         virtual void SAL_CALL dispose()
407             throw(css::uno::RuntimeException);
408 
409         virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener)
410             throw(css::uno::RuntimeException);
411 
412         virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener)
413             throw(css::uno::RuntimeException);
414 };
415 
416 //===============================================
417 class IExtendedTabPage : public TabPage
418 {
419     //-------------------------------------------
420     // member
421     protected:
422 
423         short m_nResult;
424 
425     //-------------------------------------------
426     // interface
427     public:
428 
429         IExtendedTabPage( Window* pParent, WinBits nStyle = 0 )
430             : TabPage( pParent, nStyle )
431             , m_nResult(DLG_RET_UNKNOWN)
432         {}
433 
434         IExtendedTabPage( Window* pParent, const ResId& rResId )
435             : TabPage( pParent, rResId )
436             , m_nResult(DLG_RET_UNKNOWN)
437         {}
438 
439         virtual ~IExtendedTabPage()
440         {}
441 
442         virtual short   execute() = 0;
443         virtual void    setDefButton() = 0;
444 };
445 
446 typedef ::std::vector< IExtendedTabPage* > TTabPageList;
447 
448 //===============================================
449 class TabDialog4Recovery : public TabDialog
450 {
451     //-------------------------------------------
452     // member
453     private:
454 
455         TTabPageList m_lTabPages;
456         TTabPageList::iterator m_pActualPage;
457 
458     //-------------------------------------------
459     // interface
460     public:
461 
462         TabDialog4Recovery(Window* pParent);
463         virtual ~TabDialog4Recovery();
464 
465         virtual void addTabPage(IExtendedTabPage* pPage);
466         virtual short Execute();
467 };
468 
469 //===============================================
470 class SaveDialog : public IExtendedTabPage
471 {
472     //-------------------------------------------
473     // member
474     private:
475 
476         Window          m_aTitleWin;
477         FixedText       m_aTitleFT;
478         FixedLine       m_aTitleFL;
479         FixedText       m_aDescrFT;
480         FixedText       m_aFileListFT;
481         ListBox         m_aFileListLB;
482         FixedLine       m_aBottomFL;
483         OKButton        m_aOkBtn;
484 
485         RecoveryCore*   m_pCore;
486 
487     //-------------------------------------------
488     // interface
489     public:
490 
491         //---------------------------------------
492         /** @short  create all child controls of this dialog.
493 
494             @descr  The dialog isnt shown nor it starts any
495                     action by itself!
496 
497             @param  pParent
498                     can point to a parent window.
499                     If its set to 0, the defmodal-dialog-parent
500                     is used automaticly.
501 
502             @param  pCore
503                     provides access to the recovery core service
504                     and the current list of open documents,
505                     which should be shown inside this dialog.
506          */
507         SaveDialog(Window*       pParent,
508                    RecoveryCore* pCore  );
509 
510         //---------------------------------------
511         /** @short  free all controls and used memory. */
512         virtual ~SaveDialog();
513 
514         //---------------------------------------
515         /** @short  TODO*/
516         virtual short   execute();
517 
518         //---------------------------------------
519         /** @short  TODO*/
520         virtual void    setDefButton();
521 
522         DECL_LINK(OKButtonHdl, void*);
523 };
524 
525 //===============================================
526 class SaveProgressDialog : public ModalDialog
527                          , public IRecoveryUpdateListener
528 {
529     //-------------------------------------------
530     // member
531     private:
532 
533         FixedText       m_aHintFT;
534         FixedText       m_aProgrFT;
535         String          m_aProgrBaseTxt;
536         Window          m_aProgrParent;
537 
538         // @short   TODO
539         RecoveryCore* m_pCore;
540 
541         // @short   TODO
542         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
543 
544     //-------------------------------------------
545     // interface
546     public:
547 
548         //---------------------------------------
549         /** @short  create all child controls of this dialog.
550 
551             @descr  The dialog isnt shown nor it starts any
552                     action by itself!
553 
554             @param  pParent
555                     can point to a parent window.
556                     If its set to 0, the defmodal-dialog-parent
557                     is used automaticly.
558 
559             @param  pCore
560                     used to start emegrency save.
561          */
562         SaveProgressDialog(Window*       pParent,
563                            RecoveryCore* pCore  );
564 
565         //---------------------------------------
566         /** @short  free all controls and used memory. */
567         virtual ~SaveProgressDialog();
568 
569         //---------------------------------------
570         /** @short  start the emergency save operation. */
571         virtual short Execute();
572 
573         // IRecoveryUpdateListener
574         virtual void updateItems();
575         virtual void stepNext(TURLInfo* pItem);
576         virtual void start();
577         virtual void end();
578 };
579 
580 //===============================================
581 class RecovDocListEntry : public SvLBoxString
582 {
583     //-------------------------------------------
584     // interface
585     private:
586 
587     //-------------------------------------------
588     // interface
589     public:
590 
591         //---------------------------------------
592         /** @short TODO */
593         RecovDocListEntry(      SvLBoxEntry* pEntry,
594                                 sal_uInt16       nFlags,
595                           const String&      sText );
596 
597         //---------------------------------------
598         /** @short TODO */
599         virtual void Paint(const Point&       aPos   ,
600                                  SvLBox&      aDevice,
601                                  sal_uInt16       nFlags ,
602                                  SvLBoxEntry* pEntry );
603 };
604 
605 //===============================================
606 class RecovDocList : public SvxSimpleTable
607 {
608     //-------------------------------------------
609     // member
610     public:
611 
612         Image  m_aGreenCheckImg;
613         Image  m_aYellowCheckImg;
614         Image  m_aRedCrossImg;
615         Image  m_aGreenCheckImgHC;
616         Image  m_aYellowCheckImgHC;
617         Image  m_aRedCrossImgHC;
618 
619         String m_aSuccessRecovStr;
620         String m_aOrigDocRecovStr;
621         String m_aRecovFailedStr;
622         String m_aRecovInProgrStr;
623         String m_aNotRecovYetStr;
624 
625     //-------------------------------------------
626     // interface
627     public:
628 
629         //---------------------------------------
630         /** @short TODO */
631         RecovDocList(      Window* pParent,
632                      const ResId&  rResId );
633 
634         //---------------------------------------
635         /** @short TODO */
636         virtual ~RecovDocList();
637 
638         //---------------------------------------
639         /** @short TODO */
640         virtual void InitEntry(      SvLBoxEntry* pEntry ,
641                                const XubString&   sText  ,
642                                const Image&       aImage1,
643                                const Image&       aImage2,
644                                      SvLBoxButtonKind eButtonKind);
645 };
646 
647 //===============================================
648 class RecoveryDialog : public IExtendedTabPage
649                      , public IRecoveryUpdateListener
650 {
651     //-------------------------------------------
652     // member
653     private:
654         Window          m_aTitleWin;
655         FixedText       m_aTitleFT;
656         FixedLine       m_aTitleFL;
657         FixedText       m_aDescrFT;
658         FixedText       m_aProgressFT;
659         Window          m_aProgrParent;
660         FixedText       m_aFileListFT;
661         RecovDocList    m_aFileListLB;
662         FixedLine       m_aBottomFL;
663         PushButton      m_aNextBtn;
664         CancelButton    m_aCancelBtn;
665         String          m_aNextStr;
666         String          m_aTitleRecoveryInProgress;
667         String          m_aTitleRecoveryReport;
668         String          m_aRecoveryOnlyFinish;
669         String          m_aRecoveryOnlyFinishDescr;
670 
671         PushButton*     m_pDefButton;
672         RecoveryCore*   m_pCore;
673         css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
674         enum EInternalRecoveryState
675         {
676             E_RECOVERY_PREPARED,            // dialog started ... recovery prepared
677             E_RECOVERY_IN_PROGRESS,         // recovery core still in progress
678             E_RECOVERY_CORE_DONE,           // recovery core finished it's task
679             E_RECOVERY_DONE,                // user clicked "next" button
680             E_RECOVERY_CANCELED,            // user clicked "cancel" button
681             E_RECOVERY_CANCELED_BEFORE,     // user clicked "cancel" button before recovery was started
682             E_RECOVERY_CANCELED_AFTERWARDS, // user clicked "cancel" button after reovery was finished
683             E_RECOVERY_HANDLED              // the recovery wizard page was shown already ... and will be shown now again ...
684         };
685         sal_Int32 m_eRecoveryState;
686         sal_Bool  m_bWaitForUser;
687         sal_Bool  m_bWaitForCore;
688         sal_Bool  m_bUserDecideNext;
689         sal_Bool  m_bWasRecoveryStarted;
690         sal_Bool  m_bRecoveryOnly;
691 
692     //-------------------------------------------
693     // member
694     public:
695 
696         //---------------------------------------
697         /** @short TODO */
698         RecoveryDialog(Window*       pParent,
699                        RecoveryCore* pCore  );
700 
701         //---------------------------------------
702         /** @short TODO */
703         virtual ~RecoveryDialog();
704 
705         //---------------------------------------
706         // IRecoveryUpdateListener
707         virtual void updateItems();
708         virtual void stepNext(TURLInfo* pItem);
709         virtual void start();
710         virtual void end();
711 
712         //---------------------------------------
713         /** @short TODO */
714         virtual short execute();
715 
716         //---------------------------------------
717         /** @short  TODO*/
718         virtual void    setDefButton();
719 
720     //-------------------------------------------
721     // helper
722     private:
723 
724         //---------------------------------------
725         /** @short TODO */
726         DECL_LINK(NextButtonHdl, void*);
727         DECL_LINK(CancelButtonHdl, void*);
728 
729         //---------------------------------------
730         /** @short TODO */
731         void impl_refreshDocList();
732 
733         //---------------------------------------
734         /** @short TODO */
735         String impl_getStatusString( const TURLInfo& rInfo ) const;
736 };
737 
738 //===============================================
739 class BrokenRecoveryDialog : public ModalDialog
740 {
741     //-------------------------------------------
742     // member
743     private:
744         FixedText       m_aDescrFT;
745         FixedText       m_aFileListFT;
746         ListBox         m_aFileListLB;
747         FixedText       m_aSaveDirFT;
748         Edit            m_aSaveDirED;
749         PushButton      m_aSaveDirBtn;
750         FixedLine       m_aBottomFL;
751         OKButton        m_aOkBtn;
752         CancelButton    m_aCancelBtn;
753 
754         ::rtl::OUString m_sSavePath;
755         RecoveryCore*   m_pCore;
756         sal_Bool        m_bBeforeRecovery;
757         sal_Bool        m_bExecutionNeeded;
758 
759     //-------------------------------------------
760     // interface
761     public:
762 
763         //---------------------------------------
764         /** @short TODO */
765         BrokenRecoveryDialog(Window*       pParent        ,
766                              RecoveryCore* pCore          ,
767                              sal_Bool      bBeforeRecovery);
768 
769         //---------------------------------------
770         /** @short TODO */
771         virtual ~BrokenRecoveryDialog();
772 
773         //---------------------------------------
774         /** @short TODO */
775         virtual sal_Bool isExecutionNeeded();
776 
777         //---------------------------------------
778         /** @short TODO */
779         virtual ::rtl::OUString getSaveDirURL();
780 
781     //-------------------------------------------
782     // helper
783     private:
784 
785         //---------------------------------------
786         /** @short TODO */
787         void impl_refresh();
788 
789         //---------------------------------------
790         /** @short TODO */
791         DECL_LINK(SaveButtonHdl, void*);
792 
793         //---------------------------------------
794         /** @short TODO */
795         DECL_LINK(OkButtonHdl, void*);
796 
797         //---------------------------------------
798         /** @short TODO */
799         DECL_LINK(CancelButtonHdl, void*);
800 
801         //---------------------------------------
802         /** @short TODO */
803         void impl_askForSavePath();
804 };
805 
806 
807 
808 		class ErrorRepWelcomeDialog : public IExtendedTabPage
809 		{
810 		private:
811 			Window				maTitleWin;
812 			FixedText			maTitleFT;
813             FixedLine           maTitleFL;
814 			FixedText			maDescrFT;
815 
816 			FixedLine			maBottomFL;
817 			PushButton			maPrevBtn;
818 			OKButton			maNextBtn;
819 			CancelButton		maCancelBtn;
820 
821 			DECL_LINK(			PrevBtnHdl, void* );
822 			DECL_LINK(			NextBtnHdl, void* );
823 			DECL_LINK(			CancelBtnHdl, void* );
824 		public:
825 								ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack = sal_True );
826 			virtual				~ErrorRepWelcomeDialog();
827         /** @short  TODO*/
828         virtual short execute();
829 
830         //---------------------------------------
831         /** @short  TODO*/
832         virtual void    setDefButton();
833 		};
834 
835 		struct ErrorRepParams
836 		{
837 			ErrorRepParams()
838 #ifdef WNT
839 				: miHTTPConnectionType( 0 )
840 #else
841 				: miHTTPConnectionType( 1 )
842 #endif
843 				, mbAllowContact( false )
844 			{}
845 
846 			String				maHTTPProxyServer;
847 			String				maHTTPProxyPort;
848 			int					miHTTPConnectionType;
849 			bool				mbAllowContact;
850 			String				maReturnAddress;
851 			String				maSubject;
852 			String				maBody;
853 		};
854 
855         class ErrorDescriptionEdit : public MultiLineEdit
856         {
857         private:
858                         DECL_LINK( ModifyHdl, void* );
859 
860         public:
861                         ErrorDescriptionEdit( Window* pParent, const ResId& rResId );
862             virtual     ~ErrorDescriptionEdit();
863         };
864 
865         class ErrorRepSendDialog : public IExtendedTabPage
866 		{
867 		private:
868 			Window				maTitleWin;
869 			FixedText			maTitleFT;
870             FixedLine           maTitleFL;
871 			FixedText			maDescrFT;
872 
873 			FixedText			maDocTypeFT;
874 			Edit				maDocTypeED;
875 			FixedText			maUsingFT;
876             ErrorDescriptionEdit maUsingML;
877 			PushButton			maShowRepBtn;
878 			PushButton			maOptBtn;
879 			CheckBox			maContactCB;
880 			FixedText			maEMailAddrFT;
881 			Edit				maEMailAddrED;
882 
883 			FixedLine			maBottomFL;
884 			PushButton			maPrevBtn;
885 			OKButton			maNextBtn;
886 			CancelButton		maCancelBtn;
887 
888 			ErrorRepParams		maParams;
889 
890 			DECL_LINK(			ShowRepBtnHdl, void* );
891 			DECL_LINK(			OptBtnHdl, void* );
892 			DECL_LINK(			ContactCBHdl, void* );
893 			DECL_LINK(			PrevBtnHdl, void* );
894 			DECL_LINK(			SendBtnHdl, void* );
895 			DECL_LINK(			CancelBtnHdl, void* );
896 
897             void                initControls();
898 
899 		public:
900 								ErrorRepSendDialog( Window* _pParent );
901 			virtual				~ErrorRepSendDialog();
902 
903 			String				GetDocType( void ) const;
904 			String				GetUsing( void ) const;
905 			bool				IsContactAllowed( void ) const;
906 			String				GetEMailAddress( void ) const;
907 
908 			bool				ReadParams();
909 			bool				SaveParams();
910 			bool				SendReport();
911 
912             /** @short  TODO*/
913             virtual short execute();
914 
915             //---------------------------------------
916             /** @short  TODO*/
917             virtual void    setDefButton();
918 		};
919 
920 		class ErrorRepOptionsDialog : public ModalDialog
921 		{
922 		private:
923 			FixedLine			maProxyFL;
924 			RadioButton			maSystemBtn;
925 			RadioButton			maDirectBtn;
926 			RadioButton			maManualBtn;
927 			FixedText			maProxyServerFT;
928 			Edit				maProxyServerEd;
929             FixedText           maProxyPortFT;
930             Edit                maProxyPortEd;
931             FixedText           maDescriptionFT;
932             FixedLine           maButtonsFL;
933             OKButton            maOKBtn;
934             CancelButton        maCancelBtn;
935 
936 			ErrorRepParams&		mrParams;
937 
938 			DECL_LINK(			CancelBtnHdl, void* );
939 			DECL_LINK(			OKBtnHdl, void * );
940 			DECL_LINK(			ManualBtnHdl, void * );
941 
942         public:
943 								ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& rParams );
944 			virtual				~ErrorRepOptionsDialog();
945 		};
946 
947         class ErrorRepEdit : public ExtMultiLineEdit
948         {
949         public:
950                         ErrorRepEdit( Window* pParent, const ResId& rResId );
951             virtual     ~ErrorRepEdit();
952         };
953 
954 		class ErrorRepPreviewDialog : public ModalDialog
955 		{
956 		private:
957             ErrorRepEdit        maContentML;
958             OKButton            maOKBtn;
959 
960             long                mnMinHeight;
961 
962         public:
963 								ErrorRepPreviewDialog( Window* _pParent );
964 			virtual				~ErrorRepPreviewDialog();
965 
966             virtual void        Resize();
967         };
968 	}	// namespace DocRecovery
969 }	// namespace svx
970 
971 #undef css
972 
973 #endif
974