sd/source/ui/sidebar/SlideBackground.cxx |   50 +++++++++++++++++++++----------
 sd/source/ui/sidebar/SlideBackground.hxx |    4 ++
 2 files changed, 39 insertions(+), 15 deletions(-)

New commits:
commit cea458998745f0084271b41d90c92ad27ad071eb
Author: pv2k <vidhe...@gmail.com>
Date:   Tue May 23 13:07:00 2017 +0530

    tdf#106679 UI:SideBar Master Slide Button label corrected
    
    Change-Id: Id3ac678d3b1b28564fc8d7e677caf157b4757bcb
    Reviewed-on: https://gerrit.libreoffice.org/37946
    Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>
    Tested-by: Katarina Behrens <katarina.behr...@cib.de>

diff --git a/sd/source/ui/sidebar/SlideBackground.cxx 
b/sd/source/ui/sidebar/SlideBackground.cxx
index c238260f08d8..dae67c1e1081 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -108,6 +108,10 @@ SlideBackground::SlideBackground(
     mbEditModeChangePending(false),
     mxFrame(rxFrame),
     maContext(),
+    maDrawOtherContext(vcl::EnumContext::Application::Draw, 
vcl::EnumContext::Context::DrawPage),
+    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)
@@ -146,7 +150,6 @@ void SlideBackground::Initialize()
     mpPaperSizeBox->FillPaperSizeEntries( PaperSizeApp::Draw );
     
mpPaperSizeBox->SetSelectHdl(LINK(this,SlideBackground,PaperSizeModifyHdl));
     
mpPaperOrientation->SetSelectHdl(LINK(this,SlideBackground,PaperSizeModifyHdl));
-    mpCloseMaster->Hide();
     mpCloseMaster->SetClickHdl(LINK(this, SlideBackground, CloseMasterHdl));
     meUnit = maPaperSizeController.GetCoreMetric();
 
@@ -171,6 +174,25 @@ void SlideBackground::Initialize()
             aLayoutName = 
aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR));
             mpMasterSlide->SelectEntry(aLayoutName);
         }
+
+        DrawViewShell* pDrawViewShell = 
static_cast<DrawViewShell*>(pMainViewShell);
+        EditMode eMode = pDrawViewShell->GetEditMode();
+        if ( eMode == 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));
@@ -187,6 +209,14 @@ void SlideBackground::HandleContextChange(
     if (maContext == rContext)
         return;
     maContext = rContext;
+    if ( maContext == maImpressOtherContext || maContext == 
maImpressMasterContext )
+    {
+        maApplication = vcl::EnumContext::Application::Impress;
+    }
+    else if ( maContext == maDrawOtherContext || maContext == 
maDrawMasterContext )
+    {
+        maApplication = vcl::EnumContext::Application::Draw;
+    }
 }
 
 void SlideBackground::Update()
@@ -390,32 +420,22 @@ IMPL_LINK(SlideBackground, EventMultiplexerListener,
         {
             if(!mbTitle)
             {
-                vcl::EnumContext 
aDrawOtherContext(vcl::EnumContext::Application::Draw,
-                                              
vcl::EnumContext::Context::DrawPage);
-                vcl::EnumContext 
aDrawMasterContext(vcl::EnumContext::Application::Draw,
-                                              
vcl::EnumContext::Context::MasterPage);
-                vcl::EnumContext 
aImpressOtherContext(vcl::EnumContext::Application::Impress,
-                                                 
vcl::EnumContext::Context::DrawPage);
-                vcl::EnumContext 
aImpressMasterContext(vcl::EnumContext::Application::Impress,
-                                                       
vcl::EnumContext::Context::MasterPage);
-                if(maContext == aDrawOtherContext || maContext == 
aDrawMasterContext)
+                if(maContext == maDrawOtherContext || maContext == 
maDrawMasterContext)
                 {
                     mpMasterLabel->SetText(SdResId(STR_MASTERPAGE_NAME));
-                    maApplication = vcl::EnumContext::Application::Draw;
                     mpCloseMaster->Hide();
                     mpEditMaster->Hide();
-                    if( maContext == aDrawMasterContext)
+                    if( maContext == maDrawMasterContext)
                         SetPanelTitle(SdResId(STR_MASTERPAGE_NAME));
                     else
                         SetPanelTitle(SdResId(STR_PAGE_NAME));
                 }
-                else if ( maContext == aImpressOtherContext || maContext == 
aImpressMasterContext )
+                else if ( maContext == maImpressOtherContext || maContext == 
maImpressMasterContext )
                 {
                     mpMasterLabel->SetText(SdResId(STR_MASTERSLIDE_NAME));
-                    maApplication = vcl::EnumContext::Application::Impress;
                     mpCloseMaster->Hide();
                     mpEditMaster->Show();
-                    if( maContext == aImpressMasterContext )
+                    if( maContext == maImpressMasterContext )
                         SetPanelTitle(SdResId(STR_MASTERSLIDE_NAME));
                     else
                         SetPanelTitle(SdResId(STR_SLIDE_NAME));
diff --git a/sd/source/ui/sidebar/SlideBackground.hxx 
b/sd/source/ui/sidebar/SlideBackground.hxx
index c7ace1a146e8..21098bfac61c 100644
--- a/sd/source/ui/sidebar/SlideBackground.hxx
+++ b/sd/source/ui/sidebar/SlideBackground.hxx
@@ -113,6 +113,10 @@ private:
 
     css::uno::Reference<css::frame::XFrame> mxFrame;
     vcl::EnumContext maContext;
+    vcl::EnumContext maDrawOtherContext;
+    vcl::EnumContext maDrawMasterContext;
+    vcl::EnumContext maImpressOtherContext;
+    vcl::EnumContext maImpressMasterContext;
     vcl::EnumContext::Application maApplication;
     bool         mbTitle;
     SfxBindings* mpBindings;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to