include/comphelper/accflowenum.hxx                        |    3 +
 include/svx/srchdlg.hxx                                   |    3 +
 sc/source/ui/Accessibility/AccessibleDocument.cxx         |   14 +++++---
 sc/source/ui/view/tabvwshe.cxx                            |    4 +-
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx |    2 -
 sd/source/ui/view/Outliner.cxx                            |    2 -
 svx/source/dialog/srchdlg.cxx                             |   22 ++++++++++++--
 sw/source/core/access/accdoc.cxx                          |    4 +-
 sw/source/uibase/uiview/viewsrch.cxx                      |   11 +++----
 9 files changed, 45 insertions(+), 20 deletions(-)

New commits:
commit 12eb32fccec16a436a6c3eca725b9d6d449f8e19
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Oct 23 15:30:51 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Oct 23 21:51:39 2019 +0200

    Resolves: tdf#128313 disambiguate flow-to search results
    
    for a11y between find/replace where our result is a single thing, and
    find-all/replace-all where the result is potentially many things, which 
allows
    that searching in a selected calc column will flow-to the current cell, not 
the
    entire ~infinite set of cells in the column
    
    Change-Id: Ib3e56fceb90d869f157427f090cdffe986a5a588
    Reviewed-on: https://gerrit.libreoffice.org/81396
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/comphelper/accflowenum.hxx 
b/include/comphelper/accflowenum.hxx
index c34b42e277cf..fc6b7ea2d8ec 100644
--- a/include/comphelper/accflowenum.hxx
+++ b/include/comphelper/accflowenum.hxx
@@ -25,7 +25,8 @@
 enum AccessibilityFlowTo : sal_Int32
 {
     FORSPELLCHECKFLOWTO = 1,
-    FORFINDREPLACEFLOWTO = 2
+    FORFINDREPLACEFLOWTO_ITEM = 2,
+    FORFINDREPLACEFLOWTO_RANGE = 3
 };
 
 #endif // INCLUDED_COMPHELPER_ACCFLOWENUM_HXX
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 3e3a73f92815..1a613f913554 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -23,6 +23,7 @@
 #include <sfx2/basedlgs.hxx>
 #include <svl/poolitem.hxx>
 #include <svl/srchdefs.hxx>
+#include <svl/srchitem.hxx>
 #include <svx/svxdllapi.h>
 #include <memory>
 #include <vector>
@@ -125,7 +126,7 @@ public:
 
     TransliterationFlags        GetTransliterationFlags() const;
 
-    void SetDocWin(vcl::Window* pDocWin);
+    void SetDocWin(vcl::Window* pDocWin, SvxSearchCmd eCommand);
     void SetSrchFlag( bool bSuccess ) { mbSuccess = bSuccess; }
     bool GetSrchFlag() const { return mbSuccess; }
     void            SetSaveToModule(bool b);
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 5ad1c1d41a31..d4ffbbaac88b 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -2352,18 +2352,22 @@ css::uno::Sequence< css::uno::Any >
             }
         }
     }
-    else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO)
+    else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType 
== AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
     {
         bool bSuccess(false);
         rAny >>= bSuccess;
         if ( bSuccess )
         {
-            uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
-            if ( aSeq.hasElements() )
+            if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
             {
-                return aSeq;
+                uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
+                if ( aSeq.hasElements() )
+                {
+                    return aSeq;
+                }
             }
-            else if( mpAccessibleSpreadsheet.is() )
+
+            if( mpAccessibleSpreadsheet.is() )
             {
                 uno::Reference < XAccessible > xFindCellAcc = 
mpAccessibleSpreadsheet->GetActiveCell();
                 // add xFindCellAcc to the return the Sequence
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 61bdf4e285ae..fece06e7d8ec 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -244,7 +244,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
                                 vcl::Window* pWin = pTabView->GetActiveWin();
                                 if( pWin )
                                 {
-                                    pSearchDlg->SetDocWin( pWin );
+                                    pSearchDlg->SetDocWin( pWin, 
pSearchItem->GetCommand() );
                                     pSearchDlg->SetSrchFlag( bSuccess );
                                 }
                             }
@@ -314,7 +314,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
                                 vcl::Window* pWin = pTabView->GetActiveWin();
                                 if( pWin )
                                 {
-                                    pSearchDlg->SetDocWin( pWin );
+                                    pSearchDlg->SetDocWin( pWin, 
aSearchItem.GetCommand() );
                                     pSearchDlg->SetSrchFlag(false);
                                 }
                             }
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx 
b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index 800cad560d3c..04da532ca255 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -784,7 +784,7 @@ css::uno::Sequence< css::uno::Any >
             goto Rt;
         }
     }
-    else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO)
+    else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType 
== AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
     {
         sal_Int32 nChildCount = getSelectedAccessibleChildCount();
         if ( nChildCount )
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 56e0a89a9c6d..7fab5d32c3ba 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -491,7 +491,7 @@ bool SdOutliner::StartSearchAndReplace (const 
SvxSearchItem* pSearchItem)
         {
             SvxSearchDialog* pSearchDlg =
                 
static_cast<SvxSearchDialog*>(pChildWin->GetController().get());
-            pSearchDlg->SetDocWin( pViewShell->GetActiveWindow() );
+            pSearchDlg->SetDocWin( pViewShell->GetActiveWindow(), nCommand );
             pSearchDlg->SetSrchFlag(false);
         }
     }
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index ef831b92f2bf..3d51c2bc7f53 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2287,7 +2287,7 @@ void SvxSearchDialog::SaveToModule_Impl()
     rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SfxCallMode::SLOT, 
ppArgs );
 }
 
-void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin)
+void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin, SvxSearchCmd eCommand)
 {
     m_xDialog->clear_extra_accessible_relations();
 
@@ -2305,7 +2305,25 @@ void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin)
         return;
     }
 
-    uno::Sequence<uno::Any> aAnySeq = 
xGetAccFlowTo->getAccFlowTo(Any(GetSrchFlag()), 
AccessibilityFlowTo::FORFINDREPLACEFLOWTO);
+    /* tdf#128313 FlowTo tries to set an a11y relation between the search 
dialog
+       and its results. But for "find/replace" within a calc column we don't
+       want to return the entire column as the result, we want the current 
cell.
+
+       But with search/all we do want the new multi-cellselection as the 
result.
+    */
+    AccessibilityFlowTo 
eFlowTo(AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM);
+    switch (eCommand)
+    {
+        case SvxSearchCmd::FIND:
+        case SvxSearchCmd::REPLACE:
+            eFlowTo = AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM;
+            break;
+        case SvxSearchCmd::FIND_ALL:
+        case SvxSearchCmd::REPLACE_ALL:
+            eFlowTo = AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE;
+            break;
+    }
+    uno::Sequence<uno::Any> aAnySeq = 
xGetAccFlowTo->getAccFlowTo(Any(GetSrchFlag()), eFlowTo);
 
     sal_Int32 nLen = aAnySeq.getLength();
     if (nLen)
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index b9fd5f5c0988..0aecf604ca66 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -734,7 +734,7 @@ css::uno::Sequence< css::uno::Any >
         return uno::Sequence< uno::Any >();
     }
 
-    if ( nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO )
+    if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO)
     {
         uno::Reference< css::drawing::XShape > xShape;
         rAny >>= xShape;
@@ -788,7 +788,7 @@ css::uno::Sequence< css::uno::Any >
             }
         }
     }
-    else if ( nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO )
+    else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType 
== AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
     {
         SwCursorShell* pCursorShell = GetCursorShell();
         if ( pCursorShell )
diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 9db45fe9d4ba..9bc9944ca36c 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -236,7 +236,8 @@ void SwView::ExecSearch(SfxRequest& rReq)
                     s_pSrchItem = static_cast<SvxSearchItem*>( 
pArgs->Get(SID_SEARCH_ITEM).Clone() );
                 }
             }
-            switch (s_pSrchItem->GetCommand())
+            SvxSearchCmd eCommand = s_pSrchItem->GetCommand();
+            switch (eCommand)
             {
             case SvxSearchCmd::FIND:
             {
@@ -253,7 +254,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                     pSrchDlg = GetSearchDialog();
                     if (pSrchDlg)
                     {
-                        pSrchDlg->SetDocWin(m_pEditWin);
+                        pSrchDlg->SetDocWin(m_pEditWin, eCommand);
                         pSrchDlg->SetSrchFlag(false);
                     }
                 }
@@ -286,7 +287,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                     pSrchDlg = GetSearchDialog();
                     if (pSrchDlg)
                     {
-                        pSrchDlg->SetDocWin(m_pEditWin);
+                        pSrchDlg->SetDocWin(m_pEditWin, eCommand);
                         pSrchDlg->SetSrchFlag(false);
                     }
                 }
@@ -344,7 +345,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                     pSrchDlg = GetSearchDialog();
                     if (pSrchDlg)
                     {
-                        pSrchDlg->SetDocWin(m_pEditWin);
+                        pSrchDlg->SetDocWin(m_pEditWin, eCommand);
                         pSrchDlg->SetSrchFlag(false);
                     }
                 }
@@ -412,7 +413,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                 pSrchDlg = GetSearchDialog();
                 if (pSrchDlg)
                 {
-                    pSrchDlg->SetDocWin(m_pEditWin);
+                    pSrchDlg->SetDocWin(m_pEditWin, eCommand);
                     pSrchDlg->SetSrchFlag(false);
                 }
 #endif
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to