Resolves: #i123276# Properly forward Deactivate() call...
and still don't broadcast context change. (cherry picked from commit 520cc667c80cea6bb48422825250b72ff36bb4ef) Conflicts: sd/source/ui/view/drviews1.cxx sfx2/inc/sfx2/shell.hxx sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx sfx2/source/control/shell.cxx sfx2/source/sidebar/ContextChangeBroadcaster.cxx Change-Id: I753009041a999bc31a0528e37f0a499897f311c5
This commit is contained in:
parent
9fec7c4e0d
commit
03b52b5405
5 changed files with 41 additions and 3 deletions
|
@ -249,6 +249,10 @@ public:
|
|||
*/
|
||||
void BroadcastContextForActivation (const bool bIsActivated);
|
||||
|
||||
/** Enabled or disable the context broadcaster. Returns the old state.
|
||||
*/
|
||||
bool SetContextBroadcasterEnabled (const bool bIsEnabled);
|
||||
|
||||
SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
|
||||
SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);
|
||||
SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);
|
||||
|
|
|
@ -41,8 +41,17 @@ public:
|
|||
void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame);
|
||||
void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame);
|
||||
|
||||
/** Enable or disable the broadcaster.
|
||||
@param bIsEnabled
|
||||
The new value of the "enabled" state.
|
||||
@return
|
||||
The old value of the "enabled" state is returned.
|
||||
*/
|
||||
bool SetBroadcasterEnabled (const bool bIsEnabled);
|
||||
|
||||
private:
|
||||
rtl::OUString msContextName;
|
||||
bool mbIsBroadcasterEnabled;
|
||||
|
||||
void BroadcastContextChange (
|
||||
const cssu::Reference<css::frame::XFrame>& rxFrame,
|
||||
|
|
|
@ -114,9 +114,15 @@ void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
|
|||
}
|
||||
|
||||
|
||||
void DrawViewShell::Deactivate(sal_Bool /*bIsMDIActivate*/)
|
||||
void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
|
||||
{
|
||||
// Do not forward to ViewShell::Deactivate() to prevent a context change.
|
||||
// Temporarily disable context broadcasting while the Deactivate()
|
||||
// call is forwarded to our base class.
|
||||
const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false));
|
||||
|
||||
ViewShell::Deactivate(bIsMDIActivate);
|
||||
|
||||
SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled);
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
@ -1176,4 +1176,9 @@ void SfxShell::BroadcastContextForActivation (const bool bIsActivated)
|
|||
}
|
||||
}
|
||||
|
||||
bool SfxShell::SetContextBroadcasterEnabled (const bool bIsEnabled)
|
||||
{
|
||||
return pImp->maContextChangeBroadcaster.SetBroadcasterEnabled(bIsEnabled);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace sfx2 { namespace sidebar {
|
|||
|
||||
|
||||
ContextChangeBroadcaster::ContextChangeBroadcaster (void)
|
||||
: msContextName()
|
||||
: msContextName(),
|
||||
mbIsBroadcasterEnabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,11 +77,24 @@ void ContextChangeBroadcaster::Deactivate (const cssu::Reference<css::frame::XFr
|
|||
|
||||
|
||||
|
||||
bool ContextChangeBroadcaster::SetBroadcasterEnabled (const bool bIsEnabled)
|
||||
{
|
||||
const bool bWasEnabled (mbIsBroadcasterEnabled);
|
||||
mbIsBroadcasterEnabled = bIsEnabled;
|
||||
return bWasEnabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ContextChangeBroadcaster::BroadcastContextChange (
|
||||
const cssu::Reference<css::frame::XFrame>& rxFrame,
|
||||
const ::rtl::OUString& rsModuleName,
|
||||
const ::rtl::OUString& rsContextName)
|
||||
{
|
||||
if ( ! mbIsBroadcasterEnabled)
|
||||
return;
|
||||
|
||||
if (rsContextName.getLength() == 0)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue