summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-09-12 21:31:59 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-09-13 09:20:06 +0200
commite1ec771c60d1fe03651b24f938589863c3882bc8 (patch)
tree2c0be5fde3220272ef14c67482d25ecaabda51ea /sw/source/ui
parentc5d37d324cd6d17114c209de1862344ad58a1d93 (diff)
Related: tdf#122791 take *final* dialog preferred size
as the size to consider when trying to fit as many column widgets into it. Not the size it is when the column page is inserted, which is just that of the column page and preceeding pages Change-Id: Id78085c92e9b5718e7282bf8ebd2bde1cdc50689 Reviewed-on: https://gerrit.libreoffice.org/78855 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/table/tabledlg.cxx26
1 files changed, 24 insertions, 2 deletions
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index adcd25af5d4c..f56e3c26a64e 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -702,6 +702,7 @@ DeactivateRC SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rSet)
: SfxTabPage(pParent, "modules/swriter/ui/tablecolumnpage.ui", "TableColumnPage", &rSet)
, pTableData(nullptr)
+ , m_pSizeHdlEvent(nullptr)
, nTableWidth(0)
, nMinWidth(MINLAY)
, nMetFields(MET_FIELDS)
@@ -731,9 +732,19 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rS
{
SetExchangeSupport();
+ // fire off this handler to happen on next event loop when all the rest of
+ // the pages are instantiated and the dialog preferred size is that of the
+ // all the pages that currently exist and the rest to come after this one
+ m_pSizeHdlEvent = Application::PostUserEvent(LINK(this, SwTableColumnPage, SizeHdl));
+}
+
+IMPL_LINK_NOARG(SwTableColumnPage, SizeHdl, void*, void)
+{
+ m_pSizeHdlEvent = nullptr;
+
//tdf#120420 keeping showing column width fields unless
//the dialog begins to grow, then stop adding them
- weld::Window* pTopLevel = pParent.GetFrameWeld();
+ weld::Window* pTopLevel = GetDialogFrameWeld();
Size aOrigSize = pTopLevel->get_preferred_size();
for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
{
@@ -750,12 +761,23 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rS
}
const SfxPoolItem* pItem;
- Init(SfxItemState::SET == rSet.GetItemState( SID_HTML_MODE, false,&pItem )
+ Init(SfxItemState::SET == GetItemSet().GetItemState(SID_HTML_MODE, false, &pItem)
&& static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
}
SwTableColumnPage::~SwTableColumnPage()
{
+ disposeOnce();
+}
+
+void SwTableColumnPage::dispose()
+{
+ if (m_pSizeHdlEvent)
+ {
+ Application::RemoveUserEvent(m_pSizeHdlEvent);
+ m_pSizeHdlEvent = nullptr;
+ }
+ SfxTabPage::dispose();
}
VclPtr<SfxTabPage> SwTableColumnPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet)