Kaydet (Commit) ec7cc3e5 authored tarafından Noel Grandin's avatar Noel Grandin

convert EDocStates to o3tl::typed_flags

Change-Id: I56564932a96560f2113cdc98f389b6a7ede79cf5
Reviewed-on: https://gerrit.libreoffice.org/34203Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst dc2d33dd
...@@ -338,7 +338,7 @@ void RecoveryCore::doRecovery() ...@@ -338,7 +338,7 @@ void RecoveryCore::doRecovery()
} }
ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState) ERecoveryState RecoveryCore::mapDocState2RecoverState(EDocStates eDocState)
{ {
// ??? // ???
ERecoveryState eRecState = E_NOT_RECOVERED_YET; ERecoveryState eRecState = E_NOT_RECOVERED_YET;
...@@ -352,18 +352,18 @@ ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState) ...@@ -352,18 +352,18 @@ ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState)
// running ... // running ...
if ( if (
((eDocState & E_TRY_LOAD_BACKUP ) == E_TRY_LOAD_BACKUP ) || (eDocState & EDocStates::TryLoadBackup ) ||
((eDocState & E_TRY_LOAD_ORIGINAL) == E_TRY_LOAD_ORIGINAL) (eDocState & EDocStates::TryLoadOriginal)
) )
eRecState = E_RECOVERY_IS_IN_PROGRESS; eRecState = E_RECOVERY_IS_IN_PROGRESS;
// red // red
else if ((eDocState & E_DAMAGED) == E_DAMAGED) else if (eDocState & EDocStates::Damaged)
eRecState = E_RECOVERY_FAILED; eRecState = E_RECOVERY_FAILED;
// yellow // yellow
else if ((eDocState & E_INCOMPLETE) == E_INCOMPLETE) else if (eDocState & EDocStates::Incomplete)
eRecState = E_ORIGINAL_DOCUMENT_RECOVERED; eRecState = E_ORIGINAL_DOCUMENT_RECOVERED;
// green // green
else if ((eDocState & E_SUCCEDED) == E_SUCCEDED) else if (eDocState & EDocStates::Succeeded)
eRecState = E_SUCCESSFULLY_RECOVERED; eRecState = E_SUCCESSFULLY_RECOVERED;
return eRecState; return eRecState;
...@@ -398,7 +398,7 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a ...@@ -398,7 +398,7 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a
TURLInfo aNew; TURLInfo aNew;
aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , (sal_Int32)0 ); aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , (sal_Int32)0 );
aNew.DocState = lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , (sal_Int32)0 ); aNew.DocState = (EDocStates)lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , (sal_Int32)0 );
aNew.OrgURL = lInfo.getUnpackedValueOrDefault(STATEPROP_ORGURL , OUString()); aNew.OrgURL = lInfo.getUnpackedValueOrDefault(STATEPROP_ORGURL , OUString());
aNew.TempURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPURL , OUString()); aNew.TempURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPURL , OUString());
aNew.FactoryURL = lInfo.getUnpackedValueOrDefault(STATEPROP_FACTORYURL , OUString()); aNew.FactoryURL = lInfo.getUnpackedValueOrDefault(STATEPROP_FACTORYURL , OUString());
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <svtools/svlbitm.hxx> #include <svtools/svlbitm.hxx>
#include <svtools/svmedit2.hxx> #include <svtools/svmedit2.hxx>
#include <svtools/treelistbox.hxx> #include <svtools/treelistbox.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <com/sun/star/task/StatusIndicatorFactory.hpp> #include <com/sun/star/task/StatusIndicatorFactory.hpp>
...@@ -73,29 +74,32 @@ ...@@ -73,29 +74,32 @@
#define DLG_RET_OK_AUTOLUNCH 101 #define DLG_RET_OK_AUTOLUNCH 101
namespace svx{ enum class EDocStates
namespace DocRecovery{
enum EDocStates
{ {
/* TEMP STATES */ /* TEMP STATES */
/// default state, if a document was new created or loaded /// default state, if a document was new created or loaded
E_UNKNOWN = 0, Unknown = 0x000,
/** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */ /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */
E_TRY_LOAD_BACKUP = 16, TryLoadBackup = 0x010,
E_TRY_LOAD_ORIGINAL = 32, TryLoadOriginal = 0x020,
/* FINAL STATES */ /* FINAL STATES */
/// the Auto/Emergency saved document isn't useable any longer /// the Auto/Emergency saved document isn't useable any longer
E_DAMAGED = 64, Damaged = 0x040,
/// the Auto/Emergency saved document is not really up-to-date (some changes can be missing) /// the Auto/Emergency saved document is not really up-to-date (some changes can be missing)
E_INCOMPLETE = 128, Incomplete = 0x080,
/// the Auto/Emergency saved document was processed successfully /// the Auto/Emergency saved document was processed successfully
E_SUCCEDED = 512 Succeeded = 0x200
}; };
namespace o3tl {
template<> struct typed_flags<EDocStates> : is_typed_flags<EDocStates, 0x2f0> {};
}
namespace svx{
namespace DocRecovery{
enum ERecoveryState enum ERecoveryState
...@@ -134,7 +138,7 @@ struct TURLInfo ...@@ -134,7 +138,7 @@ struct TURLInfo
OUString Module; OUString Module;
/// state info as e.g. VALID, CORRUPTED, NON EXISTING ... /// state info as e.g. VALID, CORRUPTED, NON EXISTING ...
sal_Int32 DocState; EDocStates DocState;
/// ui representation for DocState! /// ui representation for DocState!
ERecoveryState RecoveryState; ERecoveryState RecoveryState;
...@@ -146,7 +150,7 @@ struct TURLInfo ...@@ -146,7 +150,7 @@ struct TURLInfo
TURLInfo() TURLInfo()
: ID (-1 ) : ID (-1 )
, DocState (E_UNKNOWN ) , DocState (EDocStates::Unknown)
, RecoveryState(E_NOT_RECOVERED_YET) , RecoveryState(E_NOT_RECOVERED_YET)
{} {}
}; };
...@@ -256,7 +260,7 @@ class RecoveryCore : public ::cppu::WeakImplHelper< css::frame::XStatusListener ...@@ -256,7 +260,7 @@ class RecoveryCore : public ::cppu::WeakImplHelper< css::frame::XStatusListener
/** @short TODO */ /** @short TODO */
static ERecoveryState mapDocState2RecoverState(sal_Int32 eDocState); static ERecoveryState mapDocState2RecoverState(EDocStates eDocState);
// uno interface // uno interface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment