diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-06-28 17:29:45 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-07-09 23:05:22 +0200 |
commit | 4eae2eeb4c3942648aa5d32678ddb5bbbae9d221 (patch) | |
tree | 93de1337afa7718f635a75fa47b34e336a7fc09d /sd | |
parent | 06c7ff43ce85be3fbba092c6ae87f1459770817d (diff) |
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@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 58 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.hxx | 1 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/sidebarslidebackground.ui | 4 |
3 files changed, 19 insertions, 44 deletions
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> |