diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-29 10:43:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-29 21:48:30 +0200 |
commit | ba0408ae9a4ac1b391944b2fdcfd02f86ab2f773 (patch) | |
tree | 1825cdbcbc7f8b56219a36112170526a71fdafed /sfx2/source/dialog/tabdlg.cxx | |
parent | 509df47d2165fd08a7e0d270cade28ff52da532e (diff) |
we need to be able to query the ranges before creating the pages
so don't create the pages until the first execute
Change-Id: I5ecc31d5a08bae44c0a912e39b786420f2da86ee
Reviewed-on: https://gerrit.libreoffice.org/55007
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/dialog/tabdlg.cxx')
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 31be0ca30543..5ccfb377fd0b 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1615,6 +1615,8 @@ IMPL_LINK(SfxTabDialogController, ActivatePageHdl, const OString&, rPage, void) } VclPtr<SfxTabPage> pTabPage = pDataObject->pTabPage; + if (!pTabPage) + return; if (pDataObject->bRefresh) pTabPage->Reset(m_pSet); @@ -1935,24 +1937,30 @@ void SfxTabDialogController::AddTabPage ) { m_pImpl->aData.push_back(new Data_Impl(m_pImpl->aData.size(), rName, pCreateFunc, pRangesFunc)); - Data_Impl* pDataObject = m_pImpl->aData.back(); +} - assert(pDataObject->pTabPage == nullptr && "create TabPage more than once"); - weld::Container* pPage = m_xTabCtrl->get_page(rName); - pDataObject->pTabPage = (pDataObject->fnCreatePage)(pPage, m_pSet); - pDataObject->pTabPage->SetDialogController(this); +void SfxTabDialogController::CreatePages() +{ + for (auto pDataObject : m_pImpl->aData) + { + if (pDataObject->pTabPage) + continue; + weld::Container* pPage = m_xTabCtrl->get_page(pDataObject->sId); + pDataObject->pTabPage = (pDataObject->fnCreatePage)(pPage, m_pSet); + pDataObject->pTabPage->SetDialogController(this); - OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); - SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); - OUString sUserData; - Any aUserItem = aPageOpt.GetUserItem(USERITEM_NAME); - OUString aTemp; - if ( aUserItem >>= aTemp ) - sUserData = aTemp; - pDataObject->pTabPage->SetUserData(sUserData); + OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); + SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); + OUString sUserData; + Any aUserItem = aPageOpt.GetUserItem(USERITEM_NAME); + OUString aTemp; + if ( aUserItem >>= aTemp ) + sUserData = aTemp; + pDataObject->pTabPage->SetUserData(sUserData); - PageCreated(rName, *pDataObject->pTabPage); - pDataObject->pTabPage->Reset(m_pSet); + PageCreated(pDataObject->sId, *pDataObject->pTabPage); + pDataObject->pTabPage->Reset(m_pSet); + } } void SfxTabDialogController::RemoveTabPage(const OString& rId) @@ -1996,6 +2004,8 @@ void SfxTabDialogController::RemoveTabPage(const OString& rId) void SfxTabDialogController::Start_Impl() { + CreatePages(); + assert(m_pImpl->aData.size() == static_cast<size_t>(m_xTabCtrl->get_n_pages()) && "not all pages registered"); |