sw/source/uibase/inc/wrtsh.hxx       |    3 +++
 sw/source/uibase/ribbar/workctrl.cxx |    5 +++--
 sw/source/uibase/wrtsh/wrtsh1.cxx    |   15 +++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit ae30de75b45df00652845e0c7b158f363788d285
Author:     Tibor Nagy <tibor.nagy.ext...@allotropia.de>
AuthorDate: Fri Feb 21 18:13:59 2025 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Sat Feb 22 14:06:34 2025 +0100

    tdf#146553 sw: allow the AutoText dropdown button in the toolbar in RO
    
    Change-Id: Icddb74ff6256e3cce635fad14210beda8a1f4f20
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182011
    Tested-by: Jenkins
    Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de>
    (cherry picked from commit 652259c47d2be3f1b122ae4aee9e0b09f3f6cc5c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182022
    Tested-by: allotropia jenkins <jenk...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index decf24bb4a08..b7f5bee9c5c6 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -129,6 +129,9 @@ public:
     inline void ResetCursorStack();
     SelectionType   GetSelectionType() const;
 
+    // checks if the section is editable in read-only mode
+    bool    IsSectionEditableInReadonly() const;
+
     bool    IsModePushed() const { return nullptr != m_pModeStack; }
     void    PushMode();
     void    PopMode();
diff --git a/sw/source/uibase/ribbar/workctrl.cxx 
b/sw/source/uibase/ribbar/workctrl.cxx
index d7260fdfe1d2..5ace2b3bd9e2 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -89,8 +89,9 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
 VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
 {
     SwView* pView = ::GetActiveView();
-    if(pView && !pView->GetDocShell()->IsReadOnly() &&
-       !pView->GetWrtShell().HasReadonlySel() )
+    if (pView
+        && ((!pView->GetDocShell()->IsReadOnly() && 
!pView->GetWrtShell().HasReadonlySel())
+            || pView->GetWrtShell().IsSectionEditableInReadonly()))
     {
         Link<Menu*,bool> aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl);
 
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index d8d7d77e209c..b9a1a735e528 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1479,6 +1479,21 @@ SelectionType SwWrtShell::GetSelectionType() const
     return nCnt;
 }
 
+bool SwWrtShell::IsSectionEditableInReadonly() const
+{
+    bool bIsEditableSect = false;
+    SwTextNode* pTextNode = GetCursor()->GetNode().GetTextNode();
+    if (pTextNode)
+    {
+        if (SwSectionNode* pSectNode = pTextNode->FindSectionNode())
+        {
+            bIsEditableSect = pSectNode->GetSection().IsEditInReadonly();
+        }
+    }
+
+    return bIsEditableSect;
+}
+
 // Find the text collection with the name rCollname
 // Returns:   Pointer at the collection or 0, if no
 //            text collection with this name exists, or

Reply via email to