summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-07-15 10:31:39 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-07-16 18:27:13 +0200
commit8781dbe09981bbca4b5ed792fdb6c82dc1b17d27 (patch)
treeef90343665579d2f5c760c2dfbb3a8066b042662 /chart2
parent01767d5d9d43d4ef4bd948f00a1cd2c113714b20 (diff)
uitest: provide all the children for charts
This now also includes legend entries and data points. Change-Id: I0e4d1f21a20035cd632a7755dbbea17baec4b083
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/inc/ChartController.hxx2
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx5
-rw-r--r--chart2/source/controller/uitest/uiobject.cxx39
3 files changed, 37 insertions, 9 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 810788f8bd61..00833b42bb5c 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -378,6 +378,8 @@ public:
DECL_LINK_TYPED( NotifyUndoActionHdl, SdrUndoAction*, void );
+ css::uno::Reference<css::uno::XInterface> getChartView();
+
private:
DrawViewWrapper* GetDrawViewWrapper();
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 40f196f5935a..944e8762d5aa 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1969,6 +1969,11 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
m_pChartWindow->SetPointer( Pointer( PointerStyle::Arrow ));
}
+css::uno::Reference<css::uno::XInterface> ChartController::getChartView()
+{
+ return m_xChartView;
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/uitest/uiobject.cxx b/chart2/source/controller/uitest/uiobject.cxx
index 5ed1dd1b6781..d686d89aa9d8 100644
--- a/chart2/source/controller/uitest/uiobject.cxx
+++ b/chart2/source/controller/uitest/uiobject.cxx
@@ -12,6 +12,7 @@
#include "ChartWindow.hxx"
#include "ChartController.hxx"
#include "ObjectHierarchy.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
#include <algorithm>
@@ -63,22 +64,42 @@ std::unique_ptr<UIObject> ChartWindowUIObject::get_child(const OUString& /*rID*/
return nullptr;
}
-std::set<OUString> ChartWindowUIObject::get_children() const
-{
- std::set<OUString> aChildren;
+namespace {
- css::uno::Reference< css::chart2::XChartDocument > xChartDoc( mxChartWindow->GetController()->getModel(), css::uno::UNO_QUERY );
- chart::ObjectHierarchy aHierarchy(xChartDoc, nullptr, true);
- chart::ObjectIdentifier aIdentifier = aHierarchy.getRootNodeOID();
- aChildren.insert(aIdentifier.getObjectCID());
- std::vector<chart::ObjectIdentifier> aChildIndentifiers = aHierarchy.getChildren(aIdentifier);
- std::transform(aChildIndentifiers.begin(), aChildIndentifiers.end(), std::inserter(aChildren, aChildren.begin()),
+void recursiveAdd(chart::ObjectIdentifier& rID, std::set<OUString>& rChildren, const chart::ObjectHierarchy& rHierarchy)
+{
+ std::vector<chart::ObjectIdentifier> aChildIndentifiers = rHierarchy.getChildren(rID);
+ std::transform(aChildIndentifiers.begin(), aChildIndentifiers.end(), std::inserter(rChildren, rChildren.begin()),
[](const chart::ObjectIdentifier& rObject)
{
return rObject.getObjectCID();
}
);
+ for (chart::ObjectIdentifier& ID: aChildIndentifiers)
+ recursiveAdd(ID, rChildren, rHierarchy);
+}
+
+}
+
+std::set<OUString> ChartWindowUIObject::get_children() const
+{
+ std::set<OUString> aChildren;
+
+ chart::ChartController* pController = mxChartWindow->GetController();
+ if (!pController)
+ return aChildren;
+
+ css::uno::Reference< css::chart2::XChartDocument > xChartDoc( pController->getModel(), css::uno::UNO_QUERY );
+
+ css::uno::Reference<css::uno::XInterface> xChartView = pController->getChartView();
+ chart::ExplicitValueProvider* pValueProvider = chart::ExplicitValueProvider::getExplicitValueProvider( xChartView );
+ chart::ObjectHierarchy aHierarchy(xChartDoc, pValueProvider, true);
+ chart::ObjectIdentifier aIdentifier = aHierarchy.getRootNodeOID();
+ aChildren.insert(aIdentifier.getObjectCID());
+
+ recursiveAdd(aIdentifier, aChildren, aHierarchy);
+
return aChildren;
}