[Libreoffice-commits] core.git: 2 commits - include/svx sc/source svx/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 26 18:52:52 UTC 2019


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

New commits:
commit f35825e85f59e0fd155c68d63260169cd3cb38c9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 26 15:47:38 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 26 20:51:18 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/79634
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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);
commit 94223ae823a2e3e81da5ab0dc827c33f3a23882c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 26 15:04:29 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 26 20:50:47 2019 +0200

    drop unused SvLBoxColorString class
    
    Change-Id: Id78deffe002444656588fee4252a7059989d184b
    Reviewed-on: https://gerrit.libreoffice.org/79631
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index b7726a75763c..a9ee961c2c3b 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -58,23 +58,6 @@ public:
     void*           pData;
 };
 
-/// Class for the representation of Strings depending on the font.
-class SAL_WARN_UNUSED SvLBoxColorString : public SvLBoxString
-{
-public:
-                    SvLBoxColorString();
-                    virtual ~SvLBoxColorString() override;
-
-    /** Paint function of the SvLBoxColorString class.
-
-        The relevant text with the selected color is drawn in the output device.
-    */
-    virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
-                       const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override;
-
-    virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
-};
-
 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable
 {
 private:
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 1c51696b570a..67e84c7e8b9d 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -47,32 +47,6 @@ RedlinData::~RedlinData()
 {
 }
 
-SvLBoxColorString::SvLBoxColorString()
-: SvLBoxString()
-{
-}
-
-SvLBoxColorString::~SvLBoxColorString()
-{
-}
-
-std::unique_ptr<SvLBoxItem> SvLBoxColorString::Clone(SvLBoxItem const *) const
-{
-    return std::unique_ptr<SvLBoxItem>(new SvLBoxColorString);
-}
-
-void SvLBoxColorString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
-                              const SvViewDataEntry* pView, const SvTreeListEntry& rEntry)
-{
-    Color aColor = rRenderContext.GetTextColor();
-    if (!pView->IsSelected())
-    {
-        rRenderContext.SetTextColor(Color());
-    }
-    SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, rEntry);
-    rRenderContext.SetTextColor(aColor);
-}
-
 SvxRedlinTable::SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
                                std::unique_ptr<weld::TreeView> xCalcControl)
     : xSorter(new comphelper::string::NaturalStringSorter(::comphelper::getProcessComponentContext(),


More information about the Libreoffice-commits mailing list