Kaydet (Commit) b3ef6fd4 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Adolfo Jayme Barrientos

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/68432
Tested-by: Jenkins
Reviewed-by: 's avatarAdolfo Jayme Barrientos <fitojb@ubuntu.com>
üst 8b07376f
......@@ -252,6 +252,8 @@ protected:
std::unique_ptr<weld::ToggleButton> m_xBtnBitmap;
std::unique_ptr<weld::ToggleButton> m_xBtnPattern;
void SetOptimalSize(weld::DialogController* pController);
private:
DECL_LINK(SelectFillTypeHdl_Impl, weld::ToggleButton&, void);
......
......@@ -1480,7 +1480,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(pWindow.pController);
return xRet;
}
void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet)
......
......@@ -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(weld::DialogController* pController)
{
TabPageParent aFillTab(m_xFillTab.get(), pController);
// 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(pParent.pController);
return xRet;
}
namespace {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment