xref: /aoo42x/main/svx/source/inc/recoveryui.hxx (revision 3334a7e6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _RECOVERYUI_HXX
25 #define _RECOVERYUI_HXX
26 
27 //===============================================
28 // includes
29 
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/frame/XSynchronousDispatch.hpp>
33 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
34 #include <cppuhelper/implbase2.hxx>
35 #include <vcl/window.hxx>
36 #include "docrecovery.hxx"
37 
38 //===============================================
39 // namespace
40 
41 namespace svx
42 {
43 
44 // Dont export this header ... Otherwise you have to remove this namespace alias!
45 namespace css   = ::com::sun::star;
46 namespace svxdr = ::svx::DocRecovery;
47 
48 //===============================================
49 // declarations
50 
51 class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo        ,
52                                                    css::frame::XSynchronousDispatch > // => XDispatch!
53 {
54     //-------------------------------------------
55     // const, types, etcpp.
56     private:
57 
58         /** @short TODO */
59         enum EJob
60         {
61             E_JOB_UNKNOWN,
62             E_DO_EMERGENCY_SAVE,
63             E_DO_RECOVERY,
64             E_DO_CRASHREPORT
65         };
66 
67     //-------------------------------------------
68     // member
69     private:
70 
71         /** @short TODO */
72         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
73 
74         /** @short TODO */
75         Window* m_pParentWindow;
76 
77         /** @short TODO */
78         RecoveryUI::EJob m_eJob;
79 
80         /** @short TODO */
81         css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory;
82 
83     //-------------------------------------------
84     // interface
85     public:
86 
87         //---------------------------------------
88         /** @short  TODO */
89         RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
90 
91         //---------------------------------------
92         /** @short  TODO */
93         virtual ~RecoveryUI();
94 
95         //---------------------------------------
96         // css.lang.XServiceInfo
97 
98         virtual ::rtl::OUString SAL_CALL getImplementationName()
99             throw(css::uno::RuntimeException);
100 
101         virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
102             throw(css::uno::RuntimeException);
103 
104         virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
105             throw(css::uno::RuntimeException);
106 
107         //---------------------------------------
108         virtual com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue(const css::util::URL& aURL,
109                                             const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
110             throw(css::uno::RuntimeException);
111 
112         //---------------------------------------
113         // css.frame.XDispatch
114 
115         virtual void SAL_CALL dispatch(const css::util::URL&                                  aURL      ,
116                                        const css::uno::Sequence< css::beans::PropertyValue >& lArguments)
117             throw(css::uno::RuntimeException);
118 
119         virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
120                                                 const css::util::URL&                                     aURL     )
121             throw(css::uno::RuntimeException);
122         virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
123                                                    const css::util::URL&                                     aURL     )
124             throw(css::uno::RuntimeException);
125 
126         //---------------------------------------
127         // XServiceInfo helper
128 
129         static ::rtl::OUString st_getImplementationName();
130         static css::uno::Sequence< ::rtl::OUString > st_getSupportedServiceNames();
131         static css::uno::Reference< css::uno::XInterface > SAL_CALL st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
132 
133     //-------------------------------------------
134     // helper
135     private:
136 
137         EJob impl_classifyJob(const css::util::URL& aURL);
138 
139         sal_Bool impl_doEmergencySave();
140 
141         void impl_doRecovery();
142 
143 		void impl_showAllRecoveredDocs();
144 
145         void impl_doCrashReport();
146 
147 };
148 
149 } // namespace svx
150 
151 #endif // _RECOVERYUI_HXX
152