summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/objserv.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-07-21 19:39:26 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-07-29 18:44:33 +0200
commit25b200ff79c71c831bc7e6fe8b1ec0b5315e96d6 (patch)
treeb8e7cc15bfe82b677fb1bfc791b3f2f5a50fdc79 /sfx2/source/doc/objserv.cxx
parentc762e3859973355b31f6676a8e697c5fd78c9970 (diff)
Simplify Sequence iterations in sfx2
Use range-based loops, STL and comphelper functions Change-Id: I6a0d18493db7a25e8b41925f2d45cb221b5065a7 Reviewed-on: https://gerrit.libreoffice.org/76074 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sfx2/source/doc/objserv.cxx')
-rw-r--r--sfx2/source/doc/objserv.cxx34
1 files changed, 15 insertions, 19 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 517d30a7c950..69e106319b16 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1134,17 +1134,17 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
// Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
bool bIsGoogleFile = false;
bool bCheckedOut = false;
- for ( sal_Int32 i = 0; i < aCmisProperties.getLength(); ++i )
+ for ( const auto& rCmisProperty : aCmisProperties )
{
- if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" )
+ if ( rCmisProperty.Id == "cmis:isVersionSeriesCheckedOut" )
{
uno::Sequence< sal_Bool > bTmp;
- aCmisProperties[i].Value >>= bTmp;
+ rCmisProperty.Value >>= bTmp;
bCheckedOut = bTmp[0];
}
// using title to know if it's a Google Drive file
// maybe there's a safer way.
- if ( aCmisProperties[i].Name == "title" )
+ if ( rCmisProperty.Name == "title" )
bIsGoogleFile = true;
}
bShow = !bCheckedOut && !bIsGoogleFile;
@@ -1168,17 +1168,14 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
// Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
- bool bFoundCheckedout = false;
bool bCheckedOut = false;
- for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
+ auto pProp = std::find_if(aCmisProperties.begin(), aCmisProperties.end(),
+ [](const document::CmisProperty& rProp) { return rProp.Id == "cmis:isVersionSeriesCheckedOut"; });
+ if (pProp != aCmisProperties.end())
{
- if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" )
- {
- bFoundCheckedout = true;
- uno::Sequence< sal_Bool > bTmp;
- aCmisProperties[i].Value >>= bTmp;
- bCheckedOut = bTmp[0];
- }
+ uno::Sequence< sal_Bool > bTmp;
+ pProp->Value >>= bTmp;
+ bCheckedOut = bTmp[0];
}
bShow = bCheckedOut;
}
@@ -1516,25 +1513,24 @@ SignatureState SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequen
{
bool bCertValid = true;
SignatureState nResult = SignatureState::NOSIGNATURES;
- int nInfos = aInfos.getLength();
bool bCompleteSignature = true;
- if( nInfos )
+ if( aInfos.hasElements() )
{
nResult = SignatureState::OK;
- for ( int n = 0; n < nInfos; n++ )
+ for ( const auto& rInfo : aInfos )
{
if ( bCertValid )
{
- sal_Int32 nCertStat = aInfos[n].CertificateStatus;
+ sal_Int32 nCertStat = rInfo.CertificateStatus;
bCertValid = nCertStat == security::CertificateValidity::VALID;
}
- if ( !aInfos[n].SignatureIsValid )
+ if ( !rInfo.SignatureIsValid )
{
nResult = SignatureState::BROKEN;
break; // we know enough
}
- bCompleteSignature &= !aInfos[n].PartialDocumentSignature;
+ bCompleteSignature &= !rInfo.PartialDocumentSignature;
}
}