[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sd/source sfx2/inc sfx2/source

Andre Fischer af at apache.org
Wed Oct 2 03:08:34 PDT 2013


 sd/source/ui/view/drviews1.cxx                     |    9 +++++++--
 sfx2/inc/sfx2/shell.hxx                            |    4 ++++
 sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx |    9 +++++++++
 sfx2/source/control/shell.cxx                      |    9 +++++++++
 sfx2/source/sidebar/ContextChangeBroadcaster.cxx   |   16 +++++++++++++++-
 5 files changed, 44 insertions(+), 3 deletions(-)

New commits:
commit 520cc667c80cea6bb48422825250b72ff36bb4ef
Author: Andre Fischer <af at apache.org>
Date:   Wed Oct 2 08:52:09 2013 +0000

    123276: Properly forward Deactivate() call and still don't broadcast context change.

diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 56343c5..6dbb4c8 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -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( SfxInPlaceClient* pCli )
 
 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
diff --git a/sfx2/inc/sfx2/shell.hxx b/sfx2/inc/sfx2/shell.hxx
index a358020..2b24048 100644
--- a/sfx2/inc/sfx2/shell.hxx
+++ b/sfx2/inc/sfx2/shell.hxx
@@ -269,6 +269,10 @@ public:
     */
     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);
diff --git a/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx b/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
index c103ece..78cea4d 100644
--- a/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
+++ b/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
@@ -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,
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index b71bc46..c9ebfb9 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -1289,6 +1289,7 @@ void SfxShell::SetViewShell_Impl( SfxViewShell* pView )
 
 
 
+
 void SfxShell::BroadcastContextForActivation (const bool bIsActivated)
 {
     SfxViewFrame* pViewFrame = GetFrame();
@@ -1298,3 +1299,11 @@ void SfxShell::BroadcastContextForActivation (const bool bIsActivated)
         else
             pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
 }
+
+
+
+
+bool SfxShell::SetContextBroadcasterEnabled (const bool bIsEnabled)
+{
+    return pImp->maContextChangeBroadcaster.SetBroadcasterEnabled(bIsEnabled);
+}
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
index dab1b3f..a922358 100644
--- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
+++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
@@ -39,7 +39,8 @@ namespace sfx2 { namespace sidebar {
 
 ContextChangeBroadcaster::ContextChangeBroadcaster (void)
     : msContextName(),
-      mbIsContextActive(false)
+      mbIsContextActive(false),
+      mbIsBroadcasterEnabled(true)
 {
 }
 
@@ -85,11 +86,24 @@ void ContextChangeBroadcaster::Deactivate (const cssu::Reference<css::frame::XFr
 
 
 
+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;
 


More information about the Libreoffice-commits mailing list