diff options
-rw-r--r-- | sd/source/ui/inc/DrawController.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.cxx | 68 | ||||
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.hxx | 12 | ||||
-rw-r--r-- | sd/source/ui/unoidl/DrawController.cxx | 50 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.hxx | 2 |
7 files changed, 59 insertions, 82 deletions
diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx index a53f7b95685d..89b5050b26fe 100644 --- a/sd/source/ui/inc/DrawController.hxx +++ b/sd/source/ui/inc/DrawController.hxx @@ -133,6 +133,11 @@ public: */ void FireSwitchCurrentPage (SdPage* pCurrentPage) throw(); + /** Broadcast a sidebar context change that is caused by a view + switch. + */ + void BroadcastContextChange (void) const; + /** Return a pointer to the ViewShellBase object that the DrawController is connected to. @return diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 5f347439503c..525262533b2d 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -334,65 +334,6 @@ sal_Int32 LayoutMenu::GetMinimumWidth (void) -void LayoutMenu::UpdateEnabledState (const MasterMode eMode) -{ - bool bIsEnabled (false); - - ::boost::shared_ptr<ViewShell> pMainViewShell (mrBase.GetMainViewShell()); - if (pMainViewShell) - { - switch (pMainViewShell->GetShellType()) - { - case ViewShell::ST_NONE: - case ViewShell::ST_OUTLINE: - case ViewShell::ST_PRESENTATION: - case ViewShell::ST_SIDEBAR: - // The complete task pane is disabled for these values or - // not even visible. Disabling the LayoutMenu would be - // logical but unnecessary. The main disadvantage is that - // after re-enabling it (typically) another panel is - // expanded. - bIsEnabled = true; - break; - - case ViewShell::ST_DRAW: - case ViewShell::ST_IMPRESS: - { - switch (eMode) - { - case MM_UNKNOWN: - { - ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( - ::boost::dynamic_pointer_cast<DrawViewShell>(pMainViewShell)); - if (pDrawViewShell) - bIsEnabled = pDrawViewShell->GetEditMode() != EM_MASTERPAGE; - break; - } - case MM_NORMAL: - bIsEnabled = true; - break; - - case MM_MASTER: - bIsEnabled = false; - break; - } - break; - } - - case ViewShell::ST_HANDOUT: - case ViewShell::ST_NOTES: - case ViewShell::ST_SLIDE_SORTER: - default: - bIsEnabled = true; - break; - } - } - (void)bIsEnabled; //FIXME either this method is a no-op or this should do something -} - - - - void LayoutMenu::Paint (const Rectangle& rRect) { if (mbSelectionUpdatePending) @@ -899,7 +840,6 @@ IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEve case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: mbIsMainViewChangePending = true; - UpdateEnabledState(MM_UNKNOWN); break; case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: @@ -914,14 +854,6 @@ IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEve } break; - case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL: - UpdateEnabledState(MM_NORMAL); - break; - - case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER: - UpdateEnabledState(MM_MASTER); - break; - default: /* Ignored */ break; diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index eb8025860258..b61550fc3adc 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -104,18 +104,6 @@ public: */ virtual void MouseButtonDown (const MouseEvent& rEvent); - /** The LayoutMenu does not support some main views. In this case the - LayoutMenu is disabled. This state is updated in this method. - @param eMode - On some occasions the edit mode is being switched when this - method is called can not (yet) be reliably detected. Luckily, - in these cases the new value is provided by some broadcaster. - On other occasions the edit mode is not modified and is also not - provided. Therefore the Unknown value. - */ - enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN }; - void UpdateEnabledState (const MasterMode eMode); - /** Call this method when the set of displayed layouts is not up-to-date anymore. It will re-assemple this set according to the current settings. diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index e45f4f1d0119..e71a0fa4ff39 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -46,6 +46,9 @@ #include <svx/fmshell.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> +#include <sfx2/sidebar/EnumContext.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> + #include <boost/shared_ptr.hpp> using namespace ::std; @@ -53,6 +56,7 @@ using namespace ::cppu; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; +using ::sfx2::sidebar::EnumContext; namespace sd { @@ -547,6 +551,52 @@ void DrawController::FirePropertyChange ( +void DrawController::BroadcastContextChange (void) const +{ + ::boost::shared_ptr<ViewShell> pViewShell (mpBase->GetMainViewShell()); + if ( ! pViewShell) + return; + + EnumContext::Context eContext (EnumContext::Context_Unknown); + switch (pViewShell->GetShellType()) + { + case ViewShell::ST_IMPRESS: + case ViewShell::ST_DRAW: + if (mbMasterPageMode) + eContext = EnumContext::Context_MasterPage; + else + eContext = EnumContext::Context_DrawPage; + break; + + case ViewShell::ST_NOTES: + eContext = EnumContext::Context_NotesPage; + break; + + case ViewShell::ST_HANDOUT: + eContext = EnumContext::Context_HandoutPage; + break; + + case ViewShell::ST_OUTLINE: + eContext = EnumContext::Context_OutlineText; + break; + + case ViewShell::ST_SLIDE_SORTER: + eContext = EnumContext::Context_SlidesorterPage; + break; + + case ViewShell::ST_PRESENTATION: + case ViewShell::ST_NONE: + default: + eContext = EnumContext::Context_Empty; + break; + } + + ContextChangeEventMultiplexer::NotifyContextChange(mpBase, eContext); +} + + + + ViewShellBase* DrawController::GetViewShellBase (void) { return mpBase; diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index fdf951769e45..faf114fc737a 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -343,6 +343,8 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) eEMode = EM_MASTERPAGE; } + GetViewShellBase().GetDrawController().BroadcastContextChange(); + meEditMode = eEMode; mbIsLayerModeActive = bIsLayerModeActive; diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index 1042658ef15f..753436149c46 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -278,7 +278,7 @@ void TextPropertyPanel::HandleContextChange ( } maContext = aContext; - switch (maContext.GetCombinedContext_DI()) // + switch (maContext.GetCombinedContext_DI()) { case CombinedEnumContext(Application_Calc, Context_Cell): case CombinedEnumContext(Application_Calc, Context_Pivot): diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index 4666918974d6..b5ad01bc1c2f 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -48,7 +48,7 @@ class PopupContainer; class TextPropertyPanel : public Control, - public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::IContextChangeReceiver, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: |