openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1470597 - in /openoffice/trunk/main/sfx2/source/sidebar: SidebarController.cxx SidebarController.hxx
Date Mon, 22 Apr 2013 16:01:51 GMT
Author: af
Date: Mon Apr 22 16:01:51 2013
New Revision: 1470597

URL: http://svn.apache.org/r1470597
Log:
122095: React asynchronously to context changes to avoid problems in SFX2.

Modified:
    openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx?rev=1470597&r1=1470596&r2=1470597&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx Mon Apr 22 16:01:51 2013
@@ -99,6 +99,7 @@ SidebarController::SidebarController (
       maCurrentContext(OUString(), OUString()),
       msCurrentDeckId(A2S("PropertyDeck")),
       maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange,
this)),
+      maContextChangeUpdate(::boost::bind(&SidebarController::UpdateConfigurations, this)),
       mbIsDeckClosed(false),
       mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
 {
@@ -175,10 +176,14 @@ void SAL_CALL SidebarController::disposi
 void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject&
rEvent)
     throw(cssu::RuntimeException)
 {
-    UpdateConfigurations(
-        Context(
-            rEvent.ApplicationName,
-            rEvent.ContextName));
+    // Update to the requested new context asynchronously to avoid
+    // subtle errors caused by SFX2 which in rare cases can not
+    // properly handle a synchronous update.
+    maRequestedContext = Context(
+        rEvent.ApplicationName,
+        rEvent.ContextName);
+    if (maRequestedContext != maCurrentContext)
+        maContextChangeUpdate.RequestCall();
 }
 
 
@@ -285,17 +290,17 @@ void SidebarController::NotifyResize (vo
 
 
 
-void SidebarController::UpdateConfigurations (const Context& rContext)
+void SidebarController::UpdateConfigurations (void)
 {
-    if (maCurrentContext != rContext)
+    if (maCurrentContext != maRequestedContext)
     {
-        maCurrentContext = rContext;
+        maCurrentContext = maRequestedContext;
 
         // Notify the tab bar about the updated set of decks.
         ResourceManager::IdContainer aDeckIds;
         ResourceManager::Instance().GetMatchingDecks (
             aDeckIds,
-            rContext,
+            maCurrentContext,
             mxFrame);
         mpTabBar->SetDecks(aDeckIds);
 
@@ -316,13 +321,13 @@ void SidebarController::UpdateConfigurat
 
         DeckDescriptor const* pDeckDescriptor = NULL;
         if ( ! bCurrentDeckMatches)
-            pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame);
+            pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(maCurrentContext,
mxFrame);
         else
             pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
         if (pDeckDescriptor != NULL)
         {
             msCurrentDeckId = pDeckDescriptor->msId;
-            SwitchToDeck(*pDeckDescriptor, rContext);
+            SwitchToDeck(*pDeckDescriptor, maCurrentContext);
 
             // Tell the tab bar to highlight the button associated
             // with the deck.
@@ -335,7 +340,7 @@ void SidebarController::UpdateConfigurat
         {
             DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
             if (pTitleBar != NULL)
-                pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+rContext.msContext+A2S(")"));
+                pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+maCurrentContext.msContext+A2S(")"));
         }
 #endif
     }
@@ -869,7 +874,6 @@ bool SidebarController::CanModifyChildWi
     SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
     if (pSplitWindow == NULL)
     {
-        OSL_ASSERT(pSplitWindow!=NULL);
         return 0;
     }
 

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx?rev=1470597&r1=1470596&r2=1470597&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx Mon Apr 22 16:01:51 2013
@@ -111,9 +111,11 @@ private:
     ::boost::scoped_ptr<TabBar> mpTabBar;
     cssu::Reference<css::frame::XFrame> mxFrame;
     Context maCurrentContext;
+    Context maRequestedContext;
     ::rtl::OUString msCurrentDeckId;
     ::rtl::OUString msCurrentDeckTitle;
     AsynchronousCall maPropertyChangeForwarder;
+    AsynchronousCall maContextChangeUpdate;
     bool mbIsDeckClosed;
     /** Before the deck is closed the sidebar width is saved into this variable,
         so that it can be restored when the deck is reopended.
@@ -122,7 +124,9 @@ private:
     FocusManager maFocusManager;
     
     DECL_LINK(WindowEventHandler, VclWindowEvent*);
-    void UpdateConfigurations (const Context& rContext);
+    /** Make maRequestedContext the current context.
+    */
+    void UpdateConfigurations (void);
     bool ArePanelSetsEqual (
         const SharedPanelContainer& rCurrentPanels,
         const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels);



Mime
View raw message