sw/source/core/frmedt/feflyole.cxx |    4 +++-
 sw/source/uibase/inc/wrtsh.hxx     |    1 +
 sw/source/uibase/uiview/view.cxx   |    3 ++-
 sw/source/uibase/wrtsh/wrtsh1.cxx  |   10 ++++++++++
 4 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 033efbdef871631847c6062bb40fc2f2a02bbd98
Author:     Gülşah Köse <[email protected]>
AuthorDate: Fri Oct 3 17:39:58 2025 +0300
Commit:     Gülşah Köse <[email protected]>
CommitDate: Tue Oct 28 07:17:07 2025 +0100

    GH#13078 ONLINE: Fix the selecting shell issue on math objects
    
    Issue:
    Double click to math formula in Writer (Shows the right Sidebar elemets)
    Single click the outside
    Double click the formula again (Doesn't show the sidebar)
    
    Signed-off-by: Gülşah Köse <[email protected]>
    Change-Id: I627c280d6ef676dedfcac53387bc10a3882a247f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191830
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193015
    Tested-by: Jenkins

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 <ndole.hxx>
 #include <swcli.hxx>
 #include <docsh.hxx>
+#include <view.hxx>
 #include <IDocumentLinksAdministration.hxx>
 #include <sfx2/linkmgr.hxx>
 
@@ -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)

Reply via email to