sc/source/ui/view/drawview.cxx |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 5257bd795d39dbe5f184d1ceddf85512a8b44cef
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Wed May 21 15:48:00 2025 +0200
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Thu Jun 19 08:50:27 2025 +0200

    tdf#166633 - sc fix wrong context menu for text boxes
    
    Handle separately text SdrObjs from not text SdrObjs
    because when we create a new text object we also set
    in edit mode automatically.
    
    regression from commit: 7e15c704cedf1ca77b3ebe8b3b60f6a1ad57deb0
    (tdf#166481 sc shapes edit view: fix wrong draw view shell)
    
    Change-Id: I4887c5f24a277fbbf01b4449148f3934b043220b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185618
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 29edbf28fc3135ccc6d84f9484df939c5f891746)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186619
    Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index e9955ed8558f..7626ee950c2b 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -400,7 +400,8 @@ void ScDrawView::MarkListHasChanged()
     if (nMarkCount == 1)
     {
         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-        if (pObj->GetObjIdentifier() == SdrObjKind::OLE2)
+        SdrObjKind nSdrObjKind = pObj->GetObjIdentifier();
+        if (nSdrObjKind == SdrObjKind::OLE2)
         {
             pOle2Obj = static_cast<SdrOle2Obj*>(pObj);
             if (!ScDocument::IsChart(pObj) )
@@ -409,21 +410,27 @@ void ScDrawView::MarkListHasChanged()
                 pViewSh->SetChartShell(true);
             bSubShellSet = true;
         }
-        else if (pObj->GetObjIdentifier() == SdrObjKind::Graphic)
+        else if (nSdrObjKind == SdrObjKind::Graphic)
         {
             pGrafObj = static_cast<SdrGrafObj*>(pObj);
             pViewSh->SetGraphicShell(true);
             bSubShellSet = true;
         }
-        else if (pObj->GetObjIdentifier() == SdrObjKind::Media)
+        else if (nSdrObjKind == SdrObjKind::Media)
         {
             pViewSh->SetMediaShell(true);
             bSubShellSet = true;
         }
-        else if (pObj->GetObjIdentifier() != SdrObjKind::Text   // prevent 
switching to the drawing shell
-                    && !pViewSh->IsDrawTextShell())     // when creating a 
text object @#70206#
+        else if (nSdrObjKind == SdrObjKind::Text)
         {
-            // tdf#166481: we only need to switch to draw shell if we have not 
already created a text shell for text edit mode
+            // prevent switching to the drawing shell
+            if (!pViewSh->IsDrawTextShell()) // when creating a text object 
@#70206#
+                pViewSh->SetDrawShell(true);
+        }
+        else if (nSdrObjKind != SdrObjKind::Text && 
!pViewSh->IsDrawTextShell())
+        {
+            // tdf#166481: we only need to switch to draw shell if we have not
+            // already created a text shell for text edit mode
             pViewSh->SetDrawShell(true);
         }
     }

Reply via email to