summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-03 15:59:06 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-03 16:00:21 +0200
commit749a0845500d69f99bf1901bab82361f67b5e4f6 (patch)
treeb758bc7dff18029881e1a9c8f3881ce117dadfd6
parentc70c4d203340999fc039838cc487d3e4c28d2f79 (diff)
don't show area and line panel in pie chart Chart selection, tdf#94320
Change-Id: I0eacedbb3d96a059278bab0ef98a66ed49b827fc
-rw-r--r--chart2/source/controller/main/ChartController.cxx27
-rw-r--r--include/sfx2/sidebar/EnumContext.hxx1
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu6
-rw-r--r--sfx2/source/sidebar/EnumContext.cxx1
4 files changed, 34 insertions, 1 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index c5999ac63f2c..045837e7ccfd 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 d9dbe80fdff7..080a81836013 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 8de92bc3516e..ecfd7d32a82a 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 ba5e655d6d9e..7af70d9ad4d9 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);