Reduce broadcasting noise on initial title computation
...otherwise, SfxBaseModel::getTitle calls itself recursively until TitleHelper::m_sTitle has converged. Change-Id: I90577d1c2e4275ff2187d6531a1ca61e8355819b
This commit is contained in:
@@ -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);
|
||||
|
@@ -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 ();
|
||||
|
Reference in New Issue
Block a user