include/svx/ctredlin.hxx           |    7 ++++---
 sc/source/ui/miscdlgs/acredlin.cxx |    2 +-
 svx/source/dialog/ctredlin.cxx     |   13 ++++++++++---
 sw/source/uibase/misc/redlndlg.cxx |    2 +-
 4 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit a1e102bc4f0f36f19b76c34971470faa45e3aaf8
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Sep 26 15:47:38 2019 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Fri Sep 27 11:08:49 2019 +0200

    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/79635
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index 16147e60bd08..238207c72723 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -269,6 +269,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;
@@ -279,7 +280,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(); }
@@ -288,7 +289,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);
@@ -323,7 +324,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 44d89d2669be..d94d3ce662c6 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 9cdfe60d40d5..e4e8eeb654df 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -311,13 +311,14 @@ void SvxTPage::DeactivatePage()
 {
 }
 
-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"))
@@ -443,6 +444,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)
@@ -985,7 +992,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"))
 {
@@ -993,7 +1000,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 7e46cf853bea..9d2db971da19 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);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to