From 9157ae95d4861c545b01e1d9df67932c86a3c640 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Fri, 13 Jan 2017 13:55:01 +0100 Subject: tdf#105259 calculate sizes of all area tab pages on construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we open dialog that contains the area tab, we need to calculate the size of area tab pages (that are triggered by clicking on a button) and set the page area to the appropriate combined size. Otherwise we don't account for the needed space correctly and some page will be squished or have overlapping controls. This change creates all pages at dialog construction, gets all the optimal sizes and sets the size of the page container box to the combined (minimal) size. Change-Id: Ie04a121810b96973f6e4502a52af675b2baacf25 Reviewed-on: https://gerrit.libreoffice.org/33040 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl (cherry picked from commit e6d7d737522124350a17a3cfdee055f03200a274) Reviewed-on: https://gerrit.libreoffice.org/33048 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- cui/source/tabpages/tparea.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'cui') diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 9972ca5133c3..f2a054df2e55 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -66,6 +66,19 @@ const sal_uInt16 SvxAreaTabPage::pAreaRanges[] = 0 }; +namespace +{ + +void lclExtendSize(Size& rSize, const Size& rInputSize) +{ + if (rSize.Width() < rInputSize.Width()) + rSize.Width() = rInputSize.Width(); + if (rSize.Height() < rInputSize.Height()) + rSize.Height() = rInputSize.Height(); +} + +} // end anonymous namespace + /************************************************************************* |* |* Dialog to modify fill-attributes @@ -125,6 +138,22 @@ SvxAreaTabPage::SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs m_pBtnPattern->SetClickHdl(aLink); SetExchangeSupport(); + + // Calculate optimal size of all pages.. + m_pFillTabPage.disposeAndReset(SvxColorTabPage::Create(m_pFillTab, &m_rXFSet)); + Size aSize = m_pFillTabPage->GetOptimalSize(); + m_pFillTabPage.disposeAndReset(SvxGradientTabPage::Create(m_pFillTab, &m_rXFSet)); + lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + m_pFillTabPage.disposeAndReset(SvxBitmapTabPage::Create(m_pFillTab, &m_rXFSet)); + lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + m_pFillTabPage.disposeAndReset(SvxHatchTabPage::Create(m_pFillTab, &m_rXFSet)); + lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + m_pFillTabPage.disposeAndReset(SvxPatternTabPage::Create(m_pFillTab, &m_rXFSet)); + lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + m_pFillTabPage.disposeAndClear(); + + m_pFillTab->set_width_request(aSize.Width()); + m_pFillTab->set_height_request(aSize.Height()); } SvxAreaTabPage::~SvxAreaTabPage() -- cgit v1.2.3