[Libreoffice-commits] core.git: cui/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Jan 13 13:05:51 UTC 2017


 cui/source/tabpages/tparea.cxx |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

New commits:
commit e6d7d737522124350a17a3cfdee055f03200a274
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Jan 13 13:55:01 2017 +0100

    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 at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index fbe4600..70e7be4 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()


More information about the Libreoffice-commits mailing list