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

Change-Id: I0eacedbb3d96a059278bab0ef98a66ed49b827fc
This commit is contained in:
Markus Mohrhard
2015-10-03 15:59:06 +02:00
parent c70c4d2033
commit 749a084550
4 changed files with 34 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -69,6 +69,7 @@ public:
Context_Axis,
Context_Cell,
Context_Chart,
Context_ChartElements,
Context_Draw,
Context_DrawLine,
Context_DrawPage,

View File

@@ -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">

View File

@@ -179,6 +179,7 @@ void EnumContext::ProvideContextContainers()
AddContext(Cell);
AddContext(Chart);
AddContext(Chart);
AddContext(ChartElements);
AddContext(Draw);
AddContext(DrawLine);
AddContext(DrawPage);