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_sendTitleChangedEvent ();
|
||||||
|
|
||||||
void impl_updateTitle ();
|
void impl_updateTitle (bool init = false);
|
||||||
void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel);
|
void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init);
|
||||||
void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController);
|
void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init);
|
||||||
void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
|
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_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel);
|
||||||
void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController);
|
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;
|
return m_sTitle;
|
||||||
|
|
||||||
// Title seams to be unused till now ... do bootstraping
|
// Title seams to be unused till now ... do bootstraping
|
||||||
impl_updateTitle ();
|
impl_updateTitle (true);
|
||||||
|
|
||||||
return m_sTitle;
|
return m_sTitle;
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ void TitleHelper::impl_sendTitleChangedEvent ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
void TitleHelper::impl_updateTitle ()
|
void TitleHelper::impl_updateTitle (bool init)
|
||||||
{
|
{
|
||||||
// SYNCHRONIZED ->
|
// SYNCHRONIZED ->
|
||||||
::osl::ResettableMutexGuard aLock(m_aMutex);
|
::osl::ResettableMutexGuard aLock(m_aMutex);
|
||||||
@@ -328,25 +328,20 @@ void TitleHelper::impl_updateTitle ()
|
|||||||
|
|
||||||
if (xModel.is ())
|
if (xModel.is ())
|
||||||
{
|
{
|
||||||
impl_updateTitleForModel (xModel);
|
impl_updateTitleForModel (xModel, init);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (xController.is ())
|
||||||
if (xController.is ())
|
|
||||||
{
|
{
|
||||||
impl_updateTitleForController (xController);
|
impl_updateTitleForController (xController, init);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (xFrame.is ())
|
||||||
if (xFrame.is ())
|
|
||||||
{
|
{
|
||||||
impl_updateTitleForFrame (xFrame);
|
impl_updateTitleForFrame (xFrame, init);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
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 ->
|
// SYNCHRONIZED ->
|
||||||
::osl::ResettableMutexGuard aLock(m_aMutex);
|
::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,
|
// WORKAROUND: the notification is currently sent always,
|
||||||
// can be changed after shared mode is supported per UNO API
|
// 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_sTitle = sTitle;
|
||||||
m_nLeasedNumber = nLeasedNumber;
|
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 ->
|
// SYNCHRONIZED ->
|
||||||
::osl::ResettableMutexGuard aLock(m_aMutex);
|
::osl::ResettableMutexGuard aLock(m_aMutex);
|
||||||
@@ -471,7 +466,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css:
|
|||||||
aLock.reset ();
|
aLock.reset ();
|
||||||
|
|
||||||
::rtl::OUString sNewTitle = sTitle.makeStringAndClear ();
|
::rtl::OUString sNewTitle = sTitle.makeStringAndClear ();
|
||||||
sal_Bool bChanged = (! m_sTitle.equals(sNewTitle));
|
sal_Bool bChanged = !init && m_sTitle != sNewTitle;
|
||||||
m_sTitle = sNewTitle;
|
m_sTitle = sNewTitle;
|
||||||
m_nLeasedNumber = nLeasedNumber;
|
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 ())
|
if ( ! xFrame.is ())
|
||||||
return;
|
return;
|
||||||
@@ -516,7 +511,7 @@ void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::fram
|
|||||||
aLock.reset ();
|
aLock.reset ();
|
||||||
|
|
||||||
::rtl::OUString sNewTitle = sTitle.makeStringAndClear ();
|
::rtl::OUString sNewTitle = sTitle.makeStringAndClear ();
|
||||||
sal_Bool bChanged = (! m_sTitle.equals(sNewTitle));
|
sal_Bool bChanged = !init && m_sTitle != sNewTitle;
|
||||||
m_sTitle = sNewTitle;
|
m_sTitle = sNewTitle;
|
||||||
|
|
||||||
aLock.clear ();
|
aLock.clear ();
|
||||||
|
Reference in New Issue
Block a user