[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/comphelper include/svx sc/source sd/source svx/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 24 12:16:57 UTC 2019


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

New commits:
commit 66397e67829f2f502b9b6799dab16fa9a5390020
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 23 14:58:43 2019 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Oct 24 14:15:53 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
    
      plus commit...
    
    put together the 'magic' flow-to constants
    
    as a side note, there's no actual use of FORSPELLCHECKFLOWTO anywhere
    that I can see
    
    Change-Id: Ib3e56fceb90d869f157427f090cdffe986a5a588
    Reviewed-on: https://gerrit.libreoffice.org/81397
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/include/comphelper/accflowenum.hxx b/include/comphelper/accflowenum.hxx
new file mode 100644
index 000000000000..fc6b7ea2d8ec
--- /dev/null
+++ b/include/comphelper/accflowenum.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ACCFLOWENUM_HXX
+#define INCLUDED_COMPHELPER_ACCFLOWENUM_HXX
+
+#include <sal/types.h>
+
+enum AccessibilityFlowTo : sal_Int32
+{
+    FORSPELLCHECKFLOWTO = 1,
+    FORFINDREPLACEFLOWTO_ITEM = 2,
+    FORFINDREPLACEFLOWTO_RANGE = 3
+};
+
+#endif // INCLUDED_COMPHELPER_ACCFLOWENUM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 3d19b6e7cae5..01f5b07663d5 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -22,6 +22,7 @@
 #include <sfx2/childwin.hxx>
 #include <sfx2/basedlgs.hxx>
 #include <svl/srchdefs.hxx>
+#include <svl/srchitem.hxx>
 #include <svl/itempool.hxx>
 #include <svx/svxdllapi.h>
 #include <memory>
@@ -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() { return mbSuccess; }
     void            SetSaveToModule(bool b);
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index b1bf3cc48a33..a63e419754be 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -52,6 +52,7 @@
 #include <svx/AccessibleShapeTreeInfo.hxx>
 #include <svx/AccessibleShapeInfo.hxx>
 #include <svx/IAccessibleParent.hxx>
+#include <comphelper/accflowenum.hxx>
 #include <comphelper/sequence.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/docfile.hxx>
@@ -2284,9 +2285,7 @@ css::uno::Sequence< css::uno::Any >
 {
     SolarMutexGuard g;
 
-    const sal_Int32 SPELLCHECKFLOWTO = 1;
-    const sal_Int32 FINDREPLACEFLOWTO = 2;
-    if ( nType == SPELLCHECKFLOWTO )
+    if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO)
     {
         uno::Reference< css::drawing::XShape > xShape;
         rAny >>= xShape;
@@ -2350,18 +2349,22 @@ css::uno::Sequence< css::uno::Any >
             }
         }
     }
-    else if ( nType == FINDREPLACEFLOWTO )
+    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 faeb5d05bdfb..516cb11e3cba 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -246,7 +246,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
                                 vcl::Window* pWin = pTabView->GetActiveWin();
                                 if( pWin )
                                 {
-                                    pSearchDlg->SetDocWin( pWin );
+                                    pSearchDlg->SetDocWin( pWin, pSearchItem->GetCommand() );
                                     pSearchDlg->SetSrchFlag( bSuccess );
                                 }
                             }
@@ -316,7 +316,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 a9d7ca12e4fd..e178d93e7baf 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <cppuhelper/queryinterface.hxx>
+#include <comphelper/accflowenum.hxx>
 #include <comphelper/processfactory.hxx>
 #include <sal/log.hxx>
 #include <tools/debug.hxx>
@@ -743,9 +744,7 @@ css::uno::Sequence< css::uno::Any >
 {
     SolarMutexGuard g;
 
-    const sal_Int32 SPELLCHECKFLOWTO = 1;
-    const sal_Int32 FINDREPLACEFLOWTO = 2;
-    if ( nType == SPELLCHECKFLOWTO )
+    if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO)
     {
         uno::Reference< css::drawing::XShape > xShape;
         rAny >>= xShape;
@@ -787,7 +786,7 @@ css::uno::Sequence< css::uno::Any >
             goto Rt;
         }
     }
-    else if ( nType == FINDREPLACEFLOWTO )
+    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 a91d5f70d5d4..f2094296fa0f 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -509,7 +509,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 48dbc88ad860..8952e347c7cb 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -48,6 +48,7 @@
 #include <com/sun/star/configuration/theDefaultProvider.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/ui/XUIElement.hpp>
+#include <comphelper/accflowenum.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <svl/itempool.hxx>
@@ -2288,7 +2289,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();
 
@@ -2306,8 +2307,25 @@ void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin)
         return;
     }
 
-    const sal_Int32 FORFINDREPLACEFLOWTO = 2;
-    uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo(Any(GetSrchFlag()),  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 bd180490d608..4f7f2a81a158 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <comphelper/accflowenum.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <sfx2/viewsh.hxx>
@@ -762,15 +763,13 @@ css::uno::Sequence< css::uno::Any >
 {
     SolarMutexGuard g;
 
-    const sal_Int32 FORSPELLCHECKFLOWTO = 1;
-    const sal_Int32 FORFINDREPLACEFLOWTO = 2;
     SwAccessibleMap* pAccMap = GetMap();
     if ( !pAccMap )
     {
         return uno::Sequence< uno::Any >();
     }
 
-    if ( nType == FORSPELLCHECKFLOWTO )
+    if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO)
     {
         uno::Reference< css::drawing::XShape > xShape;
         rAny >>= xShape;
@@ -824,7 +823,7 @@ css::uno::Sequence< css::uno::Any >
             }
         }
     }
-    else if ( nType == 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


More information about the Libreoffice-commits mailing list