sc/source/ui/view/tabvwsha.cxx       |    2 +-
 sd/source/ui/docshell/docshell.cxx   |    2 +-
 sfx2/sdi/sfx.sdi                     |    2 +-
 sw/source/uibase/uiview/viewsrch.cxx |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ebea5ef578bd919ab10d769d2eb27521d2c15012
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Feb 11 14:24:40 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Feb 11 11:29:23 2025 +0100

    tdf#165185: consider LOK read-only view in SID_SEARCH_OPTIONS
    
    This reverts commit cae3ed92df74672a886ee706ebb970a763be3712 "disable
    invoking Search and Replace dialog (by Ctrl+H) in read-only documents",
    2025-02-11. Instead, the dialog will disable replacement controls.
    
    Change-Id: Iefef1f636492f60b2bcff07379c2c2dc7bcead79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181408
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 63e930928439..bca95efa1494 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -254,7 +254,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
                     SearchOptionFlags nOptions = SearchOptionFlags::ALL;
 
                     // No replacement if ReadOnly
-                    if (GetViewData().GetDocShell()->IsReadOnly())
+                    if (GetViewData().GetDocShell()->IsReadOnly() || 
IsCurrentLokViewReadOnly())
                         nOptions &= ~SearchOptionFlags( 
SearchOptionFlags::REPLACE | SearchOptionFlags::REPLACE_ALL );
                     rSet.Put( SfxUInt16Item( nWhich, 
static_cast<sal_uInt16>(nOptions) ) );
                 }
diff --git a/sd/source/ui/docshell/docshell.cxx 
b/sd/source/ui/docshell/docshell.cxx
index 834de4941159..d1c4d1c0b091 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -241,7 +241,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
                               SearchOptionFlags::SIMILARITY  |
                               SearchOptionFlags::SELECTION;
 
-                if (!IsReadOnly())
+                if (!IsReadOnly() && !SfxViewShell::IsCurrentLokViewReadOnly())
                 {
                     nOpt |= SearchOptionFlags::REPLACE;
                     nOpt |= SearchOptionFlags::REPLACE_ALL;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 2952289293cf..c07d4bbf7a83 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4002,7 +4002,7 @@ SfxBoolItem SearchDialog SID_SEARCH_DLG
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,
-    ReadOnlyDoc = FALSE,
+    ReadOnlyDoc = TRUE,
     Toggle = FALSE,
     Container = FALSE,
     RecordAbsolute = FALSE,
diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 8234cf5501af..1944f1f40ca3 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -869,7 +869,7 @@ void SwView::StateSearch(SfxItemSet &rSet)
             case SID_SEARCH_OPTIONS:
             {
                 SearchOptionFlags nOpt = SearchOptionFlags::ALL;
-                if( GetDocShell()->IsReadOnly() )
+                if (GetDocShell()->IsReadOnly() || IsCurrentLokViewReadOnly())
                     nOpt &= ~SearchOptionFlags( SearchOptionFlags::REPLACE |
                                SearchOptionFlags::REPLACE_ALL );
                 rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, 
static_cast<sal_uInt16>(nOpt) ));

Reply via email to