Author: af
Date: Wed Apr 24 08:35:03 2013
New Revision: 1471290

URL: http://svn.apache.org/r1471290
Log:
122093: Don't show Impress layouts panel for master pages.

Modified:
    openoffice/trunk/main/sd/source/ui/inc/DrawController.hxx
    openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.cxx
    openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.hxx
    openoffice/trunk/main/sd/source/ui/unoidl/DrawController.cxx
    openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx

Modified: openoffice/trunk/main/sd/source/ui/inc/DrawController.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/inc/DrawController.hxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/inc/DrawController.hxx (original)
+++ openoffice/trunk/main/sd/source/ui/inc/DrawController.hxx Wed Apr 24 
08:35:03 2013
@@ -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

Modified: openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.cxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.cxx Wed Apr 24 
08:35:03 2013
@@ -339,64 +339,6 @@ sal_Int32 LayoutMenu::GetMinimumWidth (v
 
 
 
-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, EventMultiplexerLi
 
         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, EventMultiplexerLi
             }
             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;

Modified: openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.hxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.hxx (original)
+++ openoffice/trunk/main/sd/source/ui/sidebar/LayoutMenu.hxx Wed Apr 24 
08:35:03 2013
@@ -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.

Modified: openoffice/trunk/main/sd/source/ui/unoidl/DrawController.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/unoidl/DrawController.cxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/unoidl/DrawController.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/unoidl/DrawController.cxx Wed Apr 24 
08:35:03 2013
@@ -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;

Modified: openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviews1.cxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews1.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews1.cxx Wed Apr 24 08:35:03 
2013
@@ -393,6 +393,8 @@ void DrawViewShell::ChangeEditMode(EditM
                        eEMode = EM_MASTERPAGE;
                }
 
+        GetViewShellBase().GetDrawController().BroadcastContextChange();
+
                meEditMode = eEMode;
                mbIsLayerModeActive = bIsLayerModeActive;
 

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx 
(original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx Wed Apr 
24 08:35:03 2013
@@ -286,7 +286,7 @@ void TextPropertyPanel::HandleContextCha
     }
 
     maContext = aContext;
-    switch (maContext.GetCombinedContext_DI()) // 
+    switch (maContext.GetCombinedContext_DI())
     {
         case CombinedEnumContext(Application_Calc, Context_Cell):
         case CombinedEnumContext(Application_Calc, Context_Pivot):

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx?rev=1471290&r1=1471289&r2=1471290&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx 
(original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx Wed Apr 
24 08:35:03 2013
@@ -52,7 +52,7 @@ class PopupContainer;
 
 class TextPropertyPanel
     : public Control,
-       public ::sfx2::sidebar::IContextChangeReceiver,
+      public ::sfx2::sidebar::IContextChangeReceiver,
       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
 {
 public:


Reply via email to