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>
This commit is contained in:
parent
82f30ac55a
commit
4a49d7a3a9
3 changed files with 202 additions and 200 deletions
|
@ -73,8 +73,7 @@ struct mso_CustomShape
|
|||
std::span<const SvxMSDffVertPair> pVertices;
|
||||
sal_uInt16* pElements;
|
||||
sal_uInt32 nElements;
|
||||
SvxMSDffCalculationData* pCalculation;
|
||||
sal_uInt32 nCalculation;
|
||||
std::span<const SvxMSDffCalculationData> pCalculation;
|
||||
sal_Int32* pDefData;
|
||||
SvxMSDffTextRectangles* pTextRect;
|
||||
sal_uInt32 nTextRect;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue