[Libreoffice-commits] core.git: sd/source sd/uiconfig

Katarina Behrens Katarina.Behrens at cib.de
Sun Jul 9 21:06:08 UTC 2017


 sd/source/ui/sidebar/SlideBackground.cxx          |   58 ++++++----------------
 sd/source/ui/sidebar/SlideBackground.hxx          |    1 
 sd/uiconfig/simpress/ui/sidebarslidebackground.ui |    4 -
 3 files changed, 19 insertions(+), 44 deletions(-)

New commits:
commit 4eae2eeb4c3942648aa5d32678ddb5bbbae9d221
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Jun 28 17:29:45 2017 +0200

    Slightly different approach to tdf#106679
    
    cowardly avoiding use of DrawViewShell in constructor
    
    Change-Id: Ib40406d439403d0e2de270827bf5c2f06cfb18c2
    Reviewed-on: https://gerrit.libreoffice.org/39368
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index c86bb14562d3..3d40c8123648 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -63,6 +63,7 @@
 #include "EventMultiplexer.hxx"
 #include "glob.hrc"
 #include <vcl/salbtype.hxx>
+#include <vcl/EnumContext.hxx>
 
 using namespace ::com::sun::star;
 
@@ -112,7 +113,6 @@ SlideBackground::SlideBackground(
     maDrawMasterContext(vcl::EnumContext::Application::Draw, vcl::EnumContext::Context::MasterPage),
     maImpressOtherContext(vcl::EnumContext::Application::Impress, vcl::EnumContext::Context::DrawPage),
     maImpressMasterContext(vcl::EnumContext::Application::Impress, vcl::EnumContext::Context::MasterPage),
-    maApplication(vcl::EnumContext::Application::NONE),
     mbTitle(false),
     mpBindings(pBindings)
 {
@@ -142,7 +142,8 @@ SlideBackground::~SlideBackground()
 
 bool SlideBackground::IsImpress()
 {
-    return ( maApplication == vcl::EnumContext::Application::Impress );
+    return ( maContext == maImpressMasterContext ||
+             maContext == maImpressOtherContext );
 }
 
 void SlideBackground::Initialize()
@@ -174,25 +175,6 @@ void SlideBackground::Initialize()
             aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR));
             mpMasterSlide->SelectEntry(aLayoutName);
         }
-
-        DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell);
-        if ( pDrawViewShell != nullptr
-             && pDrawViewShell->GetEditMode() == EditMode::MasterPage )
-        {
-            mpCloseMaster->Show();
-            mpEditMaster->Hide();
-            mpMasterSlide->Disable();
-            mpDspMasterBackground->Disable();
-            mpDspMasterObjects->Disable();
-        }
-        else
-        {
-            mpCloseMaster->Hide();
-            mpEditMaster->Show();
-            mpMasterSlide->Enable();
-            mpDspMasterBackground->Enable();
-            mpDspMasterObjects->Enable();
-        }
     }
 
     mpFillStyle->SelectEntryPos(static_cast< sal_Int32 >(NONE));
@@ -209,14 +191,24 @@ void SlideBackground::HandleContextChange(
     if (maContext == rContext)
         return;
     maContext = rContext;
-    if ( maContext == maImpressOtherContext || maContext == maImpressMasterContext )
+
+    if ( maContext == maImpressMasterContext )
     {
-        maApplication = vcl::EnumContext::Application::Impress;
+        mpCloseMaster->Show();
+        mpEditMaster->Hide();
+        mpMasterSlide->Disable();
+        mpDspMasterBackground->Disable();
+        mpDspMasterObjects->Disable();
     }
-    else if ( maContext == maDrawOtherContext || maContext == maDrawMasterContext )
+    else if (maContext == maImpressOtherContext )
     {
-        maApplication = vcl::EnumContext::Application::Draw;
+        mpCloseMaster->Hide();
+        mpEditMaster->Show();
+        mpMasterSlide->Enable();
+        mpDspMasterBackground->Enable();
+        mpDspMasterObjects->Enable();
     }
+    // else Draw or something else, do nothing
 }
 
 void SlideBackground::Update()
@@ -371,30 +363,16 @@ IMPL_LINK(SlideBackground, EventMultiplexerListener,
                     if ( eMode == EditMode::MasterPage)
                     {
                         if( IsImpress() )
-                        {
                             SetPanelTitle(SdResId(STR_MASTERSLIDE_NAME));
-                            mpEditMaster->Hide();
-                            mpCloseMaster->Show();
-                        }
                         else
                             SetPanelTitle(SdResId(STR_MASTERPAGE_NAME));
-                        mpMasterSlide->Disable();
-                        mpDspMasterBackground->Disable();
-                        mpDspMasterObjects->Disable();
                     }
                     else // EditMode::Page
                     {
                         if( IsImpress() )
-                        {
                             SetPanelTitle(SdResId(STR_SLIDE_NAME));
-                            mpCloseMaster->Hide();
-                            mpEditMaster->Show();
-                        }
                         else
                             SetPanelTitle(SdResId(STR_PAGE_NAME));
-                        mpMasterSlide->Enable();
-                        mpDspMasterBackground->Enable();
-                        mpDspMasterObjects->Enable();
                     }
                 }
                 mbEditModeChangePending = false;
@@ -433,8 +411,6 @@ IMPL_LINK(SlideBackground, EventMultiplexerListener,
                 else if ( maContext == maImpressOtherContext || maContext == maImpressMasterContext )
                 {
                     mpMasterLabel->SetText(SdResId(STR_MASTERSLIDE_NAME));
-                    mpCloseMaster->Hide();
-                    mpEditMaster->Show();
                     if( maContext == maImpressMasterContext )
                         SetPanelTitle(SdResId(STR_MASTERSLIDE_NAME));
                     else
diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx
index 21098bfac61c..4294027a0b53 100644
--- a/sd/source/ui/sidebar/SlideBackground.hxx
+++ b/sd/source/ui/sidebar/SlideBackground.hxx
@@ -117,7 +117,6 @@ private:
     vcl::EnumContext maDrawMasterContext;
     vcl::EnumContext maImpressOtherContext;
     vcl::EnumContext maImpressMasterContext;
-    vcl::EnumContext::Application maApplication;
     bool         mbTitle;
     SfxBindings* mpBindings;
 
diff --git a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
index 7672363cdd98..823d2c03f052 100644
--- a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
+++ b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
@@ -205,7 +205,7 @@
             <child>
               <object class="GtkButton" id="masterslidebutton">
                 <property name="label" translatable="yes">Master Slide</property>
-                <property name="visible">True</property>
+                <property name="visible">False</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="action_name">.uno:SlideMasterPage</property>
@@ -219,7 +219,7 @@
             <child>
               <object class="GtkButton" id="closemasterslide">
                 <property name="label" translatable="yes">Close Master View</property>
-                <property name="visible">True</property>
+                <property name="visible">False</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
               </object>


More information about the Libreoffice-commits mailing list