tdf#160984 sw continuous endnotes: hide not functional UI in this mode

Previous commits bug have fixed cases where opening a Word document
rendered a different foot/endnote separator than expected for Word. The
followings were modified:

- distance between body text and separator, between separator and first
  note

- the vertical position of the line

- the length of the line

Now ODT files keep the original feature set and Word files look as
expected, but a couple of UI controls are ignored by the layout, hide
these as they intentionally don't do anything while we're in Word compat
mode.

Change-Id: I72a3dde637d3e224038886a79550fa069253a4f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168295
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 0316f625..9ed64e3 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -29,6 +29,7 @@
#include <svx/pageitem.hxx>
#include <svl/eitem.hxx>
#include <editeng/ulspitem.hxx>
#include <svl/grabbagitem.hxx>
#include <uitool.hxx>
#include <pagedesc.hxx>
#include <pgfnote.hxx>
@@ -99,13 +100,17 @@ SwFootNotePage::SwFootNotePage(weld::Container* pPage, weld::DialogController* p
    , m_xMaxHeightPageBtn(m_xBuilder->weld_radio_button("maxheightpage"))
    , m_xMaxHeightBtn(m_xBuilder->weld_radio_button("maxheight"))
    , m_xMaxHeightEdit(m_xBuilder->weld_metric_spin_button("maxheightsb", FieldUnit::CM))
    , m_xDistLabel(m_xBuilder->weld_label("spacetotextlabel"))
    , m_xDistEdit(m_xBuilder->weld_metric_spin_button("spacetotext", FieldUnit::CM))
    , m_xLinePosLabel(m_xBuilder->weld_label("positionlabel"))
    , m_xLinePosBox(m_xBuilder->weld_combo_box("position"))
    , m_xLineTypeBox(new SvtLineListBox(m_xBuilder->weld_menu_button("style")))
    , m_xLineWidthEdit(m_xBuilder->weld_metric_spin_button("thickness", FieldUnit::POINT))
    , m_xLineColorBox(new ColorListBox(m_xBuilder->weld_menu_button("color"),
                [this]{ return GetDialogController()->getDialog(); }))
    , m_xLineLengthLabel(m_xBuilder->weld_label("lengthlabel"))
    , m_xLineLengthEdit(m_xBuilder->weld_metric_spin_button("length", FieldUnit::PERCENT))
    , m_xLineDistLabel(m_xBuilder->weld_label("spacingtocontentslabel"))
    , m_xLineDistEdit(m_xBuilder->weld_metric_spin_button("spacingtocontents", FieldUnit::CM))
{
    SetExchangeSupport();
@@ -116,6 +121,30 @@ SwFootNotePage::SwFootNotePage(weld::Container* pPage, weld::DialogController* p
    MeasurementSystem eSys = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
    tools::Long nHeightValue = MeasurementSystem::Metric != eSys ? 1440 : 1134;
    m_xMaxHeightEdit->set_value(m_xMaxHeightEdit->normalize(nHeightValue),FieldUnit::TWIP);

    bool bContinuousEndnotes = false;
    if (const SfxGrabBagItem* pGragbagItem = rSet.GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
    {
        auto it = pGragbagItem->GetGrabBag().find("ContinuousEndnotes");
        if (it != pGragbagItem->GetGrabBag().end())
        {
            it->second >>= bContinuousEndnotes;
        }
    }

    if (bContinuousEndnotes)
    {
        // These are ignored in SwFootnoteContFrame::Format() and SwFootnoteContFrame::PaintLine(),
        // hide them.
        m_xDistLabel->set_visible(false);
        m_xDistEdit->set_visible(false);
        m_xLinePosLabel->set_visible(false);
        m_xLinePosBox->set_visible(false);
        m_xLineLengthLabel->set_visible(false);
        m_xLineLengthEdit->set_visible(false);
        m_xLineDistLabel->set_visible(false);
        m_xLineDistEdit->set_visible(false);
    }
}

SwFootNotePage::~SwFootNotePage()
diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx
index c239f1e..0abb09a 100644
--- a/sw/source/uibase/inc/pgfnote.hxx
+++ b/sw/source/uibase/inc/pgfnote.hxx
@@ -44,12 +44,16 @@ private:
    std::unique_ptr<weld::RadioButton> m_xMaxHeightPageBtn;
    std::unique_ptr<weld::RadioButton> m_xMaxHeightBtn;
    std::unique_ptr<weld::MetricSpinButton> m_xMaxHeightEdit;
    std::unique_ptr<weld::Label> m_xDistLabel;
    std::unique_ptr<weld::MetricSpinButton> m_xDistEdit;
    std::unique_ptr<weld::Label> m_xLinePosLabel;
    std::unique_ptr<weld::ComboBox> m_xLinePosBox;
    std::unique_ptr<SvtLineListBox> m_xLineTypeBox;
    std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit;
    std::unique_ptr<ColorListBox> m_xLineColorBox;
    std::unique_ptr<weld::Label> m_xLineLengthLabel;
    std::unique_ptr<weld::MetricSpinButton> m_xLineLengthEdit;
    std::unique_ptr<weld::Label> m_xLineDistLabel;
    std::unique_ptr<weld::MetricSpinButton> m_xLineDistEdit;

    DECL_LINK(HeightPage, weld::Toggleable&, void);
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 66e08d9f..9f9a18c 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -68,6 +68,7 @@
#include <SwStyleNameMapper.hxx>
#include <strings.hrc>
#include <docmodel/color/ComplexColor.hxx>
#include <IDocumentSettingAccess.hxx>

// 50 cm 28350
#define MAXHEIGHT 28350
@@ -634,6 +635,12 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
            <<= rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue();
    }

    const IDocumentSettingAccess& rIDSA = rMaster.getIDocumentSettingAccess();
    if (rIDSA.get(DocumentSettingId::CONTINUOUS_ENDNOTES))
    {
        oGrabBag->GetGrabBag()["ContinuousEndnotes"] <<= true;
    }

    rSet.Put(*oGrabBag);
}

diff --git a/sw/uiconfig/swriter/ui/footnoteareapage.ui b/sw/uiconfig/swriter/ui/footnoteareapage.ui
index 2ff5986..103cf90 100644
--- a/sw/uiconfig/swriter/ui/footnoteareapage.ui
+++ b/sw/uiconfig/swriter/ui/footnoteareapage.ui
@@ -99,7 +99,7 @@
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label3">
              <object class="GtkLabel" id="spacetotextlabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="footnoteareapage|label3">Space to text</property>
@@ -190,7 +190,7 @@
            <property name="margin-start">12</property>
            <property name="margin-top">6</property>
            <child>
              <object class="GtkLabel" id="label4">
              <object class="GtkLabel" id="positionlabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="footnoteareapage|label4">_Position</property>
@@ -246,7 +246,7 @@
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label8">
              <object class="GtkLabel" id="lengthlabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="footnoteareapage|label8">_Length</property>
@@ -260,7 +260,7 @@
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label9">
              <object class="GtkLabel" id="spacingtocontentslabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="footnoteareapage|label9">_Spacing to footnote contents</property>