[Libreoffice-commits] .: framework/inc framework/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Thu May 10 05:32:50 PDT 2012


 framework/inc/framework/titlehelper.hxx     |    8 +++----
 framework/source/fwe/helper/titlehelper.cxx |   31 +++++++++++-----------------
 2 files changed, 17 insertions(+), 22 deletions(-)

New commits:
commit b43f5ccb6b09493daee401d2dd1f907e23ad6c3e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu May 10 14:32:38 2012 +0200

    Reduce broadcasting noise on initial title computation
    
    ...otherwise, SfxBaseModel::getTitle calls itself recursively until
    TitleHelper::m_sTitle has converged.
    
    Change-Id: I90577d1c2e4275ff2187d6531a1ca61e8355819b

diff --git a/framework/inc/framework/titlehelper.hxx b/framework/inc/framework/titlehelper.hxx
index a86bbaf..2fe6797 100644
--- a/framework/inc/framework/titlehelper.hxx
+++ b/framework/inc/framework/titlehelper.hxx
@@ -163,10 +163,10 @@ class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex
 
         void impl_sendTitleChangedEvent ();
 
-        void impl_updateTitle ();
-        void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel);
-        void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController);
-        void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+        void impl_updateTitle (bool init = false);
+        void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init);
+        void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init);
+        void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init);
 
         void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel);
         void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController);
diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx
index c963a2b..574a21e 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -125,7 +125,7 @@ void TitleHelper::setOwner(const css::uno::Reference< css::uno::XInterface >& xO
             return m_sTitle;
 
         // Title seams to be unused till now ... do bootstraping
-        impl_updateTitle ();
+        impl_updateTitle (true);
 
         return m_sTitle;
 
@@ -314,7 +314,7 @@ void TitleHelper::impl_sendTitleChangedEvent ()
 }
 
 //-----------------------------------------------
-void TitleHelper::impl_updateTitle ()
+void TitleHelper::impl_updateTitle (bool init)
 {
     // SYNCHRONIZED ->
     ::osl::ResettableMutexGuard aLock(m_aMutex);
@@ -328,25 +328,20 @@ void TitleHelper::impl_updateTitle ()
 
     if (xModel.is ())
     {
-        impl_updateTitleForModel (xModel);
-        return;
+        impl_updateTitleForModel (xModel, init);
     }
-
-    if (xController.is ())
+    else if (xController.is ())
     {
-        impl_updateTitleForController (xController);
-        return;
+        impl_updateTitleForController (xController, init);
     }
-
-    if (xFrame.is ())
+    else if (xFrame.is ())
     {
-        impl_updateTitleForFrame (xFrame);
-        return;
+        impl_updateTitleForFrame (xFrame, init);
     }
 }
 
 //-----------------------------------------------
-void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel)
+void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init)
 {
     // SYNCHRONIZED ->
     ::osl::ResettableMutexGuard aLock(m_aMutex);
@@ -404,7 +399,7 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram
 
     // WORKAROUND: the notification is currently sent always,
     //             can be changed after shared mode is supported per UNO API
-    sal_Bool bChanged        = sal_True; // (! m_sTitle.equals(sTitle));
+    sal_Bool bChanged        = !init; // && m_sTitle != sTitle
 
              m_sTitle        = sTitle;
              m_nLeasedNumber = nLeasedNumber;
@@ -417,7 +412,7 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram
 }
 
 //-----------------------------------------------
-void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController)
+void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init)
 {
     // SYNCHRONIZED ->
     ::osl::ResettableMutexGuard aLock(m_aMutex);
@@ -471,7 +466,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
     aLock.reset ();
 
         ::rtl::OUString sNewTitle       = sTitle.makeStringAndClear ();
-        sal_Bool        bChanged        = (! m_sTitle.equals(sNewTitle));
+        sal_Bool        bChanged        = !init && m_sTitle != sNewTitle;
                         m_sTitle        = sNewTitle;
                         m_nLeasedNumber = nLeasedNumber;
 
@@ -483,7 +478,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
 }
 
 //-----------------------------------------------
-void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame)
+void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init)
 {
     if ( ! xFrame.is ())
         return;
@@ -516,7 +511,7 @@ void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::fram
     aLock.reset ();
 
         ::rtl::OUString sNewTitle = sTitle.makeStringAndClear ();
-        sal_Bool        bChanged  = (! m_sTitle.equals(sNewTitle));
+        sal_Bool        bChanged  = !init && m_sTitle != sNewTitle;
                         m_sTitle  = sNewTitle;
 
     aLock.clear ();


More information about the Libreoffice-commits mailing list