summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-05-10 14:32:38 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-05-10 14:32:38 +0200
commitb43f5ccb6b09493daee401d2dd1f907e23ad6c3e (patch)
tree765f93684545e000356badc8c02c8959f68c41a5
parenta50a33c3a7505f78d1ab82b746f1234f404e411e (diff)
Reduce broadcasting noise on initial title computation
...otherwise, SfxBaseModel::getTitle calls itself recursively until TitleHelper::m_sTitle has converged. Change-Id: I90577d1c2e4275ff2187d6531a1ca61e8355819b
-rw-r--r--framework/inc/framework/titlehelper.hxx8
-rw-r--r--framework/source/fwe/helper/titlehelper.cxx31
2 files changed, 17 insertions, 22 deletions
diff --git a/framework/inc/framework/titlehelper.hxx b/framework/inc/framework/titlehelper.hxx
index a86bbaf95b34..2fe67979d582 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 c963a2b1fbad..574a21e06b60 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 ();