diff options
-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); |