tdf#145296 use a 'clickable' widget for custom depth

Change-Id: Ifb64e1bef2a0b216f97fe112115a997973201268
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124164
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr
index 47e7dbc..0619e54 100644
--- a/solenv/sanitizers/ui/svx.suppr
+++ b/solenv/sanitizers/ui/svx.suppr
@@ -14,11 +14,11 @@ svx/uiconfig/ui/compressgraphicdialog.ui://GtkLabel[@id='label16'] orphan-label
svx/uiconfig/ui/crashreportdlg.ui://GtkLabel[@id='ed_pre'] orphan-label
svx/uiconfig/ui/crashreportdlg.ui://GtkTextView[@id='ed_post'] no-labelled-by
svx/uiconfig/ui/crashreportdlg.ui://GtkTextView[@id='ed_bugreport'] no-labelled-by
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth0'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth1'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth2'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth3'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth4'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkToggleButton[@id='depth0'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkToggleButton[@id='depth1'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkToggleButton[@id='depth2'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkToggleButton[@id='depth3'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkToggleButton[@id='depth4'] button-no-label
svx/uiconfig/ui/docking3deffects.ui://GtkButton[@id='corner'] button-no-label
svx/uiconfig/ui/docking3deffects.ui://GtkScale[@id='horiscale'] no-labelled-by
svx/uiconfig/ui/docking3deffects.ui://GtkScale[@id='vertscale'] no-labelled-by
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index bed1675..5f654440 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -331,24 +331,23 @@ constexpr OUStringLiteral gsMetricUnit(     u".uno:MetricUnit"     );
ExtrusionDepthWindow::ExtrusionDepthWindow(svt::PopupWindowController* pControl, weld::Widget* pParent)
    : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/depthwindow.ui", "DepthWindow")
    , mxControl(pControl)
    , mxDepth0(m_xBuilder->weld_radio_button("depth0"))
    , mxDepth1(m_xBuilder->weld_radio_button("depth1"))
    , mxDepth2(m_xBuilder->weld_radio_button("depth2"))
    , mxDepth3(m_xBuilder->weld_radio_button("depth3"))
    , mxDepth4(m_xBuilder->weld_radio_button("depth4"))
    , mxInfinity(m_xBuilder->weld_radio_button("infinity"))
    , mxCustom(m_xBuilder->weld_radio_button("custom"))
    , mxDepth0(m_xBuilder->weld_toggle_button("depth0"))
    , mxDepth1(m_xBuilder->weld_toggle_button("depth1"))
    , mxDepth2(m_xBuilder->weld_toggle_button("depth2"))
    , mxDepth3(m_xBuilder->weld_toggle_button("depth3"))
    , mxDepth4(m_xBuilder->weld_toggle_button("depth4"))
    , mxInfinity(m_xBuilder->weld_toggle_button("infinity"))
    , mxCustom(m_xBuilder->weld_toggle_button("custom"))
    , meUnit(FieldUnit::NONE)
    , mfDepth( -1.0 )
    , mbSettingValue(false)
{
    mxDepth0->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth1->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth2->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth3->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth4->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxInfinity->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxCustom->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth0->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth1->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth2->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth3->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxDepth4->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxInfinity->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));
    mxCustom->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl));

    AddStatusListener( gsExtrusionDepth );
    AddStatusListener( gsMetricUnit );
@@ -363,10 +362,6 @@ void ExtrusionDepthWindow::implSetDepth( double fDepth )
{
    mfDepth = fDepth;

    bool bSettingValue = mbSettingValue;
    mbSettingValue = true;

    mxCustom->set_active(true);
    bool bIsMetric = IsMetric(meUnit);
    mxDepth0->set_active(fDepth == (bIsMetric ? aDepthListMM[0] : aDepthListInch[0]));
    mxDepth1->set_active(fDepth == (bIsMetric ? aDepthListMM[1] : aDepthListInch[1]));
@@ -374,8 +369,12 @@ void ExtrusionDepthWindow::implSetDepth( double fDepth )
    mxDepth3->set_active(fDepth == (bIsMetric ? aDepthListMM[3] : aDepthListInch[3]));
    mxDepth4->set_active(fDepth == (bIsMetric ? aDepthListMM[4] : aDepthListInch[4]));
    mxInfinity->set_active(fDepth >= 338666);

    mbSettingValue = bSettingValue;
    mxCustom->set_active(!mxDepth0->get_active() &&
                         !mxDepth1->get_active() &&
                         !mxDepth2->get_active() &&
                         !mxDepth3->get_active() &&
                         !mxDepth4->get_active() &&
                         !mxInfinity->get_active());
}

void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit )
@@ -443,10 +442,15 @@ void ExtrusionDepthWindow::statusChanged(
    }
}

IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Toggleable&, rButton, void)
IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Button&, rButton, void)
{
    if (mbSettingValue || !rButton.get_active())
        return;
    mxDepth0->set_active(&rButton == mxDepth0.get());
    mxDepth1->set_active(&rButton == mxDepth1.get());
    mxDepth2->set_active(&rButton == mxDepth2.get());
    mxDepth3->set_active(&rButton == mxDepth3.get());
    mxDepth4->set_active(&rButton == mxDepth4.get());
    mxInfinity->set_active(&rButton == mxInfinity.get());
    mxCustom->set_active(&rButton == mxCustom.get());

    if (mxCustom->get_active())
    {
diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx
index 0f0f54d..531ae48 100644
--- a/svx/source/tbxctrls/extrusioncontrols.hxx
+++ b/svx/source/tbxctrls/extrusioncontrols.hxx
@@ -93,19 +93,18 @@ class ExtrusionDepthWindow final : public WeldToolbarPopup
{
private:
    rtl::Reference<svt::PopupWindowController> mxControl;
    std::unique_ptr<weld::RadioButton> mxDepth0;
    std::unique_ptr<weld::RadioButton> mxDepth1;
    std::unique_ptr<weld::RadioButton> mxDepth2;
    std::unique_ptr<weld::RadioButton> mxDepth3;
    std::unique_ptr<weld::RadioButton> mxDepth4;
    std::unique_ptr<weld::RadioButton> mxInfinity;
    std::unique_ptr<weld::RadioButton> mxCustom;
    std::unique_ptr<weld::ToggleButton> mxDepth0;
    std::unique_ptr<weld::ToggleButton> mxDepth1;
    std::unique_ptr<weld::ToggleButton> mxDepth2;
    std::unique_ptr<weld::ToggleButton> mxDepth3;
    std::unique_ptr<weld::ToggleButton> mxDepth4;
    std::unique_ptr<weld::ToggleButton> mxInfinity;
    std::unique_ptr<weld::ToggleButton> mxCustom;

    FieldUnit   meUnit;
    double      mfDepth;
    bool        mbSettingValue;

    DECL_LINK( SelectHdl, weld::Toggleable&, void );
    DECL_LINK( SelectHdl, weld::Button&, void );

    void    implFillStrings( FieldUnit eUnit );
    void    implSetDepth( double fDepth );
diff --git a/svx/uiconfig/ui/depthwindow.ui b/svx/uiconfig/ui/depthwindow.ui
index a35fc7db..930cfbf 100644
--- a/svx/uiconfig/ui/depthwindow.ui
+++ b/svx/uiconfig/ui/depthwindow.ui
@@ -1,57 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.38.2 -->
<interface domain="svx">
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkImage" id="image1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/extrusion1inch_16.png</property>
    <property name="can-focus">False</property>
    <property name="icon-name">svx/res/extrusion1inch_16.png</property>
  </object>
  <object class="GtkImage" id="image2">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/extrusion05inch_16.png</property>
    <property name="can-focus">False</property>
    <property name="icon-name">svx/res/extrusion05inch_16.png</property>
  </object>
  <object class="GtkImage" id="image3">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/extrusion2inch_16.png</property>
    <property name="can-focus">False</property>
    <property name="icon-name">svx/res/extrusion2inch_16.png</property>
  </object>
  <object class="GtkImage" id="image4">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/extrusion0inch_16.png</property>
    <property name="can-focus">False</property>
    <property name="icon-name">svx/res/extrusion0inch_16.png</property>
  </object>
  <object class="GtkImage" id="image5">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/extrusion4inch_16.png</property>
    <property name="can-focus">False</property>
    <property name="icon-name">svx/res/extrusion4inch_16.png</property>
  </object>
  <object class="GtkImage" id="image6">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/extrusioninfinity_16.png</property>
    <property name="can-focus">False</property>
    <property name="icon-name">svx/res/extrusioninfinity_16.png</property>
  </object>
  <object class="GtkPopover" id="DepthWindow">
    <property name="can_focus">False</property>
    <property name="no_show_all">True</property>
    <property name="border_width">4</property>
    <property name="can-focus">False</property>
    <property name="no-show-all">True</property>
    <property name="border-width">4</property>
    <child>
      <object class="GtkBox" id="container">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="can-focus">False</property>
        <property name="orientation">vertical</property>
        <property name="spacing">6</property>
        <child>
          <object class="GtkRadioButton" id="depth0">
          <object class="GtkToggleButton" id="depth0">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="image">image4</property>
            <property name="use_underline">True</property>
            <property name="always_show_image">True</property>
            <property name="use-underline">True</property>
            <property name="always-show-image">True</property>
            <property name="active">True</property>
            <property name="draw_indicator">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -60,15 +59,13 @@
          </packing>
        </child>
        <child>
          <object class="GtkRadioButton" id="depth1">
          <object class="GtkToggleButton" id="depth1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="image">image2</property>
            <property name="use_underline">True</property>
            <property name="always_show_image">True</property>
            <property name="draw_indicator">True</property>
            <property name="group">depth0</property>
            <property name="use-underline">True</property>
            <property name="always-show-image">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -77,15 +74,13 @@
          </packing>
        </child>
        <child>
          <object class="GtkRadioButton" id="depth2">
          <object class="GtkToggleButton" id="depth2">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="image">image1</property>
            <property name="use_underline">True</property>
            <property name="always_show_image">True</property>
            <property name="draw_indicator">True</property>
            <property name="group">depth0</property>
            <property name="use-underline">True</property>
            <property name="always-show-image">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -94,15 +89,13 @@
          </packing>
        </child>
        <child>
          <object class="GtkRadioButton" id="depth3">
          <object class="GtkToggleButton" id="depth3">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="image">image3</property>
            <property name="use_underline">True</property>
            <property name="always_show_image">True</property>
            <property name="draw_indicator">True</property>
            <property name="group">depth0</property>
            <property name="use-underline">True</property>
            <property name="always-show-image">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -111,15 +104,13 @@
          </packing>
        </child>
        <child>
          <object class="GtkRadioButton" id="depth4">
          <object class="GtkToggleButton" id="depth4">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="image">image5</property>
            <property name="use_underline">True</property>
            <property name="always_show_image">True</property>
            <property name="draw_indicator">True</property>
            <property name="group">depth0</property>
            <property name="use-underline">True</property>
            <property name="always-show-image">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -128,16 +119,14 @@
          </packing>
        </child>
        <child>
          <object class="GtkRadioButton" id="infinity">
          <object class="GtkToggleButton" id="infinity">
            <property name="label" translatable="yes" context="depthwindow|RID_SVXSTR_INFINITY">_Infinity</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="image">image6</property>
            <property name="use_underline">True</property>
            <property name="always_show_image">True</property>
            <property name="draw_indicator">True</property>
            <property name="group">depth0</property>
            <property name="use-underline">True</property>
            <property name="always-show-image">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -146,14 +135,12 @@
          </packing>
        </child>
        <child>
          <object class="GtkRadioButton" id="custom">
          <object class="GtkToggleButton" id="custom">
            <property name="label" translatable="yes" context="depthwindow|RID_SVXSTR_CUSTOM">_Custom...</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="use_underline">True</property>
            <property name="draw_indicator">True</property>
            <property name="group">depth0</property>
            <property name="can-focus">True</property>
            <property name="receives-default">False</property>
            <property name="use-underline">True</property>
          </object>
          <packing>
            <property name="expand">False</property>