summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-16 18:44:23 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-16 22:18:09 +0200
commit75d50b7189bf9fb37d3024fa5765dfb22ca6fce6 (patch)
tree916c1d1368daba2effc30893fdda453475310962
parentd4d56067b7e0d654701912a3fd54cf2b452a8d28 (diff)
generate correct sidebar context strings for charts
Change-Id: I92adf79c461f3536475da318e03b60f2e1adc08f
-rw-r--r--chart2/source/controller/inc/ChartController.hxx2
-rw-r--r--chart2/source/controller/main/ChartController.cxx30
2 files changed, 29 insertions, 3 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index e15f8c6e5658..00d297bd62cc 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -153,7 +153,7 @@ public:
::com::sun::star::uno::XComponentContext > const & xContext);
virtual ~ChartController();
- static OUString GetContextName();
+ OUString GetContextName();
// ::com::sun::star::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName()
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index a7a92f1548d9..056e7214ecac 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -73,6 +73,8 @@
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <boost/bind.hpp>
+
// this is needed to properly destroy the unique_ptr to the AcceleratorExecute
// object in the DTOR
#include <svtools/acceleratorexecute.hxx>
@@ -114,8 +116,8 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const &
m_aDispatchContainer( m_xCC, this ),
m_eDrawMode( CHARTDRAW_SELECT ),
mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
- &ChartController::GetContextName, this,
- sfx2::sidebar::EnumContext::Context_Cell))
+ ::boost::bind(&ChartController::GetContextName, this),
+ this, sfx2::sidebar::EnumContext::Context_Cell))
{
m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) );
}
@@ -296,6 +298,30 @@ bool ChartController::TheModelRef::is() const
OUString ChartController::GetContextName()
{
+ uno::Any aAny = getSelection();
+ if (!aAny.hasValue())
+ return OUString("Chart");
+
+ OUString aCID;
+ aAny >>= aCID;
+
+ if (aCID.isEmpty())
+ return OUString("Chart");
+
+ ObjectType eObjectID = ObjectIdentifier::getObjectType(aCID);
+ switch (eObjectID)
+ {
+ case OBJECTTYPE_DATA_SERIES:
+ return OUString("Series");
+ break;
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ return OUString("ErrorBar");
+ default:
+ break;
+ }
+
return OUString("Chart");
}