diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-14 13:47:01 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-04-15 11:36:58 +0000 |
commit | f0461e8360e13137c29dfcc1d20ba93e7bbd3073 (patch) | |
tree | f50b6a25aeb7609f7bc11443bdb18bd2c343af66 /sc | |
parent | ba9acdf799bf556c8a20b1dc27eb116e23d481db (diff) |
convert LOCKFILE_ constants to scoped enum and cleanup
Change-Id: I9a2339cc953a718403b3cd0960d5d8d34abae455
Reviewed-on: https://gerrit.libreoffice.org/15304
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/sharedocdlg.cxx | 19 |
3 files changed, 23 insertions, 30 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 79ce486e6e6c..a422041945e6 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -793,17 +793,14 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) try { ::svt::DocumentLockFile aLockFile( GetSharedFileURL() ); - uno::Sequence< OUString > aData = aLockFile.GetLockData(); - if ( aData.getLength() > LOCKFILE_SYSUSERNAME_ID ) + LockFileEntry aData = aLockFile.GetLockData(); + if ( !aData[LockFileComponent::OOOUSERNAME].isEmpty() ) { - if ( !aData[LOCKFILE_OOOUSERNAME_ID].isEmpty() ) - { - aUserName = aData[LOCKFILE_OOOUSERNAME_ID]; - } - else if ( !aData[LOCKFILE_SYSUSERNAME_ID].isEmpty() ) - { - aUserName = aData[LOCKFILE_SYSUSERNAME_ID]; - } + aUserName = aData[LockFileComponent::OOOUSERNAME]; + } + else if ( !aData[LockFileComponent::SYSUSERNAME].isEmpty() ) + { + aUserName = aData[LockFileComponent::SYSUSERNAME]; } } catch ( uno::Exception& ) diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index a9dd15cf948b..4a9c0d7e8fb8 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -997,17 +997,14 @@ void ScDocShell::Execute( SfxRequest& rReq ) try { ::svt::DocumentLockFile aLockFile( GetSharedFileURL() ); - uno::Sequence< OUString > aData = aLockFile.GetLockData(); - if ( aData.getLength() > LOCKFILE_SYSUSERNAME_ID ) + LockFileEntry aData = aLockFile.GetLockData(); + if ( !aData[LockFileComponent::OOOUSERNAME].isEmpty() ) { - if ( !aData[LOCKFILE_OOOUSERNAME_ID].isEmpty() ) - { - aUserName = aData[LOCKFILE_OOOUSERNAME_ID]; - } - else if ( !aData[LOCKFILE_SYSUSERNAME_ID].isEmpty() ) - { - aUserName = aData[LOCKFILE_SYSUSERNAME_ID]; - } + aUserName = aData[LockFileComponent::OOOUSERNAME]; + } + else if ( !aData[LockFileComponent::SYSUSERNAME].isEmpty() ) + { + aUserName = aData[LockFileComponent::SYSUSERNAME]; } } catch ( uno::Exception& ) diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index d934ff77ea27..911b74d3d1d8 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -135,9 +135,8 @@ void ScShareDocumentDlg::UpdateView() try { ::svt::ShareControlFile aControlFile( mpDocShell->GetSharedFileURL() ); - uno::Sequence< uno::Sequence< OUString > > aUsersData = aControlFile.GetUsersData(); - const uno::Sequence< OUString >* pUsersData = aUsersData.getConstArray(); - sal_Int32 nLength = aUsersData.getLength(); + std::vector<LockFileEntry> aUsersData = aControlFile.GetUsersData(); + sal_Int32 nLength = aUsersData.size(); if ( nLength > 0 ) { @@ -145,24 +144,24 @@ void ScShareDocumentDlg::UpdateView() for ( sal_Int32 i = 0; i < nLength; ++i ) { - if ( pUsersData[i].getLength() > SHARED_EDITTIME_ID ) + if ( !aUsersData[i][LockFileComponent::EDITTIME].isEmpty() ) { OUString aUser; - if ( !pUsersData[i][SHARED_OOOUSERNAME_ID].isEmpty() ) + if ( !aUsersData[i][LockFileComponent::OOOUSERNAME].isEmpty() ) { - aUser = pUsersData[i][SHARED_OOOUSERNAME_ID]; + aUser = aUsersData[i][LockFileComponent::OOOUSERNAME]; } - else if ( !pUsersData[i][SHARED_SYSUSERNAME_ID].isEmpty() ) + else if ( !aUsersData[i][LockFileComponent::SYSUSERNAME].isEmpty() ) { - aUser = pUsersData[i][SHARED_SYSUSERNAME_ID]; + aUser = aUsersData[i][LockFileComponent::SYSUSERNAME]; } else { - aUser = OUString(m_aStrUnknownUser) + " " + OUString::number( nUnknownUser++ ); + aUser = m_aStrUnknownUser + " " + OUString::number( nUnknownUser++ ); } // parse the edit time string of the format "DD.MM.YYYY hh:mm" - OUString aDateTimeStr = pUsersData[i][SHARED_EDITTIME_ID]; + OUString aDateTimeStr = aUsersData[i][LockFileComponent::EDITTIME]; sal_Int32 nIndex = 0; OUString aDateStr = aDateTimeStr.getToken( 0, ' ', nIndex ); OUString aTimeStr = aDateTimeStr.getToken( 0, ' ', nIndex ); |