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