summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-14 12:05:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-06-14 16:43:24 +0200
commit574d02a7a81f99d08512410fcd3262b41db8c209 (patch)
tree3fdeacdebcca37187a1e817bda3566a0d5ee36b7 /sfx2
parent5615b7d643da3ba5319e9e9acaa5e943ffbbcf7e (diff)
do setPreviewsToSamePlace at SfxTabDialogController display time
Change-Id: Ia38c1a577b7d054ab4e7e70a8f2cbce16a3573f5 Reviewed-on: https://gerrit.libreoffice.org/55793 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/tabdlg.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 5521fe9a0305..48e721c2baf7 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1957,6 +1957,35 @@ void SfxTabDialogController::CreatePages()
}
}
+void SfxTabDialogController::setPreviewsToSamePlace()
+{
+ //where tab pages have the same basic layout with a preview on the right,
+ //get both of their non-preview areas to request the same size so that the
+ //preview appears in the same place in each one so flipping between tabs
+ //isn't distracting as it jumps around
+ std::vector<std::unique_ptr<weld::Widget>> aGrids;
+ for (auto pDataObject : m_pImpl->aData)
+ {
+ if (pDataObject->pTabPage)
+ continue;
+ if (!pDataObject->pTabPage->m_xBuilder)
+ continue;
+ weld::Widget* pGrid = pDataObject->pTabPage->m_xBuilder->weld_widget("maingrid");
+ if (!pGrid)
+ continue;
+ aGrids.emplace_back(pGrid);
+ }
+
+ m_xSizeGroup.reset();
+
+ if (aGrids.size() <= 1)
+ return;
+
+ m_xSizeGroup.reset(m_xBuilder->create_size_group());
+ for (auto& rGrid : aGrids)
+ m_xSizeGroup->add_widget(rGrid.get());
+}
+
void SfxTabDialogController::RemoveTabPage(const OString& rId)
/* [Description]
@@ -2000,6 +2029,8 @@ void SfxTabDialogController::Start_Impl()
{
CreatePages();
+ setPreviewsToSamePlace();
+
assert(m_pImpl->aData.size() == static_cast<size_t>(m_xTabCtrl->get_n_pages())
&& "not all pages registered");