From f0461e8360e13137c29dfcc1d20ba93e7bbd3073 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 14 Apr 2015 13:47:01 +0200 Subject: convert LOCKFILE_ constants to scoped enum and cleanup Change-Id: I9a2339cc953a718403b3cd0960d5d8d34abae455 Reviewed-on: https://gerrit.libreoffice.org/15304 Tested-by: Noel Grandin Reviewed-by: Noel Grandin --- sfx2/source/doc/docfile.cxx | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index cdd18ce638a2..8fff9b0f4001 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -823,7 +823,7 @@ void SfxMedium::SetEncryptionDataToStorage_Impl() // not for some URL scheme belongs in UCB, not here. -sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< OUString >& aData, bool bIsLoading, bool bOwnLock ) +sal_Int8 SfxMedium::ShowLockedDocumentDialog( const LockFileEntry& aData, bool bIsLoading, bool bOwnLock ) { sal_Int8 nResult = LOCK_UI_NOLOCK; @@ -838,27 +838,23 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< OUString >& a if ( bOwnLock ) { - if ( aData.getLength() > LOCKFILE_EDITTIME_ID ) - aInfo = aData[LOCKFILE_EDITTIME_ID]; + aInfo = aData[LockFileComponent::EDITTIME]; xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( document::OwnLockOnDocumentRequest( OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo, !bIsLoading ) ) ); } else /*logically therefore bIsLoading is set */ { - if ( aData.getLength() > LOCKFILE_EDITTIME_ID ) - { - if ( !aData[LOCKFILE_OOOUSERNAME_ID].isEmpty() ) - aInfo = aData[LOCKFILE_OOOUSERNAME_ID]; - else - aInfo = aData[LOCKFILE_SYSUSERNAME_ID]; + if ( !aData[LockFileComponent::OOOUSERNAME].isEmpty() ) + aInfo = aData[LockFileComponent::OOOUSERNAME]; + else + aInfo = aData[LockFileComponent::SYSUSERNAME]; - if ( !aInfo.isEmpty() && !aData[LOCKFILE_EDITTIME_ID].isEmpty() ) - { - aInfo += " ( " ; - aInfo += aData[LOCKFILE_EDITTIME_ID]; - aInfo += " )"; - } + if ( !aInfo.isEmpty() && !aData[LockFileComponent::EDITTIME].isEmpty() ) + { + aInfo += " ( " ; + aInfo += aData[LockFileComponent::EDITTIME]; + aInfo += " )"; } xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( @@ -1104,7 +1100,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) if ( !bResult ) { - uno::Sequence< OUString > aData; + LockFileEntry aData; try { // impossibility to get data is no real problem @@ -1118,14 +1114,12 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) if ( !bHandleSysLocked ) { - uno::Sequence< OUString > aOwnData = svt::LockFileCommon::GenerateOwnEntry(); - bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID - && aOwnData.getLength() > LOCKFILE_USERURL_ID - && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); + LockFileEntry aOwnData = svt::LockFileCommon::GenerateOwnEntry(); + bOwnLock = aOwnData[LockFileComponent::SYSUSERNAME].equals( aData[LockFileComponent::SYSUSERNAME] ); if ( bOwnLock - && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) - && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + && aOwnData[LockFileComponent::LOCALHOST].equals( aData[LockFileComponent::LOCALHOST] ) + && aOwnData[LockFileComponent::USERURL].equals( aData[LockFileComponent::USERURL] ) ) { // this is own lock from the same installation, it could remain because of crash bResult = true; -- cgit