summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-04-24 07:35:03 +0000
committerAndre Fischer <af@apache.org>2013-04-24 07:35:03 +0000
commit573490c7240fc02dcf82bf0ba262863612e53187 (patch)
treed65bfca561d6845961f20e17804f7b6f29ce0b93 /sd
parent2d6fad788b694e0396d061a8a55b6127e788fdfa (diff)
122093: Don't show Impress layouts panel for master pages.
Notes
Notes: merged as: cce9d07ada009655e005a9182abdfcccea2a61ec
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/DrawController.hxx5
-rw-r--r--sd/source/ui/sidebar/LayoutMenu.cxx67
-rw-r--r--sd/source/ui/sidebar/LayoutMenu.hxx12
-rw-r--r--sd/source/ui/unoidl/DrawController.cxx49
-rw-r--r--sd/source/ui/view/drviews1.cxx2
5 files changed, 56 insertions, 79 deletions
diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx
index d016cb42b6d2..a0ce83757f51 100644
--- a/sd/source/ui/inc/DrawController.hxx
+++ b/sd/source/ui/inc/DrawController.hxx
@@ -143,6 +143,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 e775f426121f..dd26a07d8595 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -339,64 +339,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 LayoutMenu::Paint (const Rectangle& rRect)
{
if (mbSelectionUpdatePending)
@@ -906,7 +848,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:
@@ -921,14 +862,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 f8deb8fc312f..9e187ba3dea8 100644
--- a/sd/source/ui/sidebar/LayoutMenu.hxx
+++ b/sd/source/ui/sidebar/LayoutMenu.hxx
@@ -105,18 +105,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 ec962436334e..a1a1620b28b8 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -51,6 +51,9 @@
#include <svx/fmshell.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
+
#include <boost/shared_ptr.hpp>
using namespace ::std;
@@ -60,6 +63,7 @@ using namespace ::vos;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing::framework;
+using ::sfx2::sidebar::EnumContext;
namespace {
static const ::com::sun::star::uno::Type saComponentTypeIdentifier (
@@ -561,6 +565,51 @@ 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:
+ 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 e8594a53b289..8f87947731e2 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -393,6 +393,8 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
eEMode = EM_MASTERPAGE;
}
+ GetViewShellBase().GetDrawController().BroadcastContextChange();
+
meEditMode = eEMode;
mbIsLayerModeActive = bIsLayerModeActive;