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