You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/10/02 10:52:09 UTC

svn commit: r1528376 - in /openoffice/trunk/main: sd/source/ui/view/drviews1.cxx sfx2/inc/sfx2/shell.hxx sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx sfx2/source/control/shell.cxx sfx2/source/sidebar/ContextChangeBroadcaster.cxx

Author: af
Date: Wed Oct  2 08:52:09 2013
New Revision: 1528376

URL: http://svn.apache.org/r1528376
Log:
123276: Properly forward Deactivate() call and still don't broadcast context change.

Modified:
    openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
    openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
    openoffice/trunk/main/sfx2/source/control/shell.cxx
    openoffice/trunk/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx

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=1528376&r1=1528375&r2=1528376&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews1.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews1.cxx Wed Oct  2 08:52:09 2013
@@ -53,7 +53,6 @@
 #include <svx/fmglob.hxx>
 #include <editeng/outliner.hxx>
 
-
 #include "misc.hxx"
 
 #ifdef STARIMAGE_AVAILABLE
@@ -148,7 +147,13 @@ void DrawViewShell::UIDeactivated( SfxIn
 
 void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
 {
-    // Do not forward to ViewShell::Deactivate() to prevent a context change.
+    // Temporarily disable context broadcasting while the Deactivate()
+    // call is forwarded to our base class.
+    const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false));
+    
+    ViewShell::Deactivate(bIsMDIActivate);
+
+    SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled);
 }
 
 namespace

Modified: openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx?rev=1528376&r1=1528375&r2=1528376&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx Wed Oct  2 08:52:09 2013
@@ -268,7 +268,11 @@ public:
             When <FALSE/> then broadcast the 'default' context.
     */
     void BroadcastContextForActivation (const bool bIsActivated);
-    
+
+    /** Enabled or disable the context broadcaster.  Returns the old state.
+    */
+    bool SetContextBroadcasterEnabled (const bool bIsEnabled);
+
 #ifndef _SFXSH_HXX
     SAL_DLLPRIVATE bool     CanExecuteSlot_Impl( const SfxSlot &rSlot );
     SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);

Modified: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx?rev=1528376&r1=1528375&r2=1528376&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx Wed Oct  2 08:52:09 2013
@@ -44,9 +44,18 @@ public:
     void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame);
     void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame);
 
+    /** Enable or disable the broadcaster.
+        @param bIsEnabled
+            The new value of the "enabled" state.
+        @return
+            The old value of the "enabled" state is returned.
+    */
+    bool SetBroadcasterEnabled (const bool bIsEnabled);
+    
 private:
     rtl::OUString msContextName;
     bool mbIsContextActive;
+    bool mbIsBroadcasterEnabled;
 
     void BroadcastContextChange (
         const cssu::Reference<css::frame::XFrame>& rxFrame,

Modified: openoffice/trunk/main/sfx2/source/control/shell.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/control/shell.cxx?rev=1528376&r1=1528375&r2=1528376&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/control/shell.cxx (original)
+++ openoffice/trunk/main/sfx2/source/control/shell.cxx Wed Oct  2 08:52:09 2013
@@ -1289,6 +1289,7 @@ void SfxShell::SetViewShell_Impl( SfxVie
 
 
 
+
 void SfxShell::BroadcastContextForActivation (const bool bIsActivated)
 {
     SfxViewFrame* pViewFrame = GetFrame();
@@ -1298,3 +1299,11 @@ void SfxShell::BroadcastContextForActiva
         else
             pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
 }
+
+
+
+
+bool SfxShell::SetContextBroadcasterEnabled (const bool bIsEnabled)
+{
+    return pImp->maContextChangeBroadcaster.SetBroadcasterEnabled(bIsEnabled);
+}

Modified: openoffice/trunk/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx?rev=1528376&r1=1528375&r2=1528376&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx Wed Oct  2 08:52:09 2013
@@ -39,7 +39,8 @@ namespace sfx2 { namespace sidebar {
 
 ContextChangeBroadcaster::ContextChangeBroadcaster (void)
     : msContextName(),
-      mbIsContextActive(false)
+      mbIsContextActive(false),
+      mbIsBroadcasterEnabled(true)
 {
 }
 
@@ -85,11 +86,24 @@ void ContextChangeBroadcaster::Deactivat
 
 
 
+bool ContextChangeBroadcaster::SetBroadcasterEnabled (const bool bIsEnabled)
+{
+    const bool bWasEnabled (mbIsBroadcasterEnabled);
+    mbIsBroadcasterEnabled = bIsEnabled;
+    return bWasEnabled;
+}
+
+
+
+
 void ContextChangeBroadcaster::BroadcastContextChange (
     const cssu::Reference<css::frame::XFrame>& rxFrame,
     const ::rtl::OUString& rsModuleName,
     const ::rtl::OUString& rsContextName)
 {
+    if ( ! mbIsBroadcasterEnabled)
+        return;
+
     if (rsContextName.getLength() == 0)
         return;