diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-26 15:47:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-26 20:51:18 +0200 |
commit | f35825e85f59e0fd155c68d63260169cd3cb38c9 (patch) | |
tree | 1ce4e03a7ca22ce4a936e419b0cfa1905721ff5d | |
parent | 94223ae823a2e3e81da5ab0dc827c33f3a23882c (diff) |
Resolves: tdf#127218 allow changes dialog to shrink when button text changes
original the dialog has super wide button contents when the initial size
is calculated, and then the buttons are changed afterwards, but the dialog
remains at its initial size.
Change-Id: Ib29ab9ebdec01a93561a8b304572df60b6ad5ad2
Reviewed-on: https://gerrit.libreoffice.org/79634
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svx/ctredlin.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/acredlin.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/ctredlin.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx index a9ee961c2c3b..15d27723121d 100644 --- a/include/svx/ctredlin.hxx +++ b/include/svx/ctredlin.hxx @@ -246,6 +246,7 @@ private: bool bEnableRejectAll; bool bEnableUndo; + weld::Window* m_pDialog; std::unique_ptr<weld::Button> m_xAccept; std::unique_ptr<weld::Button> m_xReject; std::unique_ptr<weld::Button> m_xAcceptAll; @@ -256,7 +257,7 @@ private: DECL_LINK( PbClickHdl, weld::Button&, void ); public: - SvxTPView(weld::Container* pParent, weld::Builder* pTopLevel); + SvxTPView(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel); virtual ~SvxTPView() override; SvxRedlinTable* GetTableControl() { return m_xViewData.get(); } @@ -265,7 +266,7 @@ public: void EnableAcceptAll(bool bFlag); void EnableReject(bool bFlag); void EnableRejectAll(bool bFlag); - static void EnableClearFormatButton(weld::Button&, bool bFlag); + void EnableClearFormatButton(weld::Button&, bool bFlag); void EnableClearFormat(bool bFlag); void EnableClearFormatAll(bool bFlag); void EnableUndo(bool bFlag=true); @@ -300,7 +301,7 @@ private: DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool); public: - SvxAcceptChgCtr(weld::Container* pParent, weld::Builder* pTopLevel); + SvxAcceptChgCtr(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel); ~SvxAcceptChgCtr(); void ShowFilterPage(); diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 3b381cd51e36..82333e4afbb3 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -101,7 +101,7 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Windo , m_xContentArea(m_xDialog->weld_content_area()) , m_xPopup(m_xBuilder->weld_menu("calcmenu")) { - m_xAcceptChgCtr.reset(new SvxAcceptChgCtr(m_xContentArea.get(), m_xBuilder.get())); + m_xAcceptChgCtr.reset(new SvxAcceptChgCtr(m_xContentArea.get(), m_xDialog.get(), m_xBuilder.get())); nAcceptCount=0; nRejectCount=0; aReOpenIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl )); diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 67e84c7e8b9d..705eefdb1b96 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -25,8 +25,6 @@ #include <sfx2/module.hxx> #include <svtools/ctrlbox.hxx> #include <unotools/textsearch.hxx> -#include <vcl/svlbitm.hxx> -#include <vcl/viewdataentry.hxx> #include <unotools/charclass.hxx> #include <editeng/unolingu.hxx> @@ -282,13 +280,14 @@ void SvxTPage::ActivatePage() { } -SvxTPView::SvxTPView(weld::Container* pParent, weld::Builder* pTopLevel) +SvxTPView::SvxTPView(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel) : SvxTPage(pParent, "svx/ui/redlineviewpage.ui", "RedlineViewPage") , bEnableAccept(true) , bEnableAcceptAll(true) , bEnableReject(true) , bEnableRejectAll(true) , bEnableUndo(true) + , m_pDialog(pDialog) , m_xAccept(pTopLevel->weld_button("accept")) , m_xReject(pTopLevel->weld_button("reject")) , m_xAcceptAll(pTopLevel->weld_button("acceptall")) @@ -414,6 +413,12 @@ void SvxTPView::EnableClearFormatButton(weld::Button& rButton, bool bFlag) rButton.set_label(sText.copy(0, nPos - 1)); } } + + if (m_pDialog) + { + // tdf#127218 allow dialog to shrink + m_pDialog->resize_to_request(); + } } void SvxTPView::EnableClearFormat(bool bFlag) @@ -956,7 +961,7 @@ IMPL_LINK_NOARG(SvxTPFilter, RefHandle, weld::Button&, void) aRefLink.Call(this); } -SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent, weld::Builder* pTopLevel) +SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel) : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/redlinecontrol.ui")) , m_xTabCtrl(m_xBuilder->weld_notebook("RedlineControl")) { @@ -964,7 +969,7 @@ SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent, weld::Builder* pTopLe m_xTabCtrl->connect_leave_page(LINK(this, SvxAcceptChgCtr, DeactivatePageHdl)); m_xTPFilter.reset(new SvxTPFilter(m_xTabCtrl->get_page("filter"))); - m_xTPView.reset(new SvxTPView(m_xTabCtrl->get_page("view"), pTopLevel)); + m_xTPView.reset(new SvxTPView(m_xTabCtrl->get_page("view"), pDialog, pTopLevel)); m_xTPFilter->SetRedlinTable(m_xTPView->GetTableControl()); m_xTabCtrl->set_current_page("view"); m_xTabCtrl->show(); diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 7d203def841a..6e32ee92dcb3 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -151,7 +151,7 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(const std::shared_ptr<weld::Window>& rPar , m_bOnlyFormatedRedlines(false) , m_bRedlnAutoFormat(bAutoFormat) , m_bInhibitActivate(false) - , m_xTabPagesCTRL(new SvxAcceptChgCtr(pContentArea, pBuilder)) + , m_xTabPagesCTRL(new SvxAcceptChgCtr(pContentArea, m_xParentDlg.get(), pBuilder)) , m_xPopup(pBuilder->weld_menu("writermenu")) { m_xTabPagesCTRL->set_help_id(HID_REDLINE_CTRL); |