diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-05-19 19:28:58 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:02:21 +0200 |
commit | e0e414cd79c6faaa8a2770742b103b5df7efa487 (patch) | |
tree | 9fc005468d3a4064a31bc473e7d29bd695aff39a /sc/source/ui/uitest/uiobject.cxx | |
parent | 8a9861c47b66afed9f9a22ee7f507ba99cd4162a (diff) |
uitest: provide charts as children of calc's grid window
Diffstat (limited to 'sc/source/ui/uitest/uiobject.cxx')
-rw-r--r-- | sc/source/ui/uitest/uiobject.cxx | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index d257b4161b3b..550aeef41a46 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -15,6 +15,11 @@ #include "viewdata.hxx" #include "dbfunc.hxx" +#include <svx/svditer.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdoole2.hxx> + namespace { ScAddress get_address_from_string(const OUString& rStr) @@ -109,6 +114,54 @@ void ScGridWinUIObject::execute(const OUString& rAction, } } +namespace { + +ScDrawLayer* get_draw_layer(VclPtr<ScGridWindow> xGridWindow) +{ + return xGridWindow->getViewData()->GetDocument()->GetDrawLayer(); +} + +SdrPage* get_draw_page(VclPtr<ScGridWindow> xGridWindow, SCTAB nTab) +{ + ScDrawLayer* pDrawLayer = get_draw_layer(xGridWindow); + + return pDrawLayer->GetPage(nTab); +} + +std::set<OUString> collect_charts(VclPtr<ScGridWindow> xGridWindow) +{ + SCTAB nTab = xGridWindow->getViewData()->GetTabNo(); + SdrPage* pPage = get_draw_page(xGridWindow, nTab); + + std::set<OUString> aRet; + + if (!pPage) + return aRet; + + SdrObjListIter aIter( *pPage, IM_FLAT ); + SdrObject* pObject = aIter.Next(); + while (pObject) + { + if (pObject->GetObjIdentifier() == OBJ_OLE2) + { + aRet.insert(static_cast<SdrOle2Obj*>(pObject)->GetPersistName()); + } + else + SAL_DEBUG(pObject->GetName()); + pObject = aIter.Next(); + } + + return aRet; +} + +} + +std::set<OUString> ScGridWinUIObject::get_children() const +{ + std::set<OUString> aChildren = collect_charts(mxGridWindow); + return aChildren; +} + std::unique_ptr<UIObject> ScGridWinUIObject::get_child(const OUString& /*rID*/) { return nullptr; |