Resolves tdf#160834 - Unclear meaning of "Ignore pieces of length"

Access in the UI removed
Find the options under ooO.Writer.Comparison.IgnoreLength and IgnorePieces

Change-Id: Ic76277ba6838bf5cf858089303f4882bc9a7c2de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167888
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 6ca432a..089942b 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -2577,10 +2577,6 @@ SwCompareOptionsTabPage::SwCompareOptionsTabPage(weld::Container* pPage, weld::D
    , m_xCompareModeImg(m_xBuilder->weld_widget("lockcomparemode"))
    , m_xRsidCB(m_xBuilder->weld_check_button("useRSID"))
    , m_xRsidImg(m_xBuilder->weld_widget("lockuseRSID"))
    , m_xIgnoreCB(m_xBuilder->weld_check_button("ignore"))
    , m_xIgnoreImg(m_xBuilder->weld_widget("lockignore"))
    , m_xLenNF(m_xBuilder->weld_spin_button("ignorelen"))
    , m_xLenImg(m_xBuilder->weld_widget("lockignorelen"))
    , m_xStoreRsidCB(m_xBuilder->weld_check_button("storeRSID"))
    , m_xStoreRsidImg(m_xBuilder->weld_widget("lockstoreRSID"))
{
@@ -2588,8 +2584,6 @@ SwCompareOptionsTabPage::SwCompareOptionsTabPage(weld::Container* pPage, weld::D
    m_xAutoRB->connect_toggled( aLnk );
    m_xWordRB->connect_toggled( aLnk );
    m_xCharRB->connect_toggled( aLnk );

    m_xIgnoreCB->connect_toggled( LINK( this, SwCompareOptionsTabPage, IgnoreHdl) );
}

SwCompareOptionsTabPage::~SwCompareOptionsTabPage()
@@ -2612,14 +2606,6 @@ OUString SwCompareOptionsTabPage::GetAllStrings()
            sAllStrings += pString->get_label() + " ";
    }

    OUString checkButton[] = { "useRSID", "ignore", "storeRSID" };

    for (const auto& check : checkButton)
    {
        if (const auto& pString = m_xBuilder->weld_check_button(check))
            sAllStrings += pString->get_label() + " ";
    }

    OUString radioButton[] = { "auto", "byword", "bycharacter" };

    for (const auto& radio : radioButton)
@@ -2656,18 +2642,6 @@ bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* )
        bRet = true;
    }

    if( m_xIgnoreCB->get_state_changed_from_saved() )
    {
        pOpt->SetIgnorePieces( m_xIgnoreCB->get_active() );
        bRet = true;
    }

    if( m_xLenNF->get_value_changed_from_saved() )
    {
        pOpt->SetPieceLen( m_xLenNF->get_value() );
        bRet = true;
    }

    if (m_xStoreRsidCB->get_state_changed_from_saved())
    {
        pOpt->SetStoreRsid(m_xStoreRsidCB->get_active());
@@ -2686,22 +2660,16 @@ void SwCompareOptionsTabPage::Reset( const SfxItemSet* )
    {
        m_xAutoRB->set_active(true);
        m_xRsidCB->set_sensitive(false);
        m_xIgnoreCB->set_sensitive(false);
        m_xLenNF->set_sensitive(false);
    }
    else if( eCmpMode == SwCompareMode::ByWord )
    {
        m_xWordRB->set_active(true);
        m_xRsidCB->set_sensitive(true);
        m_xIgnoreCB->set_sensitive(true);
        m_xLenNF->set_sensitive(true);
    }
    else if( eCmpMode == SwCompareMode::ByChar)
    {
        m_xCharRB->set_active(true);
        m_xRsidCB->set_sensitive(true);
        m_xIgnoreCB->set_sensitive(true);
        m_xLenNF->set_sensitive(true);
    }

    if (officecfg::Office::Writer::Comparison::Mode::isReadOnly())
@@ -2724,24 +2692,6 @@ void SwCompareOptionsTabPage::Reset( const SfxItemSet* )
    }
    m_xRsidCB->save_state();

    m_xIgnoreCB->set_active( pOpt->IsIgnorePieces() );
    if (officecfg::Office::Writer::Comparison::IgnorePieces::isReadOnly())
    {
        m_xIgnoreCB->set_sensitive(false);
        m_xIgnoreImg->set_visible(true);
    }
    m_xIgnoreCB->save_state();

    m_xLenNF->set_sensitive( m_xIgnoreCB->get_active() && eCmpMode != SwCompareMode::Auto );

    m_xLenNF->set_value( pOpt->GetPieceLen() );
    if (officecfg::Office::Writer::Comparison::IgnoreLength::isReadOnly())
    {
        m_xLenNF->set_sensitive(false);
        m_xLenImg->set_visible(true);
    }
    m_xLenNF->save_value();

    m_xStoreRsidCB->set_active(pOpt->IsStoreRsid());
    m_xStoreRsidCB->set_sensitive(!officecfg::Office::Writer::Comparison::StoreRSID::isReadOnly());
    m_xStoreRsidImg->set_visible(officecfg::Office::Writer::Comparison::StoreRSID::isReadOnly());
@@ -2755,13 +2705,6 @@ IMPL_LINK(SwCompareOptionsTabPage, ComparisonHdl, weld::Toggleable&, rButton, vo

    bool bChecked = !m_xAutoRB->get_active();
    m_xRsidCB->set_sensitive( bChecked );
    m_xIgnoreCB->set_sensitive( bChecked );
    m_xLenNF->set_sensitive( bChecked && m_xIgnoreCB->get_active() );
}

IMPL_LINK_NOARG(SwCompareOptionsTabPage, IgnoreHdl, weld::Toggleable&, void)
{
    m_xLenNF->set_sensitive(m_xIgnoreCB->get_active());
}

#ifdef DBG_UTIL
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index 68192a6..d162a70 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -461,15 +461,10 @@ class SwCompareOptionsTabPage final : public SfxTabPage
    std::unique_ptr<weld::Widget> m_xCompareModeImg;
    std::unique_ptr<weld::CheckButton> m_xRsidCB;
    std::unique_ptr<weld::Widget> m_xRsidImg;
    std::unique_ptr<weld::CheckButton> m_xIgnoreCB;
    std::unique_ptr<weld::Widget> m_xIgnoreImg;
    std::unique_ptr<weld::SpinButton> m_xLenNF;
    std::unique_ptr<weld::Widget> m_xLenImg;
    std::unique_ptr<weld::CheckButton> m_xStoreRsidCB;
    std::unique_ptr<weld::Widget> m_xStoreRsidImg;

    DECL_LINK(ComparisonHdl, weld::Toggleable&, void);
    DECL_LINK(IgnoreHdl, weld::Toggleable&, void);

public:
    SwCompareOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
diff --git a/sw/uiconfig/swriter/ui/optcomparison.ui b/sw/uiconfig/swriter/ui/optcomparison.ui
index afaab6e4..69ba83f 100644
--- a/sw/uiconfig/swriter/ui/optcomparison.ui
+++ b/sw/uiconfig/swriter/ui/optcomparison.ui
@@ -1,14 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!-- Generated with glade 3.40.0 -->
<interface domain="sw">
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkAdjustment" id="adjustment1">
    <property name="lower">1</property>
    <property name="upper">99</property>
    <property name="value">1</property>
    <property name="step-increment">1</property>
    <property name="page-increment">10</property>
  </object>
  <object class="GtkBox" id="OptComparison">
    <property name="visible">True</property>
    <property name="can-focus">False</property>
@@ -119,7 +112,7 @@
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <!-- n-columns=4 n-rows=3 -->
          <!-- n-columns=2 n-rows=2 -->
          <object class="GtkGrid" id="grid2">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
@@ -128,20 +121,6 @@
            <property name="row-spacing">6</property>
            <property name="column-spacing">12</property>
            <child>
              <object class="GtkCheckButton" id="ignore">
                <property name="label" translatable="yes" context="optcomparison|ignore">Ignore _pieces of length:</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>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkCheckButton" id="useRSID">
                <property name="label" translatable="yes" context="optcomparison|useRSID">Take it into account when comparing</property>
                <property name="visible">True</property>
@@ -156,19 +135,6 @@
              </packing>
            </child>
            <child>
              <object class="GtkSpinButton" id="ignorelen">
                <property name="visible">True</property>
                <property name="can-focus">True</property>
                <property name="activates-default">True</property>
                <property name="truncate-multiline">True</property>
                <property name="adjustment">adjustment1</property>
              </object>
              <packing>
                <property name="left-attach">3</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkCheckButton" id="storeRSID">
                <property name="label" translatable="yes" context="optcomparison|storeRSID">Store it when changing the document</property>
                <property name="visible">True</property>
@@ -179,7 +145,7 @@
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="top-attach">2</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
@@ -196,19 +162,6 @@
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockignore">
                <property name="can-focus">False</property>
                <property name="no-show-all">True</property>
                <property name="halign">center</property>
                <property name="valign">center</property>
                <property name="icon-name">res/lock.png</property>
              </object>
              <packing>
                <property name="left-attach">0</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockstoreRSID">
                <property name="can-focus">False</property>
                <property name="no-show-all">True</property>
@@ -218,34 +171,9 @@
              </object>
              <packing>
                <property name="left-attach">0</property>
                <property name="top-attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockignorelen">
                <property name="can-focus">False</property>
                <property name="no-show-all">True</property>
                <property name="halign">center</property>
                <property name="valign">center</property>
                <property name="icon-name">res/lock.png</property>
              </object>
              <packing>
                <property name="left-attach">2</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
          </object>
        </child>
        <child type="label">
@@ -266,4 +194,11 @@
      </packing>
    </child>
  </object>
  <object class="GtkAdjustment" id="adjustment1">
    <property name="lower">1</property>
    <property name="upper">99</property>
    <property name="value">1</property>
    <property name="step-increment">1</property>
    <property name="page-increment">10</property>
  </object>
</interface>