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 _RECOVERYUI_HXX 29 #define _RECOVERYUI_HXX 30 31 //=============================================== 32 // includes 33 34 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 35 #include <com/sun/star/lang/XServiceInfo.hpp> 36 #include <com/sun/star/frame/XSynchronousDispatch.hpp> 37 #include <com/sun/star/task/XStatusIndicatorFactory.hpp> 38 #include <cppuhelper/implbase2.hxx> 39 #include <vcl/window.hxx> 40 #include "docrecovery.hxx" 41 42 //=============================================== 43 // namespace 44 45 namespace svx 46 { 47 48 // Dont export this header ... Otherwise you have to remove this namespace alias! 49 namespace css = ::com::sun::star; 50 namespace svxdr = ::svx::DocRecovery; 51 52 //=============================================== 53 // declarations 54 55 class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo , 56 css::frame::XSynchronousDispatch > // => XDispatch! 57 { 58 //------------------------------------------- 59 // const, types, etcpp. 60 private: 61 62 /** @short TODO */ 63 enum EJob 64 { 65 E_JOB_UNKNOWN, 66 E_DO_EMERGENCY_SAVE, 67 E_DO_RECOVERY, 68 E_DO_CRASHREPORT 69 }; 70 71 //------------------------------------------- 72 // member 73 private: 74 75 /** @short TODO */ 76 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; 77 78 /** @short TODO */ 79 Window* m_pParentWindow; 80 81 /** @short TODO */ 82 RecoveryUI::EJob m_eJob; 83 84 /** @short TODO */ 85 css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory; 86 87 //------------------------------------------- 88 // interface 89 public: 90 91 //--------------------------------------- 92 /** @short TODO */ 93 RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); 94 95 //--------------------------------------- 96 /** @short TODO */ 97 virtual ~RecoveryUI(); 98 99 //--------------------------------------- 100 // css.lang.XServiceInfo 101 102 virtual ::rtl::OUString SAL_CALL getImplementationName() 103 throw(css::uno::RuntimeException); 104 105 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName) 106 throw(css::uno::RuntimeException); 107 108 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 109 throw(css::uno::RuntimeException); 110 111 //--------------------------------------- 112 virtual com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue(const css::util::URL& aURL, 113 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) 114 throw(css::uno::RuntimeException); 115 116 //--------------------------------------- 117 // css.frame.XDispatch 118 119 virtual void SAL_CALL dispatch(const css::util::URL& aURL , 120 const css::uno::Sequence< css::beans::PropertyValue >& lArguments) 121 throw(css::uno::RuntimeException); 122 123 virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, 124 const css::util::URL& aURL ) 125 throw(css::uno::RuntimeException); 126 virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, 127 const css::util::URL& aURL ) 128 throw(css::uno::RuntimeException); 129 130 //--------------------------------------- 131 // XServiceInfo helper 132 133 static ::rtl::OUString st_getImplementationName(); 134 static css::uno::Sequence< ::rtl::OUString > st_getSupportedServiceNames(); 135 static css::uno::Reference< css::uno::XInterface > SAL_CALL st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); 136 137 //------------------------------------------- 138 // helper 139 private: 140 141 EJob impl_classifyJob(const css::util::URL& aURL); 142 143 sal_Bool impl_doEmergencySave(); 144 145 void impl_doRecovery(); 146 147 void impl_showAllRecoveredDocs(); 148 149 void impl_doCrashReport(); 150 151 }; 152 153 } // namespace svx 154 155 #endif // _RECOVERYUI_HXX 156