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 652259c47d2be3f1b122ae4aee9e0b09f3f6cc5c
Author:     Tibor Nagy <tibor.nagy.ext...@allotropia.de>
AuthorDate: Fri Feb 21 18:13:59 2025 +0100
Commit:     Nagy Tibor <tibor.nagy.ext...@allotropia.de>
CommitDate: Fri Feb 21 22:26:45 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>

diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 21a59b8c039b..86487582fe80 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -139,6 +139,9 @@ public:
     inline void ResetCursorStack();
     SW_DLLPUBLIC 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 be2039c3246b..d9a98f94fe54 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -79,8 +79,9 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
 void 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 cd5572e44d6a..80d263fb4e69 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1834,6 +1834,21 @@ SelectionType SwWrtShell::GetSelectionType() const
     return nCnt;
 }
 
+bool SwWrtShell::IsSectionEditableInReadonly() const
+{
+    bool bIsEditableSect = false;
+    SwTextNode* pTextNode = GetCursor()->GetPointNode().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