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 22:08:28 +0200
commit98ac01e74ab95c735b7383601ad2e4ed09962184 (patch)
treedbb519340f3b89f829599cbd9ad285e35128c96c /sfx2
parentb555f76b9d27d8f7b4d7413650230097bd97025e (diff)
do setPreviewsToSamePlace at SfxTabDialogController display time
Change-Id: Ia38c1a577b7d054ab4e7e70a8f2cbce16a3573f5 Reviewed-on: https://gerrit.libreoffice.org/55810 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 78ba325fd581..534cef32f2a5 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1963,6 +1963,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]
@@ -2006,6 +2035,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");