summaryrefslogtreecommitdiff
path: root/oox/source/vml/vmlshape.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-08-12 23:07:08 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-08-27 12:58:33 +0200
commit36543fc426f0358086484f9b8e439cf051d0e12b (patch)
treedac91006fb5b9a902e2bfee05099a8ebe4c1fa71 /oox/source/vml/vmlshape.cxx
parentb742b4d7f1f3bb6e1fce45ccf5d885e587e01801 (diff)
Simplify Sequence iterations in oox
Use range-based loops, STL and comphelper functions Change-Id: Ic3a186e7381bd8391ab85a2602a30f06fe5db740 Reviewed-on: https://gerrit.libreoffice.org/78089 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'oox/source/vml/vmlshape.cxx')
-rw-r--r--oox/source/vml/vmlshape.cxx55
1 files changed, 23 insertions, 32 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index eca5399bf72c..c21471e5c475 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1263,32 +1263,31 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
embed::ElementModes::READ);
SAL_WARN_IF(!xStorage.is(), "oox.vml", "No xStorage!");
- uno::Sequence<security::DocumentSignatureInformation> xSignatureInfo
+ const uno::Sequence<security::DocumentSignatureInformation> xSignatureInfo
= xSignatures->verifyScriptingContentSignatures(xStorage,
uno::Reference<io::XInputStream>());
- for (int i = 0; i < xSignatureInfo.getLength(); i++)
+ // Try to find matching signature line image - if none exists that is fine,
+ // then the signature line is not digitally signed.
+ auto pSignInfo = std::find_if(xSignatureInfo.begin(), xSignatureInfo.end(),
+ [this](const security::DocumentSignatureInformation& rSigInfo) {
+ return rSigInfo.SignatureLineId == getShapeModel().maSignatureId; });
+ if (pSignInfo != xSignatureInfo.end())
{
- // Try to find matching signature line image - if none exists that is fine,
- // then the signature line is not digitally signed.
- if (xSignatureInfo[i].SignatureLineId == getShapeModel().maSignatureId)
+ bIsSigned = true;
+ if (pSignInfo->SignatureIsValid)
{
- bIsSigned = true;
- if (xSignatureInfo[i].SignatureIsValid)
- {
- // Signature is valid, use the 'valid' image
- SAL_WARN_IF(!xSignatureInfo[i].ValidSignatureLineImage.is(), "oox.vml",
- "No ValidSignatureLineImage!");
- xGraphic = xSignatureInfo[i].ValidSignatureLineImage;
- }
- else
- {
- // Signature is invalid, use the 'invalid' image
- SAL_WARN_IF(!xSignatureInfo[i].InvalidSignatureLineImage.is(), "oox.vml",
- "No InvalidSignatureLineImage!");
- xGraphic = xSignatureInfo[i].InvalidSignatureLineImage;
- }
- break;
+ // Signature is valid, use the 'valid' image
+ SAL_WARN_IF(!pSignInfo->ValidSignatureLineImage.is(), "oox.vml",
+ "No ValidSignatureLineImage!");
+ xGraphic = pSignInfo->ValidSignatureLineImage;
+ }
+ else
+ {
+ // Signature is invalid, use the 'invalid' image
+ SAL_WARN_IF(!pSignInfo->InvalidSignatureLineImage.is(), "oox.vml",
+ "No InvalidSignatureLineImage!");
+ xGraphic = pSignInfo->InvalidSignatureLineImage;
}
}
}
@@ -1418,17 +1417,9 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >
beans::PropertyValue aPair;
aPair.Name = "mso-edit-as";
aPair.Value <<= maTypeModel.maEditAs;
- if (aGrabBag.hasElements())
- {
- sal_Int32 nLength = aGrabBag.getLength();
- aGrabBag.realloc(nLength + 1);
- aGrabBag[nLength] = aPair;
- }
- else
- {
- aGrabBag.realloc(1);
- aGrabBag[0] = aPair;
- }
+ sal_Int32 nLength = aGrabBag.getLength();
+ aGrabBag.realloc(nLength + 1);
+ aGrabBag[nLength] = aPair;
xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag));
}
// Make sure group shapes are inline as well, unless there is an explicit different style.