diff --git a/sw/source/core/frmedt/feflyole.cxx b/sw/source/core/frmedt/feflyole.cxx index e65d61f03272..badea5d15f92 100644 --- a/sw/source/core/frmedt/feflyole.cxx +++ b/sw/source/core/frmedt/feflyole.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -106,7 +107,7 @@ bool SwFEShell::FinishOLEObj() // Server is terminated IsCheckForOLEInCaption() ) SetCheckForOLEInCaption( !IsCheckForOLEInCaption() ); - if (const SwDocShell* pShell = GetDoc()->GetDocShell()) + if (SwDocShell* pShell = GetDoc()->GetDocShell()) { // enable update of the link preview comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer(); @@ -123,6 +124,7 @@ bool SwFEShell::FinishOLEObj() // Server is terminated // return back original value of the "update of the link preview" flag rEmbeddedObjectContainer.setUserAllowsLinkUpdate(aUserAllowsLinkUpdate); + pShell->GetView()->SelectShell(); } } return bRet; diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 86097ca88fcd..5e387dd30171 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -360,6 +360,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrameFormat **pFlyFrameFormat = nullptr ); SW_DLLPUBLIC void LaunchOLEObj(sal_Int32 nVerb = css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY); // start server + bool IsOLEMath(); virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset ) override; virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj, const SwRect *pFlyPrtRect = nullptr, diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 279de499c6c8..ff4e4e46f985 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -316,7 +316,8 @@ void SwView::SelectShell() if ( m_pFormShell && m_pFormShell->IsActiveControl() ) nNewSelectionType |= SelectionType::FormControl; - if ( nNewSelectionType == m_nSelectionType ) + if ( nNewSelectionType == m_nSelectionType && + !(m_nSelectionType == SelectionType::Ole && m_pWrtShell->IsOLEMath()) ) { GetViewFrame().GetBindings().InvalidateAll( false ); if ( m_nSelectionType & SelectionType::Ole || diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index d8ca509844bd..be8b623e99ad 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -666,6 +666,16 @@ bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrame return bActivate; } +bool SwWrtShell::IsOLEMath() { + svt::EmbeddedObjectRef& xRef = GetOLEObject(); + OSL_ENSURE( xRef.is(), "OLE not found" ); + + const auto classId = xRef->getClassID(); + if ( SotExchange::IsMath(classId) ) + return true; + return false; +} + // The current selected OLE object will be loaded with the // verb into the server. void SwWrtShell::LaunchOLEObj(sal_Int32 nVerb)