Move "Enable Impress Remote" setting to presentation settings

Instead of hiding it in the generic options dialog.

This moves the last presentation related option to the presentation settings.

Change-Id: I7056b43378c982f9ba496b59490ed762c1f4d21d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158834
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index 74e4103..97a2f82 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -408,7 +408,6 @@ SdOptionsMisc::SdOptionsMisc( bool bImpress, bool bUseConfig ) :
    bPickThrough( true ),
    bDoubleClickTextEdit( true ),
    bClickChangeRotation( false ),
    bEnableSdremote( false ),
    bSolidDragging( true ),
    bSummationOfParagraphs( false ),
    bTabBarVisible( true ),
@@ -442,7 +441,6 @@ bool SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) const
            IsPickThrough() == rOpt.IsPickThrough() &&
            IsDoubleClickTextEdit() == rOpt.IsDoubleClickTextEdit() &&
            IsClickChangeRotation() == rOpt.IsClickChangeRotation() &&
            IsEnableSdremote() == rOpt.IsEnableSdremote() &&
            IsSummationOfParagraphs() == rOpt.IsSummationOfParagraphs() &&
            IsTabBarVisible() == rOpt.IsTabBarVisible() &&
            IsSolidDragging() == rOpt.IsSolidDragging() &&
@@ -499,7 +497,6 @@ void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount )

        "PenColor",
        "PenWidth",
        "Start/EnableSdremote",
        "TabBarVisible"
    };

@@ -558,11 +555,8 @@ bool SdOptionsMisc::ReadData( const Any* pValues )
        if( pValues[24].hasValue() )
            SetPresentationPenWidth( getSafeValue< double >( pValues[ 24 ] ) );

        if( pValues[25].hasValue() )
            SetEnableSdremote( *o3tl::doAccess<bool>(pValues[ 25 ]) );

        if( pValues[26].hasValue() ) {
            SetTabBarVisible( *o3tl::doAccess<bool>(pValues[ 26 ]) );
        if( pValues[25].hasValue() ) {
            SetTabBarVisible( *o3tl::doAccess<bool>(pValues[ 25 ]) );
        }
    }

@@ -604,8 +598,7 @@ bool SdOptionsMisc::WriteData( Any* pValues ) const

        pValues[ 23 ] <<= GetPresentationPenColor();
        pValues[ 24 ] <<= GetPresentationPenWidth();
        pValues[ 25 ] <<= IsEnableSdremote();
        pValues[ 26 ] <<= IsTabBarVisible();
        pValues[ 25 ] <<= IsTabBarVisible();
    }

    return true;
@@ -630,7 +623,6 @@ SdOptionsMiscItem::SdOptionsMiscItem( SdOptions const * pOpts, ::sd::FrameView c
    if( pOpts )
    {
        maOptionsMisc.SetStartWithTemplate( pOpts->IsStartWithTemplate() );
        maOptionsMisc.SetEnableSdremote( pOpts->IsEnableSdremote() );
        maOptionsMisc.SetSummationOfParagraphs( pOpts->IsSummationOfParagraphs() );
        maOptionsMisc.SetTabBarVisible( pOpts->IsTabBarVisible() );
        maOptionsMisc.SetShowUndoDeleteWarning( pOpts->IsShowUndoDeleteWarning() );
@@ -708,7 +700,6 @@ void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
    pOpts->SetPickThrough( maOptionsMisc.IsPickThrough() );
    pOpts->SetDoubleClickTextEdit( maOptionsMisc.IsDoubleClickTextEdit() );
    pOpts->SetClickChangeRotation( maOptionsMisc.IsClickChangeRotation() );
    pOpts->SetEnableSdremote( maOptionsMisc.IsEnableSdremote() );
    pOpts->SetSummationOfParagraphs( maOptionsMisc.IsSummationOfParagraphs() );
    pOpts->SetTabBarVisible( maOptionsMisc.IsTabBarVisible() );

diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index 34b0bef..85d234b 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -66,6 +66,8 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
    , m_xCbxChangePage(m_xBuilder->weld_check_button("changeslidesbyclick"))
    , m_xCbxAlwaysOnTop(m_xBuilder->weld_check_button("alwaysontop"))
    , m_xCbxShowNavigationButton(m_xBuilder->weld_check_button("shownavigationbutton"))
    , m_xFrameEnableRemote(m_xBuilder->weld_frame("frameremote"))
    , m_xCbxEnableRemote(m_xBuilder->weld_check_button("enableremote"))
    , m_xLbConsole(m_xBuilder->weld_combo_box("console_cb"))
    , m_xFtMonitor(m_xBuilder->weld_label("presdisplay_label"))
    , m_xLBMonitor(m_xBuilder->weld_combo_box("presdisplay_cb"))
@@ -151,6 +153,12 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
    else
        m_xLbConsole->set_active(PresenterConsoleMode::Windowed);

#ifdef ENABLE_SDREMOTE
    m_xCbxEnableRemote->set_active(officecfg::Office::Impress::Misc::Start::EnableSdremote::get());
#else
    m_xFrameEnableRemote->hide();
#endif

    InitMonitorSettings();

    ChangeRangeHdl(*m_xRbtCustomshow);
@@ -180,6 +188,9 @@ short SdStartPresentationDlg::run()
        }
        officecfg::Office::Impress::Misc::Start::ShowNavigationPanel::set(
            m_xCbxShowNavigationButton->get_active(), batch);
#ifdef ENABLE_SDREMOTE
    officecfg::Office::Impress::Misc::Start::EnableSdremote::set(m_xCbxEnableRemote->get_active(), batch);
#endif
        batch->commit();
    }
    return nRet;
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 3e92ceb..a028d0e 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -206,7 +206,6 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, weld::DialogController*
    , m_xPresentationFrame(m_xBuilder->weld_frame("presentationframe"))
    , m_xLbMetric(m_xBuilder->weld_combo_box("units"))
    , m_xMtrFldTabstop(m_xBuilder->weld_metric_spin_button("metricFields", FieldUnit::MM))
    , m_xCbxEnableSdremote(m_xBuilder->weld_check_button("enremotcont"))
    , m_xCbxCompatibility(m_xBuilder->weld_check_button("cbCompatibility"))
    , m_xScaleFrame(m_xBuilder->weld_frame("scaleframe"))
    , m_xCbScale(m_xBuilder->weld_combo_box("scaleBox"))
@@ -361,7 +360,7 @@ OUString SdTpOptionsMisc::GetAllStrings()

    OUString checkButton[] = { "startwithwizard", "copywhenmove", "backgroundback",
                               "objalwymov",      "distortcb",    "cbCompatibility",
                               "enremotcont",     "qickedit",     "textselected"};
                               "qickedit",     "textselected"};

    for (const auto& check : checkButton)
    {
@@ -382,7 +381,6 @@ bool SdTpOptionsMisc::FillItemSet( SfxItemSet* rAttrs )
        m_xCbxPickThrough->get_state_changed_from_saved()               ||
        m_xCbxMasterPageCache->get_state_changed_from_saved()           ||
        m_xCbxCopy->get_state_changed_from_saved()                      ||
        m_xCbxEnableSdremote->get_state_changed_from_saved()            ||
        m_xCbxCompatibility->get_state_changed_from_saved()             ||
        m_xCbxDistort->get_state_changed_from_saved())
    {
@@ -394,7 +392,6 @@ bool SdTpOptionsMisc::FillItemSet( SfxItemSet* rAttrs )
        aOptsItem.GetOptionsMisc().SetPickThrough( m_xCbxPickThrough->get_active() );
        aOptsItem.GetOptionsMisc().SetMasterPagePaintCaching( m_xCbxMasterPageCache->get_active() );
        aOptsItem.GetOptionsMisc().SetDragWithCopy( m_xCbxCopy->get_active() );
        aOptsItem.GetOptionsMisc().SetEnableSdremote( m_xCbxEnableSdremote->get_active() );
        aOptsItem.GetOptionsMisc().SetSummationOfParagraphs( m_xCbxCompatibility->get_active() );
        aOptsItem.GetOptionsMisc().SetCrookNoContortion( m_xCbxDistort->get_active() );
        rAttrs->Put( aOptsItem );
@@ -442,7 +439,6 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs )
    m_xCbxPickThrough->set_active( aOptsItem.GetOptionsMisc().IsPickThrough() );
    m_xCbxMasterPageCache->set_active( aOptsItem.GetOptionsMisc().IsMasterPagePaintCaching() );
    m_xCbxCopy->set_active( aOptsItem.GetOptionsMisc().IsDragWithCopy() );
    m_xCbxEnableSdremote->set_active( aOptsItem.GetOptionsMisc().IsEnableSdremote() );
    m_xCbxCompatibility->set_active( aOptsItem.GetOptionsMisc().IsSummationOfParagraphs() );
    m_xCbxDistort->set_active( aOptsItem.GetOptionsMisc().IsCrookNoContortion() );
    m_xCbxStartWithTemplate->save_state();
@@ -452,7 +448,6 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs )

    m_xCbxMasterPageCache->save_state();
    m_xCbxCopy->save_state();
    m_xCbxEnableSdremote->save_state();
    m_xCbxCompatibility->save_state();
    m_xCbxDistort->save_state();

@@ -522,20 +517,10 @@ IMPL_LINK_NOARG(SdTpOptionsMisc, SelectMetricHdl_Impl, weld::ComboBox&, void)
    }
}

void SdTpOptionsMisc::SetImpressMode()
{
#ifndef ENABLE_SDREMOTE
    m_xCbxEnableSdremote->hide();
#else
    (void) this; // loplugin:staticmethods
#endif
}

void SdTpOptionsMisc::SetDrawMode()
{
    m_xScaleFrame->show();
    m_xNewDocumentFrame->hide();
    m_xCbxEnableSdremote->hide();
    m_xCbxCompatibility->hide();
    m_xNewDocLb->hide();
    m_xCbScale->show();
@@ -641,8 +626,6 @@ void SdTpOptionsMisc::PageCreated(const SfxAllItemSet& aSet)
        sal_uInt32 nFlags=pFlagItem->GetValue();
        if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE )
            SetDrawMode();
        if ( ( nFlags & SD_IMPRESS_MODE ) == SD_IMPRESS_MODE )
            SetImpressMode();
    }
}

diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
index 0f59f860..155e267 100644
--- a/sd/source/ui/inc/present.hxx
+++ b/sd/source/ui/inc/present.hxx
@@ -55,7 +55,8 @@ private:
    std::unique_ptr<weld::CheckButton> m_xCbxChangePage;
    std::unique_ptr<weld::CheckButton> m_xCbxAlwaysOnTop;
    std::unique_ptr<weld::CheckButton> m_xCbxShowNavigationButton;

    std::unique_ptr<weld::Frame> m_xFrameEnableRemote;
    std::unique_ptr<weld::CheckButton> m_xCbxEnableRemote;

    std::unique_ptr<weld::ComboBox> m_xLbConsole;

diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx
index c798f95..c974ccd 100644
--- a/sd/source/ui/inc/tpoption.hxx
+++ b/sd/source/ui/inc/tpoption.hxx
@@ -88,7 +88,6 @@ private:
    std::unique_ptr<weld::ComboBox> m_xLbMetric;
    std::unique_ptr<weld::MetricSpinButton> m_xMtrFldTabstop;

    std::unique_ptr<weld::CheckButton> m_xCbxEnableSdremote;
    std::unique_ptr<weld::CheckButton> m_xCbxCompatibility;

    //Scale
@@ -130,16 +129,10 @@ public:
    virtual void Reset( const SfxItemSet * ) override;

    /** Hide Impress specific controls, make Draw specific controls visible
        and arrange the visible controls.  Do not call this method or the
        <member>SetImpressMode()</member> method more than once.
        and arrange the visible controls.  Do not call this method more than once.
    */
    void SetDrawMode();

    /** Hide Draw specific controls, make Impress specific controls visible
        and arrange the visible controls.  Do not call this method or the
        <member>SetDrawMode()</member> method more than once.
    */
    void SetImpressMode();
    virtual void        PageCreated(const SfxAllItemSet& aSet) override;
};

diff --git a/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui b/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui
index 99e1839..f560493 100644
--- a/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui
+++ b/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui
@@ -90,60 +90,6 @@
      </packing>
    </child>
    <child>
      <object class="GtkFrame" id="presentationframe">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <!-- n-columns=1 n-rows=1 -->
          <object class="GtkGrid" id="grid5">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <property name="margin-start">12</property>
            <property name="margin-top">6</property>
            <property name="hexpand">True</property>
            <property name="row-spacing">6</property>
            <property name="column-spacing">12</property>
            <child>
              <object class="GtkCheckButton" id="enremotcont">
                <property name="label" translatable="yes" context="optimpressgeneralpage|enremotcont">Enable remote control</property>
                <property name="visible">True</property>
                <property name="can-focus">True</property>
                <property name="receives-default">False</property>
                <property name="halign">start</property>
                <property name="use-underline">True</property>
                <property name="draw-indicator">True</property>
                <child internal-child="accessible">
                  <object class="AtkObject" id="enremotcont-atkobject">
                    <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|enremotcont">Specifies that you want to enable Bluetooth remote control while Impress is running.</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left-attach">0</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
          </object>
        </child>
        <child type="label">
          <object class="GtkLabel" id="label7">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <property name="label" translatable="yes" context="optimpressgeneralpage|label7">Presentation</property>
            <attributes>
              <attribute name="weight" value="bold"/>
            </attributes>
          </object>
        </child>
      </object>
      <packing>
        <property name="left-attach">1</property>
        <property name="top-attach">0</property>
      </packing>
    </child>
    <child>
      <object class="GtkFrame" id="frame1">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
@@ -469,7 +415,7 @@
      </object>
      <packing>
        <property name="left-attach">1</property>
        <property name="top-attach">1</property>
        <property name="top-attach">0</property>
      </packing>
    </child>
    <child>
@@ -659,9 +605,12 @@
      </object>
      <packing>
        <property name="left-attach">1</property>
        <property name="top-attach">2</property>
        <property name="top-attach">1</property>
      </packing>
    </child>
    <child>
      <placeholder/>
    </child>
    <child internal-child="accessible">
      <object class="AtkObject" id="OptSavePage-atkobject">
        <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|OptSavePage">Defines the general options for drawing or presentation documents.</property>
diff --git a/sd/uiconfig/simpress/ui/presentationdialog.ui b/sd/uiconfig/simpress/ui/presentationdialog.ui
index a6b97b8..9ca601e 100644
--- a/sd/uiconfig/simpress/ui/presentationdialog.ui
+++ b/sd/uiconfig/simpress/ui/presentationdialog.ui
@@ -80,7 +80,7 @@
          </packing>
        </child>
        <child>
          <!-- n-columns=1 n-rows=3 -->
          <!-- n-columns=1 n-rows=4 -->
          <object class="GtkGrid" id="grid1">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
@@ -733,6 +733,72 @@
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkFrame" id="frameremote">
                <property name="visible">True</property>
                <property name="can-focus">False</property>
                <property name="hexpand">True</property>
                <property name="vexpand">True</property>
                <property name="label-xalign">0</property>
                <property name="shadow-type">none</property>
                <child>
                  <!-- n-columns=2 n-rows=1 -->
                  <object class="GtkGrid" id="grid10">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="margin-start">12</property>
                    <property name="margin-top">6</property>
                    <property name="hexpand">True</property>
                    <property name="vexpand">True</property>
                    <child>
                      <object class="GtkCheckButton" id="enableremote">
                        <property name="label" translatable="yes" context="presentationdialog|enableremote">Enable remote control</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">0</property>
                        <property name="top-attach">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkLinkButton" id="learnmore">
                        <property name="label" translatable="yes" context="presentationdialog|learnmore">Download App ...</property>
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="receives-default">True</property>
                        <property name="tooltip-text" translatable="yes" context="presentationdialog|learnmore|tooltip_text">Download LibreOffice Impress Remote to remotely control the presentation from your smartphone or smartwatch.</property>
                        <property name="halign">end</property>
                        <property name="hexpand">True</property>
                        <property name="relief">none</property>
                        <property name="uri">https://www.libreoffice.org/download/impress-remote-2/</property>
                      </object>
                      <packing>
                        <property name="left-attach">1</property>
                        <property name="top-attach">0</property>
                      </packing>
                    </child>
                  </object>
                </child>
                <child type="label">
                  <object class="GtkLabel" id="label5">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="label" translatable="yes" context="presentationdialog|label3">Remote control</property>
                    <attributes>
                      <attribute name="weight" value="bold"/>
                    </attributes>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left-attach">0</property>
                <property name="top-attach">3</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>