tdf#87638 - Modify slide pane title in Impress/Draw based on edit mode

Change-Id: I0dd668324c32172144f29cf40c52e2b66e7895b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157444
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 8438a92..e3f5c45a 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -234,7 +234,9 @@
#define STR_PLACEHOLDER_DESCRIPTION_NOTES               NC_("STR_PLACEHOLDER_DESCRIPTION_NOTES", "Notes Area")
#define STR_UNDO_HANGULHANJACONVERSION                  NC_("STR_UNDO_HANGULHANJACONVERSION", "Hangul/Hanja Conversion")
#define STR_LEFT_PANE_IMPRESS_TITLE                     NC_("STR_LEFT_PANE_IMPRESS_TITLE", "Slides")
#define STR_LEFT_PANE_IMPRESS_TITLE_MASTER              NC_("STR_LEFT_PANE_IMPRESS_TITLE_MASTER", "Master Slides")
#define STR_LEFT_PANE_DRAW_TITLE                        NC_("STR_LEFT_PANE_DRAW_TITLE", "Pages")
#define STR_LEFT_PANE_DRAW_TITLE_MASTER                 NC_("STR_LEFT_PANE_DRAW_TITLE_MASTER", "Master Pages")
#define STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION        NC_("STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION", "Preview not available")
#define STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION    NC_("STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION", "Preparing preview")
#define STR_TASKPANEL_LAYOUT_MENU_TITLE                 NC_("STR_TASKPANEL_LAYOUT_MENU_TITLE", "Layouts")
diff --git a/sd/source/ui/dlg/titledockwin.cxx b/sd/source/ui/dlg/titledockwin.cxx
index 0550f05d..d545170 100644
--- a/sd/source/ui/dlg/titledockwin.cxx
+++ b/sd/source/ui/dlg/titledockwin.cxx
@@ -68,6 +68,12 @@ namespace sd
        SfxDockingWindow::dispose();
    }

    void TitledDockingWindow::SetTitle(const OUString& i_rText)
    {
        m_sTitle = i_rText;
        Invalidate();
    }

    void TitledDockingWindow::SetText( const OUString& i_rText )
    {
        SfxDockingWindow::SetText( i_rText );
diff --git a/sd/source/ui/inc/titledockwin.hxx b/sd/source/ui/inc/titledockwin.hxx
index bdbd386..5a880e2 100644
--- a/sd/source/ui/inc/titledockwin.hxx
+++ b/sd/source/ui/inc/titledockwin.hxx
@@ -76,6 +76,8 @@ namespace sd
        */
        Orientation GetOrientation() const;

        void SetTitle(const OUString& i_rText);

    private:
        // Window overridables
        virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& i_rArea) override;
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index f9378e1..309a5d5 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -71,6 +71,9 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <vcl/uitest/logger.hxx>
#include <vcl/uitest/eventdescription.hxx>
#include <titledockwin.hxx>
#include <strings.hrc>
#include <sdresid.hxx>

using namespace com::sun::star;

@@ -393,6 +396,16 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)

    ConfigureAppBackgroundColor();

    // tdf#87638 - change slide pane title according to the edit mode
    auto setLeftPaneTitleIfPaneExists
        = [pViewShell = GetViewFrame()](sal_uInt16 nId, TranslateId aId)
    {
        if (auto* pChildWindow = pViewShell->GetChildWindow(nId))
            if (auto* pTitledDockingWindow
                = static_cast<TitledDockingWindow*>(pChildWindow->GetWindow()))
                pTitledDockingWindow->SetTitle(SdResId(aId));
    };

    if (meEditMode == EditMode::Page)
    {
        /******************************************************************
@@ -401,6 +414,10 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)

        maTabControl->Clear();

        // tdf#87638 - change slide pane title according to the edit mode
        setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_DRAW, STR_LEFT_PANE_DRAW_TITLE);
        setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_IMPRESS, STR_LEFT_PANE_IMPRESS_TITLE);

        SdPage* pPage;
        sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);

@@ -431,6 +448,10 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
        GetViewFrame()->SetChildWindow(
            AnimationChildWindow::GetChildWindowId(), false );

        // tdf#87638 - change slide pane title according to the edit mode
        setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_DRAW, STR_LEFT_PANE_DRAW_TITLE_MASTER);
        setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_IMPRESS, STR_LEFT_PANE_IMPRESS_TITLE_MASTER);

        if (comphelper::LibreOfficeKit::isActive())
            GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
                                                       ".uno:SlideMasterPage=true");