xmloff/source/chart/SchXMLExport.cxx |   63 ++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 33 deletions(-)

New commits:
commit c80cbceeed44132320811d9e5f265417447bab5c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Nov 22 14:05:28 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Nov 22 16:55:00 2024 +0100

    PVS: V547 Expression '!aPropertyStates.empty()' is always true.
    
    Identified by M. Kaganski
    
    Change-Id: I02c3ab0ec29367ebc2e73586044d729eab24231d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177029
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index e2780ee0b684..4e3fa02b7651 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3152,47 +3152,44 @@ void SchXMLExportHelper_Impl::exportRegressionCurve(
             }
         }
 
-        if( !aPropertyStates.empty() || bExportEquation )
+        // write element
+        if( bExportContent )
         {
-            // write element
-            if( bExportContent )
+            // add style name attribute
+            AddAutoStyleAttribute( aPropertyStates );
+
+            SvXMLElementExport aRegressionExport( mrExport, 
XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true );
+            if( bExportEquation )
             {
-                // add style name attribute
-                AddAutoStyleAttribute( aPropertyStates );
+                mrExport.AddAttribute( XML_NAMESPACE_CHART, 
XML_DISPLAY_EQUATION, (bShowEquation ? XML_TRUE : XML_FALSE) );
+                mrExport.AddAttribute( XML_NAMESPACE_CHART, 
XML_DISPLAY_R_SQUARE, (bShowRSquared ? XML_TRUE : XML_FALSE) );
 
-                SvXMLElementExport aRegressionExport( mrExport, 
XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true );
-                if( bExportEquation )
+                // export position
+                chart2::RelativePosition aRelativePosition;
+                if( xEquationProperties->getPropertyValue( 
u"RelativePosition"_ustr ) >>= aRelativePosition )
                 {
-                    mrExport.AddAttribute( XML_NAMESPACE_CHART, 
XML_DISPLAY_EQUATION, (bShowEquation ? XML_TRUE : XML_FALSE) );
-                    mrExport.AddAttribute( XML_NAMESPACE_CHART, 
XML_DISPLAY_R_SQUARE, (bShowRSquared ? XML_TRUE : XML_FALSE) );
-
-                    // export position
-                    chart2::RelativePosition aRelativePosition;
-                    if( xEquationProperties->getPropertyValue( 
u"RelativePosition"_ustr ) >>= aRelativePosition )
-                    {
-                        double fX = aRelativePosition.Primary * 
rPageSize.Width;
-                        double fY = aRelativePosition.Secondary * 
rPageSize.Height;
-                        awt::Point aPos;
-                        aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( 
fX ));
-                        aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( 
fY ));
-                        addPosition( aPos );
-                    }
-
-                    if( !aEquationPropertyStates.empty())
-                    {
-                        AddAutoStyleAttribute( aEquationPropertyStates );
-                    }
+                    double fX = aRelativePosition.Primary * rPageSize.Width;
+                    double fY = aRelativePosition.Secondary * rPageSize.Height;
+                    awt::Point aPos;
+                    aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX 
));
+                    aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY 
));
+                    addPosition( aPos );
+                }
 
-                    SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, 
XML_EQUATION, true, true );
+                if( !aEquationPropertyStates.empty())
+                {
+                    AddAutoStyleAttribute( aEquationPropertyStates );
                 }
+
+                SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, 
XML_EQUATION, true, true );
             }
-            else    // autostyles
+        }
+        else    // autostyles
+        {
+            CollectAutoStyle( std::move(aPropertyStates) );
+            if( bExportEquation && !aEquationPropertyStates.empty())
             {
-                CollectAutoStyle( std::move(aPropertyStates) );
-                if( bExportEquation && !aEquationPropertyStates.empty())
-                {
-                    CollectAutoStyle( std::move(aEquationPropertyStates) );
-                }
+                CollectAutoStyle( std::move(aEquationPropertyStates) );
             }
         }
     }

Reply via email to