don't show area and line panel in pie chart Chart selection, tdf#94320

Change-Id: I0eacedbb3d96a059278bab0ef98a66ed49b827fc
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index c5999ac..045837e 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -61,6 +61,8 @@
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <com/sun/star/document/XUndoAction.hpp>
#include <com/sun/star/ui/XSidebar.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>

#include <svx/sidebar/SelectionChangeHandler.hxx>
#include <vcl/msgbox.hxx>
@@ -298,6 +300,26 @@ bool ChartController::TheModelRef::is() const
    return (m_pTheModel != 0);
}

namespace {

css::uno::Reference<css::chart2::XChartType> getChartType(
        css::uno::Reference<css::chart2::XChartDocument> xChartDoc)
{
    Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();

    Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY_THROW );

    Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());

    Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[0], uno::UNO_QUERY_THROW );

    Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );

    return xChartTypeSequence[0];
}

}

OUString ChartController::GetContextName()
{
    if (m_bDisposed)
@@ -314,6 +336,8 @@ 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_THROW));
    switch (eObjectID)
    {
        case OBJECTTYPE_DATA_SERIES:
@@ -327,6 +351,9 @@ OUString ChartController::GetContextName()
            return OUString("Axis");
        case OBJECTTYPE_GRID:
            return OUString("Grid");
        case OBJECTTYPE_DIAGRAM:
            if (xChartType->getChartType() == "com.sun.star.chart2.PieChartType")
                return OUString("ChartElements");
        default:
        break;
    }
diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx
index d9dbe80..080a818 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/sfx2/sidebar/EnumContext.hxx
@@ -69,6 +69,7 @@ public:
        Context_Axis,
        Context_Cell,
        Context_Chart,
        Context_ChartElements,
        Context_Draw,
        Context_DrawLine,
        Context_DrawPage,
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index 8de92bc..ecfd7d3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -1307,7 +1307,11 @@
        </prop>
        <prop oor:name="ContextList">
          <value oor:separator=";">
            Chart, any, visible ;
            Chart, Chart, visible ;
            Chart, Series, visible ;
            Chart, ErrorBar, visible ;
            Chart, Axis, visible ;
            Chart, Grid, visible ;
          </value>
        </prop>
        <prop oor:name="ImplementationURL" oor:type="xs:string">
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx
index ba5e655..7af70d9 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -179,6 +179,7 @@ void EnumContext::ProvideContextContainers()
        AddContext(Cell);
        AddContext(Chart);
        AddContext(Chart);
        AddContext(ChartElements);
        AddContext(Draw);
        AddContext(DrawLine);
        AddContext(DrawPage);