20#ifndef INCLUDED_SVX_SOURCE_INC_DOCRECOVERY_HXX
21#define INCLUDED_SVX_SOURCE_INC_DOCRECOVERY_HXX
27#include <com/sun/star/task/XStatusIndicator.hpp>
28#include <com/sun/star/frame/XStatusListener.hpp>
29#include <com/sun/star/frame/XDispatch.hpp>
30#include <com/sun/star/lang/XComponent.hpp>
31#include <com/sun/star/uno/XComponentContext.hpp>
34#define RECOVERY_CMDPART_PROTOCOL "vnd.sun.star.autorecovery:"
36#define RECOVERY_CMDPART_DO_EMERGENCY_SAVE "/doEmergencySave"
37#define RECOVERY_CMDPART_DO_RECOVERY "/doAutoRecovery"
38#define RECOVERY_CMDPART_DO_BRINGTOFRONT "/doBringToFront"
60#define RECOVERY_OPERATIONSTATE_START "start"
61#define RECOVERY_OPERATIONSTATE_STOP "stop"
62#define RECOVERY_OPERATIONSTATE_UPDATE "update"
64#define DLG_RET_UNKNOWN -1
65#define DLG_RET_OK RET_OK
66#define DLG_RET_CANCEL RET_CANCEL
67#define DLG_RET_OK_AUTOLUNCH 101
95 namespace DocRecovery{
178class RecoveryCore final :
public ::cppu::WeakImplHelper< css::frame::XStatusListener >
189 css::uno::Reference< css::uno::XComponentContext >
m_xContext;
218 RecoveryCore(css::uno::Reference< css::uno::XComponentContext > xContext,
219 bool bUsedForSaving);
245 void setProgressHandler(
const css::uno::Reference< css::task::XStatusIndicator >& xProgress);
266 virtual void SAL_CALL
statusChanged(
const css::frame::FeatureStateEvent& aEvent)
override;
269 virtual void SAL_CALL
disposing(
const css::lang::EventObject& aEvent)
override;
290class PluginProgress final :
public ::cppu::WeakImplHelper<css::task::XStatusIndicator, css::lang::XComponent>
305 virtual void SAL_CALL
start(
const OUString& sText, sal_Int32 nRange)
override;
306 virtual void SAL_CALL
end()
override;
307 virtual void SAL_CALL
setText(
const OUString& sText)
override;
309 virtual void SAL_CALL
reset()
override;
312 virtual void SAL_CALL
dispose()
override;
313 virtual void SAL_CALL
addEventListener(
const css::uno::Reference< css::lang::XEventListener >& xListener)
override;
314 virtual void SAL_CALL
removeEventListener(
const css::uno::Reference< css::lang::XEventListener >& xListener)
override;
380 virtual short run()
override;
385 virtual void end()
override;
439 virtual void end()
override;
476 bool bBeforeRecovery);
virtual ~BrokenRecoveryDialog() override
const OUString & getSaveDirURL() const
TODO.
DECL_LINK(OkButtonHdl, weld::Button &, void)
TODO.
DECL_LINK(CancelButtonHdl, weld::Button &, void)
TODO.
DECL_LINK(SaveButtonHdl, weld::Button &, void)
TODO.
void impl_askForSavePath()
TODO.
BrokenRecoveryDialog(weld::Window *pParent, RecoveryCore *pCore, bool bBeforeRecovery)
TODO.
std::unique_ptr< weld::Button > m_xSaveDirBtn
std::unique_ptr< weld::Button > m_xCancelBtn
bool isExecutionNeeded() const
TODO.
std::unique_ptr< weld::Entry > m_xSaveDirED
std::unique_ptr< weld::Button > m_xOkBtn
bool const m_bBeforeRecovery
std::unique_ptr< weld::TreeView > m_xFileListLB
virtual void updateItems()=0
~IRecoveryUpdateListener()
virtual void stepNext(TURLInfo *pItem)=0
PluginProgress(weld::ProgressBar *pProgressBar)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual void SAL_CALL setValue(sal_Int32 nValue) override
virtual void SAL_CALL setText(const OUString &sText) override
virtual void SAL_CALL start(const OUString &sText, sal_Int32 nRange) override
virtual void SAL_CALL reset() override
weld::ProgressBar * m_pProgressBar
virtual void SAL_CALL dispose() override
virtual ~PluginProgress() override
virtual void SAL_CALL end() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
IRecoveryUpdateListener * m_pListener
TODO.
css::uno::Reference< css::task::XStatusIndicator > m_xProgress
TODO.
TURLList & getURLListAccess()
TODO.
css::uno::Reference< css::uno::XComponentContext > m_xContext
TODO.
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
void saveBrokenTempEntries(const OUString &sSaveDir)
virtual ~RecoveryCore() override
TODO.
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &aEvent) override
void setUpdateListener(IRecoveryUpdateListener *pListener)
TODO.
void impl_stopListening()
stop listening on the internal EmergencySave/AutoRecovery core.
static ERecoveryState mapDocState2RecoverState(EDocStates eDocState)
TODO.
void forgetAllRecoveryEntriesMarkedForDiscard()
void impl_startListening()
starts listening on the internal EmergencySave/AutoRecovery core.
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
TODO.
void forgetAllRecoveryEntries()
void doEmergencySavePrepare()
TODO.
bool m_bListenForSaving
knows the reason, why we listen on our internal m_xRealCore member.
css::util::URL impl_getParsedURL(const OUString &sURL)
TODO.
void forgetBrokenRecoveryEntries()
void setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator > &xProgress)
TODO.
void saveAllTempEntries(const OUString &sSaveDir)
static bool isBrokenTempEntry(const TURLInfo &rInfo)
TODO.
void forgetBrokenTempEntries()
RecoveryCore(css::uno::Reference< css::uno::XComponentContext > xContext, bool bUsedForSaving)
TODO.
css::uno::Reference< css::frame::XDispatch > m_xRealCore
TODO.
DECL_LINK(NextButtonHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xCancelBtn
OUString m_aWillBeDiscStr
DECL_LINK(ToggleRowHdl, const weld::TreeView::iter_col &, void)
std::unique_ptr< weld::TreeView > m_xFileListLB
virtual void stepNext(TURLInfo *pItem) override
OUString m_aTitleRecoveryInProgress
virtual ~RecoveryDialog() override
RecoveryDialog(weld::Window *pParent, RecoveryCore *pCore)
TODO.
OUString impl_getStatusString(const TURLInfo &rInfo) const
@ E_RECOVERY_CANCELED_BEFORE
@ E_RECOVERY_CANCELED_AFTERWARDS
OUString m_aRecovFailedStr
OUString m_aRecovInProgrStr
OUString m_aSuccessRecovStr
virtual void updateItems() override
std::unique_ptr< weld::Button > m_xNextBtn
OUString m_aOrigDocRecovStr
static OUString impl_getStatusImage(const TURLInfo &rInfo)
bool m_bWasRecoveryStarted
std::unique_ptr< weld::ProgressBar > m_xProgressBar
OUString m_aNotRecovYetStr
OUString m_aRecoveryOnlyFinishDescr
css::uno::Reference< css::task::XStatusIndicator > m_xProgress
std::unique_ptr< weld::Label > m_xDescrFT
virtual void end() override
sal_Int32 m_eRecoveryState
OUString m_aRecoveryOnlyFinish
void impl_updateItemDescription(int row, const TriState &rState)
DECL_LINK(CancelButtonHdl, weld::Button &, void)
SaveDialog(weld::Window *pParent, RecoveryCore *pCore)
create all child controls of this dialog.
std::unique_ptr< weld::Button > m_xOkBtn
DECL_LINK(OKButtonHdl, weld::Button &, void)
virtual ~SaveDialog() override
std::unique_ptr< weld::TreeView > m_xFileListLB
virtual void updateItems() override
css::uno::Reference< css::task::XStatusIndicator > m_xProgress
virtual void end() override
std::unique_ptr< weld::ProgressBar > m_xProgressBar
SaveProgressDialog(weld::Window *pParent, RecoveryCore *pCore)
create all child controls of this dialog.
virtual short run() override
start the emergency save operation.
virtual ~SaveProgressDialog() override
virtual void stepNext(TURLInfo *pItem) override
std::pair< const TreeIter &, int > iter_col
constexpr OUStringLiteral RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE
constexpr OUStringLiteral RECOVERY_CMD_DO_EMERGENCY_SAVE
constexpr OUStringLiteral STATEPROP_ORGURL
constexpr OUStringLiteral STATEPROP_TEMPURL
constexpr OUStringLiteral STATEPROP_TITLE
constexpr OUStringLiteral RECOVERY_CMD_DO_ENTRY_BACKUP
constexpr OUStringLiteral STATEPROP_MODULE
constexpr OUStringLiteral STATEPROP_STATE
constexpr OUStringLiteral RECOVERY_CMD_DO_RECOVERY
constexpr OUStringLiteral STATEPROP_ID
constexpr OUStringLiteral RECOVERY_CMD_DO_ENTRY_CLEANUP
constexpr OUStringLiteral PROP_DISPATCHASYNCHRON
constexpr OUStringLiteral PROP_SAVEPATH
constexpr OUStringLiteral PROP_STATUSINDICATOR
constexpr OUStringLiteral STATEPROP_TEMPLATEURL
constexpr OUStringLiteral STATEPROP_FACTORYURL
constexpr OUStringLiteral PROP_ENTRYID
@ Incomplete
the Auto/Emergency saved document is not really up-to-date (some changes can be missing)
@ Succeeded
the Auto/Emergency saved document was processed successfully
@ TryLoadBackup
an action was started (saving/loading) ... Can be interesting later if the process may be was interru...
@ Damaged
the Auto/Emergency saved document isn't usable any longer
::std::vector< TURLInfo > TURLList
@ E_SUCCESSFULLY_RECOVERED
@ E_RECOVERY_IS_IN_PROGRESS
@ E_ORIGINAL_DOCUMENT_RECOVERED
bool ShouldDiscard
user choice to discard
OUString TemplateURL
may be the document base on a template file !?
ERecoveryState RecoveryState
ui representation for DocState!
OUString FactoryURL
a may be existing factory URL (e.g. for untitled documents)
OUString DisplayName
the pure file name, without path, disc etcpp.
OUString TempURL
the full qualified URL of the temp. file (if it's exists)
EDocStates DocState
state info as e.g. VALID, CORRUPTED, NON EXISTING ...
OUString StandardImageId
standard icon
OUString OrgURL
the full qualified document URL
OUString Module
the application module, where this document was loaded
sal_Int32 ID
unique ID, which is specified by the underlying autorecovery core!