summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2023-07-03 15:30:04 +0100
committerHossein <hossein@libreoffice.org>2023-12-09 00:47:13 +0100
commit4a49d7a3a98ccdca52ea0a4475d05235a111ec0a (patch)
tree0a65e31f04e30c712aa7f70e328bf4d2f10cf31a /svx/source/svdraw
parent82f30ac55a90a0f0915d4016c760c5c38db087f1 (diff)
tdf#147021 Use std::span to avoid SAL_N_ELEMENTS in CustomShape
as for previous set, this time for Calculations. Again the size is mostly mechanical: In vim load into a: :+4,+4s/const_cast<SvxMSDffCalculationData\*>[(]\([^)]*\)[)],.*/o3tl::span<const SvxMSDffCalculatinoData>(\1),/ :+4,+4s/nullptr, 0/o3tl::span<const SvxMSDffCalculationData>() and run :%g/^const mso_C.*=/@a (But has had some fixups after conversion from o3tl to std) Change-Id: I11cdfffdfb61678c173d3136a8e948fd0c224af7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153884 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdoashp.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 609d245e7857..9cb5cffb3f5d 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1036,14 +1036,16 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
// Equations
static constexpr OUString sEquations( u"Equations"_ustr );
pAny = aGeometryItem.GetPropertyValueByName( sEquations );
- if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
+ if (!pAny && pDefCustomShape && !pDefCustomShape->pCalculation.empty() )
{
- sal_Int32 i, nCount = pDefCustomShape->nCalculation;
+ sal_Int32 i, nCount = pDefCustomShape->pCalculation.size();
uno::Sequence< OUString > seqEquations( nCount );
auto pseqEquations = seqEquations.getArray();
- const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
- for ( i = 0; i < nCount; i++, pData++ )
+ for (i = 0; i < nCount; i++)
+ {
+ const SvxMSDffCalculationData* pData = &pDefCustomShape->pCalculation[i];
pseqEquations[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
+ }
aPropVal.Name = sEquations;
aPropVal.Value <<= seqEquations;
aGeometryItem.SetPropertyValue( aPropVal );
@@ -1274,24 +1276,26 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::Equations :
{
pAny = rGeometryItem.GetPropertyValueByName( "Equations" );
- if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
+ if (pAny && pDefCustomShape && !pDefCustomShape->pCalculation.empty())
{
uno::Sequence<OUString> seqEquations1;
if ( *pAny >>= seqEquations1 )
{
- sal_Int32 i, nCount = pDefCustomShape->nCalculation;
+ sal_Int32 i, nCount = pDefCustomShape->pCalculation.size();
uno::Sequence<OUString> seqEquations2( nCount );
auto pseqEquations2 = seqEquations2.getArray();
- const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
- for ( i = 0; i < nCount; i++, pData++ )
+ for (i = 0; i < nCount; i++)
+ {
+ const SvxMSDffCalculationData* pData = &pDefCustomShape->pCalculation[i];
pseqEquations2[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
+ }
if ( seqEquations1 == seqEquations2 )
bIsDefaultGeometry = true;
}
}
- else if ( pDefCustomShape && ( ( pDefCustomShape->nCalculation == 0 ) || ( pDefCustomShape->pCalculation == nullptr ) ) )
+ else if (pDefCustomShape && pDefCustomShape->pCalculation.empty())
bIsDefaultGeometry = true;
}
break;