diff options
-rw-r--r-- | include/sfx2/viewsh.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 27 |
3 files changed, 26 insertions, 8 deletions
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 865f7588d38d..f76e00c70328 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -315,7 +315,7 @@ public: SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &); SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &); SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&); - SAL_DLLPRIVATE void CheckIPClient_Impl( SfxInPlaceClient* ); + SAL_DLLPRIVATE void CheckIPClient_Impl(SfxInPlaceClient*, const Rectangle&); SAL_DLLPRIVATE void PushSubShells_Impl( bool bPush=true ); SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( false ); } SAL_DLLPRIVATE void TakeOwnership_Impl(); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 1861d33a0b2f..6b7f0adf0e01 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -593,7 +593,10 @@ void SfxInPlaceClient_Impl::SizeHasChanged() IMPL_LINK_NOARG_TYPED(SfxInPlaceClient_Impl, TimerHdl, Timer *, void) { if ( m_pClient && m_xObject.is() ) - m_pClient->GetViewShell()->CheckIPClient_Impl( m_pClient ); + { + m_pClient->GetViewShell()->CheckIPClient_Impl(m_pClient, + m_pClient->GetViewShell()->GetObjectShell()->GetVisArea()); + } } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 93a2b8b422a6..c785f8e3639c 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1564,7 +1564,8 @@ void SfxViewShell::VisAreaChanged(const Rectangle& /*rVisArea*/) } -void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient ) +void SfxViewShell::CheckIPClient_Impl( + SfxInPlaceClient *const pIPClient, const Rectangle& rVisArea) { if ( GetObjectShell()->IsInClose() ) return; @@ -1574,11 +1575,25 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient ) bool bActiveWhenVisible = ( (( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ) || svt::EmbeddedObjectRef::IsGLChart(pIPClient->GetObject())); - // object in client is currently active - // check if the object wants to be activated always or when it becomes at least partially visible - // in this case selecting of the "Edit/Plugin" checkbox should let such objects deactivate - if ( bAlwaysActive || bActiveWhenVisible ) - pIPClient->GetObject()->changeState( embed::EmbedStates::RUNNING ); + + // this method is called when a client is created + if (!pIPClient->IsObjectInPlaceActive()) + { + // object in client is currently not active + // check if the object wants to be activated always or when it becomes at least partially visible + // TODO/LATER: maybe we should use the scaled area instead of the ObjArea?! + if (bAlwaysActive || (bActiveWhenVisible && rVisArea.IsOver(pIPClient->GetObjArea()))) + { + try + { + pIPClient->GetObject()->changeState( embed::EmbedStates::INPLACE_ACTIVE ); + } + catch (const uno::Exception& e) + { + SAL_WARN("sfx.view", "SfxViewShell::CheckIPClient_Impl exception: " << e.Message); + } + } + } } |