chart2/source/controller/main/ChartController.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 3a0c25d65f7c034eace5dd0aee7d36e24277bfa7
Author: Stephan Bergmann <[email protected]>
Date:   Fri Oct 21 17:10:25 2016 +0200

    Only call getChartType when the return value is actually used
    
    Change-Id: I687ef0ce7013bce08caa25e1e6035507b814e20a

diff --git a/chart2/source/controller/main/ChartController.cxx 
b/chart2/source/controller/main/ChartController.cxx
index ce70a16..c79a917 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -311,8 +311,6 @@ OUString ChartController::GetContextName()
         return OUString("Chart");
 
     ObjectType eObjectID = ObjectIdentifier::getObjectType(aCID);
-
-    css::uno::Reference<css::chart2::XChartType> xChartType = 
getChartType(css::uno::Reference<css::chart2::XChartDocument>(getModel(), 
uno::UNO_QUERY));
     switch (eObjectID)
     {
         case OBJECTTYPE_DATA_SERIES:
@@ -327,9 +325,12 @@ OUString ChartController::GetContextName()
         case OBJECTTYPE_GRID:
             return OUString("Grid");
         case OBJECTTYPE_DIAGRAM:
-            if (xChartType.is() && xChartType->getChartType() == 
"com.sun.star.chart2.PieChartType")
-                return OUString("ChartElements");
-            break;
+            {
+                css::uno::Reference<css::chart2::XChartType> xChartType = 
getChartType(css::uno::Reference<css::chart2::XChartDocument>(getModel(), 
uno::UNO_QUERY));
+                if (xChartType.is() && xChartType->getChartType() == 
"com.sun.star.chart2.PieChartType")
+                    return OUString("ChartElements");
+                break;
+            }
         case OBJECTTYPE_DATA_CURVE:
         case OBJECTTYPE_DATA_AVERAGE_LINE:
             return OUString("Trendline");
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to