diff options
author | Mathias Bauer <mba@openoffice.org> | 2002-09-18 15:10:39 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2002-09-18 15:10:39 +0000 |
commit | 6fef57e7b3166ba1a330a91a2006f09179f04118 (patch) | |
tree | c89ddb969c678069f7dae8c79e17b01465dffb42 /sfx2 | |
parent | 006c26d82cb6854de1fa2a79de7cb8f74fd712a7 (diff) |
#103456#: make sure that contextChanged is called not too often
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 41 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 6 |
2 files changed, 39 insertions, 8 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index f48453500759..aea3724138ec 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -2,9 +2,8 @@ * * $RCSfile: bindings.cxx,v $ * - * $Revision: 1.21 $ - * - * last change: $Author: mba $ $Date: 2002-09-06 12:45:14 $ + * $Revision: 1.22 $ + * last change: $Author: mba $ $Date: 2002-09-18 16:09:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -216,6 +215,7 @@ public: sal_uInt16 nCachedFunc2; // index der vorletzt gerufenen sal_uInt16 nMsgPos; // Message-Position, ab der zu aktualisieren ist SfxPopupAction ePopupAction; // in DeleteFloatinWindow() abgefragt + sal_Bool bContextChanged; sal_Bool bMsgDirty; // wurde ein MessageServer invalidiert? sal_Bool bAllMsgDirty; // wurden die MessageServer invalidiert? sal_Bool bAllDirty; // nach InvalidateAll @@ -307,6 +307,7 @@ SfxBindings::SfxBindings() { pImp->nMsgPos = 0; pImp->bAllMsgDirty = sal_True; + pImp->bContextChanged = sal_False; pImp->bMsgDirty = sal_True; pImp->bAllDirty = sal_True; pImp->ePopupAction = SFX_POPUP_DELETE; @@ -927,13 +928,13 @@ void SfxBindings::InvalidateAll for ( sal_uInt16 n = 0; n < pImp->pCaches->Count(); ++n ) pImp->pCaches->GetObject(n)->Invalidate(bWithMsg); - +/* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); if ( bWithMsg && xFrame.is() ) xFrame->contextChanged(); - +*/ pImp->nMsgPos = 0; if ( !nRegLevel ) { @@ -1716,6 +1717,20 @@ void SfxBindings::UpdateSlotServer_Impl() pDispatcher->Flush(); // pDispatcher->Update_Impl(); + if ( pImp->bAllMsgDirty ) + { + if ( !nRegLevel ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame + ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + if ( xFrame.is() ) + xFrame->contextChanged(); + pImp->bContextChanged = FALSE; + } + else + pImp->bContextChanged = TRUE; + } + const sal_uInt16 nCount = pImp->pCaches->Count(); for(sal_uInt16 i = 0; i < nCount; ++i) { @@ -2293,6 +2308,15 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, char *pFile, int nLine // check if this is the outer most level if ( --nRegLevel == 0 && !SFX_APP()->IsDowning() ) { + if ( pImp->bContextChanged ) + { + ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame + ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + if ( xFrame.is() ) + xFrame->contextChanged(); + pImp->bContextChanged = FALSE; + } + #ifndef slow SfxViewFrame* pFrame = pDispatcher->GetFrame(); @@ -2846,3 +2870,10 @@ void SfxBindings::SetRecorder_Impl( com::sun::star::uno::Reference< com::sun::st pImp->xRecorder = rRecorder; } +void SfxBindings::ContextChanged_Impl() +{ + if ( !pImp->bInUpdate && ( !pImp->bContextChanged || !pImp->bAllMsgDirty ) ) + { + InvalidateAll( TRUE ); + } +} diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 0c04a43c2399..aac8f1a9e85d 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sfxbasecontroller.cxx,v $ * - * $Revision: 1.33 $ + * $Revision: 1.34 $ * - * last change: $Author: mba $ $Date: 2002-08-29 12:29:44 $ + * last change: $Author: mba $ $Date: 2002-09-18 16:10:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -393,7 +393,7 @@ void SAL_CALL IMPL_SfxBaseController_ListenerHelper::frameAction( const FRAMEACT else if ( aEvent.Action == ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - m_pController->GetViewShell_Impl()->GetViewFrame()->GetBindings().InvalidateAll( TRUE ); + m_pController->GetViewShell_Impl()->GetViewFrame()->GetBindings().ContextChanged_Impl(); } } } |