sc/sdi/tabvwsh.sdi             |    1 +
 sc/source/ui/inc/tabvwsh.hxx   |    1 +
 sc/source/ui/view/tabvwsha.cxx |   13 ++++++++++++-
 sc/source/ui/view/tabvwshe.cxx |    4 ++++
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 769cffa5fe2ff66d05f5ff55df6382f35ea853a6
Author: Damjan Jovanovic <dam...@apache.org>
Date:   Thu Nov 12 17:04:30 2015 +0000

    #i35093# Find (and replace) on selected cells is misleading
    
    When any cellc in Calc are selected at the time the "Find & Replace" dialog 
is opened,
    automatically check the "Current selection only" checkbox, just like Writer 
does when
    multiple lines of text are selected when this dialog opens. Users expect 
this from
    Writer and other spreadsheets, and not doing it can even lead to wrong cells
    being changed when "Replace" is used!
    
    Patch by: me

diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index f93b1e6..a266a6d 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -198,6 +198,7 @@ interface TableEditView
     FID_SEARCH          [ ExecMethod = ExecSearch; ]
     FID_REPLACE         [ ExecMethod = ExecSearch; ]
     FID_SEARCH_ALL      [ ExecMethod = ExecSearch; ]
+    FID_SEARCH_ON       [ ExecMethod = ExecSearch; Export = FALSE; ]
     FID_REPLACE_ALL     [ ExecMethod = ExecSearch; ]
     FID_REPEAT_SEARCH   [ ExecMethod = ExecSearch; ]
 
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index f593985..abc7b82 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -178,6 +178,7 @@ private:
     String                  aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
 
     sal_Bool    bForceFocusOnCurCell; // i123629
+    sal_Bool    bSearchJustOpened; // i35093
 
 private:
     void    Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index e34f697..33a37b3 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -225,7 +225,18 @@ void __EXPORT ScTabViewShell::GetState( SfxItemSet& rSet )
                 break;
 
             case SID_SEARCH_ITEM:
-                rSet.Put( ScGlobal::GetSearchItem() );
+                {
+                    SvxSearchItem searchItem = ScGlobal::GetSearchItem();
+                    // i35093:
+                    if (bSearchJustOpened)
+                    {
+                        ScMarkData& rMarkData = pViewData->GetMarkData();
+                        if (rMarkData.IsMarked())
+                            searchItem.SetSelection( sal_True );
+                    }
+                    bSearchJustOpened = sal_False;
+                    rSet.Put(searchItem);
+                }
                 break;
 
             case SID_SEARCH_OPTIONS:
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index e04a481..b4b0f2f 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -246,6 +246,10 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
 
     switch ( nSlot )
     {
+        case FID_SEARCH_ON:
+            bSearchJustOpened = sal_True;
+            break;
+
         case FID_SEARCH_NOW:
             {
                 if ( pReqArgs &&
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to