[Libreoffice-commits] core.git: Branch 'feature/sidebar' - sd/source svx/source

Andre Fischer af at apache.org
Thu May 9 08:37:44 PDT 2013


 sd/source/ui/inc/DrawController.hxx           |    5 +
 sd/source/ui/sidebar/LayoutMenu.cxx           |   68 --------------------------
 sd/source/ui/sidebar/LayoutMenu.hxx           |   12 ----
 sd/source/ui/unoidl/DrawController.cxx        |   50 +++++++++++++++++++
 sd/source/ui/view/drviews1.cxx                |    2 
 svx/source/sidebar/text/TextPropertyPanel.cxx |    2 
 svx/source/sidebar/text/TextPropertyPanel.hxx |    2 
 7 files changed, 59 insertions(+), 82 deletions(-)

New commits:
commit cce9d07ada009655e005a9182abdfcccea2a61ec
Author: Andre Fischer <af at apache.org>
Date:   Wed Apr 24 07:35:03 2013 +0000

    Resolves: #i122093# Don't show Impress layouts panel for master pages
    
    (cherry picked from commit 573490c7240fc02dcf82bf0ba262863612e53187)
    
    Conflicts:
    	sd/source/ui/sidebar/LayoutMenu.cxx
    
    Change-Id: Ie5c0a1e15ea8db2d2b033efb1234492bd438658d
    
    Related: #i122093# WaE in DrawController::BroadcastContextChenge()
    
    (cherry picked from commit 26e4fcdbb8594696b45d0600e1b7a5e5946cd2aa)
    
    Change-Id: I416215077643f3eb4d43eb761e457d0893bcc429

diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx
index a53f7b9..89b5050 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 5f34743..5252625 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 eb80258..b61550f 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 e45f4f1..e71a0fa 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 fdf9517..faf114f 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 1042658..7534361 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 4666918..b5ad01b 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:


More information about the Libreoffice-commits mailing list