diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-31 06:10:50 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:01:54 +0200 |
commit | e407b0e6861175dca85d08e013a639c11d372589 (patch) | |
tree | 807a000f2b5b737126363f93b7870c98d96318d7 /sfx2/source | |
parent | 2a9253d3f5b0eba7b9129f7e64aec1e8867719f6 (diff) |
uitest: support selecting different tab pages in tab dialog
Change-Id: I541f83a87f5f3d459b2baf4587b76cb2fce5d5fc
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/uitest/sfx_uiobject.cxx | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx b/sfx2/source/uitest/sfx_uiobject.cxx index 138e4858fcbc..1f416277b497 100644 --- a/sfx2/source/uitest/sfx_uiobject.cxx +++ b/sfx2/source/uitest/sfx_uiobject.cxx @@ -25,16 +25,53 @@ StringMap SfxTabDialogUIObject::get_state() { StringMap aMap = WindowUIObject::get_state(); sal_uInt16 nPageId = mxTabDialog->GetCurPageId(); + std::vector<sal_uInt16> aPageIds = mxTabDialog->m_pTabCtrl->GetPageIDs(); + OUString aStrIds; + OUString aStrNames; + for (auto itr = aPageIds.begin(), itrEnd = aPageIds.end(); + itr != itrEnd; ++itr) + { + aStrIds = aStrIds + OUString::number(*itr) + ";"; + aStrNames = aStrNames + mxTabDialog->GetPageText(*itr) + ";"; + } + + aMap["PageIds"] = aStrIds; + aMap["PageNames"] = aStrNames; aMap["CurrentPageID"] = OUString::number(nPageId); aMap["CurrentPageText"] = mxTabDialog->GetPageText(nPageId); return aMap; } void SfxTabDialogUIObject::execute(const OUString& rAction, - const StringMap& /*rParameters*/) + const StringMap& rParameters) { if (rAction == "SELECT") { + if (rParameters.find("POS") != rParameters.end()) + { + auto itr = rParameters.find("POS"); + sal_uInt32 nPos = itr->second.toUInt32(); + std::vector<sal_uInt16> aIds = mxTabDialog->m_pTabCtrl->GetPageIDs(); + sal_uInt16 nPageId = aIds[nPos]; + mxTabDialog->ShowPage(nPageId); + } + else if (rParameters.find("NAME") != rParameters.end()) + { + auto itr = rParameters.find("NAME"); + OUString aName = itr->second; + std::vector<sal_uInt16> aIds = mxTabDialog->m_pTabCtrl->GetPageIDs(); + auto it = aIds.begin(), itEnd = aIds.end(); + for (; it != itEnd; ++it) + { + if (mxTabDialog->GetPageText(*it) == aName) + break; + } + + if (it == aIds.end()) + return; + + mxTabDialog->ShowPage(*it); + } } } |