summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-01-13 13:55:01 +0100
committerTomaž Vajngerl <quikee@gmail.com>2017-01-13 13:05:31 +0000
commite6d7d737522124350a17a3cfdee055f03200a274 (patch)
tree8f705a31a716c3eee3541160f5d589962f2f8dcf
parentfa44327ed791df4d8b2199e9a6d2113235d64d92 (diff)
tdf#105259 calculate sizes of all area tab pages on construction
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 <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--cui/source/tabpages/tparea.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index fbe4600930d1..70e7be46c9c7 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()