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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 27 21:20:48 UTC 2019


 cui/source/inc/cuitabarea.hxx    |    2 +
 cui/source/tabpages/backgrnd.cxx |    4 ++-
 cui/source/tabpages/tparea.cxx   |   48 ++++++++++++++++++++++++++-------------
 3 files changed, 38 insertions(+), 16 deletions(-)

New commits:
commit c9666ae13d0c5c24e876770fc6458bf41f178a57
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 27 11:41:54 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 27 22:20:20 2019 +0100

    Related: tdf#123711 better optimal size for highlighting tab
    
    it only uses the color subtab, so just measure
    ones which can be visible
    
    Change-Id: Id09419480fd920b242f4d0d65e9ac5fbfb619784
    Reviewed-on: https://gerrit.libreoffice.org/68431
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 40ea7ce95592..98289ab450e6 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -249,6 +249,8 @@ protected:
     std::unique_ptr<weld::ToggleButton> m_xBtnBitmap;
     std::unique_ptr<weld::ToggleButton> m_xBtnPattern;
 
+    void SetOptimalSize();
+
 private:
     DECL_LINK(SelectFillTypeHdl_Impl, weld::ToggleButton&, void);
 
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index f0e186d5376d..8711e3a3ebc9 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -1478,7 +1478,9 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet )
 
 VclPtr<SfxTabPage> SvxBkgTabPage::Create(TabPageParent pWindow, const SfxItemSet* rAttrs)
 {
-    return VclPtr<SvxBkgTabPage>::Create(pWindow, *rAttrs);
+    auto xRet = VclPtr<SvxBkgTabPage>::Create(pWindow, *rAttrs);
+    xRet->SetOptimalSize();
+    return xRet;
 }
 
 void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet)
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index cacca8f8d51e..ee48acd5f9a8 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -117,8 +117,11 @@ SvxAreaTabPage::SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs
     m_xBtnPattern->connect_toggled(aLink);
 
     SetExchangeSupport();
+}
 
-    TabPageParent aFillTab(m_xFillTab.get(), pParent.pController);
+void SvxAreaTabPage::SetOptimalSize()
+{
+    TabPageParent aFillTab(m_xFillTab.get(), GetDialogController());
     // TEMP
     if (!aFillTab.pController)
         aFillTab.pParent = GetParentDialog();
@@ -126,21 +129,34 @@ SvxAreaTabPage::SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs
     // Calculate optimal size of all pages..
     m_pFillTabPage.disposeAndReset(SvxColorTabPage::Create(aFillTab, &m_rXFSet));
     m_aColorSize = m_xFillTab->get_preferred_size();
-    m_pFillTabPage.disposeAndReset(SvxGradientTabPage::Create(aFillTab, &m_rXFSet));
-    Size aGradientSize = m_xFillTab->get_preferred_size();
-    m_pFillTabPage.disposeAndReset(SvxBitmapTabPage::Create(aFillTab, &m_rXFSet));
-    Size aBitmapSize = m_xFillTab->get_preferred_size();
-    m_pFillTabPage.disposeAndReset(SvxHatchTabPage::Create(aFillTab, &m_rXFSet));
-    Size aHatchSize = m_xFillTab->get_preferred_size();
-    m_pFillTabPage.disposeAndReset(SvxPatternTabPage::Create(aFillTab, &m_rXFSet));
-    Size aPatternSize = m_xFillTab->get_preferred_size();
+    Size aSize(m_aColorSize);
+
+    if (m_xBtnGradient->get_visible())
+    {
+        m_pFillTabPage.disposeAndReset(SvxGradientTabPage::Create(aFillTab, &m_rXFSet));
+        Size aGradientSize = m_xFillTab->get_preferred_size();
+        lclExtendSize(aSize, aGradientSize);
+    }
+    if (m_xBtnBitmap->get_visible())
+    {
+        m_pFillTabPage.disposeAndReset(SvxBitmapTabPage::Create(aFillTab, &m_rXFSet));
+        Size aBitmapSize = m_xFillTab->get_preferred_size();
+        lclExtendSize(aSize, aBitmapSize);
+    }
+    if (m_xBtnHatch->get_visible())
+    {
+        m_pFillTabPage.disposeAndReset(SvxHatchTabPage::Create(aFillTab, &m_rXFSet));
+        Size aHatchSize = m_xFillTab->get_preferred_size();
+        lclExtendSize(aSize, aHatchSize);
+    }
+    if (m_xBtnPattern->get_visible())
+    {
+        m_pFillTabPage.disposeAndReset(SvxPatternTabPage::Create(aFillTab, &m_rXFSet));
+        Size aPatternSize = m_xFillTab->get_preferred_size();
+        lclExtendSize(aSize, aPatternSize);
+    }
     m_pFillTabPage.disposeAndClear();
 
-    Size aSize(m_aColorSize);
-    lclExtendSize(aSize, aGradientSize);
-    lclExtendSize(aSize, aBitmapSize);
-    lclExtendSize(aSize, aHatchSize);
-    lclExtendSize(aSize, aPatternSize);
     m_xFillTab->set_size_request(aSize.Width(), aSize.Height());
 }
 
@@ -326,7 +342,9 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs )
 
 VclPtr<SfxTabPage> SvxAreaTabPage::Create(TabPageParent pParent, const SfxItemSet* rAttrs)
 {
-    return VclPtr<SvxAreaTabPage>::Create(pParent, *rAttrs);
+    auto xRet = VclPtr<SvxAreaTabPage>::Create(pParent, *rAttrs);
+    xRet->SetOptimalSize();
+    return xRet;
 }
 
 namespace {


More information about the Libreoffice-commits mailing list