[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Michael Stahl
mstahl at redhat.com
Wed May 4 15:59:27 UTC 2016
include/sfx2/viewsh.hxx | 2 +-
sfx2/source/view/ipclient.cxx | 5 ++++-
sfx2/source/view/viewsh.cxx | 27 +++++++++++++++++++++------
3 files changed, 26 insertions(+), 8 deletions(-)
New commits:
commit db0d96472519042e3527805b8fa5c90038934bf5
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed May 4 17:43:02 2016 +0200
sfx2: fix SfxViewShell::CheckIPClient_Impl()
Probably the Edit->Plug-in removal removed the wrong branch there since
m_bPlugInsActive was always true before.
This caused embded::UnreachableStateException to be thrown out of a
Timer and that was only handled as a FatalError in desktop::Main,
for example on kde84498-1.html.
(regression from 4b3c211cfb4f64f0f31461aa2e623d64224c4423)
Change-Id: If9e2578f722ea5c5b0821d3d894bb439dbf3c40c
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 865f758..f76e00c 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 1861d33..6b7f0ad 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 93a2b8b..c785f8e 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);
+ }
+ }
+ }
}
More information about the Libreoffice-commits
mailing list