diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-12 21:31:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-13 09:20:06 +0200 |
commit | e1ec771c60d1fe03651b24f938589863c3882bc8 (patch) | |
tree | 2c0be5fde3220272ef14c67482d25ecaabda51ea /sw/source | |
parent | c5d37d324cd6d17114c209de1862344ad58a1d93 (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')
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/table/tablepg.hxx | 3 |
2 files changed, 27 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) diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index e5b47fb2f35d..f9d7c8d9ec50 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -93,6 +93,7 @@ public: class SwTableColumnPage : public SfxTabPage { SwTableRep* pTableData; + ImplSVEvent* m_pSizeHdlEvent; SwTwips nTableWidth; SwTwips nMinWidth; sal_uInt16 nMetFields; @@ -121,12 +122,14 @@ class SwTableColumnPage : public SfxTabPage void UpdateCols( sal_uInt16 nCurrentPos ); SwTwips GetVisibleWidth(sal_uInt16 nPos); void SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth); + DECL_LINK(SizeHdl, void*, void); using TabPage::ActivatePage; using TabPage::DeactivatePage; public: SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rSet); + virtual void dispose() override; virtual ~SwTableColumnPage() override; static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet); |