From cc65d9fe56dbbf77ed48d5dacd9d1a11a450e5a6 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 12 Dec 2011 15:00:25 +0100 Subject: [PATCH] pptx: fix custom shape equations import - guide names can be reused and in that case current one used in following equations is the last one --- oox/source/drawingml/customshapeproperties.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 77eb2967f169..c433d7630774 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -84,14 +84,16 @@ sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< CustomSh // if the return value is < 0 then the guide value could not be found sal_Int32 CustomShapeProperties::GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const rtl::OUString& rFormulaName ) { - sal_Int32 nIndex = 0; - for( ; nIndex < static_cast< sal_Int32 >( rGuideList.size() ); nIndex++ ) + // traverse the list from the end, because guide names can be reused + // and current is the last one + // see a1 guide in gear6 custom shape preset as example + sal_Int32 nIndex = static_cast< sal_Int32 >( rGuideList.size() ) - 1; + for( ; nIndex >= 0; nIndex-- ) { if ( rGuideList[ nIndex ].maName == rFormulaName ) break; } - if ( nIndex == static_cast< sal_Int32 >( rGuideList.size() ) ) - nIndex = -1; + return nIndex; }