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 60861c131d0bbc6e45d235f09c8c3d8c1bd69b0a
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Feb 11 14:24:40 2025 +0500
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Tue Feb 11 11:40:50 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/+/181412
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index ead308730fd9..ddd94926303a 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -255,7 +255,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 5ac592f80be3..6dae05250ba1 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 7318b659c292..ad4a5a5b4189 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3968,7 +3968,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 5fc92d517b1b..1b2b64d1d460 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -855,7 +855,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